update nvim config

This commit is contained in:
ksyasuda 2022-10-30 12:49:59 -07:00
parent 851ae5a1a2
commit c82203111a
7 changed files with 123 additions and 46 deletions

View File

@ -5,6 +5,9 @@ if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
autocmd FileType help wincmd L
autocmd FileType man wincmd L
let g:mapleader = "\<Space>"
let g:maplocalleader = ','
set completeopt=menu,menuone,noselect
@ -35,7 +38,7 @@ source ~/.config/nvim/plugin-confs/null-ls.lua
source ~/.config/nvim/plugin-confs/nvim-cmp.lua
source ~/.config/nvim/plugin-confs/fidget.lua
source ~/.config/nvim/plugin-confs/symbols-outline.lua
source ~/.config/nvim/plugin-confs/nvim-docs-view.lua
" source ~/.config/nvim/plugin-confs/nvim-docs-view.lua
" nvim and vim plugins
source ~/.vim/plugin-confs/floaterm.vim
@ -67,7 +70,8 @@ command! -bang -nargs=? -complete=dir Buffers
\ call fzf#vim#buffers(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline', '--preview', '~/.vim/plugged/fzf.vim/bin/preview.sh']}), <bang>0)
command! Reload execute "source ~/.vimrc"
command! Config execute ":e ~/.vimrc"
command! Config execute ":e ~/.config/nvim/init.vim"
command! Plugins execute ":e ~/.config/nvim/lua/plugins.lua"
command! Env execute ":Dotenv .env"
command! MakeTags !ctags -R .
command! Ovewrite execute ":w !sudo tee %"

View File

@ -18,7 +18,7 @@ nmap <C-K> :bprev<CR>
nmap <C-T> :wa<CR>:FloatermToggle floatterm<CR>
" open file under cursor, create if necessary
nnoremap // :Lines<CR>
nnoremap // :Telescope current_buffer_fuzzy_find<CR>
nnoremap ?? :BLines<CR>
nmap gA :lua vim.lsp.buf.code_actions()<CR>
@ -81,14 +81,13 @@ nmap <leader>isp :-1read $HOME/Templates/python.py<CR>4jw
nmap <leader>j :AnyJump<CR>
nmap K :DocsViewToggle<CR>
" nmap K :lua vim.lsp.buf.hover()<CR>
" nmap K :DocsViewToggle<CR>
nmap K :lua vim.lsp.buf.hover()<CR>
nmap <leader>lD :Telescope lsp_definitions<CR>
nmap <leader>ld :Telescope lsp_definitions<CR>
nmap <leader>la :lua vim.lsp.buf.code_action()<CR>
nmap <leader>lci :Telescope lsp_incoming_calls<CR>
nmap <leader>lco :Telescope lsp_outgoing_calls<CR>
nmap <leader>ld :Telescope lsp_declarations<CR>
nmap <leader>lh :lua vim.lsp.buf.signature_help()<CR>
nmap <leader>li :Telescope lsp_implementations<CR>
nmap <leader>lr :Telescope lsp_references<CR>

View File

