fix nvim config

This commit is contained in:
ksyasuda 2022-11-01 22:06:54 -07:00
parent c82203111a
commit 3cf5559b0c
11 changed files with 337 additions and 202 deletions

10
nvim/autocommands.vim Normal file
View File

@ -0,0 +1,10 @@
" open at last location if possible
if has('autocmd')
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" open help and man pages in a vertical split
autocmd FileType help wincmd L
autocmd FileType man wincmd L
" make terminal not have line numbers
autocmd TermOpen * setlocal nonumber norelativenumber

View File

@ -1,17 +1,34 @@
lua require('settings') if has('autocmd')
lua require('plugins')
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif endif
" open help and man pages in a vertical split
autocmd FileType help wincmd L autocmd FileType help wincmd L
autocmd FileType man wincmd L autocmd FileType man wincmd L
" make terminal not have line numbers
autocmd TermOpen * setlocal nonumber norelativenumber
let g:mapleader = "\<Space>" " " " gray
let g:maplocalleader = ',' " highlight! CmpItemAbbrDeprecated guibg=NONE gui=strikethrough guifg=#808080
set completeopt=menu,menuone,noselect " " blue
let g:fzf_command = 'fzf --height 90% --width=85% --layout=reverse --preview "bat --color=always {}"' " highlight! CmpItemAbbrMatch guibg=NONE guifg=#569CD6
" highlight! link CmpItemAbbrMatchFuzzy CmpItemAbbrMatch
" " light blue
" highlight! CmpItemKindVariable guibg=NONE guifg=#9CDCFE
" highlight! link CmpItemKindInterface CmpItemKindVariable
" highlight! link CmpItemKindText CmpItemKindVariable
" " pink
" highlight! CmpItemKindFunction guibg=NONE guifg=#C586C0
" highlight! link CmpItemKindMethod CmpItemKindFunction
" " front
" highlight! CmpItemKindKeyword guibg=NONE guifg=#D4D4D4
" highlight! link CmpItemKindProperty CmpItemKindKeyword
" highlight! link CmpItemKindUnit CmpItemKindKeyword
" highlight! PmenuSel guibg=#51afef guifg=NONE
" highlight! Pmenu guifg=#C5CDD9 guibg=#51afef
lua require('settings')
lua require('plugins')
source ~/.config/nvim/keybindings.vim source ~/.config/nvim/keybindings.vim
" nvim plugins " nvim plugins
@ -28,16 +45,16 @@ source ~/.config/nvim/plugin-confs/whichkey.lua
source ~/.config/nvim/plugin-confs/telescope.lua source ~/.config/nvim/plugin-confs/telescope.lua
source ~/.config/nvim/plugin-confs/code_actions.lua source ~/.config/nvim/plugin-confs/code_actions.lua
" source ~/.config/nvim/plugin-confs/copilot.lua
source ~/.config/nvim/plugin-confs/goto-preview.lua source ~/.config/nvim/plugin-confs/goto-preview.lua
source ~/.config/nvim/plugin-confs/lsp-kind.lua source ~/.config/nvim/plugin-confs/lsp-kind.lua
source ~/.config/nvim/plugin-confs/lsp-signature.lua
source ~/.config/nvim/plugin-confs/lspconfig.lua source ~/.config/nvim/plugin-confs/lspconfig.lua
source ~/.config/nvim/plugin-confs/lsplines.lua source ~/.config/nvim/plugin-confs/lsplines.lua
source ~/.config/nvim/plugin-confs/null-ls.lua source ~/.config/nvim/plugin-confs/null-ls.lua
source ~/.config/nvim/plugin-confs/nvim-cmp.lua source ~/.config/nvim/plugin-confs/nvim-cmp.lua
source ~/.config/nvim/plugin-confs/fidget.lua source ~/.config/nvim/plugin-confs/fidget.lua
source ~/.config/nvim/plugin-confs/symbols-outline.lua source ~/.config/nvim/plugin-confs/symbols-outline.lua
" source ~/.config/nvim/plugin-confs/copilot.lua
" source ~/.config/nvim/plugin-confs/lsp-signature.lua
" source ~/.config/nvim/plugin-confs/nvim-docs-view.lua " source ~/.config/nvim/plugin-confs/nvim-docs-view.lua
" nvim and vim plugins " nvim and vim plugins
@ -47,15 +64,12 @@ source ~/.vim/plugin-confs/vim-closetag.vim
source ~/.vim/plugin-confs/wakatime.vim source ~/.vim/plugin-confs/wakatime.vim
source ~/.config/nvim/plugin-confs/doomone.lua source ~/.config/nvim/plugin-confs/doomone.lua
" source ~/.config/nvim/plugin-confs/dracula.lua source ~/.config/nvim/plugin-confs/dracula.lua
" source ~/.config/nvim/plugin-confs/github-theme.lua source ~/.config/nvim/plugin-confs/github-theme.lua
" source ~/.config/nvim/plugin-confs/onedarkpro.lua source ~/.config/nvim/plugin-confs/onedarkpro.lua
source ~/.config/nvim/lua/toggle_lsp_diagnostics.lua source ~/.config/nvim/lua/toggle_lsp_diagnostics.lua
" make terminal not have line numbers
autocmd TermOpen * setlocal nonumber norelativenumber
" CUSTOM COMMANDS " CUSTOM COMMANDS
command! -bang -nargs=? -complete=dir Files command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline', '--preview', '~/.vim/plugged/fzf.vim/bin/preview.sh']}), <bang>0) \ call fzf#vim#files(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline', '--preview', '~/.vim/plugged/fzf.vim/bin/preview.sh']}), <bang>0)
@ -69,13 +83,15 @@ command! -bang -nargs=? -complete=dir Lines
command! -bang -nargs=? -complete=dir Buffers 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) \ 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! Reload execute "source ~/.config/nvim/init.vim"
command! Config execute ":e ~/.config/nvim/init.vim" command! Config execute ":e ~/.config/nvim/init.vim"
command! Plugins execute ":e ~/.config/nvim/lua/plugins.lua" command! Plugins execute ":e ~/.config/nvim/lua/plugins.lua"
command! Settings execute ":e ~/.config/nvim/lua/settings.lua"
command! Env execute ":Dotenv .env" command! Env execute ":Dotenv .env"
command! MakeTags !ctags -R . command! MakeTags !ctags -R .
command! Ovewrite execute ":w !sudo tee %" command! Ovewrite execute ":w !sudo tee %"
command! Aniwrapper execute ":FloatermNew aniwrapper -qtdoomone -D 144" command! Aniwrapper execute ":FloatermNew aniwrapper -qtdoomone -D 144"
set termguicolors set termguicolors
colorscheme doom-one " colorscheme doom-one
colorscheme onedarkpro

