summaryrefslogtreecommitdiff
path: root/.config/nvim
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-03-18 22:19:57 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-03-18 22:19:57 +0100
commite6fed655e18343e6e399e8198346466effe8c3a8 (patch)
treecdae8ac05aa014a4970f3bdf656cb297527780e5 /.config/nvim
parent55517dded759e1dd4381792985a6d7fb88df8a1e (diff)
Fix nvim lua scripts
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/init.lua14
-rw-r--r--.config/nvim/lua/_bufferline/init.lua2
-rw-r--r--.config/nvim/lua/_comment/init.lua3
-rw-r--r--.config/nvim/lua/_compe/init.lua5
-rw-r--r--.config/nvim/lua/_gitsigns/init.lua12
-rw-r--r--.config/nvim/lua/_hop/init.lua4
-rw-r--r--.config/nvim/lua/_illuminate/init.lua1
-rw-r--r--.config/nvim/lua/_kommentary/init.lua6
-rw-r--r--.config/nvim/lua/_lsp/bash-ls.lua2
-rw-r--r--.config/nvim/lua/_lsp/docker-ls.lua2
-rw-r--r--.config/nvim/lua/_lsp/general.lua15
-rw-r--r--.config/nvim/lua/_lsp/init.lua59
-rw-r--r--.config/nvim/lua/_lsp/json-ls.lua1
-rw-r--r--.config/nvim/lua/_lsp/lua-ls.lua20
-rw-r--r--.config/nvim/lua/_lsp/python-ls.lua4
-rw-r--r--.config/nvim/lua/_lsp/vim-ls.lua2
-rw-r--r--.config/nvim/lua/_lsp/vim.lua2
-rw-r--r--.config/nvim/lua/_lsp/wrapper.lua129
-rw-r--r--.config/nvim/lua/_lsp/yaml-ls.lua4
-rw-r--r--.config/nvim/lua/_matchup/init.lua1
-rw-r--r--.config/nvim/lua/_nvimtree/init.lua23
-rw-r--r--.config/nvim/lua/_telescope/init.lua16
-rw-r--r--.config/nvim/lua/_treesitter/init.lua13
-rw-r--r--.config/nvim/lua/_utils/init.lua204
-rw-r--r--.config/nvim/lua/_vim-bbye/init.lua1
-rw-r--r--.config/nvim/lua/_vim-bbye/init.vim1
-rw-r--r--.config/nvim/lua/plugins.lua25
-rw-r--r--.config/nvim/vim-script/_goyo/init.vim (renamed from .config/nvim/lua/_goyo/init.vim)0
-rw-r--r--.config/nvim/vim-script/_limelight/init.vim23
-rw-r--r--.config/nvim/vim-script/_nvimtree/init.vim19
-rw-r--r--.config/nvim/vim-script/_whichkey/init.vim (renamed from .config/nvim/lua/_whichkey/init.vim)0
31 files changed, 399 insertions, 214 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
index 4ee361e..45826ca 100644
--- a/.config/nvim/init.lua
+++ b/.config/nvim/init.lua
@@ -3,6 +3,7 @@ require('plugins')
require('mappings')
require('settings')
require('colorscheme')
+require('_utils')
-- Plugins
require('_compe')
@@ -10,11 +11,13 @@ require('_telescope')
require('_autopairs')
require('_closetag')
require('_colorizer')
+require('_comment')
require('_floaterm')
require('_gitblame')
require('_gitsigns')
require('_hop')
-require('_kommentary')
+require('_illuminate')
+require('_matchup')
-- require('_limeligth')
require('_neogit')
require('_nvimtree')
@@ -23,6 +26,7 @@ require('_rnvimr')
require('_startify')
-- require('_treesitter')
require('_vim-rooter')
+require('_vim-bbye')
-- bufferline and statusline
require('_galaxyline')
@@ -30,17 +34,17 @@ require('_bufferline')
-- Load vim scripts
-- Which Key (Hope to replace with Lua plugin someday)
-vim.cmd('source ~/.config/nvim/lua/_goyo/init.vim')
-vim.cmd('source ~/.config/nvim/lua/_vim-bbye/init.vim')
-vim.cmd('source ~/.config/nvim/lua/_whichkey/init.vim')
+vim.cmd('source ~/.config/nvim/vim-script/_goyo/init.vim')
+vim.cmd('source ~/.config/nvim/vim-script/_limelight/init.vim')
+vim.cmd('source ~/.config/nvim/vim-script/_whichkey/init.vim')
-- LSP
require('_lspkind')
require('_lsp')
-require('utils')
require('_lsp.bash-ls')
require('_lsp.docker-ls')
require('_lsp.lua-ls')
require('_lsp.json-ls')
+require('_lsp.vim-ls')
require('_lsp.python-ls')
require('_lsp.yaml-ls')
diff --git a/.config/nvim/lua/_bufferline/init.lua b/.config/nvim/lua/_bufferline/init.lua
index ab7ecae..c3bd69a 100644
--- a/.config/nvim/lua/_bufferline/init.lua
+++ b/.config/nvim/lua/_bufferline/init.lua
@@ -13,7 +13,7 @@ require'bufferline'.setup{
max_prefix_length = 15, -- prefix used when a buffer is deduplicated
tab_size = 18,
diagnostics = "nvim_lsp",
- show_buffer_close_icons = true,
+ show_buffer_close_icons = false,
show_tab_indicators = true,
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
-- can also be a table containing 2 custom separators
diff --git a/.config/nvim/lua/_comment/init.lua b/.config/nvim/lua/_comment/init.lua
new file mode 100644
index 0000000..df79438
--- /dev/null
+++ b/.config/nvim/lua/_comment/init.lua
@@ -0,0 +1,3 @@
+require('nvim_comment').setup()
+vim.api.nvim_set_keymap("n", "<leader>/", ":CommentToggle<CR>", {noremap=true, silent = true})
+vim.api.nvim_set_keymap("v", "<leader>/", ":CommentToggle<CR>", {noremap=true, silent = true})
diff --git a/.config/nvim/lua/_compe/init.lua b/.config/nvim/lua/_compe/init.lua
index d269be4..75fa9b5 100644
--- a/.config/nvim/lua/_compe/init.lua
+++ b/.config/nvim/lua/_compe/init.lua
@@ -1,3 +1,5 @@
+vim.o.completeopt = "menuone,noselect"
+
require'compe'.setup {
enabled = true;
autocomplete = true;
@@ -27,6 +29,9 @@ require'compe'.setup {
}
+
+
+
local t = function(str)
return vim.api.nvim_replace_termcodes(str, true, true, true)
end
diff --git a/.config/nvim/lua/_gitsigns/init.lua b/.config/nvim/lua/_gitsigns/init.lua
index b435be7..c19a5d0 100644
--- a/.config/nvim/lua/_gitsigns/init.lua
+++ b/.config/nvim/lua/_gitsigns/init.lua
@@ -13,18 +13,6 @@ require('gitsigns').setup {
-- Default keymap options
noremap = true,
buffer = true,
-
- --[[ ['n ]c'] = { expr = true, "&diff ? ']c' : '<cmd>lua require\"gitsigns\".next_hunk()<CR>'"},
- ['n [c'] = { expr = true, "&diff ? '[c' : '<cmd>lua require\"gitsigns\".prev_hunk()<CR>'"},
- ['n <leader>hs'] = '<cmd>lua require"gitsigns".stage_hunk()<CR>',
- ['n <leader>hu'] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>',
- ['n <leader>hr'] = '<cmd>lua require"gitsigns".reset_hunk()<CR>',
- ['n <leader>hp'] = '<cmd>lua require"gitsigns".preview_hunk()<CR>',
- ['n <leader>hb'] = '<cmd>lua require"gitsigns".blame_line()<CR>', ]]
-
- -- Text objects
- --[[ ['o ih'] = ':<C-U>lua require"gitsigns".text_object()<CR>',
- ['x ih'] = ':<C-U>lua require"gitsigns".text_object()<CR>' ]]
},
watch_index = {
interval = 1000
diff --git a/.config/nvim/lua/_hop/init.lua b/.config/nvim/lua/_hop/init.lua
index f7dd27d..acd4cd7 100644
--- a/.config/nvim/lua/_hop/init.lua
+++ b/.config/nvim/lua/_hop/init.lua
@@ -1,2 +1,2 @@
-vim.api.nvim_set_keymap('n', 's', ":HopChar2<cr>", {})
-vim.api.nvim_set_keymap('n', 'S', ":HopWord<cr>", {})
+vim.api.nvim_set_keymap('n', 's', ":HopChar2<cr>", {silent = true})
+vim.api.nvim_set_keymap('n', 'S', ":HopWord<cr>", {silent = true})
diff --git a/.config/nvim/lua/_illuminate/init.lua b/.config/nvim/lua/_illuminate/init.lua
new file mode 100644
index 0000000..5588aab
--- /dev/null
+++ b/.config/nvim/lua/_illuminate/init.lua
@@ -0,0 +1 @@
+vim.g.Illuminate_ftblacklist = {'NvimTree'}
diff --git a/.config/nvim/lua/_kommentary/init.lua b/.config/nvim/lua/_kommentary/init.lua
deleted file mode 100644
index 350e1ac..0000000
--- a/.config/nvim/lua/_kommentary/init.lua
+++ /dev/null
@@ -1,6 +0,0 @@
-vim.g.kommentary_create_default_mappings = false
-vim.api.nvim_set_keymap("n", "gc", "<Plug>kommentary_line_default", {})
-vim.api.nvim_set_keymap("v", "gc", "<Plug>kommentary_visual_default", {})
-require('kommentary.config').configure_language("default", {
- prefer_single_line_comments = true,
-})
diff --git a/.config/nvim/lua/_lsp/bash-ls.lua b/.config/nvim/lua/_lsp/bash-ls.lua
index 8be0383..7a12dc0 100644
--- a/.config/nvim/lua/_lsp/bash-ls.lua
+++ b/.config/nvim/lua/_lsp/bash-ls.lua
@@ -1,2 +1,2 @@
-- npm i -g bash-language-server
-require'lspconfig'.bashls.setup{}
+require'lspconfig'.bashls.setup {on_attach = require'_lsp'.common_on_attach}
diff --git a/.config/nvim/lua/_lsp/docker-ls.lua b/.config/nvim/lua/_lsp/docker-ls.lua
index ad6e220..878aa86 100644
--- a/.config/nvim/lua/_lsp/docker-ls.lua
+++ b/.config/nvim/lua/_lsp/docker-ls.lua
@@ -1,2 +1,2 @@
-- npm install -g dockerfile-language-server-nodejs
-require'lspconfig'.dockerls.setup{}
+require'lspconfig'.dockerls.setup {on_attach = require'_lsp'.common_on_attach}
diff --git a/.config/nvim/lua/_lsp/general.lua b/.config/nvim/lua/_lsp/general.lua
deleted file mode 100644
index fa28dbc..0000000
--- a/.config/nvim/lua/_lsp/general.lua
+++ /dev/null
@@ -1,15 +0,0 @@
-require"lspconfig".efm.setup {
- init_options = {documentFormatting = true},
- filetypes = {"lua"},
- settings = {
- rootMarkers = {".git/"},
- languages = {
- lua = {
- {
- formatCommand = "lua-format -i --no-keep-simple-function-one-line --no-break-after-operator --column-limit=150 --break-after-table-lb",
- formatStdin = true
- }
- }
- }
- }
-}
diff --git a/.config/nvim/lua/_lsp/init.lua b/.config/nvim/lua/_lsp/init.lua
index 4515e7c..12ce36a 100644
--- a/.config/nvim/lua/_lsp/init.lua
+++ b/.config/nvim/lua/_lsp/init.lua
@@ -1,8 +1,24 @@
---TODO figure out why this don't work
-vim.fn.sign_define("LspDiagnosticsSignError", {texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError"})
-vim.fn.sign_define("LspDiagnosticsSignWarning", {texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning"})
-vim.fn.sign_define("LspDiagnosticsSignInformation", {texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation"})
-vim.fn.sign_define("LspDiagnosticsSignHint", {texthl = "LspDiagnosticsSignHint", text = "", numhl = "LspDiagnosticsSignHint"})
+-- TODO figure out why this don't work
+vim.fn.sign_define("LspDiagnosticsSignError", {
+ texthl = "LspDiagnosticsSignError",
+ text = "",
+ numhl = "LspDiagnosticsSignError"
+})
+vim.fn.sign_define("LspDiagnosticsSignWarning", {
+ texthl = "LspDiagnosticsSignWarning",
+ text = "",
+ numhl = "LspDiagnosticsSignWarning"
+})
+vim.fn.sign_define("LspDiagnosticsSignInformation", {
+ texthl = "LspDiagnosticsSignInformation",
+ text = "",
+ numhl = "LspDiagnosticsSignInformation"
+})
+vim.fn.sign_define("LspDiagnosticsSignHint", {
+ texthl = "LspDiagnosticsSignHint",
+ text = "",
+ numhl = "LspDiagnosticsSignHint"
+})
vim.cmd('nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>')
vim.cmd('nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>')
@@ -17,3 +33,36 @@ vim.cmd('nnoremap <silent> <C-n> :Lspsaga diagnostic_jump_next<CR>')
vim.cmd('nnoremap <silent> <C-f> <cmd>lua require(\'lspsaga.action\').smart_scroll_with_saga(1)<CR>')
-- scroll up hover doc
vim.cmd('nnoremap <silent> <C-b> <cmd>lua require(\'lspsaga.action\').smart_scroll_with_saga(-1)<CR>')
+vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()')
+
+--[[ " autoformat
+autocmd BufWritePre *.js lua vim.lsp.buf.formatting_sync(nil, 100)
+autocmd BufWritePre *.jsx lua vim.lsp.buf.formatting_sync(nil, 100)
+autocmd BufWritePre *.lua lua vim.lsp.buf.formatting_sync(nil, 100) ]]
+-- Java
+-- autocmd FileType java nnoremap ca <Cmd>lua require('jdtls').code_action()<CR>
+
+local lsp_config = {}
+
+function lsp_config.common_on_attach(client, bufnr)
+
+ -- Set autocommands conditional on server_capabilities
+ if client.resolved_capabilities.document_highlight then
+ vim.api.nvim_exec([[
+ hi LspReferenceRead cterm=bold ctermbg=red guibg=#464646
+ hi LspReferenceText cterm=bold ctermbg=red guibg=#464646
+ hi LspReferenceWrite cterm=bold ctermbg=red guibg=#464646
+ augroup lsp_document_highlight
+ autocmd! * <buffer>
+ autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
+ autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
+ augroup END
+ ]], false)
+ end
+end
+
+-- Use a loop to conveniently both setup defined servers
+-- and map buffer local keybindings when the language server attaches
+-- local servers = {"pyright", "tsserver"}
+-- for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup {on_attach = on_attach} end
+return lsp_config
diff --git a/.config/nvim/lua/_lsp/json-ls.lua b/.config/nvim/lua/_lsp/json-ls.lua
index d13fed3..4fbbeff 100644
--- a/.config/nvim/lua/_lsp/json-ls.lua
+++ b/.config/nvim/lua/_lsp/json-ls.lua
@@ -1,5 +1,6 @@
-- npm install -g vscode-json-languageserver
require'lspconfig'.jsonls.setup {
+ on_attach = require'_lsp'.common_on_attach,
commands = {
Format = {
function()
diff --git a/.config/nvim/lua/_lsp/lua-ls.lua b/.config/nvim/lua/_lsp/lua-ls.lua
index c04219a..5768e5d 100644
--- a/.config/nvim/lua/_lsp/lua-ls.lua
+++ b/.config/nvim/lua/_lsp/lua-ls.lua
@@ -1,21 +1,26 @@
--- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)
+ -- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)
USER = vim.fn.expand('$USER')
local sumneko_root_path = ""
local sumneko_binary = ""
if vim.fn.has("mac") == 1 then
- sumneko_root_path = "/Users/" .. USER .. "/.config/nvim/lua-language-server"
- sumneko_binary = "/Users/" .. USER .. "/.config/nvim/lua-language-server/bin/macOS/lua-language-server"
+ sumneko_root_path = "/Users/" .. USER ..
+ "/.config/nvim/ls/lua-language-server"
+ sumneko_binary = "/Users/" .. USER ..
+ "/.config/nvim/ls/lua-language-server/bin/macOS/lua-language-server"
elseif vim.fn.has("unix") == 1 then
- sumneko_root_path = "/home/" .. USER .. "/.config/nvim/lua-language-server"
- sumneko_binary = "/home/" .. USER .. "/.config/nvim/lua-language-server/bin/Linux/lua-language-server"
+ sumneko_root_path = "/home/" .. USER ..
+ "/.config/nvim/ls/lua-language-server"
+ sumneko_binary = "/home/" .. USER ..
+ "/.config/nvim/ls/lua-language-server/bin/Linux/lua-language-server"
else
print("Unsupported system for sumneko")
end
require'lspconfig'.sumneko_lua.setup {
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
+ on_attach = require'_lsp'.common_on_attach,
settings = {
Lua = {
runtime = {
@@ -30,7 +35,10 @@ require'lspconfig'.sumneko_lua.setup {
},
workspace = {
-- Make the server aware of Neovim runtime files
- library = {[vim.fn.expand('$VIMRUNTIME/lua')] = true, [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true}
+ library = {
+ [vim.fn.expand('$VIMRUNTIME/lua')] = true,
+ [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true
+ }
}
}
}
diff --git a/.config/nvim/lua/_lsp/python-ls.lua b/.config/nvim/lua/_lsp/python-ls.lua
index 11eeef9..d07f59b 100644
--- a/.config/nvim/lua/_lsp/python-ls.lua
+++ b/.config/nvim/lua/_lsp/python-ls.lua
@@ -1,2 +1,4 @@
-- npm i -g pyright
-require'lspconfig'.pyright.setup{}
+require'lspconfig'.pyright.setup{
+ on_attach = require'_lsp'.common_on_attach,
+}
diff --git a/.config/nvim/lua/_lsp/vim-ls.lua b/.config/nvim/lua/_lsp/vim-ls.lua
new file mode 100644
index 0000000..08039a3
--- /dev/null
+++ b/.config/nvim/lua/_lsp/vim-ls.lua
@@ -0,0 +1,2 @@
+-- npm install -g vim-language-server
+require'lspconfig'.vimls.setup {on_attach = require'_lsp'.common_on_attach}
diff --git a/.config/nvim/lua/_lsp/vim.lua b/.config/nvim/lua/_lsp/vim.lua
deleted file mode 100644
index a7555c6..0000000
--- a/.config/nvim/lua/_lsp/vim.lua
+++ /dev/null
@@ -1,2 +0,0 @@
--- npm install -g vim-language-server
-require'lspconfig'.vimls.setup{}
diff --git a/.config/nvim/lua/_lsp/wrapper.lua b/.config/nvim/lua/_lsp/wrapper.lua
deleted file mode 100644
index 7f3647c..0000000
--- a/.config/nvim/lua/_lsp/wrapper.lua
+++ /dev/null
@@ -1,129 +0,0 @@
-local lsp_wrapper = {}
-
--- buf
-
-function lsp_wrapper.add_to_workspace_folder()
- vim.lsp.buf.add_workspace_folder()
-end
-
-function lsp_wrapper.clear_references()
- vim.lsp.buf.clear_references()
-end
-
-function lsp_wrapper.code_action()
- vim.lsp.buf.code_action()
-end
-
-function lsp_wrapper.declaration()
- vim.lsp.buf.declaration()
- vim.lsp.buf.clear_references()
-end
-
-function lsp_wrapper.definition()
- vim.lsp.buf.definition()
- vim.lsp.buf.clear_references()
-end
-
-function lsp_wrapper.document_highlight()
- vim.lsp.buf.document_highlight()
-end
-
-function lsp_wrapper.document_symbol()
- vim.lsp.buf.document_symbol()
-end
-
-function lsp_wrapper.formatting()
- vim.lsp.buf.formatting()
-end
-
-function lsp_wrapper.formatting_sync()
- vim.lsp.buf.formatting_sync()
-end
-
-function lsp_wrapper.hover()
- vim.lsp.buf.hover()
-end
-
-function lsp_wrapper.implementation()
- vim.lsp.buf.implementation()
-end
-
-function lsp_wrapper.incoming_calls()
- vim.lsp.buf.incoming_calls()
-end
-
-function lsp_wrapper.list_workspace_folders()
- vim.lsp.buf.list_workspace_folders()
-end
-
-function lsp_wrapper.outgoing_calls()
- vim.lsp.buf.outgoing_calls()
-end
-
-function lsp_wrapper.range_code_action()
- vim.lsp.buf.range_code_action()
-end
-
-function lsp_wrapper.range_formatting()
- vim.lsp.buf.range_formatting()
-end
-
-function lsp_wrapper.references()
- vim.lsp.buf.references()
- vim.lsp.buf.clear_references()
-end
-
-function lsp_wrapper.remove_workspace_folder()
- vim.lsp.buf.remove_workspace_folder()
-end
-
-function lsp_wrapper.rename()
- vim.lsp.buf.rename()
-end
-
-function lsp_wrapper.signature_help()
- vim.lsp.buf.signature_help()
-end
-
-function lsp_wrapper.type_definition()
- vim.lsp.buf.type_definition()
-end
-
-function lsp_wrapper.workspace_symbol()
- vim.lsp.buf.workspace_symbol()
-end
-
--- diagnostic
-
-function lsp_wrapper.get_all()
- vim.lsp.diagnostic.get_all()
-end
-
-function lsp_wrapper.get_next()
- vim.lsp.diagnostic.get_next()
-end
-
-function lsp_wrapper.get_prev()
- vim.lsp.diagnostic.get_prev()
-end
-
-function lsp_wrapper.goto_next()
- vim.lsp.diagnostic.goto_next()
-end
-
-function lsp_wrapper.goto_prev()
- vim.lsp.diagnostic.goto_prev()
-end
-
-function lsp_wrapper.show_line_diagnostics()
- vim.lsp.diagnostic.show_line_diagnostics()
-end
-
--- misc
-
--- :lua print(vim.inspect(vim.lsp.buf_get_clients()))
-
--- autoformat
--- autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_sync(nil, 1000)
-
-return lsp_wrapper
diff --git a/.config/nvim/lua/_lsp/yaml-ls.lua b/.config/nvim/lua/_lsp/yaml-ls.lua
index 904f20e..e611572 100644
--- a/.config/nvim/lua/_lsp/yaml-ls.lua
+++ b/.config/nvim/lua/_lsp/yaml-ls.lua
@@ -1,2 +1,4 @@
-- npm install -g yaml-language-server
-require'lspconfig'.yamlls.setup{}
+require'lspconfig'.yamlls.setup{
+ -- on_attach = require'lsp'.common_on_attach,
+}
diff --git a/.config/nvim/lua/_matchup/init.lua b/.config/nvim/lua/_matchup/init.lua
new file mode 100644
index 0000000..4494908
--- /dev/null
+++ b/.config/nvim/lua/_matchup/init.lua
@@ -0,0 +1 @@
+vim.g.matchup_matchparen_offscreen = {}
diff --git a/.config/nvim/lua/_nvimtree/init.lua b/.config/nvim/lua/_nvimtree/init.lua
index 3803765..997ade6 100644
--- a/.config/nvim/lua/_nvimtree/init.lua
+++ b/.config/nvim/lua/_nvimtree/init.lua
@@ -1,3 +1,25 @@
+--[[ "
+--let g:nvim_tree_auto_ignore_ft = 'startify' "empty by default, don't auto open tree on specific filetypes.
+let g:nvim_tree_hide_dotfiles = 1 "0 by default, this option hides files and folders starting with a dot `.`
+let g:nvim_tree_git_hl = 1 "0 by default, will enable file highlight for git attributes (can be used without the icons).
+" let g:nvim_tree_tab_open = 1 "0 by default, will open the tree when entering a new tab and the tree was previously open
+" let g:nvim_tree_width_allow_resize = 1 "0 by default, will not resize the tree when opening a file
+let g:nvim_tree_show_icons = {
+ \ 'git': 1,
+ \ 'folders': 1,
+ \ 'files': 1,
+ \ }
+"If 0, do not show the icons for one of 'git' 'folder' and 'files'
+"1 by default, notice that if 'files' is 1, it will only display
+"if nvim-web-devicons is installed and on your runtimepath ]]
+-- vim.g.nvim_tree_ignore = [ '.git', 'node_modules', '.cache' ] "empty by default
+vim.g.nvim_tree_disable_netrw = 0 --"1 by default, disables netrw
+-- vim.g.nvim_tree_hijack_netrw = 0 --"1 by default, prevents netrw from automatically opening when opening directories (but lets you keep its other utilities)
+vim.g.nvim_tree_hide_dotfiles = 1 --0 by default, this option hides files and folders starting with a dot `.`
+vim.g.nvim_tree_indent_markers = 1 --"0 by default, this option shows indent markers when folders are open
+vim.g.nvim_tree_follow = 1 --"0 by default, this option allows the cursor to be updated when entering a buffer
+vim.g.nvim_tree_auto_close = 1 --0 by default, closes the tree when it's the last window
+vim.g.nvim_tree_auto_ignore_ft = 'startify' --"empty by default, don't auto open tree on specific filetypes.
local tree_cb = require'nvim-tree.config'.nvim_tree_callback
vim.g.nvim_tree_bindings = {
-- mappings
@@ -29,3 +51,4 @@ vim.g.nvim_tree_bindings = {
["-"] = tree_cb("dir_up"),
["q"] = tree_cb("close")
}
+vim.cmd([[source ~/.config/nvim/vim-script/_nvimtree/init.vim]])
diff --git a/.config/nvim/lua/_telescope/init.lua b/.config/nvim/lua/_telescope/init.lua
index 7466cd4..3d6df8e 100644
--- a/.config/nvim/lua/_telescope/init.lua
+++ b/.config/nvim/lua/_telescope/init.lua
@@ -25,14 +25,9 @@ require('telescope').setup {
results_height = 1,
results_width = 0.8,
border = {},
- borderchars = {
- { '─', '│', '─', '│', '┌', '┐', '┘', '└'},
- prompt = {"─", "│", " ", "│", '┌', '┐', "│", "│"},
- results = {"─", "│", "─", "│", "├", "┤", "┘", "└"},
- preview = { '─', '│', '─', '│', '┌', '┐', '┘', '└'},
- },
+ borderchars = {'─', '│', '─', '│', '╭', '╮', '╯', '╰'},
color_devicons = true,
- use_less = true,
+ use_less = true,
set_env = {['COLORTERM'] = 'truecolor'}, -- default = nil,
file_previewer = require'telescope.previewers'.vim_buffer_cat.new,
grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new,
@@ -47,6 +42,7 @@ require('telescope').setup {
-- To disable a keymap, put [map] = false
-- So, to not map "<C-n>", just put
-- ["<c-x>"] = false,
+ ["<esc>"] = actions.close,
-- Otherwise, just set the mapping to the function that you want it to be.
-- ["<C-i>"] = actions.select_horizontal,
@@ -60,7 +56,6 @@ require('telescope').setup {
n = {
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous
- -- ["<esc>"] = actions.close,
-- ["<C-i>"] = my_cool_custom_action,
}
}
@@ -76,8 +71,3 @@ require('telescope').setup {
}
}
}
-
-vim.api.nvim_set_keymap('n', '<leader>ff', '<cmd>lua require("telescope.builtin").find_files()<cr>', { noremap = true, silent = true })
-vim.api.nvim_set_keymap('n', '<leader>fg', '<cmd>lua require("telescope.builtin").live_grep()<cr>', { noremap = true, silent = true })
-vim.api.nvim_set_keymap('n', '<leader>fb', '<cmd>lua require("telescope.builtin").buffers()<cr>', { noremap = true, silent = true })
-vim.api.nvim_set_keymap('n', '<leader>fh', '<cmd>lua require("telescope.builtin").help_tags()<cr>', { noremap = true, silent = true })
diff --git a/.config/nvim/lua/_treesitter/init.lua b/.config/nvim/lua/_treesitter/init.lua
index d202a9f..2b61051 100644
--- a/.config/nvim/lua/_treesitter/init.lua
+++ b/.config/nvim/lua/_treesitter/init.lua
@@ -3,13 +3,18 @@ require'nvim-treesitter.configs'.setup {
highlight = {
enable = true, -- false will disable the whole extension
},
-}
-
-require "nvim-treesitter.configs".setup {
playground = {
enable = true,
disable = {},
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
persist_queries = false -- Whether the query persists across vim sessions
- }
+ },
+ rainbow = {
+ enable = false
+ },
+ refactor = {
+ highlight_definitions = {
+ enable = false
+ }
+ }
}
diff --git a/.config/nvim/lua/_utils/init.lua b/.config/nvim/lua/_utils/init.lua
new file mode 100644
index 0000000..bed87a3
--- /dev/null
+++ b/.config/nvim/lua/_utils/init.lua
@@ -0,0 +1,204 @@
+local _utils = {}
+
+function _utils.define_augroups(definitions) -- {{{1
+ -- Create autocommand groups based on the passed definitions
+ --
+ -- The key will be the name of the group, and each definition
+ -- within the group should have:
+ -- 1. Trigger
+ -- 2. Pattern
+ -- 3. Text
+ -- just like how they would normally be defined from Vim itself
+ for group_name, definition in pairs(definitions) do
+ vim.cmd('augroup ' .. group_name)
+ vim.cmd('autocmd!')
+
+ for _, def in pairs(definition) do
+ local command = table.concat(vim.tbl_flatten {'autocmd', def}, ' ')
+ vim.cmd(command)
+ end
+
+ vim.cmd('augroup END')
+ end
+end
+_utils.define_augroups({
+ _general_settings = {
+ {
+ 'TextYankPost', '*',
+ 'lua require(\'vim.highlight\').on_yank({higroup = \'QuickScopePrimary\', timeout = 200})'
+ },
+ {'BufWinEnter', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'},
+ {'BufRead', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'},
+ {'BufNewFile', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'},
+ -- {'User', 'GoyoLeave', 'lua require(\'galaxyline\').disable_galaxyline()'},
+ -- {'User', 'GoyoEnter', 'lua require(\'galaxyline\').galaxyline_augroup()'},
+ },
+ numbertoggle = {
+ {'BufEnter,FocusGained,InsertLeave', '*', 'set relativenumber'},
+ {'BufLeave,FocusLost,InsertEnter', '*', 'set norelativenumber'},
+ }
+})
+
+-- Add this to lightbulb, java makes this annoying tho
+-- autocmd CursorHold,CursorHoldI * lua require'nvim-lightbulb'.update_lightbulb()
+
+-- lsp
+
+function _utils.add_to_workspace_folder()
+ vim.lsp.buf.add_workspace_folder()
+
+end
+
+function _utils.clear_references()
+ vim.lsp.buf.clear_references()
+end
+
+function _utils.code_action()
+ vim.lsp.buf.code_action()
+end
+
+function _utils.declaration()
+ vim.lsp.buf.declaration()
+ vim.lsp.buf.clear_references()
+end
+
+function _utils.definition()
+ vim.lsp.buf.definition()
+ vim.lsp.buf.clear_references()
+end
+
+function _utils.document_highlight()
+ vim.lsp.buf.document_highlight()
+end
+
+function _utils.document_symbol()
+ vim.lsp.buf.document_symbol()
+end
+
+function _utils.formatting()
+ vim.lsp.buf.formatting()
+end
+
+function _utils.formatting_sync()
+ vim.lsp.buf.formatting_sync()
+end
+
+function _utils.hover()
+ vim.lsp.buf.hover()
+end
+
+function _utils.implementation()
+ vim.lsp.buf.implementation()
+end
+
+function _utils.incoming_calls()
+ vim.lsp.buf.incoming_calls()
+end
+
+function _utils.list_workspace_folders()
+ vim.lsp.buf.list_workspace_folders()
+end
+
+function _utils.outgoing_calls()
+ vim.lsp.buf.outgoing_calls()
+end
+
+function _utils.range_code_action()
+ vim.lsp.buf.range_code_action()
+end
+
+function _utils.range_formatting()
+ vim.lsp.buf.range_formatting()
+end
+
+function _utils.references()
+ vim.lsp.buf.references()
+ vim.lsp.buf.clear_references()
+end
+
+function _utils.remove_workspace_folder()
+ vim.lsp.buf.remove_workspace_folder()
+end
+
+function _utils.rename()
+ vim.lsp.buf.rename()
+end
+
+function _utils.signature_help()
+ vim.lsp.buf.signature_help()
+end
+
+function _utils.type_definition()
+ vim.lsp.buf.type_definition()
+end
+
+function _utils.workspace_symbol()
+ vim.lsp.buf.workspace_symbol()
+end
+
+-- diagnostic
+
+function _utils.get_all()
+ vim.lsp.diagnostic.get_all()
+end
+
+function _utils.get_next()
+ vim.lsp.diagnostic.get_next()
+end
+
+function _utils.get_prev()
+ vim.lsp.diagnostic.get_prev()
+end
+
+function _utils.goto_next()
+ vim.lsp.diagnostic.goto_next()
+end
+
+function _utils.goto_prev()
+ vim.lsp.diagnostic.goto_prev()
+end
+
+function _utils.show_line_diagnostics()
+ vim.lsp.diagnostic.show_line_diagnostics()
+end
+
+-- git signs
+
+function _utils.next_hunk()
+ require('gitsigns').next_hunk()
+end
+
+function _utils.prev_hunk()
+ require('gitsigns').prev_hunk()
+end
+
+function _utils.stage_hunk()
+ require('gitsigns').stage_hunk()
+end
+
+function _utils.undo_stage_hunk()
+ require('gitsigns').undo_stage_hunk()
+end
+
+function _utils.reset_hunk()
+ require('gitsigns').reset_hunk()
+end
+
+function _utils.reset_buffer()
+ require('gitsigns').reset_buffer()
+end
+
+function _utils.preview_hunk()
+ require('gitsigns').preview_hunk()
+end
+
+function _utils.blame_line()
+ require('gitsigns').blame_line()
+end
+
+-- misc
+
+-- autoformat
+-- autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_sync(nil, 1000)
+
+return _utils
diff --git a/.config/nvim/lua/_vim-bbye/init.lua b/.config/nvim/lua/_vim-bbye/init.lua
new file mode 100644
index 0000000..77b4c39
--- /dev/null
+++ b/.config/nvim/lua/_vim-bbye/init.lua
@@ -0,0 +1 @@
+vim.api.nvim_set_keymap('n', '<Leader>q', ':Bdelete<CR>', { noremap = true, silent = true })
diff --git a/.config/nvim/lua/_vim-bbye/init.vim b/.config/nvim/lua/_vim-bbye/init.vim
deleted file mode 100644
index 10ee440..0000000
--- a/.config/nvim/lua/_vim-bbye/init.vim
+++ /dev/null
@@ -1 +0,0 @@
-nnoremap <Leader>q :Bdelete<CR>
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
index 1122ba3..fece949 100644
--- a/.config/nvim/lua/plugins.lua
+++ b/.config/nvim/lua/plugins.lua
@@ -1,14 +1,17 @@
local execute = vim.api.nvim_command
local fn = vim.fn
-local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
-
+local install_path = fn.stdpath('data') .. '/site/pack/packer/opt/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
- execute('!git clone https://github.com/wbthomason/packer.nvim '..install_path)
- execute 'packadd packer.nvim'
+ execute('!git clone https://github.com/wbthomason/packer.nvim ' .. install_path)
+ execute 'packadd packer.nvim'
end
+vim.cmd [[packadd packer.nvim]]
+
+vim.cmd 'autocmd BufWritePost plugins.lua PackerCompile' -- Auto compile when there are changes in plugins.lua
+
return require('packer').startup(function()
-- Packer can manage itself as an optional plugin
@@ -35,9 +38,9 @@ return require('packer').startup(function()
use 'hrsh7th/vim-vsnip-integ'
-- Treesitter
- -- use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
- -- use 'nvim-treesitter/playground'
- -- use 'p00f/nvim-ts-rainbow'
+ use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
+ use 'nvim-treesitter/playground'
+ use 'p00f/nvim-ts-rainbow'
-- Icons
use 'kyazdani42/nvim-web-devicons'
@@ -56,7 +59,6 @@ return require('packer').startup(function()
-- Explorer
use 'kyazdani42/nvim-tree.lua'
-
-- Color
use 'aktersnurra/githubsy.vim'
use 'christianchiarulli/nvcode-color-schemes.vim'
@@ -66,6 +68,8 @@ return require('packer').startup(function()
use 'TimUntersberger/neogit'
use {'lewis6991/gitsigns.nvim', requires = { 'nvim-lua/plenary.nvim' } }
use 'f-person/git-blame.nvim'
+ use 'tpope/vim-fugitive'
+ use 'tpope/vim-rhubarb'
-- Easily Create Gists
use 'mattn/vim-gist'
@@ -86,10 +90,13 @@ return require('packer').startup(function()
use 'turbio/bracey.vim'
use 'AndrewRadev/tagalong.vim'
use 'alvan/vim-closetag'
- use { 'glacambre/firenvim', run = function() vim.fn['firenvim#install'](1) end }
use 'liuchengxu/vim-which-key'
use 'tpope/vim-sleuth'
use 'voldikss/vim-floaterm'
+ use 'liuchengxu/vista.vim'
+ use 'terrortylor/nvim-comment'
+ use 'bfredl/nvim-miniyank'
+ use 'andymass/vim-matchup'
use 'phaazon/hop.nvim'
use 'junegunn/goyo.vim'
use 'junegunn/limelight.vim'
diff --git a/.config/nvim/lua/_goyo/init.vim b/.config/nvim/vim-script/_goyo/init.vim
index f617194..f617194 100644
--- a/.config/nvim/lua/_goyo/init.vim
+++ b/.config/nvim/vim-script/_goyo/init.vim
diff --git a/.config/nvim/vim-script/_limelight/init.vim b/.config/nvim/vim-script/_limelight/init.vim
new file mode 100644
index 0000000..4e9bf10
--- /dev/null
+++ b/.config/nvim/vim-script/_limelight/init.vim
@@ -0,0 +1,23 @@
+" Color name (:help cterm-colors) or ANSI code
+let g:limelight_conceal_ctermfg = 'gray'
+let g:limelight_conceal_ctermfg = 240
+
+" Color name (:help gui-colors) or RGB color
+let g:limelight_conceal_guifg = 'DarkGray'
+let g:limelight_conceal_guifg = '#777777'
+
+" Default: 0.5
+let g:limelight_default_coefficient = 0.7
+
+" Number of preceding/following paragraphs to include (default: 0)
+let g:limelight_paragraph_span = 1
+
+" Beginning/end of paragraph
+" When there's no empty line between the paragraphs
+" and each paragraph starts with indentation
+let g:limelight_bop = '^\s'
+let g:limelight_eop = '\ze\n^\s'
+
+" Highlighting priority (default: 10)
+" Set it to -1 not to overrule hlsearch
+let g:limelight_priority = -1
diff --git a/.config/nvim/vim-script/_nvimtree/init.vim b/.config/nvim/vim-script/_nvimtree/init.vim
new file mode 100644
index 0000000..de5634e
--- /dev/null
+++ b/.config/nvim/vim-script/_nvimtree/init.vim
@@ -0,0 +1,19 @@
+" TODO this really should be in the lua section
+let g:nvim_tree_icons = {
+ \ 'default': '',
+ \ 'symlink': '',
+ \ 'git': {
+ \ 'unstaged': "",
+ \ 'staged': "✓",
+ \ 'unmerged': "",
+ \ 'renamed': "➜",
+ \ 'untracked': "✗"
+ \ },
+ \ 'folder': {
+ \ 'default': "",
+ \ 'open': "",
+ \ 'empty': "",
+ \ 'empty_open': "",
+ \ 'symlink': "",
+ \ }
+ \ }
diff --git a/.config/nvim/lua/_whichkey/init.vim b/.config/nvim/vim-script/_whichkey/init.vim
index c8fe9e4..c8fe9e4 100644
--- a/.config/nvim/lua/_whichkey/init.vim
+++ b/.config/nvim/vim-script/_whichkey/init.vim