mirror of
https://github.com/CompeyDev/my-nvim-setup.git
synced 2024-12-12 04:40:37 +00:00
initial v2 configs
This commit is contained in:
commit
5571a91d28
32 changed files with 2200 additions and 0 deletions
47
.gitignore
vendored
Normal file
47
.gitignore
vendored
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
# Compiled Lua sources
|
||||||
|
luac.out
|
||||||
|
|
||||||
|
# luarocks build files
|
||||||
|
*.src.rock
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
|
||||||
|
# Object files
|
||||||
|
*.o
|
||||||
|
*.os
|
||||||
|
*.ko
|
||||||
|
*.obj
|
||||||
|
*.elf
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Libraries
|
||||||
|
*.lib
|
||||||
|
*.a
|
||||||
|
*.la
|
||||||
|
*.lo
|
||||||
|
*.def
|
||||||
|
*.exp
|
||||||
|
|
||||||
|
# Shared objects (inc. Windows DLLs)
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
*.i*86
|
||||||
|
*.x86_64
|
||||||
|
*.hex
|
||||||
|
|
||||||
|
lazy-lock.json
|
||||||
|
lua/custom.lua
|
||||||
|
lua/my_plugins/*
|
||||||
|
!lua/my_plugins/example.lua
|
||||||
|
package-lock.json
|
||||||
|
|
6
.stylua.toml
Normal file
6
.stylua.toml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
column_width = 120
|
||||||
|
line_endings = "Unix"
|
||||||
|
indent_type = "Spaces"
|
||||||
|
indent_width = 2
|
||||||
|
quote_style = "AutoPreferDouble"
|
||||||
|
call_parentheses = "None"
|
201
LICENSE
Normal file
201
LICENSE
Normal file
|
@ -0,0 +1,201 @@
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
6
filetype.lua
Normal file
6
filetype.lua
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
vim.filetype.add({
|
||||||
|
extension = {
|
||||||
|
mdx = "mdx",
|
||||||
|
luau = "luau"
|
||||||
|
},
|
||||||
|
})
|
38
init.lua
Normal file
38
init.lua
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
-- Basic settings
|
||||||
|
require("basic")
|
||||||
|
|
||||||
|
-- Load plugins
|
||||||
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
|
vim.fn.system({
|
||||||
|
"git",
|
||||||
|
"clone",
|
||||||
|
"--filter=blob:none",
|
||||||
|
"https://github.com/folke/lazy.nvim.git",
|
||||||
|
"--branch=stable", -- latest stable release
|
||||||
|
lazypath,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
vim.g.mapleader = require("custom_keys").leader
|
||||||
|
vim.g.maplocalleader = "\\"
|
||||||
|
|
||||||
|
require("lazy").setup({
|
||||||
|
spec = {
|
||||||
|
{ import = "plugins" },
|
||||||
|
{ import = "languages" },
|
||||||
|
{ import = "my_plugins" },
|
||||||
|
},
|
||||||
|
ui = {
|
||||||
|
border = "rounded",
|
||||||
|
},
|
||||||
|
change_detection = {
|
||||||
|
enabled = true,
|
||||||
|
notify = false, -- get a notification when changes are found
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Final settings
|
||||||
|
require("core")
|
||||||
|
pcall(require, "custom")
|
85
lua/basic.lua
Normal file
85
lua/basic.lua
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
HOME = os.getenv("HOME")
|
||||||
|
|
||||||
|
vim.opt.termguicolors = true
|
||||||
|
vim.opt.cursorline = true
|
||||||
|
vim.opt.updatetime = 200
|
||||||
|
|
||||||
|
-- Basic settings
|
||||||
|
vim.opt.encoding = "utf-8"
|
||||||
|
vim.opt.backspace = "indent,eol,start" -- backspace works on every char in insert mode
|
||||||
|
vim.opt.completeopt = "menuone,noselect"
|
||||||
|
vim.opt.history = 1000
|
||||||
|
vim.opt.startofline = true
|
||||||
|
|
||||||
|
-- Mapping waiting time
|
||||||
|
vim.opt.timeout = false
|
||||||
|
vim.opt.ttimeout = true
|
||||||
|
vim.opt.ttimeoutlen = 100
|
||||||
|
|
||||||
|
-- Display
|
||||||
|
vim.opt.scrolloff = 3
|
||||||
|
vim.opt.showmatch = true
|
||||||
|
vim.opt.synmaxcol = 300
|
||||||
|
vim.opt.laststatus = 3
|
||||||
|
|
||||||
|
-- vim.opt.list = false -- do not display white characters
|
||||||
|
-- vim.opt.foldenable = false
|
||||||
|
-- vim.opt.foldlevel = 4 -- limit folding to 4 levels
|
||||||
|
-- vim.opt.foldmethod = "syntax" -- use language syntax to generate folds
|
||||||
|
vim.opt.wrap = false --do not wrap lines even if very long
|
||||||
|
vim.opt.eol = false -- show if there's no eol char
|
||||||
|
vim.opt.showbreak = "↪" -- character to show when line is broken
|
||||||
|
|
||||||
|
-- Sidebar
|
||||||
|
vim.opt.number = true -- line number on the left
|
||||||
|
vim.opt.numberwidth = 3 -- always reserve 3 spaces for line number
|
||||||
|
vim.opt.signcolumn = "yes" -- keep 1 column for coc.vim check
|
||||||
|
vim.opt.modelines = 0
|
||||||
|
vim.opt.showcmd = true -- display command in bottom bar
|
||||||
|
|
||||||
|
-- Search
|
||||||
|
vim.opt.incsearch = true -- starts searching as soon as typing, without enter needed
|
||||||
|
vim.opt.ignorecase = true -- ignore letter case when searching
|
||||||
|
vim.opt.smartcase = true -- case insentive unless capitals used in search
|
||||||
|
|
||||||
|
vim.opt.matchtime = 2 -- delay before showing matching paren
|
||||||
|
vim.opt.mps = vim.o.mps .. ",<:>"
|
||||||
|
|
||||||
|
-- White characters
|
||||||
|
vim.opt.autoindent = true
|
||||||
|
vim.opt.smartindent = true
|
||||||
|
vim.opt.tabstop = 4
|
||||||
|
vim.opt.softtabstop = 4
|
||||||
|
vim.opt.shiftwidth = 4 -- indentation rule
|
||||||
|
vim.opt.formatoptions = "qnj1" -- q - comment formatting; n - numbered lists; j - remove comment when joining lines; 1 - don't break after one-letter word
|
||||||
|
vim.opt.expandtab = true -- expand tab to spaces
|
||||||
|
|
||||||
|
-- Backup files
|
||||||
|
vim.opt.backup = false
|
||||||
|
vim.opt.writebackup = false
|
||||||
|
vim.opt.swapfile = false -- do not use swap file
|
||||||
|
|
||||||
|
-- Commands mode
|
||||||
|
vim.opt.wildmenu = true -- on TAB, complete options for system command
|
||||||
|
vim.opt.wildignore =
|
||||||
|
"deps,.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,.DS_Store,*.aux,*.out,*.toc"
|
||||||
|
|
||||||
|
-- Only show cursorline in the current window and in normal mode.
|
||||||
|
-- vim.cmd([[
|
||||||
|
-- augroup cline
|
||||||
|
-- au!
|
||||||
|
-- au WinLeave * set nocursorline
|
||||||
|
-- au WinEnter * set cursorline
|
||||||
|
-- au InsertEnter * set nocursorline
|
||||||
|
-- au InsertLeave * set cursorline
|
||||||
|
-- augroup END
|
||||||
|
-- ]])
|
||||||
|
|
||||||
|
vim.cmd([[
|
||||||
|
set noeb
|
||||||
|
set t_Co=256
|
||||||
|
filetype plugin indent on
|
||||||
|
exec "nohlsearch"
|
||||||
|
syntax enable
|
||||||
|
syntax on
|
||||||
|
]])
|
152
lua/core.lua
Normal file
152
lua/core.lua
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
local keys = require("custom_keys")
|
||||||
|
local opts = require("custom_opts")
|
||||||
|
|
||||||
|
-- Setup keymapping
|
||||||
|
local function set_keymap()
|
||||||
|
local map = vim.keymap.set
|
||||||
|
local option = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
map("n", keys.jump_left_window, "<C-W>h", option)
|
||||||
|
map("n", keys.jump_down_window, "<C-W>j", option)
|
||||||
|
map("n", keys.jump_up_window, "<C-W>k", option)
|
||||||
|
map("n", keys.jump_right_window, "<C-W>l", option)
|
||||||
|
|
||||||
|
vim.cmd([[
|
||||||
|
" press esc to cancel search highlight
|
||||||
|
nnoremap <silent> <Esc> :nohlsearch<CR>:echo<CR>
|
||||||
|
]])
|
||||||
|
|
||||||
|
-- for markdown file
|
||||||
|
vim.cmd([[
|
||||||
|
" optimized up and down move when set wrap for markdown file
|
||||||
|
autocmd FileType markdown noremap <buffer> j gj
|
||||||
|
autocmd FileType markdown noremap <buffer> k gk
|
||||||
|
autocmd FileType markdown setlocal wrap
|
||||||
|
]])
|
||||||
|
|
||||||
|
-- Supported by bufdelete
|
||||||
|
vim.cmd([[
|
||||||
|
cnoreabbrev bdelete Bdelete
|
||||||
|
cnoreabbrev bdelete! Bdelete!
|
||||||
|
cnoreabbrev bwipeout Bwipeout
|
||||||
|
cnoreabbrev bwipeout! Bwipeout!
|
||||||
|
]])
|
||||||
|
|
||||||
|
-- Supported by bufferline
|
||||||
|
map("n", keys.pick_tab, ":BufferLinePick<CR>", option)
|
||||||
|
|
||||||
|
-- Supported by nvim-tree
|
||||||
|
map("n", keys.file_explorer, ":Neotree position=left source=filesystem action=show toggle=true<CR>", option)
|
||||||
|
map("n", keys.git_status, ":Neotree position=float source=git_status action=show toggle=true<CR>", option)
|
||||||
|
|
||||||
|
-- Supported by aerial
|
||||||
|
map("n", keys.outline, ":AerialToggle! right<CR>", option)
|
||||||
|
|
||||||
|
-- Supported by diffview
|
||||||
|
map("n", keys.diff_open, ":DiffviewOpen<CR>", option)
|
||||||
|
map("n", keys.diff_close, ":DiffviewClose<CR>", option)
|
||||||
|
|
||||||
|
-- Supported by toggleterm
|
||||||
|
-- float terminal
|
||||||
|
local float_terminal_default = require("toggleterm.terminal").Terminal:new({
|
||||||
|
direction = "float",
|
||||||
|
on_open = function(term)
|
||||||
|
-- forced to change the working dir for terminal
|
||||||
|
-- This will solve the problem of not updating the directory when switching sessions.
|
||||||
|
local cwd = vim.fn.getcwd()
|
||||||
|
if cwd ~= term.dir then
|
||||||
|
term:change_dir(cwd)
|
||||||
|
end
|
||||||
|
-- when float term opened, disable bottom terminal
|
||||||
|
vim.api.nvim_del_keymap("t", keys.terminal_bottom)
|
||||||
|
vim.cmd("startinsert!")
|
||||||
|
end,
|
||||||
|
on_close = function(t, job, exit_code, name)
|
||||||
|
-- when float term closed, enable bottom terminal
|
||||||
|
map("t", keys.terminal_bottom, "<C-\\><C-n>:lua _bottom_term_toggle()<CR>", option)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
function _float_term_toggle()
|
||||||
|
float_terminal_default:toggle()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- bottom terminal
|
||||||
|
local bottom_terminal_default = require("toggleterm.terminal").Terminal:new({
|
||||||
|
direction = "horizontal",
|
||||||
|
on_open = function(term)
|
||||||
|
-- forced to change the working dir for terminal
|
||||||
|
-- This will solve the problem of not updating the directory when switching sessions.
|
||||||
|
local cwd = vim.fn.getcwd()
|
||||||
|
if cwd ~= term.dir then
|
||||||
|
term:change_dir(cwd)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- set keymapping
|
||||||
|
local opts = { buffer = 0 }
|
||||||
|
vim.api.nvim_buf_set_keymap(
|
||||||
|
term.bufnr,
|
||||||
|
"t",
|
||||||
|
"<C-h>",
|
||||||
|
[[<Cmd>wincmd h<CR>]],
|
||||||
|
{ noremap = true, silent = true }
|
||||||
|
)
|
||||||
|
vim.api.nvim_buf_set_keymap(
|
||||||
|
term.bufnr,
|
||||||
|
"t",
|
||||||
|
"<C-j>",
|
||||||
|
[[<Cmd>wincmd j<CR>]],
|
||||||
|
{ noremap = true, silent = true }
|
||||||
|
)
|
||||||
|
vim.api.nvim_buf_set_keymap(
|
||||||
|
term.bufnr,
|
||||||
|
"t",
|
||||||
|
"<C-k>",
|
||||||
|
[[<Cmd>wincmd k<CR>]],
|
||||||
|
{ noremap = true, silent = true }
|
||||||
|
)
|
||||||
|
vim.api.nvim_buf_set_keymap(
|
||||||
|
term.bufnr,
|
||||||
|
"t",
|
||||||
|
"<C-l>",
|
||||||
|
[[<Cmd>wincmd l<CR>]],
|
||||||
|
{ noremap = true, silent = true }
|
||||||
|
)
|
||||||
|
vim.cmd("startinsert!")
|
||||||
|
end,
|
||||||
|
on_exit = function(t, job, exit_code, name)
|
||||||
|
vim.cmd("quit!")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
function _bottom_term_toggle()
|
||||||
|
bottom_terminal_default:toggle()
|
||||||
|
end
|
||||||
|
|
||||||
|
map("n", keys.terminal_float, ":lua _float_term_toggle()<CR>", option)
|
||||||
|
map("t", keys.terminal_float, "<C-\\><C-n>:lua _float_term_toggle()<CR>", option)
|
||||||
|
map("n", keys.terminal_bottom, ":lua _bottom_term_toggle()<CR>", option)
|
||||||
|
map("t", keys.terminal_bottom, "<C-\\><C-n>:lua _bottom_term_toggle()<CR>", option)
|
||||||
|
|
||||||
|
vim.cmd([[
|
||||||
|
command! Termfloat :lua _float_term_toggle()
|
||||||
|
]])
|
||||||
|
vim.cmd([[cnoreabbrev terminal Termfloat]])
|
||||||
|
|
||||||
|
-- Supported by nvim-session-manager
|
||||||
|
map("n", keys.switch_session, ":SessionManager load_session<CR>", option)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Set up transparency
|
||||||
|
local function set_transparency()
|
||||||
|
local transparency = opts.window_transparency
|
||||||
|
-- Setup global transparency for float window.
|
||||||
|
vim.api.nvim_command(string.format("autocmd FileType * set winblend=%d", transparency))
|
||||||
|
-- Setup global transparency for popup menu.
|
||||||
|
vim.o.pumblend = transparency
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Set up auto command
|
||||||
|
local function set_autocmd() end
|
||||||
|
|
||||||
|
set_keymap()
|
||||||
|
set_transparency()
|
||||||
|
set_autocmd()
|
70
lua/custom_keys.lua
Normal file
70
lua/custom_keys.lua
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
--
|
||||||
|
-- You can edit the default settings of the shortcut keys here
|
||||||
|
--
|
||||||
|
return {
|
||||||
|
-- The default '<leader>' is the space.
|
||||||
|
leader = " ",
|
||||||
|
|
||||||
|
-- Use the shortcut to switch/jump window.
|
||||||
|
jump_left_window = "<C-h>",
|
||||||
|
jump_right_window = "<C-l>",
|
||||||
|
jump_up_window = "<C-k>",
|
||||||
|
jump_down_window = "<C-j>",
|
||||||
|
|
||||||
|
-- View other usage of the plugin: https://github.com/akinsho/bufferline.nvim
|
||||||
|
-- Use the shortcut to pick a buffer tab.
|
||||||
|
pick_tab = "<leader>tt",
|
||||||
|
|
||||||
|
-- View other usage of the plugin: https://github.com/nvim-neo-tree/neo-tree.nvim
|
||||||
|
-- Use the shortcut to open or close file explorer.
|
||||||
|
file_explorer = "<F9>",
|
||||||
|
-- Use the shortcut to open or close git status on a float window.
|
||||||
|
git_status = "<F8>",
|
||||||
|
|
||||||
|
-- View other usage of the plugin: https://github.com/stevearc/aerial.nvim
|
||||||
|
-- Use the shortcut to open or close the outline, it need to call the lsp server.
|
||||||
|
outline = "<F7>",
|
||||||
|
|
||||||
|
-- View other usage of the plugin: https://github.com/akinsho/toggleterm.nvim
|
||||||
|
-- Use the shortcut to open or close the terminal.
|
||||||
|
terminal_float = "<A-u>", -- open terminal in a float window
|
||||||
|
terminal_bottom = "<A-b>", -- open terminal at the bottom
|
||||||
|
|
||||||
|
-- View other usage of the plugin: https://github.com/Shatur/neovim-session-manager
|
||||||
|
-- Use the shortcut to switch a session.
|
||||||
|
switch_session = "<leader>ss",
|
||||||
|
|
||||||
|
-- View other usage of the plugin: https://github.com/nvim-telescope/telescope.nvim
|
||||||
|
-- Use the shortcut to find, search files and find buffers.
|
||||||
|
find_files = "<leader>ff",
|
||||||
|
live_grep = "<leader>gg",
|
||||||
|
search_cursor = "<leader>cc",
|
||||||
|
find_buffer = "<leader>bb",
|
||||||
|
-- Use the to close telescope window. <C-c> is the default setting, can't edit it here.
|
||||||
|
-- close_telescope = "<C-c>",
|
||||||
|
|
||||||
|
-- View other usage of the plugin: https://github.com/sindrets/diffview.nvim
|
||||||
|
-- Use the shortcut to open 'git diff'.
|
||||||
|
diff_open = "<leader>df",
|
||||||
|
-- Use the shortcut to close 'git diff'.
|
||||||
|
diff_close = "<leader>dc",
|
||||||
|
|
||||||
|
-- View other usage of the plugin: https://github.com/mrjones2014/smart-splits.nvim
|
||||||
|
-- Use the shortcut to resize the window, <control + alt + hjkl>
|
||||||
|
resize_left = "<C-A-h>",
|
||||||
|
resize_down = "<C-A-j>",
|
||||||
|
resize_up = "<C-A-k>",
|
||||||
|
resize_right = "<C-A-l>",
|
||||||
|
|
||||||
|
-- View other usage of the plugin: https://github.com/neovim/nvim-lspconfig
|
||||||
|
-- Goto
|
||||||
|
goto_definition = "gd",
|
||||||
|
goto_references = "gr",
|
||||||
|
goto_declaration = "gD",
|
||||||
|
goto_impl = "gi",
|
||||||
|
-- goto_back = "<C-o>",
|
||||||
|
-- Use the shortcut to rename the code symbols.
|
||||||
|
lsp_rename = "<leader>re",
|
||||||
|
-- Use the shortcut to format your codes.
|
||||||
|
format = "<leader>ft",
|
||||||
|
}
|
44
lua/custom_opts.lua
Normal file
44
lua/custom_opts.lua
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
local function strsplit(inputstr, sep)
|
||||||
|
if sep == nil then
|
||||||
|
sep = "%s"
|
||||||
|
end
|
||||||
|
local t={}
|
||||||
|
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
|
||||||
|
table.insert(t, str)
|
||||||
|
end
|
||||||
|
return t
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
file_explorer_title = "🥷 File Explorer",
|
||||||
|
tab_style = "thin", -- options: thin, thick, slope, slant
|
||||||
|
terminal_size = 0.7, -- control the float terminal only
|
||||||
|
window_transparency = 0,
|
||||||
|
auto_open_outline = false, -- options: true, false
|
||||||
|
cmdline_view = "cmdline", -- options: cmdline, cmdline_popup
|
||||||
|
close_message_notify = false,
|
||||||
|
|
||||||
|
-- Starting screen header.
|
||||||
|
home_header =
|
||||||
|
strsplit([[
|
||||||
|
⢀⠀⢀⣀⣠⣤⣤⣤⣤⣤⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣠⣠⣤⣤⣤⣤⣀⠲⢦⣄⡀⠀⠀
|
||||||
|
⡶⢟⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⡀⠀⠀⠀⠀⠀⠰⣷⣷⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣬⡛⢷⣔
|
||||||
|
⣾⡿⠟⠋⠉⠁⠀⡀⠀⠀⠀⠀⠈⠉⠉⠙⠛⢻⠛⠛⠋⠀⠀⠀⠀⠀⠀⠀⠈⠙⢛⣛⣛⣛⣛⣉⢉⣉⡀⠀⠀⠀⠀⠀⠈⠉⠛⢿⣷⣝
|
||||||
|
⠃⠀⠀⠀⠀⠀⠀⣛⣛⣛⣛⣛⣛⢛⡛⠛⠛⠛⣰⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣌⠛⠛⢛⣛⣛⣛⣛⣛⣛⣛⣓⣀⠀⠀⠀⠀⠀⠈⢻
|
||||||
|
⠀⠀⠀⢀⣤⡾⠛⢻⣿⣿⣿⡿⣿⡟⢻⣿⠳⠆⠘⣿⣦⠀⠀⠀⠀⠀⠀⠀⣰⣿⠁⠐⠛⣿⡟⢻⣿⣿⣿⣿⢿⣟⠛⠻⣦⣀⠀⠀⠀⠀
|
||||||
|
⠀⠀⢴⠿⣧⣄⣀⣘⣿⣿⣿⣿⣿⡿⣀⡙⢷⠀⢀⡿⠁⠀⠀⠀⠀⠀⠀⠀⠈⢻⡖⠀⣾⣋⣀⣺⣿⣿⣿⣿⣿⣏⣀⣤⣴⠿⢷⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠈⠉⠉⠉⠉⠉⠉⠙⠉⠉⠉⠉⠛⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠋⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠁⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⠆⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣿⠉⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡿⠁⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⠆⠀⠀⢀⣿⠁⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣶⠟⠁⠀⠀⠀⣾⠇⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣀⣀⣀⣤⣤⣴⣶⣾⠿⠛⠋⠀⠀⠀⠀⠀⢸⡟⠀⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠟⠛⠛⠛⠛⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠇⠀⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠛⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⠀⠀⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠋⠀⠀⠀⠀⠀⠀⠀
|
||||||
|
]], "\n")
|
||||||
|
}
|
23
lua/languages/go.lua
Normal file
23
lua/languages/go.lua
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"ray-x/go.nvim",
|
||||||
|
dependencies = { -- optional packages
|
||||||
|
"ray-x/guihua.lua",
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("go").setup({
|
||||||
|
run_in_floaterm = true,
|
||||||
|
floaterm = {
|
||||||
|
posititon = "center", -- one of {`top`, `bottom`, `left`, `right`, `center`, `auto`}
|
||||||
|
width = 0.45, -- width of float window if not auto
|
||||||
|
height = 0.98, -- height of float window if not auto
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
event = { "CmdlineEnter" },
|
||||||
|
ft = { "go", "gomod" },
|
||||||
|
build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries
|
||||||
|
},
|
||||||
|
}
|
37
lua/languages/luau.lua
Normal file
37
lua/languages/luau.lua
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
return {
|
||||||
|
"lopi-py/luau-lsp.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
},
|
||||||
|
|
||||||
|
config = function()
|
||||||
|
require("luau-lsp").setup({
|
||||||
|
fflags = {
|
||||||
|
sync = true, -- sync currently enabled fflags with roblox's published fflags
|
||||||
|
override = {
|
||||||
|
DebugLuauDeferredConstraintResolution = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
server = {
|
||||||
|
settings = {
|
||||||
|
-- https://github.com/folke/neoconf.nvim/blob/main/schemas/luau_lsp.json
|
||||||
|
["luau-lsp"] = {
|
||||||
|
require = {
|
||||||
|
mode = "relativeToFile",
|
||||||
|
directoryAliases = { ["@lune"] = "~/.lune/.typedefs/0.8.0/" },
|
||||||
|
},
|
||||||
|
completion = {
|
||||||
|
imports = {
|
||||||
|
enabled = true, -- enable auto imports
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
types = {
|
||||||
|
roblox = false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
8
lua/languages/markdown.lua
Normal file
8
lua/languages/markdown.lua
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"iamcco/markdown-preview.nvim",
|
||||||
|
build = function()
|
||||||
|
vim.fn["mkdp#util#install"]()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
184
lua/languages/rust.lua
Normal file
184
lua/languages/rust.lua
Normal file
|
@ -0,0 +1,184 @@
|
||||||
|
return {
|
||||||
|
{ 'rust-lang/rust.vim' },
|
||||||
|
{
|
||||||
|
"simrat39/rust-tools.nvim",
|
||||||
|
lazy = true,
|
||||||
|
config = function()
|
||||||
|
local rt = require("rust-tools")
|
||||||
|
rt.setup({
|
||||||
|
tools = { -- rust-tools options
|
||||||
|
|
||||||
|
-- how to execute terminal commands
|
||||||
|
-- options right now: termopen / quickfix
|
||||||
|
executor = require("rust-tools.executors").quickfix,
|
||||||
|
|
||||||
|
-- callback to execute once rust-analyzer is done initializing the workspace
|
||||||
|
-- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error"
|
||||||
|
on_initialized = nil,
|
||||||
|
|
||||||
|
-- automatically call RustReloadWorkspace when writing to a Cargo.toml file.
|
||||||
|
reload_workspace_from_cargo_toml = true,
|
||||||
|
|
||||||
|
-- These apply to the default RustSetInlayHints command
|
||||||
|
inlay_hints = {
|
||||||
|
-- automatically set inlay hints (type hints)
|
||||||
|
-- default: true
|
||||||
|
auto = true,
|
||||||
|
|
||||||
|
-- Only show inlay hints for the current line
|
||||||
|
only_current_line = false,
|
||||||
|
|
||||||
|
-- whether to show parameter hints with the inlay hints or not
|
||||||
|
-- default: true
|
||||||
|
show_parameter_hints = true,
|
||||||
|
|
||||||
|
-- prefix for parameter hints
|
||||||
|
-- default: "<-"
|
||||||
|
parameter_hints_prefix = "<- ",
|
||||||
|
|
||||||
|
-- prefix for all the other hints (type, chaining)
|
||||||
|
-- default: "=>"
|
||||||
|
other_hints_prefix = "=> ",
|
||||||
|
|
||||||
|
-- whether to align to the length of the longest line in the file
|
||||||
|
max_len_align = false,
|
||||||
|
|
||||||
|
-- padding from the left if max_len_align is true
|
||||||
|
max_len_align_padding = 1,
|
||||||
|
|
||||||
|
-- whether to align to the extreme right or not
|
||||||
|
right_align = false,
|
||||||
|
|
||||||
|
-- padding from the right if right_align is true
|
||||||
|
right_align_padding = 7,
|
||||||
|
|
||||||
|
-- The color of the hints
|
||||||
|
highlight = "Comment",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- options same as lsp hover / vim.lsp.util.open_floating_preview()
|
||||||
|
hover_actions = {
|
||||||
|
|
||||||
|
-- the border that is used for the hover window
|
||||||
|
-- see vim.api.nvim_open_win()
|
||||||
|
border = {
|
||||||
|
{ "╭", "FloatBorder" },
|
||||||
|
{ "─", "FloatBorder" },
|
||||||
|
{ "╮", "FloatBorder" },
|
||||||
|
{ "│", "FloatBorder" },
|
||||||
|
{ "╯", "FloatBorder" },
|
||||||
|
{ "─", "FloatBorder" },
|
||||||
|
{ "╰", "FloatBorder" },
|
||||||
|
{ "│", "FloatBorder" },
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Maximal width of the hover window. Nil means no max.
|
||||||
|
max_width = nil,
|
||||||
|
|
||||||
|
-- Maximal height of the hover window. Nil means no max.
|
||||||
|
max_height = nil,
|
||||||
|
|
||||||
|
-- whether the hover action window gets automatically focused
|
||||||
|
-- default: false
|
||||||
|
auto_focus = false,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- settings for showing the crate graph based on graphviz and the dot
|
||||||
|
-- command
|
||||||
|
crate_graph = {
|
||||||
|
-- Backend used for displaying the graph
|
||||||
|
-- see: https://graphviz.org/docs/outputs/
|
||||||
|
-- default: x11
|
||||||
|
backend = "x11",
|
||||||
|
-- where to store the output, nil for no output stored (relative
|
||||||
|
-- path from pwd)
|
||||||
|
-- default: nil
|
||||||
|
output = nil,
|
||||||
|
-- true for all crates.io and external crates, false only the local
|
||||||
|
-- crates
|
||||||
|
-- default: true
|
||||||
|
full = true,
|
||||||
|
|
||||||
|
-- List of backends found on: https://graphviz.org/docs/outputs/
|
||||||
|
-- Is used for input validation and autocompletion
|
||||||
|
-- Last updated: 2021-08-26
|
||||||
|
enabled_graphviz_backends = {
|
||||||
|
"bmp",
|
||||||
|
"cgimage",
|
||||||
|
"canon",
|
||||||
|
"dot",
|
||||||
|
"gv",
|
||||||
|
"xdot",
|
||||||
|
"xdot1.2",
|
||||||
|
"xdot1.4",
|
||||||
|
"eps",
|
||||||
|
"exr",
|
||||||
|
"fig",
|
||||||
|
"gd",
|
||||||
|
"gd2",
|
||||||
|
"gif",
|
||||||
|
"gtk",
|
||||||
|
"ico",
|
||||||
|
"cmap",
|
||||||
|
"ismap",
|
||||||
|
"imap",
|
||||||
|
"cmapx",
|
||||||
|
"imap_np",
|
||||||
|
"cmapx_np",
|
||||||
|
"jpg",
|
||||||
|
"jpeg",
|
||||||
|
"jpe",
|
||||||
|
"jp2",
|
||||||
|
"json",
|
||||||
|
"json0",
|
||||||
|
"dot_json",
|
||||||
|
"xdot_json",
|
||||||
|
"pdf",
|
||||||
|
"pic",
|
||||||
|
"pct",
|
||||||
|
"pict",
|
||||||
|
"plain",
|
||||||
|
"plain-ext",
|
||||||
|
"png",
|
||||||
|
"pov",
|
||||||
|
"ps",
|
||||||
|
"ps2",
|
||||||
|
"psd",
|
||||||
|
"sgi",
|
||||||
|
"svg",
|
||||||
|
"svgz",
|
||||||
|
"tga",
|
||||||
|
"tiff",
|
||||||
|
"tif",
|
||||||
|
"tk",
|
||||||
|
"vml",
|
||||||
|
"vmlz",
|
||||||
|
"wbmp",
|
||||||
|
"webp",
|
||||||
|
"xlib",
|
||||||
|
"x11",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- all the opts to send to nvim-lspconfig
|
||||||
|
-- these override the defaults set by rust-tools.nvim
|
||||||
|
-- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer
|
||||||
|
server = {
|
||||||
|
-- standalone file support
|
||||||
|
-- setting it to false may improve startup time
|
||||||
|
standalone = true,
|
||||||
|
}, -- rust-analyzer options
|
||||||
|
|
||||||
|
-- debugging stuff
|
||||||
|
dap = {
|
||||||
|
adapter = {
|
||||||
|
type = "executable",
|
||||||
|
command = "lldb-vscode",
|
||||||
|
name = "rt_lldb",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
30
lua/my_plugins/example.lua
Normal file
30
lua/my_plugins/example.lua
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"andweeb/presence.nvim",
|
||||||
|
config = function()
|
||||||
|
-- The setup config table shows all available config options with their default values:
|
||||||
|
require("presence").setup({
|
||||||
|
-- General options
|
||||||
|
auto_update = true, -- Update activity based on autocmd events (if `false`, map or manually execute `:lua package.loaded.presence:update()`)
|
||||||
|
neovim_image_text = "The One True Text Editor", -- Text displayed when hovered over the Neovim image
|
||||||
|
main_image = "neovim", -- Main image display (either "neovim" or "file")
|
||||||
|
log_level = nil, -- Log messages at or above this level (one of the following: "debug", "info", "warn", "error")
|
||||||
|
debounce_timeout = 10, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(<filename>, true)`)
|
||||||
|
enable_line_number = false, -- Displays the current line number instead of the current project
|
||||||
|
blacklist = {}, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches
|
||||||
|
buttons = true, -- Configure Rich Presence button(s), either a boolean to enable/disable, a static table (`{{ label = "<label>", url = "<url>" }, ...}`, or a function(buffer: string, repo_url: string|nil): table)
|
||||||
|
file_assets = {}, -- Custom file asset definitions keyed by file names and extensions (see default config at `lua/presence/file_assets.lua` for reference)
|
||||||
|
show_time = true, -- Show the timer
|
||||||
|
|
||||||
|
-- Rich Presence text options
|
||||||
|
editing_text = "Editing %s", -- Format string rendered when an editable file is loaded in the buffer (either string or function(filename: string): string)
|
||||||
|
file_explorer_text = "Browsing %s", -- Format string rendered when browsing a file explorer (either string or function(file_explorer_name: string): string)
|
||||||
|
git_commit_text = "Committing changes", -- Format string rendered when committing changes in git (either string or function(filename: string): string)
|
||||||
|
plugin_manager_text = "Managing plugins", -- Format string rendered when managing plugins (either string or function(plugin_manager_name: string): string)
|
||||||
|
reading_text = "Reading %s", -- Format string rendered when a read-only or unmodifiable file is loaded in the buffer (either string or function(filename: string): string)
|
||||||
|
workspace_text = "Working on %s", -- Format string rendered when in a git repository (either string or function(project_name: string|nil, filename: string): string)
|
||||||
|
line_number_text = "Line %s out of %s", -- Format string rendered when `enable_line_number` is set to true (either string or function(line_number: number, line_count: number): string)
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
78
lua/plugins/autocmp/config.lua
Normal file
78
lua/plugins/autocmp/config.lua
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
return function()
|
||||||
|
local cmp = require("cmp")
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
-- Select the luasnip engine here. You can switch to another engine.
|
||||||
|
expand = function(args)
|
||||||
|
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||||
|
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||||
|
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
||||||
|
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered({
|
||||||
|
border = "rounded",
|
||||||
|
winhighlight = "",
|
||||||
|
minwidth = 60,
|
||||||
|
}),
|
||||||
|
documentation = cmp.config.window.bordered({
|
||||||
|
border = "rounded",
|
||||||
|
winhighlight = "",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
formatting = {
|
||||||
|
format = require("lspkind").cmp_format({
|
||||||
|
mode = "symbol_text",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
|
["<C-e>"] = cmp.mapping.abort(),
|
||||||
|
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
|
["<Tab>"] = function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
}, {
|
||||||
|
{ name = "buffer" },
|
||||||
|
{ name = "path" },
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
-- `/` cmdline setup.
|
||||||
|
cmp.setup.cmdline("/", {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = {
|
||||||
|
{ name = "buffer" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- `:` cmdline setup.
|
||||||
|
cmp.setup.cmdline(":", {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "path" },
|
||||||
|
}, {
|
||||||
|
{
|
||||||
|
name = "cmdline",
|
||||||
|
option = {
|
||||||
|
ignore_cmds = { "Man", "!" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
-- If you want insert `(` after select function or method item
|
||||||
|
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||||
|
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||||
|
end
|
34
lua/plugins/bufferline/config.lua
Normal file
34
lua/plugins/bufferline/config.lua
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
return function()
|
||||||
|
local bufferline = require("bufferline")
|
||||||
|
bufferline.setup({
|
||||||
|
options = {
|
||||||
|
mode = "buffers", -- set to "tabs" to only show tabpages instead
|
||||||
|
style_preset = bufferline.style_preset.default, -- or bufferline.style_preset.minimal,
|
||||||
|
themable = true, -- allows highlight groups to be overriden i.e. sets highlights as default
|
||||||
|
--numbers = function(opts)
|
||||||
|
-- return string.format("%s·%s", opts.raise(opts.id), opts.lower(opts.ordinal))
|
||||||
|
--end,
|
||||||
|
indicator = {
|
||||||
|
icon = "▎", -- this should be omitted if indicator style is not 'icon'
|
||||||
|
style = "icon",
|
||||||
|
},
|
||||||
|
diagnostics = "nvim_lsp",
|
||||||
|
diagnostics_update_in_insert = false,
|
||||||
|
offsets = {
|
||||||
|
{
|
||||||
|
filetype = "neo-tree",
|
||||||
|
text = require("custom_opts").file_explorer_title,
|
||||||
|
text_align = "left",
|
||||||
|
separator = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
color_icons = true, -- whether or not to add the filetype icon highlights
|
||||||
|
separator_style = require("custom_opts").tab_style,
|
||||||
|
hover = {
|
||||||
|
enabled = true,
|
||||||
|
delay = 200,
|
||||||
|
reveal = { "close" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
85
lua/plugins/coding.lua
Normal file
85
lua/plugins/coding.lua
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
return {
|
||||||
|
-- auto-tag
|
||||||
|
{
|
||||||
|
"windwp/nvim-ts-autotag",
|
||||||
|
config = function()
|
||||||
|
require("nvim-ts-autotag").setup()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- auto-pairs
|
||||||
|
{
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
config = function()
|
||||||
|
require("nvim-autopairs").setup({
|
||||||
|
enable_check_bracket_line = false,
|
||||||
|
ignored_next_char = "[%w%.]", -- will ignore alphanumeric and `.` symbol
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- auto completion
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
config = function()
|
||||||
|
require("plugins/autocmp/config")()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{ "hrsh7th/cmp-nvim-lsp" },
|
||||||
|
{ "hrsh7th/cmp-buffer" },
|
||||||
|
{ "hrsh7th/cmp-path" },
|
||||||
|
{ "hrsh7th/cmp-cmdline" },
|
||||||
|
|
||||||
|
{ "L3MON4D3/LuaSnip" }, -- install the LuaSnip engine
|
||||||
|
|
||||||
|
{ "onsails/lspkind.nvim" }, -- icons in autocomplete source
|
||||||
|
|
||||||
|
-- todo comments
|
||||||
|
-- Preview
|
||||||
|
-- TODO: todo
|
||||||
|
-- FIX: fix
|
||||||
|
-- WARNING: warning
|
||||||
|
-- HACK: hack
|
||||||
|
-- NOTE: note
|
||||||
|
-- PERF: perf
|
||||||
|
-- TEST: test
|
||||||
|
--
|
||||||
|
{
|
||||||
|
"folke/todo-comments.nvim",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
|
config = function()
|
||||||
|
require("todo-comments").setup({
|
||||||
|
keywords = {
|
||||||
|
FIX = {
|
||||||
|
icon = " ", -- icon used for the sign, and in search results
|
||||||
|
color = "error", -- can be a hex color, or a named color (see below)
|
||||||
|
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
|
||||||
|
-- signs = false, -- configure signs for some keywords individually
|
||||||
|
},
|
||||||
|
TODO = { icon = " ", color = "todo" },
|
||||||
|
HACK = { icon = " ", color = "warning" },
|
||||||
|
WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } },
|
||||||
|
PERF = { icon = "", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
|
||||||
|
NOTE = { icon = " ", color = "info", alt = { "INFO" } },
|
||||||
|
TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
|
||||||
|
},
|
||||||
|
colors = {
|
||||||
|
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
|
||||||
|
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
|
||||||
|
todo = { "DiagnosticOk", "#2563EB" },
|
||||||
|
info = { "DiagnosticInfo", "#10B981" },
|
||||||
|
default = { "Identifier", "#7C3AED" },
|
||||||
|
test = { "Identifier", "#FF00FF" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- guess indent
|
||||||
|
{
|
||||||
|
"nmac427/guess-indent.nvim",
|
||||||
|
config = function()
|
||||||
|
require("guess-indent").setup({})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
29
lua/plugins/colorschemes.lua
Normal file
29
lua/plugins/colorschemes.lua
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"hardhackerlabs/theme-vim",
|
||||||
|
name = "hardhacker",
|
||||||
|
lazy = false,
|
||||||
|
priority = 1000,
|
||||||
|
config = function()
|
||||||
|
vim.g.hardhacker_darker = 0
|
||||||
|
vim.g.hardhacker_hide_tilde = 1
|
||||||
|
vim.g.hardhacker_keyword_italic = 1
|
||||||
|
-- vim.cmd("colorscheme hardhacker")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"folke/tokyonight.nvim",
|
||||||
|
lazy = false,
|
||||||
|
priority = 1000,
|
||||||
|
config = function()
|
||||||
|
-- vim.cmd("colorscheme tokyonight-storm")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rose-pine/neovim",
|
||||||
|
name = "rose-pine",
|
||||||
|
config = function()
|
||||||
|
vim.cmd("colorscheme rose-pine-main")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
18
lua/plugins/find.lua
Normal file
18
lua/plugins/find.lua
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
'nvim-telescope/telescope.nvim',
|
||||||
|
dependencies = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}},
|
||||||
|
config = function()
|
||||||
|
require'telescope'.setup{}
|
||||||
|
|
||||||
|
local option = {noremap = true, silent = true }
|
||||||
|
|
||||||
|
local keys = require("custom_keys")
|
||||||
|
local builtin = require('telescope.builtin')
|
||||||
|
vim.keymap.set('n', keys.find_files, builtin.find_files, option)
|
||||||
|
vim.keymap.set('n', keys.live_grep, builtin.live_grep, option)
|
||||||
|
vim.keymap.set('n', keys.search_cursor, builtin.grep_string, option)
|
||||||
|
vim.keymap.set('n', keys.find_buffer, builtin.buffers, option)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
16
lua/plugins/git.lua
Normal file
16
lua/plugins/git.lua
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"lewis6991/gitsigns.nvim",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
|
config = function()
|
||||||
|
require("gitsigns").setup({
|
||||||
|
current_line_blame = true,
|
||||||
|
preview_config = {
|
||||||
|
border = "rounded",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{ "sindrets/diffview.nvim", dependencies = { "nvim-lua/plenary.nvim" } },
|
||||||
|
}
|
46
lua/plugins/highlight.lua
Normal file
46
lua/plugins/highlight.lua
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
return {
|
||||||
|
-- Syntax highlighting
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
config = function()
|
||||||
|
require("nvim-treesitter.configs").setup({
|
||||||
|
indent = {
|
||||||
|
enable = true,
|
||||||
|
disable = {},
|
||||||
|
},
|
||||||
|
ensure_installed = { "markdown", "markdown_inline", "regex" },
|
||||||
|
sync_install = false,
|
||||||
|
auto_install = true,
|
||||||
|
ignore_install = {},
|
||||||
|
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
disable = {},
|
||||||
|
disable = function(lang, buf)
|
||||||
|
local max_filesize = 100 * 1024 -- 100 KB
|
||||||
|
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||||
|
if ok and stats and stats.size > max_filesize then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
additional_vim_regex_highlighting = false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- let it to use 'markdown' parser for mdx filetype.
|
||||||
|
vim.treesitter.language.register('markdown', 'mdx')
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Colors highlighting
|
||||||
|
{
|
||||||
|
"NvChad/nvim-colorizer.lua",
|
||||||
|
config = function(plun)
|
||||||
|
require("colorizer").setup({
|
||||||
|
user_default_options = {
|
||||||
|
names = false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
103
lua/plugins/lsp.lua
Normal file
103
lua/plugins/lsp.lua
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
config = function()
|
||||||
|
require("mason").setup({
|
||||||
|
ui = {
|
||||||
|
icons = {
|
||||||
|
package_installed = "✓",
|
||||||
|
package_pending = "➜",
|
||||||
|
package_uninstalled = "✗",
|
||||||
|
},
|
||||||
|
border = "rounded",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
config = function()
|
||||||
|
require("mason-lspconfig").setup()
|
||||||
|
require("mason-lspconfig").setup_handlers({
|
||||||
|
-- The first entry (without a key) will be the default handler
|
||||||
|
-- and will be called for each installed server that doesn't have
|
||||||
|
-- a dedicated handler.
|
||||||
|
function(server_name) -- default handler (optional)
|
||||||
|
require("lspconfig")[server_name].setup({})
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- Next, you can provide a dedicated handler for specific servers.
|
||||||
|
-- For example, a handler override for the `rust_analyzer`:
|
||||||
|
-- ["rust_analyzer"] = function ()
|
||||||
|
-- require("rust-tools").setup {}
|
||||||
|
-- end
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
config = function()
|
||||||
|
require("plugins/lspconfig/config")()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
|
config = function()
|
||||||
|
local null_ls = require("null-ls")
|
||||||
|
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||||
|
|
||||||
|
null_ls.setup({
|
||||||
|
border = "rounded",
|
||||||
|
cmd = { "nvim" },
|
||||||
|
debounce = 250,
|
||||||
|
debug = false,
|
||||||
|
default_timeout = 5000,
|
||||||
|
diagnostic_config = {},
|
||||||
|
diagnostics_format = "#{m}",
|
||||||
|
fallback_severity = vim.diagnostic.severity.ERROR,
|
||||||
|
log_level = "warn",
|
||||||
|
notify_format = "[null-ls] %s",
|
||||||
|
on_init = nil,
|
||||||
|
on_exit = nil,
|
||||||
|
root_dir = require("null-ls.utils").root_pattern(".null-ls-root", "Makefile", ".git"),
|
||||||
|
should_attach = nil,
|
||||||
|
sources = nil,
|
||||||
|
temp_dir = nil,
|
||||||
|
update_in_insert = false,
|
||||||
|
-- formatting on save
|
||||||
|
--on_attach = function(client, bufnr)
|
||||||
|
-- if client.supports_method("textDocument/formatting") then
|
||||||
|
-- vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||||
|
-- vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
-- group = augroup,
|
||||||
|
-- buffer = bufnr,
|
||||||
|
-- callback = function()
|
||||||
|
-- vim.lsp.buf.format({ bufnr = bufnr })
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
-- end
|
||||||
|
--end,
|
||||||
|
}) -- end of setup
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"jay-babu/mason-null-ls.nvim",
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
dependencies = {
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("mason-null-ls").setup({
|
||||||
|
automatic_setup = true,
|
||||||
|
ensure_installed = { "shfmt", "prettier", "stylua" },
|
||||||
|
handlers = {},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
42
lua/plugins/lspconfig/config.lua
Normal file
42
lua/plugins/lspconfig/config.lua
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
return function()
|
||||||
|
require("lspconfig.ui.windows").default_options.border = "rounded"
|
||||||
|
|
||||||
|
-- Global mappings.
|
||||||
|
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||||
|
vim.keymap.set("n", "<space>e", vim.diagnostic.open_float)
|
||||||
|
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
|
||||||
|
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
|
||||||
|
vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist)
|
||||||
|
|
||||||
|
-- Use LspAttach autocommand to only map the following keys
|
||||||
|
-- after the language server attaches to the current buffer
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||||
|
callback = function(ev)
|
||||||
|
-- Enable completion triggered by <c-x><c-o>
|
||||||
|
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||||
|
|
||||||
|
-- Buffer local mappings.
|
||||||
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
|
local opts = { buffer = ev.buf }
|
||||||
|
vim.keymap.set("n", require("custom_keys").goto_declaration, vim.lsp.buf.declaration, opts)
|
||||||
|
vim.keymap.set("n", require("custom_keys").goto_definition, vim.lsp.buf.definition, opts)
|
||||||
|
vim.keymap.set("n", require("custom_keys").goto_references, vim.lsp.buf.references, opts)
|
||||||
|
vim.keymap.set("n", require("custom_keys").goto_impl, vim.lsp.buf.implementation, opts)
|
||||||
|
vim.keymap.set("n", require("custom_keys").lsp_rename, vim.lsp.buf.rename, opts)
|
||||||
|
vim.keymap.set("n", require("custom_keys").format, function()
|
||||||
|
vim.lsp.buf.format({ async = true })
|
||||||
|
end, opts)
|
||||||
|
|
||||||
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||||
|
vim.keymap.set("n", "<C-m>", vim.lsp.buf.signature_help, opts)
|
||||||
|
vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts)
|
||||||
|
vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts)
|
||||||
|
vim.keymap.set("n", "<space>wl", function()
|
||||||
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
end, opts)
|
||||||
|
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, opts)
|
||||||
|
vim.keymap.set({ "n", "v" }, "<space>ca", vim.lsp.buf.code_action, opts)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
135
lua/plugins/lualine/config.lua
Normal file
135
lua/plugins/lualine/config.lua
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
return function()
|
||||||
|
--local colors = {
|
||||||
|
-- red = "#e965a5",
|
||||||
|
-- green = "#b1f2a7",
|
||||||
|
-- yellow = "#ebde76",
|
||||||
|
-- blue = "#b1baf4",
|
||||||
|
-- purple = "#e192ef",
|
||||||
|
-- cyan = "#b3f4f3",
|
||||||
|
-- white = "#eee9fc",
|
||||||
|
-- black = "#282433",
|
||||||
|
-- selection = "#282433",
|
||||||
|
-- comment = "#938aad",
|
||||||
|
--}
|
||||||
|
|
||||||
|
--local hardhacker_theme = {
|
||||||
|
-- normal = {
|
||||||
|
-- a = { fg = colors.black, bg = colors.purple },
|
||||||
|
-- b = { fg = colors.red, bg = colors.selection },
|
||||||
|
-- c = { fg = colors.comment, bg = colors.selection },
|
||||||
|
-- },
|
||||||
|
|
||||||
|
-- insert = { a = { fg = colors.black, bg = colors.green } },
|
||||||
|
-- visual = { a = { fg = colors.black, bg = colors.yellow } },
|
||||||
|
-- replace = { a = { fg = colors.black, bg = colors.red } },
|
||||||
|
|
||||||
|
-- inactive = {
|
||||||
|
-- a = { fg = colors.white, bg = colors.selection },
|
||||||
|
-- b = { fg = colors.white, bg = colors.selection },
|
||||||
|
-- c = { fg = colors.white, bg = colors.selection },
|
||||||
|
-- },
|
||||||
|
--}
|
||||||
|
|
||||||
|
require("lualine").setup({
|
||||||
|
options = {
|
||||||
|
icons_enabled = true,
|
||||||
|
theme = vim.g.hardhacker_lualine_theme,
|
||||||
|
component_separators = "",
|
||||||
|
section_separators = { left = "", right = "" },
|
||||||
|
disabled_filetypes = {
|
||||||
|
statusline = {},
|
||||||
|
winbar = {},
|
||||||
|
},
|
||||||
|
ignore_focus = {},
|
||||||
|
always_divide_middle = true,
|
||||||
|
globalstatus = true,
|
||||||
|
refresh = {
|
||||||
|
statusline = 1000,
|
||||||
|
tabline = 1000,
|
||||||
|
winbar = 1000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
lualine_a = { { "mode", separator = { left = "" }, right_padding = 2 } },
|
||||||
|
lualine_b = {
|
||||||
|
{ "branch" },
|
||||||
|
{ "diff" },
|
||||||
|
},
|
||||||
|
lualine_c = {
|
||||||
|
{
|
||||||
|
"filename",
|
||||||
|
file_status = true, -- Displays file status (readonly status, modified status)
|
||||||
|
newfile_status = false, -- Display new file status (new file means no write after created)
|
||||||
|
path = 3, -- 0: Just the filename
|
||||||
|
-- 1: Relative path
|
||||||
|
-- 2: Absolute path
|
||||||
|
-- 3: Absolute path, with tilde as the home directory
|
||||||
|
-- 4: Filename and parent dir, with tilde as the home directory
|
||||||
|
|
||||||
|
shorting_target = 40, -- Shortens path to leave 40 spaces in the window
|
||||||
|
-- for other components. (terrible name, any suggestions?)
|
||||||
|
symbols = {
|
||||||
|
modified = "[+]", -- Text to show when the file is modified.
|
||||||
|
readonly = "[-]", -- Text to show when the file is non-modifiable or readonly.
|
||||||
|
unnamed = "[No Name]", -- Text to show for unnamed buffers.
|
||||||
|
newfile = "[New]", -- Text to show for newly created file before first write
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lualine_x = {
|
||||||
|
{
|
||||||
|
require("noice").api.status.command.get,
|
||||||
|
cond = require("noice").api.status.command.has,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
require("noice").api.status.search.get,
|
||||||
|
cond = require("noice").api.status.search.has,
|
||||||
|
},
|
||||||
|
"encoding",
|
||||||
|
"fileformat",
|
||||||
|
"filetype",
|
||||||
|
},
|
||||||
|
lualine_y = {
|
||||||
|
"filesize",
|
||||||
|
"progress",
|
||||||
|
-- {
|
||||||
|
-- "diagnostics",
|
||||||
|
|
||||||
|
-- -- Table of diagnostic sources, available sources are:
|
||||||
|
-- -- 'nvim_lsp', 'nvim_diagnostic', 'nvim_workspace_diagnostic', 'coc', 'ale', 'vim_lsp'.
|
||||||
|
-- -- or a function that returns a table as such:
|
||||||
|
-- -- { error=error_cnt, warn=warn_cnt, info=info_cnt, hint=hint_cnt }
|
||||||
|
-- sources = { "nvim_lsp", "nvim_diagnostic" },
|
||||||
|
|
||||||
|
-- -- Displays diagnostics for the defined severity types
|
||||||
|
-- sections = { "error", "warn", "info", "hint" },
|
||||||
|
|
||||||
|
-- diagnostics_color = {
|
||||||
|
-- -- Same values as the general color option can be used here.
|
||||||
|
-- error = "DiagnosticError", -- Changes diagnostics' error color.
|
||||||
|
-- warn = "DiagnosticWarn", -- Changes diagnostics' warn color.
|
||||||
|
-- info = "DiagnosticInfo", -- Changes diagnostics' info color.
|
||||||
|
-- hint = "DiagnosticHint", -- Changes diagnostics' hint color.
|
||||||
|
-- },
|
||||||
|
-- symbols = { error = " ", warn = " ", info = " ", hint = " " },
|
||||||
|
-- colored = true, -- Displays diagnostics status in color if set to true.
|
||||||
|
-- update_in_insert = false, -- Update diagnostics in insert mode.
|
||||||
|
-- always_visible = false, -- Show diagnostics even if there are none.
|
||||||
|
-- },
|
||||||
|
},
|
||||||
|
lualine_z = { { "location", separator = { right = "" }, left_padding = 2 } },
|
||||||
|
},
|
||||||
|
inactive_sections = {
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_c = { "filename" },
|
||||||
|
lualine_x = { "location" },
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
},
|
||||||
|
tabline = {},
|
||||||
|
winbar = {},
|
||||||
|
inactive_winbar = {},
|
||||||
|
extensions = {},
|
||||||
|
})
|
||||||
|
end
|
208
lua/plugins/neo-tree/config.lua
Normal file
208
lua/plugins/neo-tree/config.lua
Normal file
|
@ -0,0 +1,208 @@
|
||||||
|
return function()
|
||||||
|
-- Unless you are still migrating, remove the deprecated commands from v1.x
|
||||||
|
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||||
|
|
||||||
|
-- If you want icons for diagnostic errors, you'll need to define them somewhere:
|
||||||
|
vim.fn.sign_define("DiagnosticSignError", {text = " ", texthl = "DiagnosticSignError"})
|
||||||
|
vim.fn.sign_define("DiagnosticSignWarn", {text = " ", texthl = "DiagnosticSignWarn"})
|
||||||
|
vim.fn.sign_define("DiagnosticSignInfo", {text = " ", texthl = "DiagnosticSignInfo"})
|
||||||
|
vim.fn.sign_define("DiagnosticSignHint", {text = " ", texthl = "DiagnosticSignHint"})
|
||||||
|
|
||||||
|
require("neo-tree").setup({
|
||||||
|
close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab
|
||||||
|
popup_border_style = "rounded",
|
||||||
|
enable_git_status = true,
|
||||||
|
enable_diagnostics = true,
|
||||||
|
open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes
|
||||||
|
sort_case_insensitive = false, -- used when sorting files and directories in the tree
|
||||||
|
sort_function = nil , -- use a custom function for sorting files and directories in the tree
|
||||||
|
-- sort_function = function (a,b)
|
||||||
|
-- if a.type == b.type then
|
||||||
|
-- return a.path > b.path
|
||||||
|
-- else
|
||||||
|
-- return a.type > b.type
|
||||||
|
-- end
|
||||||
|
-- end , -- this sorts files and directories descendantly
|
||||||
|
|
||||||
|
sources = {
|
||||||
|
"filesystem",
|
||||||
|
"buffers",
|
||||||
|
"git_status",
|
||||||
|
},
|
||||||
|
|
||||||
|
source_selector = {
|
||||||
|
winbar = false,
|
||||||
|
statusline = false,
|
||||||
|
},
|
||||||
|
|
||||||
|
default_component_configs = {
|
||||||
|
container = {
|
||||||
|
enable_character_fade = true
|
||||||
|
},
|
||||||
|
icon = {
|
||||||
|
folder_closed = "",
|
||||||
|
folder_open = "",
|
||||||
|
default = "*",
|
||||||
|
highlight = "NeoTreeFileIcon",
|
||||||
|
folder_empty = "",
|
||||||
|
folder_empty_open = "",
|
||||||
|
},
|
||||||
|
modified = {
|
||||||
|
symbol = "[+]",
|
||||||
|
highlight = "NeoTreeModified",
|
||||||
|
},
|
||||||
|
name = {
|
||||||
|
trailing_slash = false,
|
||||||
|
use_git_status_colors = true,
|
||||||
|
highlight = "NeoTreeFileName",
|
||||||
|
},
|
||||||
|
git_status = {
|
||||||
|
symbols = {
|
||||||
|
added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name
|
||||||
|
modified = "", -- or "", but this is redundant info if you use git_status_colors on the name
|
||||||
|
deleted = "✖",-- this can only be used in the git_status source
|
||||||
|
untracked = "",
|
||||||
|
ignored = "",
|
||||||
|
staged = "",
|
||||||
|
conflict = "",
|
||||||
|
renamed = "",
|
||||||
|
unstaged = "",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
window = {
|
||||||
|
position = "left",
|
||||||
|
width = 35,
|
||||||
|
mapping_options = {
|
||||||
|
noremap = true,
|
||||||
|
nowait = true,
|
||||||
|
},
|
||||||
|
mappings = {
|
||||||
|
["<space>"] = {
|
||||||
|
"toggle_node",
|
||||||
|
nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use
|
||||||
|
},
|
||||||
|
["<2-LeftMouse>"] = "open",
|
||||||
|
["<cr>"] = "open",
|
||||||
|
["o"] = "open",
|
||||||
|
["<esc>"] = "revert_preview",
|
||||||
|
["P"] = { "toggle_preview", config = { use_float = true } },
|
||||||
|
["l"] = "focus_preview",
|
||||||
|
["S"] = "open_split",
|
||||||
|
["s"] = "open_vsplit",
|
||||||
|
["t"] = "open_tabnew",
|
||||||
|
["w"] = "open_with_window_picker",
|
||||||
|
["C"] = "close_node",
|
||||||
|
["z"] = "close_all_nodes",
|
||||||
|
["a"] = {
|
||||||
|
"add",
|
||||||
|
config = {
|
||||||
|
show_path = "none" -- "none", "relative", "absolute"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion.
|
||||||
|
["d"] = "delete",
|
||||||
|
["r"] = "rename",
|
||||||
|
["y"] = "copy_to_clipboard",
|
||||||
|
["x"] = "cut_to_clipboard",
|
||||||
|
["p"] = "paste_from_clipboard",
|
||||||
|
["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add":
|
||||||
|
["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add".
|
||||||
|
["q"] = "close_window",
|
||||||
|
["R"] = "refresh",
|
||||||
|
["?"] = "show_help",
|
||||||
|
["<"] = "prev_source",
|
||||||
|
[">"] = "next_source",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
filesystem = {
|
||||||
|
filtered_items = {
|
||||||
|
visible = false, -- when true, they will just be displayed differently than normal items
|
||||||
|
hide_dotfiles = false,
|
||||||
|
hide_gitignored = false,
|
||||||
|
hide_hidden = true, -- only works on Windows for hidden files/directories
|
||||||
|
hide_by_name = {
|
||||||
|
--"node_modules"
|
||||||
|
},
|
||||||
|
hide_by_pattern = { -- uses glob style patterns
|
||||||
|
--"*.meta",
|
||||||
|
--"*/src/*/tsconfig.json",
|
||||||
|
},
|
||||||
|
always_show = { -- remains visible even if other settings would normally hide it
|
||||||
|
--".gitignored",
|
||||||
|
},
|
||||||
|
never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show
|
||||||
|
--".DS_Store",
|
||||||
|
--"thumbs.db"
|
||||||
|
},
|
||||||
|
never_show_by_pattern = { -- uses glob style patterns
|
||||||
|
--".null-ls_*",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
follow_current_file = true, -- This will find and focus the file in the active buffer every
|
||||||
|
-- time the current file is changed while the tree is open.
|
||||||
|
group_empty_dirs = false, -- when true, empty folders will be grouped together
|
||||||
|
hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree
|
||||||
|
-- in whatever position is specified in window.position
|
||||||
|
-- "open_current", -- netrw disabled, opening a directory opens within the
|
||||||
|
-- window like netrw would, regardless of window.position
|
||||||
|
-- "disabled", -- netrw left alone, neo-tree does not handle opening dirs
|
||||||
|
use_libuv_file_watcher = true, -- This will use the OS level file watchers to detect changes
|
||||||
|
-- instead of relying on nvim autocmd events.
|
||||||
|
window = {
|
||||||
|
mappings = {
|
||||||
|
["<bs>"] = "navigate_up",
|
||||||
|
["."] = "set_root",
|
||||||
|
["H"] = "toggle_hidden",
|
||||||
|
["/"] = "fuzzy_finder",
|
||||||
|
["D"] = "fuzzy_finder_directory",
|
||||||
|
["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm
|
||||||
|
-- ["D"] = "fuzzy_sorter_directory",
|
||||||
|
["f"] = "filter_on_submit",
|
||||||
|
["<c-x>"] = "clear_filter",
|
||||||
|
["[g"] = "prev_git_modified",
|
||||||
|
["]g"] = "next_git_modified",
|
||||||
|
},
|
||||||
|
fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode
|
||||||
|
["<down>"] = "move_cursor_down",
|
||||||
|
["<C-n>"] = "move_cursor_down",
|
||||||
|
["<up>"] = "move_cursor_up",
|
||||||
|
["<C-p>"] = "move_cursor_up",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
commands = {} -- Add a custom command or override a global one using the same function name
|
||||||
|
},
|
||||||
|
|
||||||
|
buffers = {
|
||||||
|
follow_current_file = true, -- This will find and focus the file in the active buffer every
|
||||||
|
-- time the current file is changed while the tree is open.
|
||||||
|
group_empty_dirs = true, -- when true, empty folders will be grouped together
|
||||||
|
show_unloaded = true,
|
||||||
|
window = {
|
||||||
|
mappings = {
|
||||||
|
["bd"] = "buffer_delete",
|
||||||
|
["<bs>"] = "navigate_up",
|
||||||
|
["."] = "set_root",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
git_status = {
|
||||||
|
window = {
|
||||||
|
position = "float",
|
||||||
|
mappings = {
|
||||||
|
["A"] = "git_add_all",
|
||||||
|
["gu"] = "git_unstage_file",
|
||||||
|
["ga"] = "git_add_file",
|
||||||
|
["gr"] = "git_revert_file",
|
||||||
|
["gc"] = "git_commit",
|
||||||
|
["gp"] = "git_push",
|
||||||
|
["gg"] = "git_commit_and_push",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
97
lua/plugins/noice/config.lua
Normal file
97
lua/plugins/noice/config.lua
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
return function()
|
||||||
|
local myopts = require("custom_opts")
|
||||||
|
|
||||||
|
require("noice").setup({
|
||||||
|
cmdline = {
|
||||||
|
enabled = true, -- enables the Noice cmdline UI
|
||||||
|
view = myopts.cmdline_view, -- view for rendering the cmdline. Change to `cmdline` to get a classic cmdline at the bottom
|
||||||
|
opts = {}, -- global options for the cmdline. See section on views
|
||||||
|
---@type table<string, CmdlineFormat>
|
||||||
|
format = {
|
||||||
|
-- conceal: (default=true) This will hide the text in the cmdline that matches the pattern.
|
||||||
|
-- view: (default is cmdline view)
|
||||||
|
-- opts: any options passed to the view
|
||||||
|
-- icon_hl_group: optional hl_group for the icon
|
||||||
|
-- title: set to anything or empty string to hide
|
||||||
|
cmdline = { pattern = "^:", icon = "", lang = "vim" },
|
||||||
|
search_down = { kind = "search", pattern = "^/", icon = " ", lang = "regex" },
|
||||||
|
search_up = { kind = "search", pattern = "^%?", icon = " ", lang = "regex" },
|
||||||
|
filter = { pattern = "^:%s*!", icon = "$", lang = "bash" },
|
||||||
|
lua = {
|
||||||
|
pattern = { "^:%s*lua%s+", "^:%s*lua%s*=%s*", "^:%s*=%s*" },
|
||||||
|
icon = "",
|
||||||
|
lang = "lua",
|
||||||
|
},
|
||||||
|
help = { pattern = "^:%s*he?l?p?%s+", icon = "" },
|
||||||
|
input = {}, -- Used by input()
|
||||||
|
-- lua = false, -- to disable a format, set to `false`
|
||||||
|
},
|
||||||
|
},
|
||||||
|
messages = {
|
||||||
|
-- NOTE: If you enable messages, then the cmdline is enabled automatically.
|
||||||
|
-- This is a current Neovim limitation.
|
||||||
|
enabled = not myopts.close_message_notify, -- enables the Noice messages UI
|
||||||
|
view = "mini", -- default view for messages
|
||||||
|
view_error = "notify", -- view for errors
|
||||||
|
view_warn = "notify", -- view for warnings
|
||||||
|
view_history = "messages", -- view for :messages
|
||||||
|
view_search = false, -- view for search count messages. Set to `false` to disable
|
||||||
|
},
|
||||||
|
lsp = {
|
||||||
|
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||||
|
override = {
|
||||||
|
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||||
|
["vim.lsp.util.stylize_markdown"] = true,
|
||||||
|
["cmp.entry.get_documentation"] = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- you can enable a preset for easier configuration
|
||||||
|
presets = {
|
||||||
|
bottom_search = true, -- use a classic bottom cmdline for search
|
||||||
|
command_palette = true, -- position the cmdline and popupmenu together
|
||||||
|
long_message_to_split = true, -- long messages will be sent to a split
|
||||||
|
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||||
|
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||||
|
},
|
||||||
|
views = {
|
||||||
|
cmdline_popup = {
|
||||||
|
position = {
|
||||||
|
row = "50%",
|
||||||
|
col = "50%",
|
||||||
|
},
|
||||||
|
size = {
|
||||||
|
width = 60,
|
||||||
|
height = "auto",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
routes = {
|
||||||
|
{
|
||||||
|
filter = {
|
||||||
|
event = "msg_show",
|
||||||
|
kind = "",
|
||||||
|
find = "已写入",
|
||||||
|
},
|
||||||
|
opts = { skip = true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filter = {
|
||||||
|
event = "msg_show",
|
||||||
|
kind = "",
|
||||||
|
find = "written",
|
||||||
|
},
|
||||||
|
opts = { skip = true },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
notify = {
|
||||||
|
-- Noice can be used as `vim.notify` so you can route any notification like other messages
|
||||||
|
-- Notification messages have their level and other properties set.
|
||||||
|
-- event is always "notify" and kind can be any log level as a string
|
||||||
|
-- The default routes will forward notifications to nvim-notify
|
||||||
|
-- Benefit of using Noice for this is the routing and consistent history view
|
||||||
|
enabled = true,
|
||||||
|
view = "notify",
|
||||||
|
replace = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
44
lua/plugins/nvim-web-devicons/config.lua
Normal file
44
lua/plugins/nvim-web-devicons/config.lua
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
return function()
|
||||||
|
require('nvim-web-devicons').setup {
|
||||||
|
-- your personnal icons can go here (to override)
|
||||||
|
-- you can specify color or cterm_color instead of specifying both of them
|
||||||
|
-- DevIcon will be appended to `name`
|
||||||
|
override = {
|
||||||
|
zsh = {
|
||||||
|
icon = "",
|
||||||
|
color = "#428850",
|
||||||
|
cterm_color = "65",
|
||||||
|
name = "Zsh"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
-- globally enable different highlight colors per icon (default to true)
|
||||||
|
-- if set to false all icons will have the default icon's color
|
||||||
|
color_icons = true;
|
||||||
|
-- globally enable default icons (default to false)
|
||||||
|
-- will get overriden by `get_icons` option
|
||||||
|
default = true;
|
||||||
|
-- globally enable "strict" selection of icons - icon will be looked up in
|
||||||
|
-- different tables, first by filename, and if not found by extension; this
|
||||||
|
-- prevents cases when file doesn't have any extension but still gets some icon
|
||||||
|
-- because its name happened to match some extension (default to false)
|
||||||
|
strict = true;
|
||||||
|
-- same as `override` but specifically for overrides by filename
|
||||||
|
-- takes effect when `strict` is true
|
||||||
|
override_by_filename = {
|
||||||
|
[".gitignore"] = {
|
||||||
|
icon = "",
|
||||||
|
color = "#f1502f",
|
||||||
|
name = "Gitignore"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
-- same as `override` but specifically for overrides by extension
|
||||||
|
-- takes effect when `strict` is true
|
||||||
|
override_by_extension = {
|
||||||
|
["log"] = {
|
||||||
|
icon = "",
|
||||||
|
color = "#81e043",
|
||||||
|
name = "Log"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
end
|
19
lua/plugins/smart-split/config.lua
Normal file
19
lua/plugins/smart-split/config.lua
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
return function()
|
||||||
|
require('smart-splits').setup({
|
||||||
|
ignored_filetypes = {
|
||||||
|
'nofile',
|
||||||
|
'quickfix',
|
||||||
|
'prompt',
|
||||||
|
'neo-tree',
|
||||||
|
},
|
||||||
|
ignored_buftypes = { 'NvimTree', 'neo-tree' },
|
||||||
|
})
|
||||||
|
|
||||||
|
local keys = require("custom_keys")
|
||||||
|
local opttion = {noremap = true, silent = true }
|
||||||
|
|
||||||
|
vim.keymap.set({'n', 't'}, keys.resize_left, require('smart-splits').resize_left, option)
|
||||||
|
vim.keymap.set({'n', 't'}, keys.resize_down, require('smart-splits').resize_down, option)
|
||||||
|
vim.keymap.set({'n', 't'}, keys.resize_up, require('smart-splits').resize_up, option)
|
||||||
|
vim.keymap.set({'n', 't'}, keys.resize_right, require('smart-splits').resize_right, option)
|
||||||
|
end
|
57
lua/plugins/start_screen.lua
Normal file
57
lua/plugins/start_screen.lua
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"goolord/alpha-nvim",
|
||||||
|
requires = { "nvim-tree/nvim-web-devicons" },
|
||||||
|
setup = function()
|
||||||
|
vim.g.alpha_statusline = false
|
||||||
|
end,
|
||||||
|
config = function()
|
||||||
|
local dashboard = require("alpha.themes.dashboard")
|
||||||
|
|
||||||
|
-- header, it's a logo
|
||||||
|
dashboard.section.header.val = require("custom_opts").home_header
|
||||||
|
dashboard.section.header.opts.hl = "HardHackerRed"
|
||||||
|
|
||||||
|
-- footer
|
||||||
|
local handle = io.popen("fortune")
|
||||||
|
local fortune = handle:read("*a")
|
||||||
|
handle:close()
|
||||||
|
dashboard.section.footer.val = fortune
|
||||||
|
|
||||||
|
-- button
|
||||||
|
local create_button = function(key, desc, action)
|
||||||
|
local b = dashboard.button(key, desc, action)
|
||||||
|
b.opts.hl = "HardHackerComment"
|
||||||
|
b.opts.hl_shortcut = "HardHackerComment"
|
||||||
|
b.opts.width = 40
|
||||||
|
return b
|
||||||
|
end
|
||||||
|
dashboard.section.buttons.val = {
|
||||||
|
create_button("f", " New file", ":ene <BAR> startinsert <CR>"),
|
||||||
|
create_button("s", " Load last session", ":SessionManager load_last_session<CR>"),
|
||||||
|
-- create_button("e", " Select session", ":SessionManager load_session<CR>"),
|
||||||
|
create_button(
|
||||||
|
"c",
|
||||||
|
" Open current directory",
|
||||||
|
":Neotree position=left source=filesystem action=focus toggle=true<CR>"
|
||||||
|
),
|
||||||
|
create_button("q", " Quit", ":qa<CR>"),
|
||||||
|
}
|
||||||
|
|
||||||
|
-- config
|
||||||
|
dashboard.config.layout[1].val = vim.fn.max({ 3, vim.fn.floor(vim.fn.winheight(0) * 0.3) })
|
||||||
|
dashboard.config.layout[3].val = 5
|
||||||
|
dashboard.config.opts.noautocmd = true
|
||||||
|
|
||||||
|
require("alpha").setup(dashboard.config)
|
||||||
|
|
||||||
|
-- disable the tabline & statusline in alpha dashboard screen
|
||||||
|
vim.cmd([[
|
||||||
|
autocmd User AlphaReady set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2
|
||||||
|
autocmd User AlphaReady set laststatus=0 | autocmd BufUnload <buffer> set laststatus=3
|
||||||
|
autocmd User AlphaReady :NeoTreeClose
|
||||||
|
autocmd User AlphaReady :AerialCloseAll
|
||||||
|
]])
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
53
lua/plugins/terminal.lua
Normal file
53
lua/plugins/terminal.lua
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"akinsho/toggleterm.nvim",
|
||||||
|
version = "*",
|
||||||
|
config = function()
|
||||||
|
local copts = require("custom_opts")
|
||||||
|
|
||||||
|
require("toggleterm").setup({
|
||||||
|
size = function(term)
|
||||||
|
if term.direction == "horizontal" then
|
||||||
|
return 15
|
||||||
|
elseif term.direction == "vertical" then
|
||||||
|
return vim.o.columns * 0.4
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
highlights = {
|
||||||
|
Normal = {
|
||||||
|
link = "Normal",
|
||||||
|
},
|
||||||
|
NormalFloat = {
|
||||||
|
link = "Normal",
|
||||||
|
},
|
||||||
|
FloatBorder = {
|
||||||
|
link = "FloatBorder",
|
||||||
|
},
|
||||||
|
SignColumn = {
|
||||||
|
link = "EndOfBuffer",
|
||||||
|
},
|
||||||
|
EndOfBuffer = {
|
||||||
|
link = "EndOfBuffer",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
float_opts = {
|
||||||
|
border = "rounded",
|
||||||
|
-- winblend = copts.window_transparency,
|
||||||
|
width = function(term)
|
||||||
|
local columns = vim.api.nvim_get_option("columns")
|
||||||
|
local w = math.floor(columns * copts.terminal_size)
|
||||||
|
return (w < 20) and 20 or w
|
||||||
|
end,
|
||||||
|
height = function(term)
|
||||||
|
local lines = vim.api.nvim_get_option("lines")
|
||||||
|
local h = math.floor(lines * (copts.terminal_size + 0.1))
|
||||||
|
return (h < 35) and 35 or h
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
persist_size = true,
|
||||||
|
persist_mode = true,
|
||||||
|
autochdir = true,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
104
lua/plugins/utils.lua
Normal file
104
lua/plugins/utils.lua
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
return {
|
||||||
|
{ "rcarriga/nvim-notify" },
|
||||||
|
|
||||||
|
-- resize the window
|
||||||
|
{
|
||||||
|
"mrjones2014/smart-splits.nvim",
|
||||||
|
version = "v1.2.2",
|
||||||
|
config = function()
|
||||||
|
require("plugins/smart-split/config")()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- buffer delete
|
||||||
|
{ "famiu/bufdelete.nvim" },
|
||||||
|
|
||||||
|
-- session
|
||||||
|
{
|
||||||
|
"Shatur/neovim-session-manager",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
|
config = function()
|
||||||
|
local Path = require("plenary.path")
|
||||||
|
local config = require("session_manager.config")
|
||||||
|
require("session_manager").setup({
|
||||||
|
sessions_dir = Path:new(vim.fn.stdpath("data"), "sessions"), -- The directory where the session files will be saved.
|
||||||
|
session_filename_to_dir = session_filename_to_dir, -- Function that replaces symbols into separators and colons to transform filename into a session directory.
|
||||||
|
dir_to_session_filename = dir_to_session_filename, -- Function that replaces separators and colons into special symbols to transform session directory into a filename. Should use `vim.loop.cwd()` if the passed `dir` is `nil`.
|
||||||
|
autoload_mode = config.AutoloadMode.Disabled, -- Define what to do when Neovim is started without arguments. Possible values: Disabled, CurrentDir, LastSession
|
||||||
|
autosave_last_session = true, -- Automatically save last session on exit and on session switch.
|
||||||
|
autosave_ignore_not_normal = true, -- Plugin will not save a session when no buffers are opened, or all of them aren't writable or listed.
|
||||||
|
autosave_ignore_dirs = { "/", "~", "/tmp/" }, -- A list of directories where the session will not be autosaved.
|
||||||
|
autosave_ignore_filetypes = { -- All buffers of these file types will be closed before the session is saved.
|
||||||
|
"gitcommit",
|
||||||
|
"gitrebase",
|
||||||
|
},
|
||||||
|
autosave_ignore_buftypes = {}, -- All buffers of these bufer types will be closed before the session is saved.
|
||||||
|
autosave_only_in_session = false, -- Always autosaves session. If true, only autosaves after a session is active.
|
||||||
|
max_path_length = 80, -- Shorten the display path if length exceeds this threshold. Use 0 if don't want to shorten the path at all.
|
||||||
|
})
|
||||||
|
|
||||||
|
-- automatic open neotree sidebar when a session opened
|
||||||
|
local hardhacker_config_group = vim.api.nvim_create_augroup("HardHackerConfigGroup", {})
|
||||||
|
vim.api.nvim_create_autocmd({ "User" }, {
|
||||||
|
pattern = "SessionLoadPost",
|
||||||
|
group = hardhacker_config_group,
|
||||||
|
callback = function()
|
||||||
|
vim.api.nvim_command("Neotree position=left source=filesystem action=show")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
-- zen-mode
|
||||||
|
{
|
||||||
|
"folke/zen-mode.nvim",
|
||||||
|
opts = {
|
||||||
|
window = {
|
||||||
|
backdrop = 1, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal
|
||||||
|
-- height and width can be:
|
||||||
|
-- * an absolute number of cells when > 1
|
||||||
|
-- * a percentage of the width / height of the editor when <= 1
|
||||||
|
-- * a function that returns the width or the height
|
||||||
|
width = 120, -- width of the Zen window
|
||||||
|
height = 0.9, -- height of the Zen window
|
||||||
|
-- by default, no options are changed for the Zen window
|
||||||
|
-- uncomment any of the options below, or add other vim.wo options you want to apply
|
||||||
|
options = {
|
||||||
|
signcolumn = "no", -- disable signcolumn
|
||||||
|
number = false, -- disable number column
|
||||||
|
relativenumber = false, -- disable relative numbers
|
||||||
|
cursorline = false, -- disable cursorline
|
||||||
|
cursorcolumn = false, -- disable cursor column
|
||||||
|
foldcolumn = "0", -- disable fold column
|
||||||
|
list = false, -- disable whitespace characters
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- callback where you can add custom code when the Zen window opens
|
||||||
|
on_open = function(win) end,
|
||||||
|
-- callback where you can add custom code when the Zen window closes
|
||||||
|
on_close = function() end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"folke/twilight.nvim",
|
||||||
|
opts = {
|
||||||
|
dimming = {
|
||||||
|
alpha = 0.25, -- amount of dimming
|
||||||
|
-- we try to get the foreground from the highlight groups or fallback color
|
||||||
|
-- color = { "Normal", "#eee9fc" },
|
||||||
|
-- term_bg = "#000000", -- if guibg=NONE, this will be used to calculate text color
|
||||||
|
inactive = false, -- when true, other windows will be fully dimmed (unless they contain the same buffer)
|
||||||
|
},
|
||||||
|
context = 10, -- amount of lines we will try to show around the current line
|
||||||
|
treesitter = true, -- use treesitter when available for the filetype
|
||||||
|
-- treesitter is used to automatically expand the visible text,
|
||||||
|
-- but you can further control the types of nodes that should always be fully expanded
|
||||||
|
expand = { -- for treesitter, we we always try to expand to the top-most ancestor with these types
|
||||||
|
"function",
|
||||||
|
"method",
|
||||||
|
"table",
|
||||||
|
"if_statement",
|
||||||
|
},
|
||||||
|
exclude = {}, -- exclude these filetypes
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
101
lua/plugins/view.lua
Normal file
101
lua/plugins/view.lua
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
return {
|
||||||
|
-- winbar
|
||||||
|
{
|
||||||
|
"utilyre/barbecue.nvim",
|
||||||
|
name = "barbecue",
|
||||||
|
version = "*",
|
||||||
|
dependencies = {
|
||||||
|
"SmiteshP/nvim-navic",
|
||||||
|
"nvim-tree/nvim-web-devicons", -- optional dependency
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("barbecue").setup({
|
||||||
|
create_autocmd = false, -- prevent barbecue from updating itself automatically
|
||||||
|
theme = vim.g.hardhacker_barbecue_theme,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd({
|
||||||
|
"WinScrolled", -- or WinResized on NVIM-v0.9 and higher
|
||||||
|
"BufWinEnter",
|
||||||
|
"CursorHold",
|
||||||
|
"InsertLeave",
|
||||||
|
|
||||||
|
-- include this if you have set `show_modified` to `true`
|
||||||
|
"BufModifiedSet",
|
||||||
|
}, {
|
||||||
|
group = vim.api.nvim_create_augroup("barbecue.updater", {}),
|
||||||
|
callback = function()
|
||||||
|
require("barbecue.ui").update()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Status line
|
||||||
|
{
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
dependencies = { "nvim-tree/nvim-web-devicons", opt = true },
|
||||||
|
config = function()
|
||||||
|
require("plugins/lualine/config")()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- File explorer
|
||||||
|
{
|
||||||
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
|
branch = "v2.x",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||||
|
"MunifTanjim/nui.nvim",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("plugins/neo-tree/config")()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Outline
|
||||||
|
{
|
||||||
|
"stevearc/aerial.nvim",
|
||||||
|
opts = {},
|
||||||
|
-- Optional dependencies
|
||||||
|
dependencies = {
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
"nvim-tree/nvim-web-devicons",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("aerial").setup({
|
||||||
|
lazy_load = false,
|
||||||
|
open_automatic = require("custom_opts").auto_open_outline,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Tab line
|
||||||
|
{
|
||||||
|
"akinsho/bufferline.nvim",
|
||||||
|
version = "v4.1.0",
|
||||||
|
dependencies = "nvim-tree/nvim-web-devicons",
|
||||||
|
config = function()
|
||||||
|
require("plugins/bufferline/config")()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- cmd line
|
||||||
|
{
|
||||||
|
"folke/noice.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"MunifTanjim/nui.nvim",
|
||||||
|
"rcarriga/nvim-notify",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("plugins/noice/config")()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Improve the ui
|
||||||
|
{
|
||||||
|
"stevearc/dressing.nvim",
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
}
|
Loading…
Reference in a new issue