3
nvim/lua/keybindings.lua Normal file
View File

@ -0,0 +1,3 @@
local function map(m, k, v)
vim.keymap.set(m, k, v, {silent = true, noremap = true})
end

View File

@ -1,4 +1,5 @@
return require('packer').startup(function(use) vim.cmd [[packadd packer.nvim]]
require('packer').startup(function(use)
use 'wbthomason/packer.nvim' use 'wbthomason/packer.nvim'
use 'nvim-lua/plenary.nvim' use 'nvim-lua/plenary.nvim'
use { use {
@ -7,10 +8,11 @@ return require('packer').startup(function(use)
} }
use { use {
'nvim-lualine/lualine.nvim', 'nvim-lualine/lualine.nvim',
requires = {'kyazdani42/nvim-web-devicons', opt = true} requires = { 'kyazdani42/nvim-web-devicons', opt = true }
} }
use { use {
"zbirenbaum/copilot.lua", "zbirenbaum/copilot.lua",
after = "lualine.nvim", after = "lualine.nvim",
@ -63,10 +65,10 @@ return require('packer').startup(function(use)
after = { "copilot.lua" }, after = { "copilot.lua" },
config = function () config = function ()
require("copilot_cmp").setup({ require("copilot_cmp").setup({
method = "getCompletionsCycling", -- method = "getCompletionsCycling",
formatters = { -- formatters = {
insert_text = require("copilot_cmp.format").remove_existing -- insert_text = require("copilot_cmp.format").remove_existing
} -- }
}) })
end end
} }
@ -122,35 +124,84 @@ return require('packer').startup(function(use)
use 'voldikss/vim-floaterm' use 'voldikss/vim-floaterm'
use 'wakatime/vim-wakatime' use 'wakatime/vim-wakatime'
use 'akinsho/nvim-bufferline.lua' use {
use 'andweeb/presence.nvim' 'akinsho/nvim-bufferline.lua'
use 'folke/which-key.nvim' }
use 'glepnir/dashboard-nvim' use {
use 'kyazdani42/nvim-tree.lua' 'andweeb/presence.nvim'
}
use {
'folke/which-key.nvim'
}
use {
'glepnir/dashboard-nvim'
}
use {
'kyazdani42/nvim-tree.lua'
}
use 'kyazdani42/nvim-web-devicons' use 'kyazdani42/nvim-web-devicons'
use 'lewis6991/gitsigns.nvim' use {
use 'nvim-telescope/telescope.nvim' 'lewis6991/gitsigns.nvim'
use 'ojroques/nvim-lspfuzzy' }
use {
'nvim-telescope/telescope.nvim'
}
use {
'ojroques/nvim-lspfuzzy'
}
use 'L3MON4D3/LuaSnip' use 'L3MON4D3/LuaSnip'
-- use 'amrbashir/nvim-docs-view' -- use 'amrbashir/nvim-docs-view'
use 'hrsh7th/cmp-buffer' use {
use 'hrsh7th/cmp-nvim-lsp' 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-nvim-lua' }
use 'hrsh7th/cmp-path' use {
use 'hrsh7th/nvim-cmp' 'hrsh7th/cmp-nvim-lsp'
use 'j-hui/fidget.nvim' }
use 'jose-elias-alvarez/null-ls.nvim' use {
use 'ksyasuda/lsp_lines.nvim' 'hrsh7th/cmp-nvim-lua'
use 'neovim/nvim-lspconfig' }
use 'onsails/lspkind-nvim' use {
use 'ray-x/lsp_signature.nvim' 'hrsh7th/cmp-nvim-lsp-signature-help'
use 'rmagatti/goto-preview' }
use {
'hrsh7th/cmp-path'
}
use {
'hrsh7th/cmp-buffer'
}
use {
'j-hui/fidget.nvim'
}
use {
'jose-elias-alvarez/null-ls.nvim'
}
use {
'ksyasuda/lsp_lines.nvim'
}
use {
'neovim/nvim-lspconfig'
}
use {
'onsails/lspkind-nvim'
}
-- use 'ray-x/lsp_signature.nvim'
use {
'rmagatti/goto-preview'
}
use 'saadparwaiz1/cmp_luasnip' use 'saadparwaiz1/cmp_luasnip'
use 'williamboman/nvim-lsp-installer' use 'williamboman/nvim-lsp-installer'
use 'Mofiqul/dracula.nvim' use {
use 'NTBBloodbath/doom-one.nvim' 'Mofiqul/dracula.nvim'
use 'olimorris/onedarkpro.nvim' }
use 'projekt0n/github-nvim-theme' use {
'NTBBloodbath/doom-one.nvim'
}
use {
'olimorris/onedarkpro.nvim'
}
use {
'projekt0n/github-nvim-theme'
}
end) end)

View File

@ -2,8 +2,10 @@ local g = vim.g
local o = vim.o local o = vim.o
local A = vim.api local A = vim.api
g.mapleader = "<Space>" g.mapleader = " "
g.maplocalleader = ',' g.maplocalleader = ','
g.fzf_command = 'fzf --height 90% --width=85% --layout=reverse --preview "bat --color=always {}"'
o.completeopt="menu,menuone,noselect"
o.showmode = false o.showmode = false
o.termguicolors = true o.termguicolors = true
o.background = 'dark' o.background = 'dark'

View File

@ -185,33 +185,33 @@ lsp_installer.on_server_ready(function(server)
end) end)
local servers = { 'jedi_language_server', 'bashls', 'vimls', 'yamlls', 'dockerls', 'rust_analyzer', 'clangd', 'ansiblels' } -- local servers = { 'jedi_language_server', 'bashls', 'vimls', 'yamlls', 'dockerls', 'rust_analyzer', 'clangd', 'ansiblels' }
for _, lsp in pairs(servers) do -- for _, lsp in pairs(servers) do
require('lspconfig')[lsp].setup { -- require('lspconfig')[lsp].setup {
on_attach = on_attach, -- on_attach = on_attach,
handlers = handlers, -- handlers = handlers,
flags = { -- flags = {
-- This will be the default in neovim 0.7+ -- -- This will be the default in neovim 0.7+
debounce_text_changes = 150, -- debounce_text_changes = 150,
} -- }
} -- }
end -- end
local plugins_path = vim.fn.stdpath("data") .. "site/autoload/plug.vim" -- local plugins_path = vim.fn.stdpath("data") .. "site/autoload/plug.vim"
local dir_list = vim.fn.glob(plugins_path .. "/*", true, true) -- local dir_list = vim.fn.glob(plugins_path .. "/*", true, true)
local library_table = {} -- local library_table = {}
for _, v in ipairs(dir_list) do -- for _, v in ipairs(dir_list) do
library_table[v .. "/lua"] = true -- library_table[v .. "/lua"] = true
end -- end
library_table[vim.fn.expand("$VIMRUNTIME/lua")] = true -- library_table[vim.fn.expand("$VIMRUNTIME/lua")] = true
library_table[vim.fn.stdpath("config") .. "/lua"] = true -- library_table[vim.fn.stdpath("config") .. "/lua"] = true
require('lspconfig').sumneko_lua.setup({ -- require('lspconfig').sumneko_lua.setup({
settings = { -- settings = {
Lua = { -- Lua = {
diagnostics = { globals = { "vim" } }, -- diagnostics = { globals = { "vim" } },
workspace = { library = library_table }, -- workspace = { library = library_table },
}, -- },
}, -- },
}) -- })
-- require 'lspconfig'.bashls.setup {} -- -- require 'lspconfig'.bashls.setup {}

View File

@ -1,4 +1,4 @@
require("lsp_lines").register_lsp_virtual_lines() require("lsp_lines").setup()
-- Disable virtual_text since it's redundant due to lsp_lines. -- Disable virtual_text since it's redundant due to lsp_lines.
vim.diagnostic.config({ vim.diagnostic.config({
virtual_text = false, virtual_text = false,

View File

@ -1,53 +1,52 @@
require('lualine').setup { require('lualine').setup {
options = { options = {
icons_enabled = true, icons_enabled = true,
theme = 'codedark', theme = 'codedark',
-- theme = 'dracula', -- theme = 'dracula',
-- theme = 'horizon', -- theme = 'horizon',
-- theme = 'onedark', -- theme = 'onedark',
component_separators = { left = '', right = '' }, component_separators = { left = '', right = '' },
section_separators = { left = '', right = ''}, section_separators = { left = '', right = ''},
-- section_separators = { left = '', right = '' }, disabled_filetypes = {},
disabled_filetypes = {}, always_divide_middle = true,
always_divide_middle = true, },
}, sections = {
sections = { lualine_a = { 'mode' },
lualine_a = { 'mode' }, lualine_b = { 'branch', 'diff' },
lualine_b = { 'branch', 'diff' }, lualine_c = { 'filename' },
lualine_c = { 'filename' }, lualine_x = {
lualine_x = { {
{ 'diagnostics',
'diagnostics', 'fileformat',
'fileformat', symbols = {
symbols = { unix = '', -- e712
unix = '', -- e712 dos = '', -- e70f
dos = '', -- e70f mac = '', -- e711
mac = '', -- e711 }
} }, 'encoding', 'fileformat', { 'filetype', colored = true, icon_only = false } },
}, 'encoding', 'fileformat', { 'filetype', colored = true, icon_only = false } }, lualine_y = { 'progress' },
lualine_y = { 'progress' }, lualine_z = { 'location' }
lualine_z = { 'location' } },
}, inactive_sections = {
inactive_sections = { lualine_a = {},
lualine_a = {}, lualine_b = {},
lualine_b = {}, lualine_c = {
lualine_c = { {
{ 'filename',
'filename', file_status = true, -- Displays file status (readonly status, modified status)
file_status = true, -- Displays file status (readonly status, modified status) path = 0, -- 0: Just the filename
path = 0, -- 0: Just the filename shorting_target = 40, -- Shortens path to leave 40 spaces in the window
shorting_target = 40, -- Shortens path to leave 40 spaces in the window symbols = {
symbols = { modified = '[+]', -- Text to show when the file is modified.
modified = '[+]', -- Text to show when the file is modified. readonly = '[-]', -- Text to show when the file is non-modifiable or readonly.
readonly = '[-]', -- Text to show when the file is non-modifiable or readonly. unnamed = '[No Name]', -- Text to show for unnamed buffers.
unnamed = '[No Name]', -- Text to show for unnamed buffers. }
} },
}, },
}, lualine_x = { 'location' },
lualine_x = { 'location' }, lualine_y = {},
lualine_y = {}, lualine_z = {}
lualine_z = {} },
}, tabline = {},
tabline = {}, extensions = { 'quickfix', 'fzf', 'nvim-tree', 'symbols-outline', 'fugitive' }
extensions = { 'quickfix', 'fzf', 'nvim-tree', 'symbols-outline', 'fugitive' } }
}

View File

@ -1,13 +1,11 @@
-- Setup nvim-cmp. -- Setup nvim-cmp.
local cmp = require 'cmp' local cmp = require 'cmp'
local lspkind = require('lspkind') local lspkind = require('lspkind')
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local capabilities = vim.lsp.protocol.make_client_capabilities() local lspconfig = require('lspconfig')
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
-- luasnip setup -- luasnip setup
local luasnip = require 'luasnip' local luasnip = require 'luasnip'
local highlight = require('cmp.utils.highlight')
local has_words_before = function() local has_words_before = function()
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end
@ -15,6 +13,14 @@ local has_words_before = function()
return col ~= 0 and vim.api.nvim_buf_get_text(0, line-1, 0, line-1, col, {})[1]:match("^%s*$") == nil return col ~= 0 and vim.api.nvim_buf_get_text(0, line-1, 0, line-1, col, {})[1]:match("^%s*$") == nil
end end
lspkind.init({
symbol_map = {
Copilot = "",
},
})
vim.api.nvim_set_hl(0, "CmpItemKindCopilot", {fg ="#6CC644"})
cmp.setup({ cmp.setup({
snippet = { snippet = {
expand = function(args) expand = function(args)
@ -25,17 +31,6 @@ cmp.setup({
end, end,
}, },
capabilities = capabilities, capabilities = capabilities,
-- mapping = {
-- ['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
-- ['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
-- ['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
-- ['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
-- ['<C-e>'] = cmp.mapping({
-- i = cmp.mapping.abort(),
-- c = cmp.mapping.close(),
-- }),
-- ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
-- },
mapping = { mapping = {
['<C-p>'] = cmp.mapping(function(fallback) ['<C-p>'] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
@ -67,65 +62,119 @@ cmp.setup({
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = true, select = true,
}, },
["<Tab>"] = cmp.mapping(function(fallback) -- ["<Tab>"] = cmp.mapping(function(fallback)
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 -- if cmp.visible() then
-- cmp.select_next_item() -- cmp.select_next_item()
-- elseif has_words_before() then -- elseif luasnip.expand_or_jumpable() then
-- cmp.complete() -- luasnip.expand_or_jump()
-- else -- else
-- fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`. -- fallback()
-- end -- end
end, { "i", "s" }), -- end, { "i", "s" }),
["<Tab>"] = vim.schedule_wrap(function(fallback)
if cmp.visible() and has_words_before() then
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
else
fallback()
end
end),
['<S-Tab>'] = cmp.mapping(function() ['<S-Tab>'] = cmp.mapping(function()
if cmp.visible() then if cmp.visible() then
cmp.select_prev_item() cmp.select_prev_item()
end end
end, { "i", "s"}), end, { "i", "s"}),
}, },
window = {
completion = {
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
col_offset = -3,
side_padding = 0,
border = "rounded",
borderchars = {
"",
"",
"",
"",
"",
"",
"",
"",
},
},
documentation = {
border = "rounded",
borderchars = {
"",
"",
"",
"",
"",
"",
"",
"",
},
-- padding = 15,
}
},
formatting = { formatting = {
format = lspkind.cmp_format({ fields = { "kind", "abbr", "menu" },
mode = 'symbol', -- show only symbol annotations format = function(entry, vim_item)
maxwidth = 20, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) local kind = require("lspkind").cmp_format({ mode = "symbol_text", maxwidth = 75 })(entry, vim_item)
local strings = vim.split(kind.kind, "%s", { trimempty = true })
kind.kind = " " .. strings[1] .. " "
kind.menu = " (" .. strings[2] .. ")"
-- The function below will be called before any actual modifications from lspkind return kind
-- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) end,
-- before = function (entry, vim_item) -- format = lspkind.cmp_format({
-- ... -- mode = 'symbol_text', -- show only symbol annotations
-- return vim_item -- menu = ({
-- end -- buffer = "[Buffer]",
}) -- nvim_lsp = "[LSP]",
-- luasnip = "[LuaSnip]",
-- nvim_lua = "[Lua]",
-- latex_symbols = "[Latex]",
-- })
-- })
}, },
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = "copilot", group_index = 2 }, { name = "copilot", group_index = 2 },
{ name = 'nvim_lsp', group_index = 2 }, { name = 'nvim_lsp', group_index = 2 },
-- { name = 'vsnip' }, -- For vsnip users. { name = 'nvim_lsp_signature_help', group_index = 2 },
{ name = "path", group_index = 2 }, { name = "path", group_index = 2 },
{ name = 'luasnip', group_index = 2 }, -- For luasnip users. { name = 'luasnip', group_index = 2 }, -- For luasnip users.
{
name = 'buffer',
option = {
get_bufnrs = function()
local bufs = {}
for _, win in ipairs(vim.api.nvim_list_wins()) do
bufs[vim.api.nvim_win_get_buf(win)] = true
end
return vim.tbl_keys(bufs)
end
}
}
-- { name = 'ultisnips' }, -- For ultisnips users. -- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users. -- { name = 'snippy' }, -- For snippy users.
}, { }, {
{ name = 'buffer' }, { name = 'buffer' },
}) }),
sorting = {
priority_weight = 2,
comparators = {
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
}
}) })
-- Setup lspconfig.
-- local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
-- require('lspconfig')['bashls'].setup {
-- capabilities = capabilities
-- }
-- Enable some language servers with the additional completion capabilities offered by nvim-cmp
local lspconfig = require('lspconfig')
local servers = { 'bashls', 'jedi_language_server', 'sqlls', 'jsonls', 'yamlls', 'vimls', 'dotls', 'dockerls' } local servers = { 'bashls', 'jedi_language_server', 'sqlls', 'jsonls', 'yamlls', 'vimls', 'dotls', 'dockerls' }
for _, lsp in ipairs(servers) do for _, lsp in ipairs(servers) do
lspconfig[lsp].setup { lspconfig[lsp].setup {
@ -135,9 +184,9 @@ for _, lsp in ipairs(servers) do
end end
-- cmp.event:on("menu_opened", function() cmp.event:on("menu_opened", function()
-- vim.b.copilot_suggestion_hidden = true vim.b.copilot_suggestion_hidden = true
-- end) end)
-- cmp.event:on("menu_closed", function() cmp.event:on("menu_closed", function()
-- vim.b.copilot_suggestion_hidden = false vim.b.copilot_suggestion_hidden = false
-- end) end)

View File

@ -3,7 +3,7 @@ require("which-key").setup {
marks = true, -- shows a list of your marks on ' and ` marks = true, -- shows a list of your marks on ' and `
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
spelling = { spelling = {
enabled = false, -- enabling this will show WhichKey when pressing z= to select spelling suggestions enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
suggestions = 20, -- how many suggestions should be shown in the list? suggestions = 20, -- how many suggestions should be shown in the list?
}, },
-- the presets plugin, adds help for a bunch of default keybindings in Neovim -- the presets plugin, adds help for a bunch of default keybindings in Neovim
@ -53,8 +53,9 @@ require("which-key").setup {
ignore_missing = false, -- enable this to hide mappings for which you didn't specify a label ignore_missing = false, -- enable this to hide mappings for which you didn't specify a label
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ "}, -- hide mapping boilerplate hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ "}, -- hide mapping boilerplate
show_help = true, -- show help message on the command line when the popup is visible show_help = true, -- show help message on the command line when the popup is visible
show_keys = true, -- show the key strokes for your commands
triggers = "auto", -- automatically setup triggers triggers = "auto", -- automatically setup triggers
-- triggers = {"<leader>"} -- or specify a list manually -- triggers = {"<leader>"}, -- or specify a list manually
triggers_blacklist = { triggers_blacklist = {
-- list of mode / prefixes that should never be hooked by WhichKey -- list of mode / prefixes that should never be hooked by WhichKey
-- this is mostly relevant for key maps that start with a native binding -- this is mostly relevant for key maps that start with a native binding
@ -62,4 +63,8 @@ require("which-key").setup {
i = { "j", "k" }, i = { "j", "k" },
v = { "j", "k" }, v = { "j", "k" },
}, },
disable = {
buftypes = {},
filetypes = { "TelescopePrompt" },
},
} }

View File

@ -99,6 +99,11 @@ _G.packer_plugins = {
path = "/home/sudacode/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", path = "/home/sudacode/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
url = "https://github.com/hrsh7th/cmp-nvim-lsp" url = "https://github.com/hrsh7th/cmp-nvim-lsp"
}, },
["cmp-nvim-lsp-signature-help"] = {
loaded = true,
path = "/home/sudacode/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp-signature-help",
url = "https://github.com/hrsh7th/cmp-nvim-lsp-signature-help"
},
["cmp-nvim-lua"] = { ["cmp-nvim-lua"] = {
loaded = true, loaded = true,
path = "/home/sudacode/.local/share/nvim/site/pack/packer/start/cmp-nvim-lua", path = "/home/sudacode/.local/share/nvim/site/pack/packer/start/cmp-nvim-lua",
@ -115,7 +120,7 @@ _G.packer_plugins = {
url = "https://github.com/saadparwaiz1/cmp_luasnip" url = "https://github.com/saadparwaiz1/cmp_luasnip"
}, },
["copilot-cmp"] = { ["copilot-cmp"] = {
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" }, config = { "\27LJ\2\n=\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\16copilot_cmp\frequire\0" },
load_after = {}, load_after = {},
loaded = true, loaded = true,
needs_bufread = false, needs_bufread = false,
@ -124,7 +129,7 @@ _G.packer_plugins = {
}, },
["copilot.lua"] = { ["copilot.lua"] = {
after = { "copilot-cmp" }, after = { "copilot-cmp" },
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" }, 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\tprev\n<M-[>\vaccept\n<Tab>\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\14jump_prev\a[[\vaccept\t<CR>\frefresh\agr\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" },
load_after = {}, load_after = {},
loaded = true, loaded = true,
needs_bufread = false, needs_bufread = false,
@ -177,7 +182,7 @@ _G.packer_plugins = {
url = "https://github.com/rmagatti/goto-preview" url = "https://github.com/rmagatti/goto-preview"
}, },
["hover.nvim"] = { ["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" }, 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\ntitle\2\19preview_window\1\0\nsetup\nhover\frequire\0" },
loaded = true, loaded = true,
path = "/home/sudacode/.local/share/nvim/site/pack/packer/start/hover.nvim", path = "/home/sudacode/.local/share/nvim/site/pack/packer/start/hover.nvim",
url = "https://github.com/lewis6991/hover.nvim" url = "https://github.com/lewis6991/hover.nvim"
@ -187,11 +192,6 @@ _G.packer_plugins = {
path = "/home/sudacode/.local/share/nvim/site/pack/packer/start/lsp_lines.nvim", path = "/home/sudacode/.local/share/nvim/site/pack/packer/start/lsp_lines.nvim",
url = "https://github.com/ksyasuda/lsp_lines.nvim" url = "https://github.com/ksyasuda/lsp_lines.nvim"
}, },
["lsp_signature.nvim"] = {
loaded = true,
path = "/home/sudacode/.local/share/nvim/site/pack/packer/start/lsp_signature.nvim",
url = "https://github.com/ray-x/lsp_signature.nvim"
},
["lspkind-nvim"] = { ["lspkind-nvim"] = {
loaded = true, loaded = true,
path = "/home/sudacode/.local/share/nvim/site/pack/packer/start/lspkind-nvim", path = "/home/sudacode/.local/share/nvim/site/pack/packer/start/lspkind-nvim",
@ -307,7 +307,7 @@ _G.packer_plugins = {
time([[Defining packer_plugins]], false) time([[Defining packer_plugins]], false)
-- Config for: hover.nvim -- Config for: hover.nvim
time([[Config for hover.nvim]], true) 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") 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\ntitle\2\19preview_window\1\0\nsetup\nhover\frequire\0", "config", "hover.nvim")
time([[Config for hover.nvim]], false) time([[Config for hover.nvim]], false)
-- Load plugins in order defined by `after` -- Load plugins in order defined by `after`
time([[Sequenced loading]], true) time([[Sequenced loading]], true)
@ -315,12 +315,12 @@ vim.cmd [[ packadd lualine.nvim ]]
vim.cmd [[ packadd copilot.lua ]] vim.cmd [[ packadd copilot.lua ]]
-- Config for: copilot.lua -- Config for: 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") 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\tprev\n<M-[>\vaccept\n<Tab>\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\14jump_prev\a[[\vaccept\t<CR>\frefresh\agr\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")
vim.cmd [[ packadd copilot-cmp ]] vim.cmd [[ packadd copilot-cmp ]]
-- Config for: copilot-cmp -- Config for: 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") try_loadstring("\27LJ\2\n=\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\16copilot_cmp\frequire\0", "config", "copilot-cmp")
time([[Sequenced loading]], false) time([[Sequenced loading]], false)