@ -39,17 +39,17 @@ return require('packer').startup(function(use)
dismiss = "<C-]>",
},
},
filetypes = {
yaml = false,
markdown = false,
help = false,
gitcommit = false,
gitrebase = false,
hgcommit = false,
svn = false,
cvs = false,
["."] = false,
},
-- filetypes = {
-- yaml = false,
-- markdown = false,
-- help = false,
-- gitcommit = false,
-- gitrebase = false,
-- hgcommit = false,
-- svn = false,
-- cvs = false,
-- ["."] = false,
-- },
copilot_node_command = 'node', -- Node version must be < 18
plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer",
server_opts_overrides = {},
@ -63,7 +63,7 @@ return require('packer').startup(function(use)
after = { "copilot.lua" },
config = function ()
require("copilot_cmp").setup({
-- method = "getCompletionsCycling",
method = "getCompletionsCycling",
formatters = {
insert_text = require("copilot_cmp.format").remove_existing
}
@ -76,6 +76,43 @@ return require('packer').startup(function(use)
run = function() vim.fn['fzf#install']() end
}
use {
"lewis6991/hover.nvim",
config = function()
require("hover").setup {
init = function()
-- Require providers
require("hover.providers.lsp")
-- require('hover.providers.gh')
-- require('hover.providers.jira')
require('hover.providers.man')
require('hover.providers.dictionary')
end,
preview_opts = {
border = "rounded"
-- border = {
-- { "╭", "FloatBorder" },
-- { "─", "FloatBorder" },
-- { "╮", "FloatBorder" },
-- { "│", "FloatBorder" },
-- { "╯", "FloatBorder" },
-- { "─", "FloatBorder" },
-- { "╰", "FloatBorder" },
-- { "│", "FloatBorder" },
-- }
},
-- Whether the contents of a currently open hover window should be moved
-- to a :h preview-window when pressing the hover keymap.
preview_window = false,
title = true
}
-- Setup keymaps
vim.keymap.set("n", "K", require("hover").hover, {desc = "hover.nvim"})
vim.keymap.set("n", "gK", require("hover").hover_select, {desc = "hover.nvim (select)"})
end
}
use 'ap/vim-css-color'
use 'jiangmiao/auto-pairs'
use 'junegunn/fzf.vim'
@ -96,7 +133,7 @@ return require('packer').startup(function(use)
use 'ojroques/nvim-lspfuzzy'
use 'L3MON4D3/LuaSnip'
use 'amrbashir/nvim-docs-view'
-- use 'amrbashir/nvim-docs-view'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-nvim-lua'

View File

@ -4,6 +4,7 @@ local A = vim.api
g.mapleader = "<Space>"
g.maplocalleader = ','
o.showmode = false
o.termguicolors = true
o.background = 'dark'
o.mouse = 'a'

View File

@ -185,10 +185,11 @@ lsp_installer.on_server_ready(function(server)
end)
local servers = { 'jedi_language_server', 'bashls', 'vimls', 'yamlls', 'dockerls', 'sumneko_lua', 'rust_analyzer', 'clangd', 'ansiblels' }
local servers = { 'jedi_language_server', 'bashls', 'vimls', 'yamlls', 'dockerls', 'rust_analyzer', 'clangd', 'ansiblels' }
for _, lsp in pairs(servers) do
require('lspconfig')[lsp].setup {
on_attach = on_attach,
handlers = handlers,
flags = {
-- This will be the default in neovim 0.7+
debounce_text_changes = 150,

View File

@ -8,6 +8,7 @@ capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
-- luasnip setup
local luasnip = require 'luasnip'
local has_words_before = function()
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
@ -36,24 +37,53 @@ cmp.setup({
-- ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
-- },
mapping = {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { 'i', 's' }),
['<C-n>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { 'i', 's' }),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
select = true,
},
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif has_words_before() then
cmp.complete()
else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
end
if has_words_before() then
require('copilot.suggestion').accept()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif not has_words_before() then
cmp.complete()
else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
end
-- if cmp.visible() then
-- cmp.select_next_item()
-- elseif has_words_before() then
-- cmp.complete()
-- else
-- fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
-- end
end, { "i", "s" }),
['<S-Tab>'] = cmp.mapping(function()
if cmp.visible() then
@ -105,9 +135,9 @@ for _, lsp in ipairs(servers) do
end
cmp.event:on("menu_opened", function()
vim.b.copilot_suggestion_hidden = true
end)
cmp.event:on("menu_closed", function()
vim.b.copilot_suggestion_hidden = false
end)
-- cmp.event:on("menu_opened", function()
-- vim.b.copilot_suggestion_hidden = true
-- end)
-- cmp.event:on("menu_closed", function()
-- vim.b.copilot_suggestion_hidden = false
-- end)

View File

@ -115,7 +115,7 @@ _G.packer_plugins = {
url = "https://github.com/saadparwaiz1/cmp_luasnip"
},
["copilot-cmp"] = {
config = { "\27LJ\2\n9\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\16copilot_cmp\frequire\0" },
config = { "\27LJ\2\n\1\0\0\a\0\t\0\0146\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0005\3\6\0006\4\0\0'\6\4\0B\4\2\0029\4\5\4=\4\a\3=\3\b\2B\0\2\1K\0\1\0\15formatters\16insert_text\1\0\0\20remove_existing\23copilot_cmp.format\1\0\1\vmethod\26getCompletionsCycling\nsetup\16copilot_cmp\frequire\0" },
load_after = {},
loaded = true,
needs_bufread = false,
@ -124,7 +124,7 @@ _G.packer_plugins = {
},
["copilot.lua"] = {
after = { "copilot-cmp" },
config = { "\27LJ\2\n\4\0\0\6\0\20\0\0276\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\6\0005\3\3\0005\4\4\0=\4\5\3=\3\a\0025\3\b\0005\4\t\0=\4\5\3=\3\n\0025\3\v\0=\3\f\0026\3\r\0009\3\14\0039\3\15\3'\5\16\0B\3\2\2'\4\17\0&\3\4\3=\3\18\0024\3\0\0=\3\19\2B\0\2\1K\0\1\0\26server_opts_overrides\24plugin_manager_path\22/site/pack/packer\tdata\fstdpath\afn\bvim\14filetypes\1\0\t\bsvn\1\rhgcommit\1\14gitrebase\1\14gitcommit\1\thelp\1\rmarkdown\1\tyaml\1\6.\1\bcvs\1\15suggestion\1\0\4\tnext\n<M-]>\fdismiss\n<C-]>\tprev\n<M-[>\vaccept\n<M-l>\1\0\3\rdebounce\3K\fenabled\2\17auto_trigger\2\npanel\1\0\1\25copilot_node_command\tnode\vkeymap\1\0\5\14jump_prev\a[[\frefresh\agr\vaccept\t<CR>\topen\v<M-CR>\14jump_next\a]]\1\0\2\17auto_refresh\1\fenabled\2\nsetup\fcopilot\frequire-\1\0\4\0\3\0\0066\0\0\0009\0\1\0003\2\2\0)\3d\0B\0\3\1K\0\1\0\0\rdefer_fn\bvim\0" },
config = { "\27LJ\2\n¹\3\0\0\6\0\18\0\0256\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\6\0005\3\3\0005\4\4\0=\4\5\3=\3\a\0025\3\b\0005\4\t\0=\4\5\3=\3\n\0026\3\v\0009\3\f\0039\3\r\3'\5\14\0B\3\2\2'\4\15\0&\3\4\3=\3\16\0024\3\0\0=\3\17\2B\0\2\1K\0\1\0\26server_opts_overrides\24plugin_manager_path\22/site/pack/packer\tdata\fstdpath\afn\bvim\15suggestion\1\0\4\vaccept\n<Tab>\tprev\n<M-[>\tnext\n<M-]>\fdismiss\n<C-]>\1\0\3\17auto_trigger\2\rdebounce\3K\fenabled\2\npanel\1\0\1\25copilot_node_command\tnode\vkeymap\1\0\5\frefresh\agr\topen\v<M-CR>\14jump_next\a]]\vaccept\t<CR>\14jump_prev\a[[\1\0\2\17auto_refresh\1\fenabled\2\nsetup\fcopilot\frequire-\1\0\4\0\3\0\0066\0\0\0009\0\1\0003\2\2\0)\3d\0B\0\3\1K\0\1\0\0\rdefer_fn\bvim\0" },
load_after = {},
loaded = true,
needs_bufread = false,
@ -176,6 +176,12 @@ _G.packer_plugins = {
path = "/home/sudacode/.local/share/nvim/site/pack/packer/start/goto-preview",
url = "https://github.com/rmagatti/goto-preview"
},
["hover.nvim"] = {
config = { "\27LJ\2\nz\0\0\3\0\4\0\n6\0\0\0'\2\1\0B\0\2\0016\0\0\0'\2\2\0B\0\2\0016\0\0\0'\2\3\0B\0\2\1K\0\1\0\31hover.providers.dictionary\24hover.providers.man\24hover.providers.lsp\frequire°\2\1\0\a\0\17\0!6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0003\3\3\0=\3\5\0025\3\6\0=\3\a\2B\0\2\0016\0\b\0009\0\t\0009\0\n\0'\2\v\0'\3\f\0006\4\0\0'\6\1\0B\4\2\0029\4\1\0045\5\r\0B\0\5\0016\0\b\0009\0\t\0009\0\n\0'\2\v\0'\3\14\0006\4\0\0'\6\1\0B\4\2\0029\4\15\0045\5\16\0B\0\5\1K\0\1\0\1\0\1\tdesc\24hover.nvim (select)\17hover_select\agK\1\0\1\tdesc\15hover.nvim\6K\6n\bset\vkeymap\bvim\17preview_opts\1\0\1\vborder\frounded\tinit\1\0\2\19preview_window\1\ntitle\2\0\nsetup\nhover\frequire\0" },
loaded = true,
path = "/home/sudacode/.local/share/nvim/site/pack/packer/start/hover.nvim",
url = "https://github.com/lewis6991/hover.nvim"
},
["lsp_lines.nvim"] = {
loaded = true,
path = "/home/sudacode/.local/share/nvim/site/pack/packer/start/lsp_lines.nvim",
@ -211,11 +217,6 @@ _G.packer_plugins = {
path = "/home/sudacode/.local/share/nvim/site/pack/packer/start/nvim-cmp",
url = "https://github.com/hrsh7th/nvim-cmp"
},
["nvim-docs-view"] = {
loaded = true,
path = "/home/sudacode/.local/share/nvim/site/pack/packer/start/nvim-docs-view",
url = "https://github.com/amrbashir/nvim-docs-view"
},
["nvim-lsp-installer"] = {
loaded = true,
path = "/home/sudacode/.local/share/nvim/site/pack/packer/start/nvim-lsp-installer",
@ -304,18 +305,22 @@ _G.packer_plugins = {
}
time([[Defining packer_plugins]], false)
-- Config for: hover.nvim
time([[Config for hover.nvim]], true)
try_loadstring("\27LJ\2\nz\0\0\3\0\4\0\n6\0\0\0'\2\1\0B\0\2\0016\0\0\0'\2\2\0B\0\2\0016\0\0\0'\2\3\0B\0\2\1K\0\1\0\31hover.providers.dictionary\24hover.providers.man\24hover.providers.lsp\frequire°\2\1\0\a\0\17\0!6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0003\3\3\0=\3\5\0025\3\6\0=\3\a\2B\0\2\0016\0\b\0009\0\t\0009\0\n\0'\2\v\0'\3\f\0006\4\0\0'\6\1\0B\4\2\0029\4\1\0045\5\r\0B\0\5\0016\0\b\0009\0\t\0009\0\n\0'\2\v\0'\3\14\0006\4\0\0'\6\1\0B\4\2\0029\4\15\0045\5\16\0B\0\5\1K\0\1\0\1\0\1\tdesc\24hover.nvim (select)\17hover_select\agK\1\0\1\tdesc\15hover.nvim\6K\6n\bset\vkeymap\bvim\17preview_opts\1\0\1\vborder\frounded\tinit\1\0\2\19preview_window\1\ntitle\2\0\nsetup\nhover\frequire\0", "config", "hover.nvim")
time([[Config for hover.nvim]], false)
-- Load plugins in order defined by `after`
time([[Sequenced loading]], true)
vim.cmd [[ packadd lualine.nvim ]]
vim.cmd [[ packadd copilot.lua ]]
-- Config for: copilot.lua
try_loadstring("\27LJ\2\n\4\0\0\6\0\20\0\0276\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\6\0005\3\3\0005\4\4\0=\4\5\3=\3\a\0025\3\b\0005\4\t\0=\4\5\3=\3\n\0025\3\v\0=\3\f\0026\3\r\0009\3\14\0039\3\15\3'\5\16\0B\3\2\2'\4\17\0&\3\4\3=\3\18\0024\3\0\0=\3\19\2B\0\2\1K\0\1\0\26server_opts_overrides\24plugin_manager_path\22/site/pack/packer\tdata\fstdpath\afn\bvim\14filetypes\1\0\t\bsvn\1\rhgcommit\1\14gitrebase\1\14gitcommit\1\thelp\1\rmarkdown\1\tyaml\1\6.\1\bcvs\1\15suggestion\1\0\4\tnext\n<M-]>\fdismiss\n<C-]>\tprev\n<M-[>\vaccept\n<M-l>\1\0\3\rdebounce\3K\fenabled\2\17auto_trigger\2\npanel\1\0\1\25copilot_node_command\tnode\vkeymap\1\0\5\14jump_prev\a[[\frefresh\agr\vaccept\t<CR>\topen\v<M-CR>\14jump_next\a]]\1\0\2\17auto_refresh\1\fenabled\2\nsetup\fcopilot\frequire-\1\0\4\0\3\0\0066\0\0\0009\0\1\0003\2\2\0)\3d\0B\0\3\1K\0\1\0\0\rdefer_fn\bvim\0", "config", "copilot.lua")
try_loadstring("\27LJ\2\n¹\3\0\0\6\0\18\0\0256\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\6\0005\3\3\0005\4\4\0=\4\5\3=\3\a\0025\3\b\0005\4\t\0=\4\5\3=\3\n\0026\3\v\0009\3\f\0039\3\r\3'\5\14\0B\3\2\2'\4\15\0&\3\4\3=\3\16\0024\3\0\0=\3\17\2B\0\2\1K\0\1\0\26server_opts_overrides\24plugin_manager_path\22/site/pack/packer\tdata\fstdpath\afn\bvim\15suggestion\1\0\4\vaccept\n<Tab>\tprev\n<M-[>\tnext\n<M-]>\fdismiss\n<C-]>\1\0\3\17auto_trigger\2\rdebounce\3K\fenabled\2\npanel\1\0\1\25copilot_node_command\tnode\vkeymap\1\0\5\frefresh\agr\topen\v<M-CR>\14jump_next\a]]\vaccept\t<CR>\14jump_prev\a[[\1\0\2\17auto_refresh\1\fenabled\2\nsetup\fcopilot\frequire-\1\0\4\0\3\0\0066\0\0\0009\0\1\0003\2\2\0)\3d\0B\0\3\1K\0\1\0\0\rdefer_fn\bvim\0", "config", "copilot.lua")
vim.cmd [[ packadd copilot-cmp ]]
-- Config for: copilot-cmp
try_loadstring("\27LJ\2\n9\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\16copilot_cmp\frequire\0", "config", "copilot-cmp")
try_loadstring("\27LJ\2\n\1\0\0\a\0\t\0\0146\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0005\3\6\0006\4\0\0'\6\4\0B\4\2\0029\4\5\4=\4\a\3=\3\b\2B\0\2\1K\0\1\0\15formatters\16insert_text\1\0\0\20remove_existing\23copilot_cmp.format\1\0\1\vmethod\26getCompletionsCycling\nsetup\16copilot_cmp\frequire\0", "config", "copilot-cmp")
time([[Sequenced loading]], false)