Update
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
set nocompatible
|
||||
filetype off
|
||||
|
||||
source /usr/share/nvim/runtime/plugin/fzf.vim
|
||||
|
||||
call plug#begin('$HOME/.config/nvim/bundle')
|
||||
|
||||
Plug 'tpope/vim-sensible'
|
||||
@@ -13,21 +11,16 @@ Plug 'chriskempson/base16-vim'
|
||||
Plug 'terryma/vim-multiple-cursors'
|
||||
Plug 'Lokaltog/vim-easymotion'
|
||||
|
||||
Plug 'rust-lang/rust.vim'
|
||||
" Plug 'racer-rust/vim-racer'
|
||||
Plug 'simrat39/rust-tools.nvim'
|
||||
Plug 'vim-ruby/vim-ruby'
|
||||
Plug 'tpope/vim-rails'
|
||||
Plug 'tpope/vim-rake'
|
||||
Plug 'tpope/vim-bundler'
|
||||
Plug 'tpope/vim-markdown'
|
||||
Plug 'calviken/vim-gdscript3'
|
||||
" Plug 'tpope/vim-projectionist'
|
||||
" Plug 'tpope/vim-haml'
|
||||
Plug 'ledger/vim-ledger'
|
||||
Plug 'slim-template/vim-slim'
|
||||
Plug 'fatih/vim-go'
|
||||
" Plug 'wavded/vim-stylus'
|
||||
" Plug 'digitaltoad/vim-jade'
|
||||
Plug 'Glench/Vim-Jinja2-Syntax'
|
||||
Plug 'HerringtonDarkholme/yats.vim'
|
||||
Plug 'm-pilia/vim-ccls'
|
||||
@@ -53,7 +46,7 @@ Plug 'L3MON4D3/LuaSnip'
|
||||
" Appearance
|
||||
Plug 'itchyny/lightline.vim'
|
||||
Plug 'shinchu/lightline-gruvbox.vim'
|
||||
Plug 'spywhere/lightline-lsp'
|
||||
Plug 'bsedin/lightline-lsp'
|
||||
|
||||
Plug 'editorconfig/editorconfig-vim'
|
||||
Plug 'tpope/vim-surround'
|
||||
@@ -61,8 +54,6 @@ Plug 'tpope/vim-unimpaired'
|
||||
Plug 'tpope/vim-endwise'
|
||||
Plug 'rstacruz/vim-closer'
|
||||
|
||||
Plug 'junegunn/fzf.vim'
|
||||
|
||||
Plug 'godlygeek/tabular'
|
||||
|
||||
" LSP
|
||||
@@ -71,7 +62,7 @@ Plug 'hrsh7th/cmp-nvim-lsp'
|
||||
Plug 'folke/lsp-colors.nvim'
|
||||
|
||||
Plug 'hrsh7th/cmp-buffer'
|
||||
Plug 'hrsh7th/cmp-path'
|
||||
" Plug 'hrsh7th/cmp-path'
|
||||
Plug 'hrsh7th/cmp-cmdline'
|
||||
Plug 'hrsh7th/nvim-cmp'
|
||||
|
||||
@@ -90,6 +81,12 @@ Plug 'powerman/vim-plugin-AnsiEsc'
|
||||
Plug 'vimwiki/vimwiki'
|
||||
Plug 'tbabej/taskwiki'
|
||||
|
||||
Plug 'McAuleyPenney/tidy.nvim' " Remove whitespaces
|
||||
Plug 'Chiel92/vim-autoformat'
|
||||
|
||||
Plug 'nvim-lua/plenary.nvim'
|
||||
Plug 'nvim-telescope/telescope.nvim'
|
||||
|
||||
call plug#end()
|
||||
|
||||
" Colorscheme
|
||||
@@ -117,9 +114,24 @@ let g:neosnippet#enable_snipmate_compatibility = 1
|
||||
" Tell Neosnippet about the other snippets
|
||||
let g:neosnippet#snippets_directory='$HOME/.config/nvim/bundle/vim-snippets/snippets'
|
||||
|
||||
" nvim-lspconfig
|
||||
|
||||
lua << EOF
|
||||
|
||||
-- telescope
|
||||
|
||||
require('telescope').setup{
|
||||
pickers = {
|
||||
find_files = {
|
||||
theme = "dropdown",
|
||||
},
|
||||
live_grep = {
|
||||
theme = "dropdown",
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
-- nvim-lspconfig
|
||||
|
||||
local nvim_lsp = require('lspconfig')
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
@@ -147,12 +159,20 @@ local on_attach = function(client, bufnr)
|
||||
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>e', '<cmd>lua vim.diagnostic.get()<CR>', opts)
|
||||
buf_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
|
||||
buf_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||
|
||||
-- buf_set_keymap('n', 'gh', '<cmd>lua require(\'lspsaga.provider\').lsp_finder()<CR>', opts)
|
||||
-- buf_set_keymap('n', '<leader>ca', '<cmd>lua require(\'lspsaga.codeaction\').code_action()<CR>', opts)
|
||||
-- buf_set_keymap('v', '<leader>ca', ':<C-U>lua require(\'lspsaga.codeaction\').range_code_action()<CR>', opts)
|
||||
-- buf_set_keymap('n', 'K', '<cmd>lua require(\'lspsaga.hover\').render_hover_doc()<CR>', opts)
|
||||
-- buf_set_keymap('n', '<space>rn', '<cmd>lua require(\'lspsaga.rename\').rename()<CR>', opts)
|
||||
-- buf_set_keymap('n', 'gs', '<cmd>lua require(\'lspsaga.signaturehelp\').signature_help()<CR>', opts)
|
||||
-- buf_set_keymap('n', 'gd', '<cmd>lua require(\'lspsaga.provider\').preview_definition()<CR>', opts)
|
||||
-- buf_set_keymap('n', 'gd', '<cmd>lua require(\'lspsaga.provider\').preview_definition()<CR>', opts)
|
||||
end
|
||||
|
||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||
@@ -191,102 +211,145 @@ nvim_lsp.elixirls.setup{
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
EOF
|
||||
|
||||
set completeopt=menu,menuone,noselect
|
||||
|
||||
lua <<EOF
|
||||
-- Setup nvim-cmp.
|
||||
local cmp = require('cmp')
|
||||
local luasnip = require('luasnip')
|
||||
local has_words_before = function()
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
cmp.setup({
|
||||
experimental = {
|
||||
ghost_text = { hl_group = 'Comment' }
|
||||
},
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||
luasnip.lsp_expand(args.body) -- For `luasnip` users.
|
||||
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||
-- require'snippy'.expand_snippet(args.body) -- For `snippy` users.
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-d>'] = 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.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true
|
||||
}),
|
||||
|
||||
['<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-p>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
|
||||
['<C-e>'] = cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
}),
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' }, -- For luasnip users.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline('/', {
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
nvim_lsp.rust_analyzer.setup({
|
||||
cmd = { "rust-analyzer" },
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
assist = {
|
||||
importGranularity = "module",
|
||||
importPrefix = "by_self",
|
||||
},
|
||||
cargo = {
|
||||
loadOutDirsFromCheck = true
|
||||
},
|
||||
procMacro = {
|
||||
enable = true
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
require('rust-tools').setup({
|
||||
tools = { -- rust-tools options
|
||||
autoSetHints = true,
|
||||
hover_with_actions = true,
|
||||
inlay_hints = {
|
||||
-- show_parameter_hints = false,
|
||||
-- parameter_hints_prefix = "",
|
||||
-- other_hints_prefix = "",
|
||||
},
|
||||
},
|
||||
|
||||
-- all the opts to send to nvim-lspconfig
|
||||
-- these override the defaults set by rust-tools.nvim
|
||||
-- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer
|
||||
server = {
|
||||
-- on_attach is a callback called when the language server attachs to the buffer
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
-- to enable rust-analyzer settings visit:
|
||||
-- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc
|
||||
["rust-analyzer"] = {
|
||||
-- enable clippy on save
|
||||
checkOnSave = {
|
||||
allTargets = false,
|
||||
command = "clippy"
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
-- Setup nvim-cmp.
|
||||
local cmp = require('cmp')
|
||||
local luasnip = require('luasnip')
|
||||
local has_words_before = function()
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
cmp.setup({
|
||||
experimental = {
|
||||
ghost_text = { hl_group = 'Comment' }
|
||||
},
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||
luasnip.lsp_expand(args.body) -- For `luasnip` users.
|
||||
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||
-- require'snippy'.expand_snippet(args.body) -- For `snippy` users.
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-d>'] = 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.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true
|
||||
}),
|
||||
|
||||
['<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-p>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
|
||||
['<C-e>'] = cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
}),
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' }, -- For luasnip users.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline('/', {
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
||||
|
||||
EOF
|
||||
|
||||
" EditorConfig
|
||||
let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*']
|
||||
|
||||
" FZF ripgrep
|
||||
nnoremap <Leader>g :Rg<Space>
|
||||
|
||||
" NerdTREE
|
||||
silent! nmap <C-g> :NERDTreeToggle<CR>
|
||||
silent! map <F4> :NERDTreeFind<CR>
|
||||
@@ -360,59 +423,6 @@ highlight GitGutterChangeDeleteLineNr ctermfg=16 ctermbg=18 guifg=#d3869b guibg=
|
||||
highlight link GitGutterAddLineNr GitGutterAddLine
|
||||
highlight link GitGutterDeleteLineNr GitGutterDeleteLine
|
||||
|
||||
" fzf
|
||||
let $FZF_DEFAULT_COMMAND="fd --type file --full-path -c never -H"
|
||||
|
||||
silent! nmap <C-p> :Files<CR>
|
||||
|
||||
" An action can be a reference to a function that processes selected lines
|
||||
function! s:build_quickfix_list(lines)
|
||||
call setqflist(map(copy(a:lines), '{ "filename": v:val }'))
|
||||
copen
|
||||
cc
|
||||
endfunction
|
||||
|
||||
" This is the default extra key bindings
|
||||
let g:fzf_action = {
|
||||
\ 'ctrl-q': function('s:build_quickfix_list'),
|
||||
\ 'ctrl-t': 'tab split',
|
||||
\ 'ctrl-x': 'split',
|
||||
\ 'ctrl-v': 'vsplit',
|
||||
\ 'ctrl-o': 'edit' }
|
||||
|
||||
let g:fzf_preview_window = 'right:60%'
|
||||
|
||||
" let g:fzf_layout = { 'window': { 'width': 0.4, 'height': 0.25 } }
|
||||
" let g:fzf_preview_window = ''
|
||||
let g:fzf_buffers_jump = 1
|
||||
|
||||
autocmd! FileType fzf set laststatus=0 noshowmode noruler
|
||||
\| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
|
||||
|
||||
command! -bang -nargs=* Rg
|
||||
\ call fzf#vim#grep(
|
||||
\ 'rg --column --line-number --no-heading --color=always --smart-case -- '.shellescape(<q-args>), 1,
|
||||
\ fzf#vim#with_preview(), <bang>0)
|
||||
|
||||
command! -bang -nargs=? -complete=dir Files
|
||||
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview(), <bang>0)
|
||||
|
||||
" Customize fzf colors to match your color scheme
|
||||
let g:fzf_colors =
|
||||
\ { 'fg': ['fg', 'Normal'],
|
||||
\ 'bg': ['bg', 'Normal'],
|
||||
\ 'hl': ['fg', 'Comment'],
|
||||
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
|
||||
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
|
||||
\ 'hl+': ['fg', 'Statement'],
|
||||
\ 'info': ['fg', 'PreProc'],
|
||||
\ 'border': ['fg', 'Ignore'],
|
||||
\ 'prompt': ['fg', 'Conditional'],
|
||||
\ 'pointer': ['fg', 'Exception'],
|
||||
\ 'marker': ['fg', 'Keyword'],
|
||||
\ 'spinner': ['fg', 'Label'],
|
||||
\ 'header': ['fg', 'Comment'] }
|
||||
|
||||
" Replace current word with yanked or deleted text
|
||||
" nnoremap S "_diwP
|
||||
|
||||
@@ -442,6 +452,11 @@ let g:tagbar_type_ruby = {
|
||||
\ ]
|
||||
\}
|
||||
|
||||
" vim-autoformat
|
||||
let g:autoformat_autoindent = 1
|
||||
let g:autoformat_retab = 1
|
||||
let g:autoformat_remove_trailing_spaces = 1
|
||||
|
||||
" Vimwiki
|
||||
let g:vimwiki_list = [{'path': '~/vimwiki/', 'syntax': 'markdown', 'ext': '.md'}]
|
||||
|
||||
@@ -495,6 +510,12 @@ set noeol " Don’t add empty newlines at the end of file
|
||||
autocmd InsertEnter * set cursorline " Show cursor line in insert mode
|
||||
autocmd InsertLeave * set nocursorline " Hide cursor line in insert mode
|
||||
|
||||
" Set updatetime for CursorHold
|
||||
" 300ms of no cursor movement to trigger CursorHold
|
||||
set updatetime=1000
|
||||
" Show diagnostic popup on cursor hold
|
||||
autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false })
|
||||
|
||||
" Visual
|
||||
set showmatch " Show matching brackets.
|
||||
set mat=5 " Bracket blinking.
|
||||
@@ -530,9 +551,16 @@ set splitbelow
|
||||
set splitright
|
||||
|
||||
set title
|
||||
set completeopt=menuone,noinsert,noselect
|
||||
|
||||
" Quicker window movement
|
||||
nnoremap <C-j> <C-w>j
|
||||
nnoremap <C-k> <C-w>k
|
||||
nnoremap <C-h> <C-w>h
|
||||
nnoremap <C-l> <C-w>l
|
||||
|
||||
" telescope
|
||||
nnoremap <C-p> <cmd>lua require('telescope.builtin').find_files()<CR>
|
||||
nnoremap <leader>g <cmd>lua require('telescope.builtin').live_grep()<CR>
|
||||
nnoremap <leader>b <cmd>lua require('telescope.builtin').buffers()<CR>
|
||||
nnoremap <leader>h <cmd>lua require('telescope.builtin').help_tags()<CR>
|
||||
|
||||
Reference in New Issue
Block a user