Nvim: Configure plugins in after directory
Switch from fzf to telescope and filesystem to defx
This commit is contained in:
1
.config/nvim/after/ftplugin/markdown/markdown_spell.vim
Symbolic link
1
.config/nvim/after/ftplugin/markdown/markdown_spell.vim
Symbolic link
@@ -0,0 +1 @@
|
||||
../spell.vim
|
||||
3
.config/nvim/after/ftplugin/spell.vim
Normal file
3
.config/nvim/after/ftplugin/spell.vim
Normal file
@@ -0,0 +1,3 @@
|
||||
setlocal spell
|
||||
" Undo changes when switching to different buffer
|
||||
"let b:undo_ftplugin .= '|setlocal spell<'
|
||||
1
.config/nvim/after/ftplugin/vimwiki/vimwiki_spell.vim
Symbolic link
1
.config/nvim/after/ftplugin/vimwiki/vimwiki_spell.vim
Symbolic link
@@ -0,0 +1 @@
|
||||
../spell.vim
|
||||
4
.config/nvim/after/plugin/airline.rc.vim
Normal file
4
.config/nvim/after/plugin/airline.rc.vim
Normal file
@@ -0,0 +1,4 @@
|
||||
let g:airline_theme = 'minimalist'
|
||||
let g:airline_powerline_fonts = 1
|
||||
let g:airline_stl_path_style = 'short'
|
||||
let g:airline_highlighting_cache = 1
|
||||
1
.config/nvim/after/plugin/alternate.rc.vim
Normal file
1
.config/nvim/after/plugin/alternate.rc.vim
Normal file
@@ -0,0 +1 @@
|
||||
nnoremap <F6> :silent FSHere<CR>
|
||||
2
.config/nvim/after/plugin/context.rc.vim
Normal file
2
.config/nvim/after/plugin/context.rc.vim
Normal file
@@ -0,0 +1,2 @@
|
||||
" Disable context.vim on json files
|
||||
let g:context_filetype_blacklist = ["json", "log"]
|
||||
67
.config/nvim/after/plugin/defx.rc.vim
Normal file
67
.config/nvim/after/plugin/defx.rc.vim
Normal file
@@ -0,0 +1,67 @@
|
||||
nnoremap <leader>d <cmd>Defx<CR>
|
||||
|
||||
autocmd FileType defx call s:defx_my_settings()
|
||||
function! s:defx_my_settings() abort
|
||||
" Define mappings
|
||||
nnoremap <silent><buffer><expr> <CR>
|
||||
\ defx#do_action('open')
|
||||
nnoremap <silent><buffer><expr> c
|
||||
\ defx#do_action('copy')
|
||||
nnoremap <silent><buffer><expr> m
|
||||
\ defx#do_action('move')
|
||||
nnoremap <silent><buffer><expr> p
|
||||
\ defx#do_action('paste')
|
||||
nnoremap <silent><buffer><expr> l
|
||||
\ defx#do_action('open')
|
||||
nnoremap <silent><buffer><expr> E
|
||||
\ defx#do_action('open', 'vsplit')
|
||||
nnoremap <silent><buffer><expr> P
|
||||
\ defx#do_action('preview')
|
||||
nnoremap <silent><buffer><expr> o
|
||||
\ defx#do_action('open_tree', 'toggle')
|
||||
nnoremap <silent><buffer><expr> K
|
||||
\ defx#do_action('new_directory')
|
||||
nnoremap <silent><buffer><expr> N
|
||||
\ defx#do_action('new_file')
|
||||
nnoremap <silent><buffer><expr> M
|
||||
\ defx#do_action('new_multiple_files')
|
||||
nnoremap <silent><buffer><expr> C
|
||||
\ defx#do_action('toggle_columns',
|
||||
\ 'mark:indent:icon:filename:type:size:time')
|
||||
nnoremap <silent><buffer><expr> S
|
||||
\ defx#do_action('toggle_sort', 'time')
|
||||
nnoremap <silent><buffer><expr> d
|
||||
\ defx#do_action('remove')
|
||||
nnoremap <silent><buffer><expr> r
|
||||
\ defx#do_action('rename')
|
||||
nnoremap <silent><buffer><expr> !
|
||||
\ defx#do_action('execute_command')
|
||||
nnoremap <silent><buffer><expr> x
|
||||
\ defx#do_action('execute_system')
|
||||
nnoremap <silent><buffer><expr> yy
|
||||
\ defx#do_action('yank_path')
|
||||
nnoremap <silent><buffer><expr> .
|
||||
\ defx#do_action('toggle_ignored_files')
|
||||
nnoremap <silent><buffer><expr> ;
|
||||
\ defx#do_action('repeat')
|
||||
nnoremap <silent><buffer><expr> h
|
||||
\ defx#do_action('cd', ['..'])
|
||||
nnoremap <silent><buffer><expr> ~
|
||||
\ defx#do_action('cd')
|
||||
nnoremap <silent><buffer><expr> q
|
||||
\ defx#do_action('quit')
|
||||
nnoremap <silent><buffer><expr> <Space>
|
||||
\ defx#do_action('toggle_select') . 'j'
|
||||
nnoremap <silent><buffer><expr> *
|
||||
\ defx#do_action('toggle_select_all')
|
||||
nnoremap <silent><buffer><expr> j
|
||||
\ line('.') == line('$') ? 'gg' : 'j'
|
||||
nnoremap <silent><buffer><expr> k
|
||||
\ line('.') == 1 ? 'G' : 'k'
|
||||
nnoremap <silent><buffer><expr> <C-l>
|
||||
\ defx#do_action('redraw')
|
||||
nnoremap <silent><buffer><expr> <C-g>
|
||||
\ defx#do_action('print')
|
||||
nnoremap <silent><buffer><expr> cd
|
||||
\ defx#do_action('change_vim_cwd')
|
||||
endfunction
|
||||
5
.config/nvim/after/plugin/fzf.rc.vim
Normal file
5
.config/nvim/after/plugin/fzf.rc.vim
Normal file
@@ -0,0 +1,5 @@
|
||||
nnoremap <leader>f :FZF!<CR>
|
||||
nnoremap <leader>l :Lines!<CR>
|
||||
nnoremap <leader>b :Buffers<CR>
|
||||
inoremap <leader>s <ESC>:Snippets!<CR>
|
||||
nnoremap <leader>a :Rg! <C-R><C-W><CR>
|
||||
89
.config/nvim/after/plugin/lspconfig.rc.vim
Normal file
89
.config/nvim/after/plugin/lspconfig.rc.vim
Normal file
@@ -0,0 +1,89 @@
|
||||
if !exists('g:lspconfig')
|
||||
finish
|
||||
endif
|
||||
"
|
||||
" Completion configuration for native neovim + nvim-lspconfig
|
||||
lua << EOF
|
||||
local nvim_lsp = require'lspconfig'
|
||||
|
||||
nvim_lsp.ccls.setup {
|
||||
init_options = {
|
||||
compilationDatabaseDirectory = ".";
|
||||
index = {
|
||||
threads = 0;
|
||||
};
|
||||
clang = {
|
||||
excludeArgs = { "-frounding-math"} ;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
nvim_lsp.pylsp.setup{}
|
||||
nvim_lsp.cmake.setup{}
|
||||
nvim_lsp.rls.setup {
|
||||
settings = {
|
||||
rust = {
|
||||
unstable_features = true,
|
||||
build_on_save = false,
|
||||
all_features = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
|
||||
--Enable completion triggered by <c-x><c-o>
|
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
local opts = { noremap=true, silent=true }
|
||||
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
|
||||
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
||||
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||
require'completion'.on_attach()
|
||||
end
|
||||
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
signs = {
|
||||
severity_limit = 'Warning',
|
||||
},
|
||||
underline = false,
|
||||
update_in_insert = false,
|
||||
virtual_text = {
|
||||
spacing = 40,
|
||||
severity_limit = 'Warning',
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||
-- map buffer local keybindings when the language server attaches
|
||||
local servers = { "pylsp", "rls", "cmake", 'ccls' }
|
||||
for _, lsp in ipairs(servers) do
|
||||
nvim_lsp[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
on_publish_diagnostics = diagnostic_handler
|
||||
}
|
||||
end
|
||||
EOF
|
||||
45
.config/nvim/after/plugin/lspsaga.rc.vim
Normal file
45
.config/nvim/after/plugin/lspsaga.rc.vim
Normal file
@@ -0,0 +1,45 @@
|
||||
lua << EOF
|
||||
local saga = require 'lspsaga'
|
||||
|
||||
-- add your config value here
|
||||
-- default value
|
||||
-- use_saga_diagnostic_sign = true
|
||||
-- error_sign = '',
|
||||
-- warn_sign = '',
|
||||
-- hint_sign = '',
|
||||
-- infor_sign = '',
|
||||
-- dianostic_header_icon = ' ',
|
||||
-- code_action_icon = ' ',
|
||||
-- code_action_prompt = {
|
||||
-- enable = true,
|
||||
-- sign = true,
|
||||
-- sign_priority = 20,
|
||||
-- virtual_text = true,
|
||||
-- },
|
||||
-- finder_definition_icon = ' ',
|
||||
-- finder_reference_icon = ' ',
|
||||
-- max_preview_lines = 10, -- preview lines of lsp_finder and definition preview
|
||||
-- finder_action_keys = {
|
||||
-- open = 'o', vsplit = 's',split = 'i',quit = 'q',scroll_down = '<C-f>', scroll_up = '<C-b>' -- quit can be a table
|
||||
-- },
|
||||
-- code_action_keys = {
|
||||
-- quit = 'q',exec = '<CR>'
|
||||
-- },
|
||||
-- rename_action_keys = {
|
||||
-- quit = '<C-c>',exec = '<CR>' -- quit can be a table
|
||||
-- },
|
||||
-- definition_preview_icon = ' '
|
||||
-- "single" "double" "round" "plus"
|
||||
-- border_style = "single"
|
||||
-- rename_prompt_prefix = '➤',
|
||||
-- if you don't use nvim-lspconfig you must pass your server name and
|
||||
-- the related filetypes into this table
|
||||
-- like server_filetype_map = {metals = {'sbt', 'scala'}}
|
||||
-- server_filetype_map = {}
|
||||
|
||||
--saga.init_lsp_saga {
|
||||
-- your custom option here
|
||||
--}
|
||||
saga.init_lsp_saga()
|
||||
|
||||
EOF
|
||||
3
.config/nvim/after/plugin/nerdtree.rc.vim
Normal file
3
.config/nvim/after/plugin/nerdtree.rc.vim
Normal file
@@ -0,0 +1,3 @@
|
||||
" Mapping to NERDTree
|
||||
nnoremap <leader>t :NERDTreeToggle<CR>
|
||||
let NERDTreeIgnore=['\~$', '\.pyc$']
|
||||
2
.config/nvim/after/plugin/search-pulse.rc.vim
Normal file
2
.config/nvim/after/plugin/search-pulse.rc.vim
Normal file
@@ -0,0 +1,2 @@
|
||||
let g:vim_search_pulse_mode = 'pattern'
|
||||
let g:vim_search_pulse_duration = 400
|
||||
1
.config/nvim/after/plugin/startify.rc.vim
Normal file
1
.config/nvim/after/plugin/startify.rc.vim
Normal file
@@ -0,0 +1 @@
|
||||
let g:startify_custom_header = ''
|
||||
56
.config/nvim/after/plugin/telescope.rc.vim
Normal file
56
.config/nvim/after/plugin/telescope.rc.vim
Normal file
@@ -0,0 +1,56 @@
|
||||
nnoremap <leader>f <cmd>Telescope find_files<CR>
|
||||
nnoremap <leader>b <cmd>Telescope buffers<CR>
|
||||
nnoremap <leader>a <cmd>:Telescope live_grep<CR>
|
||||
nnoremap <leader>l :Telescope<CR>
|
||||
"inoremap <leader>s <ESC>:Snippets!<CR>
|
||||
|
||||
lua << EOF
|
||||
require('telescope').setup{
|
||||
defaults = {
|
||||
vimgrep_arguments = {
|
||||
'rg',
|
||||
'--color=never',
|
||||
'--no-heading',
|
||||
'--with-filename',
|
||||
'--line-number',
|
||||
'--column',
|
||||
'--smart-case'
|
||||
},
|
||||
prompt_prefix = "> ",
|
||||
selection_caret = "> ",
|
||||
entry_prefix = " ",
|
||||
initial_mode = "insert",
|
||||
selection_strategy = "reset",
|
||||
sorting_strategy = "descending",
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = {
|
||||
horizontal = {
|
||||
mirror = false,
|
||||
},
|
||||
vertical = {
|
||||
mirror = false,
|
||||
},
|
||||
},
|
||||
file_sorter = require'telescope.sorters'.get_fuzzy_file,
|
||||
file_ignore_patterns = {},
|
||||
generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter,
|
||||
winblend = 0,
|
||||
border = {},
|
||||
borderchars = { '─', '│', '─', '│', '╭', '╮', '╯', '╰' },
|
||||
color_devicons = true,
|
||||
use_less = true,
|
||||
path_display = {},
|
||||
set_env = { ['COLORTERM'] = 'truecolor' }, -- default = nil,
|
||||
file_previewer = require'telescope.previewers'.vim_buffer_cat.new,
|
||||
grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new,
|
||||
qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new,
|
||||
|
||||
-- Developer configurations: Not meant for general override
|
||||
buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker
|
||||
}
|
||||
}
|
||||
|
||||
-- Ultisnip support
|
||||
require('telescope').load_extension('ultisnips')
|
||||
|
||||
EOF
|
||||
17
.config/nvim/after/plugin/treesitter.rc.vim
Normal file
17
.config/nvim/after/plugin/treesitter.rc.vim
Normal file
@@ -0,0 +1,17 @@
|
||||
" Tree-sitter configuration
|
||||
lua <<EOF
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"cmake",
|
||||
"cpp",
|
||||
"fish",
|
||||
"lua",
|
||||
"rust",
|
||||
}
|
||||
}
|
||||
EOF
|
||||
8
.config/nvim/after/plugin/ultisnips.rc.vim
Normal file
8
.config/nvim/after/plugin/ultisnips.rc.vim
Normal file
@@ -0,0 +1,8 @@
|
||||
" Set completeopt to have a better completion experience
|
||||
set completeopt=menuone,noinsert,noselect
|
||||
let g:completion_enable_snippet = 'UltiSnips'
|
||||
iunmap <Tab>
|
||||
imap <c-s> <C-R>=UltiSnips#ExpandSnippet()<CR>
|
||||
let g:UltiSnipsExpandTrigger="<c-s>"
|
||||
let g:UltiSnipsJumpForwardTrigger="<c-n>"
|
||||
let g:UltiSnipsJumpBackwardTrigger="<c-p>"
|
||||
5
.config/nvim/after/plugin/yoink.rc.vim
Normal file
5
.config/nvim/after/plugin/yoink.rc.vim
Normal file
@@ -0,0 +1,5 @@
|
||||
" yoink configuration
|
||||
"nmap <leader>yp <plug>(YoinkPostPasteSwapBack)
|
||||
"nmap <leader>yn <plug>(YoinkPostPasteSwapForward)
|
||||
"nmap p <plug>(YoinkPaste_p)
|
||||
"nmap P <plug>(YoinkPaste_P)
|
||||
@@ -13,6 +13,7 @@ call plug#begin('~/.config/nvim/plugins')
|
||||
|
||||
" Code development helpers {{{
|
||||
Plug 'neovim/nvim-lspconfig'
|
||||
Plug 'glepnir/lspsaga.nvim'
|
||||
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
|
||||
Plug 'wellle/context.vim'
|
||||
Plug 'dbeniamine/cheat.sh-vim'
|
||||
@@ -20,11 +21,17 @@ Plug 'puremourning/vimspector'
|
||||
Plug 'derekwyatt/vim-fswitch'
|
||||
Plug 'nvim-lua/completion-nvim'
|
||||
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
||||
Plug 'tpope/vim-fugitive'
|
||||
" }}}
|
||||
|
||||
" Files switch, jump and grep-like tools {{{
|
||||
Plug 'preservim/nerdtree' | Plug 'Xuyuanp/nerdtree-git-plugin'
|
||||
Plug 'junegunn/fzf' | Plug 'junegunn/fzf.vim'
|
||||
"Plug 'preservim/nerdtree' | Plug 'Xuyuanp/nerdtree-git-plugin'
|
||||
Plug 'Shougo/defx.nvim', { 'do': ':UpdateRemotePlugins' }
|
||||
"Plug 'junegunn/fzf' | Plug 'junegunn/fzf.vim'
|
||||
Plug 'nvim-lua/popup.nvim'
|
||||
Plug 'nvim-lua/plenary.nvim'
|
||||
Plug 'nvim-telescope/telescope.nvim'
|
||||
Plug 'fhill2/telescope-ultisnips.nvim'
|
||||
Plug 'liuchengxu/vista.vim'
|
||||
Plug 'inside/vim-search-pulse'
|
||||
Plug 'mhinz/vim-startify'
|
||||
@@ -36,7 +43,7 @@ Plug 'mhinz/vim-signify' " Mark edited lines - faster gitgutter
|
||||
" }}}
|
||||
|
||||
" Syntax for random filetypes {{{
|
||||
Plug 'masukomi/vim-markdown-folding'
|
||||
"Plug 'masukomi/vim-markdown-folding'
|
||||
"Plug 'weirongxu/plantuml-previewer.vim' |
|
||||
Plug 'aklt/plantuml-syntax'
|
||||
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']}
|
||||
@@ -52,7 +59,7 @@ Plug 'JMcKiern/vim-shoot'
|
||||
" }}}
|
||||
|
||||
" Filetype syntax {{{
|
||||
Plug 'plasticboy/vim-markdown'
|
||||
"Plug 'plasticboy/vim-markdown'
|
||||
Plug 'kergoth/vim-bitbake' " Bitbake templates and syntax
|
||||
Plug 'pboettch/vim-cmake-syntax'
|
||||
Plug 'aklt/plantuml-syntax'
|
||||
@@ -102,6 +109,8 @@ set textwidth=80
|
||||
set formatoptions+=t
|
||||
set scrolloff=10
|
||||
|
||||
set inccommand="split"
|
||||
|
||||
" space one line, home,end globally increase/decrease
|
||||
nnoremap <Home> zc
|
||||
nnoremap <End> zo
|
||||
@@ -136,10 +145,6 @@ nnoremap <leader>8 <esc>:set tabstop=8 softtabstop=8 shiftwidth=8<cr>
|
||||
|
||||
nnoremap <leader><space> :nohlsearch<cr>
|
||||
|
||||
let g:UltiSnipsExpandTrigger="<c-s>"
|
||||
let g:UltiSnipsJumpForwardTrigger="<c-n>"
|
||||
let g:UltiSnipsJumpBackwardTrigger="<c-p>"
|
||||
|
||||
" TextEdit might fail if hidden is not set.
|
||||
set hidden
|
||||
|
||||
@@ -169,153 +174,12 @@ endif
|
||||
|
||||
set wildmode=longest,list,full
|
||||
|
||||
" yoink configuration
|
||||
"nmap <leader>yp <plug>(YoinkPostPasteSwapBack)
|
||||
"nmap <leader>yn <plug>(YoinkPostPasteSwapForward)
|
||||
"nmap p <plug>(YoinkPaste_p)
|
||||
"nmap P <plug>(YoinkPaste_P)
|
||||
|
||||
" Mapping to NERDTree
|
||||
nnoremap <leader>t :NERDTreeToggle<CR>
|
||||
let NERDTreeIgnore=['\.vim$', '\~$', '\.pyc$']
|
||||
|
||||
nnoremap <leader>f :FZF!<CR>
|
||||
nnoremap <leader>l :Lines!<CR>
|
||||
nnoremap <leader>b :Buffers<CR>
|
||||
inoremap <leader>s <ESC>:Snippets!<CR>
|
||||
nnoremap <leader>a :Rg! <C-R><C-W><CR>
|
||||
|
||||
" Disable context.vim on json files
|
||||
let g:context_filetype_blacklist = ["json"]
|
||||
|
||||
match Error /\s\+$\|DU\cPA/
|
||||
|
||||
nnoremap <F6> :silent FSHere<CR>
|
||||
|
||||
setglobal virtualedit=block
|
||||
setglobal shiftround
|
||||
|
||||
let g:vim_search_pulse_mode = 'pattern'
|
||||
let g:vim_search_pulse_duration = 400
|
||||
|
||||
let g:airline_theme = 'minimalist'
|
||||
let g:airline_powerline_fonts = 1
|
||||
let g:airline_stl_path_style = 'short'
|
||||
let g:airline_highlighting_cache = 1
|
||||
|
||||
let g:startify_custom_header = ''
|
||||
|
||||
packadd termdebug
|
||||
|
||||
let g:vimwiki_list = [{'path': '~/vimwiki/',
|
||||
\ 'syntax': 'markdown', 'ext': '.md'}]
|
||||
|
||||
" Completion configuration for native neovim + nvim-lspconfig
|
||||
lua << EOF
|
||||
local lspconfig = require'lspconfig'
|
||||
lspconfig.ccls.setup {
|
||||
init_options = {
|
||||
compilationDatabaseDirectory = ".";
|
||||
index = {
|
||||
threads = 0;
|
||||
};
|
||||
clang = {
|
||||
excludeArgs = { "-frounding-math"} ;
|
||||
};
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
lua << EOF
|
||||
require'lspconfig'.pylsp.setup{}
|
||||
EOF
|
||||
|
||||
lua << EOF
|
||||
require'lspconfig'.cmake.setup{}
|
||||
EOF
|
||||
|
||||
lua << EOF
|
||||
require'lspconfig'.rls.setup {
|
||||
settings = {
|
||||
rust = {
|
||||
unstable_features = true,
|
||||
build_on_save = false,
|
||||
all_features = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
EOF
|
||||
|
||||
lua << EOF
|
||||
local nvim_lsp = require('lspconfig')
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
|
||||
--Enable completion triggered by <c-x><c-o>
|
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
local opts = { noremap=true, silent=true }
|
||||
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
|
||||
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
||||
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||
require'completion'.on_attach()
|
||||
end
|
||||
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
signs = {
|
||||
severity_limit = 'Warning',
|
||||
},
|
||||
underline = false,
|
||||
update_in_insert = false,
|
||||
virtual_text = {
|
||||
spacing = 40,
|
||||
severity_limit = 'Warning',
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||
-- map buffer local keybindings when the language server attaches
|
||||
local servers = { "pylsp", "rls", "cmake", 'ccls' }
|
||||
for _, lsp in ipairs(servers) do
|
||||
nvim_lsp[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
on_publish_diagnostics = diagnostic_handler
|
||||
}
|
||||
end
|
||||
EOF
|
||||
|
||||
" Set completeopt to have a better completion experience
|
||||
set completeopt=menuone,noinsert,noselect
|
||||
let g:completion_enable_snippet = 'UltiSnips'
|
||||
|
||||
" Tree-sitter configuration
|
||||
lua <<EOF
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
}
|
||||
EOF
|
||||
packadd termdebug
|
||||
|
||||
Reference in New Issue
Block a user