@ -6,6 +6,9 @@ if empty(glob(data_dir . '/autoload/plug.vim'))
endif
call plug #begin ( )
" auto pairs
Plug 'LunarWatcher/auto-pairs'
" Lightline
Plug 'itchyny/lightline.vim'
@ -58,10 +61,14 @@ Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-nvim-lua'
Plug 'f3fora/cmp-spell'
" Plug 'hrsh7th/cmp-copilot'
Plug 'onsails/lspkind.nvim'
Plug 'quangnguyen30192/cmp-nvim-ultisnips'
" Diagnostics
Plug 'folke/trouble.nvim'
" Telescope
Plug 'nvim-telescope/telescope.nvim'
Plug 'nvim-telescope/telescope-fzf-native.nvim' , { 'do' : 'make' }
@ -135,7 +142,7 @@ let maplocalleader=" "
nnoremap < silent > < Enter > :nohl < CR > < Enter >
if has ( 'nvim' )
nnoremap < leader > b < cmd > Telescope buffers < CR >
nnoremap < cmd > lua require ( "telescope.builtin" ) .current_buffer_fuzzy_find ( require ( 'telescope.themes' ) .get_ivy ( ) ) < CR >
nnoremap < C - /> < cmd > lua require ( "telescope.builtin" ) .current_buffer_fuzzy_find ( require ( 'telescope.themes' ) .get_ivy ( ) ) < CR >
nnoremap < leader > f < cmd > Telescope find_files < CR >
else
nnoremap < leader > b < cmd > ls < CR > :b < Space >
@ -149,6 +156,9 @@ noremap k j
noremap j h
noremap h ;
nnoremap [q < cmd > :cprev < CR >
nnoremap ]q < cmd > :cnext < CR >
noremap < C - W > j < C - \> < C - N > < C - W > h
noremap < C - W > k < C - \> < C - N > < C - W > j
noremap < C - W > l < C - \> < C - N > < C - W > k
@ -220,15 +230,16 @@ let g:lightline = {
function ! LightlineFilename ( )
return &filetype = = # 'fugitive' ? fugitive #statusline ( ) :
\ &filetype = = # 'qf' ? 'QuickFix' :
\ &filetype = = # 'Trouble' ? 'Trouble' :
\ expand ( '%:t' ) ! = # '' ? expand ( '%:t' ) : '[No Name]'
endfunction
function ! LightlineReadonly ( )
return &readonly && &filetype ! ~ # '\v(help|fugitive )' ? 'RO' : ''
return &readonly && &filetype ! ~ # '\v(help|fugitive |Trouble )' ? 'RO' : ''
endfunction
function ! LightlineBranch ( )
return &filetype ! ~ # '\v(help|fugitive|qf )' ? FugitiveHead ( ) : ''
return &filetype ! ~ # '\v(help|fugitive|qf |Trouble )' ? FugitiveHead ( ) : ''
endfunction
" }}}
@ -269,9 +280,16 @@ command Ex Vifm
" Markdown config {{{
let g :vim_markdown_frontmatter = 1
let g :vim_markdown_folding_disabled = 1
" }}}
" Auto-Pairs config {{{
let g :AutoPairsMapBS = 1
" }}}
" Autocompile dwmblocks {{{
if has ( "nvim" )
autocmd BufWritePost ~ /desktop/ dwmblocks /blocks.h :term cd ~/ desktop /dwmblocks/ ; sudo make install && { killall - q dwmblocks ;setsid - f dwmblocks > /dev/ null 2 > /dev/ null ; }
@ -289,7 +307,7 @@ if filereadable("/etc/vim/vimrc.local")
source /etc/ vim /vimrc .local
endif
" L SP Setup {{{
" L ua Setup {{{
if has ( "nvim" )
lua < < EOF
@ -387,6 +405,14 @@ if has("nvim")
{ name = 'nvim_lsp' },
{ name = 'nvim_lua' },
{ name = 'ultisnips' },
{ name = 'spell' ,
option = {
enable_in_context = function ( )
return true - - require ( 'cmp.config.context' ) .in_treesitter_capture ( 'spell' )
end ,
},
keyword_length = 3 ,
},
{ name = 'path' },
}, {
{ name = 'buffer' , keyword_length = 5 },
@ -400,6 +426,7 @@ if has("nvim")
nvim_lua = "[api]" ,
path = "[path]" ,
ultisnips = "[snip]" ,
spell = "[spell]" ,
- - copilot = "[cop]" ,
},
},
@ -407,15 +434,16 @@ if has("nvim")
})
- - Setup lspconfig .
local capabilities = require ( 'cmp_nvim_lsp' ) .update_capabilities( vim .lsp .protocol .make_client_capabilities ( ) )
local capabilities = require ( 'cmp_nvim_lsp' ) .default_capabilities( )
local function on_attach ( 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
buf_set_keymap ( 'n' , 'gd' , '<Cmd>lua vim.lsp.buf.definition()<CR>' , {noremap = true })
buf_set_keymap ( 'n' , 'gt' , '<Cmd>lua vim.lsp.buf.type_definition()<CR>' , {noremap = true })
- - buf_set_keymap ( 'n' , 'gt' , '<Cmd>lua vim.lsp.buf.type_definition()<CR>' , {noremap = true })
buf_set_keymap ( 'n' , 'gi' , '<Cmd>lua vim.lsp.buf.implementation()<CR>' , {noremap = true })
buf_set_keymap ( 'n' , '<leader>r' , '<Cmd>lua vim.lsp.buf.rename()<CR>' , {noremap = true })
buf_set_keymap ( 'n' , '<leader>d' , '<Cmd>Trouble workspace_diagnostics<CR>' , {noremap = true })
buf_set_keymap ( 'n' , ']d' , '<Cmd>lua vim.diagnostic.goto_next()<CR>' , {noremap = true })
buf_set_keymap ( 'n' , '[d' , '<Cmd>lua vim.diagnostic.goto_prev()<CR>' , {noremap = true })
buf_set_keymap ( 'n' , '<C-Space>' , '<Cmd>lua vim.lsp.buf.code_action()<CR>' , {noremap = true })
@ -424,6 +452,8 @@ if has("nvim")
buf_set_option ( 'omnifunc' , 'v:lua.vim.lsp.omnifunc' )
end
require ( 'lspconfig' ) ['ccls' ].setup ( { capabilities = capabilities , on_attach = on_attach })
require ( 'lspconfig' ) ['pyright' ].setup ( { capabilities = capabilities , on_attach = on_attach })
require ( 'lspconfig' ) ['texlab' ].setup ( { capabilities = capabilities , on_attach = on_attach })
@ -493,6 +523,12 @@ if has("nvim")
},
} - - }}}
- - ]]
require ( "trouble" ) .setup {
- - your configuration comes here
- - or leave it empty to use the default settings
- - refer to the configuration section below
}
EOF
endif