Compare commits
No commits in common. "4240a67dff2d597766d7575a5ae3e70ab93423a5" and "194c9e31ca23e1850225e26849c43352e1f4e173" have entirely different histories.
4240a67dff
...
194c9e31ca
35
nvim-config/coc-settings.json
Normal file
35
nvim-config/coc-settings.json
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"languageserver": {
|
||||||
|
"haskell": {
|
||||||
|
"command": "haskell-language-server-wrapper",
|
||||||
|
"args": ["--lsp"],
|
||||||
|
"rootPatterns": ["*.cabal", "stack.yaml", "cabal.project", "package.yaml", "hie.yaml"],
|
||||||
|
"filetypes": ["haskell", "lhaskell"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"coc.source.iced.enable": true,
|
||||||
|
"diagnostic-languageserver.filetypes": {
|
||||||
|
"vim": "vint",
|
||||||
|
"email": "languagetool",
|
||||||
|
"markdown": [ "write-good", "markdownlint" ],
|
||||||
|
"sh": "shellcheck",
|
||||||
|
"bash": "shellcheck",
|
||||||
|
"elixir": ["mix_credo", "mix_credo_compile"],
|
||||||
|
"eelixir": ["mix_credo", "mix_credo_compile"],
|
||||||
|
"php": ["phpstan", "psalm"],
|
||||||
|
"yaml": [ "yamllint" ],
|
||||||
|
"cmake": [ "cmake-lint", "cmakelint" ],
|
||||||
|
"systemd": "systemd-analyze"
|
||||||
|
},
|
||||||
|
"diagnostic-languageserver.formatFiletypes": {
|
||||||
|
"dart": "dartfmt",
|
||||||
|
"elixir": "mix_format",
|
||||||
|
"eelixir": "mix_format",
|
||||||
|
"python": ["black", "isort"],
|
||||||
|
"lua": "lua-format",
|
||||||
|
"sh": "shfmt",
|
||||||
|
"bash": "shfmt",
|
||||||
|
"blade": "blade-formatter",
|
||||||
|
"cmake": "cmake-format"
|
||||||
|
}
|
||||||
|
}
|
@ -60,6 +60,13 @@ Plug 'mhinz/vim-sayonara'
|
|||||||
" Session-Management
|
" Session-Management
|
||||||
Plug 'xolox/vim-session' | Plug 'xolox/vim-misc'
|
Plug 'xolox/vim-session' | Plug 'xolox/vim-misc'
|
||||||
|
|
||||||
|
" CoC
|
||||||
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||||
|
|
||||||
|
" Clojure
|
||||||
|
Plug 'guns/vim-sexp', {'for': 'clojure'}
|
||||||
|
Plug 'liquidz/vim-iced', {'for': 'clojure'}
|
||||||
|
Plug 'liquidz/vim-iced-coc-source', {'for': 'clojure'}
|
||||||
|
|
||||||
" todo.txt
|
" todo.txt
|
||||||
Plug 'freitass/todo.txt-vim'
|
Plug 'freitass/todo.txt-vim'
|
||||||
@ -67,21 +74,12 @@ Plug 'freitass/todo.txt-vim'
|
|||||||
" LSP
|
" LSP
|
||||||
Plug 'williamboman/mason.nvim'
|
Plug 'williamboman/mason.nvim'
|
||||||
Plug 'williamboman/mason-lspconfig.nvim'
|
Plug 'williamboman/mason-lspconfig.nvim'
|
||||||
Plug 'neovim/nvim-lspconfig'
|
Plug 'neovim/nvim-lspconfig', {'branch': 'v0.1.6'}
|
||||||
Plug 'hrsh7th/cmp-nvim-lsp'
|
|
||||||
Plug 'hrsh7th/cmp-buffer'
|
|
||||||
Plug 'hrsh7th/cmp-path'
|
|
||||||
Plug 'hrsh7th/cmp-cmdline'
|
|
||||||
Plug 'hrsh7th/nvim-cmp'
|
|
||||||
Plug 'onsails/lspkind.nvim'
|
|
||||||
|
|
||||||
" For vsnip users.
|
|
||||||
Plug 'hrsh7th/cmp-vsnip'
|
|
||||||
Plug 'hrsh7th/vim-vsnip'
|
|
||||||
|
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
" GENERAL VIM SETUP
|
|
||||||
|
" SETTINGS
|
||||||
|
|
||||||
" set leader to space
|
" set leader to space
|
||||||
let mapleader= "\<SPACE>"
|
let mapleader= "\<SPACE>"
|
||||||
@ -119,7 +117,7 @@ set smartcase " ... unless the query has capital letters.
|
|||||||
set incsearch " Incremental search.
|
set incsearch " Incremental search.
|
||||||
set gdefault " Use 'g' flag by default with :s/foo/bar/.
|
set gdefault " Use 'g' flag by default with :s/foo/bar/.
|
||||||
set magic " Use 'magic' patterns (extended regular expressions).
|
set magic " Use 'magic' patterns (extended regular expressions).
|
||||||
set inccommand=nosplit " Use live-preview of search/replace etc.
|
"set inccommand=nosplit " Use live-preview of search/replace etc.
|
||||||
set conceallevel=2 " Allow things to be visually opressed (i.e. *foo* be italic)
|
set conceallevel=2 " Allow things to be visually opressed (i.e. *foo* be italic)
|
||||||
set mouse=a " enable mouse
|
set mouse=a " enable mouse
|
||||||
set foldenable " enable folding
|
set foldenable " enable folding
|
||||||
@ -133,13 +131,46 @@ set hidden
|
|||||||
|
|
||||||
let g:loaded_perl_provider = 0
|
let g:loaded_perl_provider = 0
|
||||||
|
|
||||||
|
" LSP Config
|
||||||
|
|
||||||
|
lua << EOF
|
||||||
|
require("mason").setup()
|
||||||
|
require("mason-lspconfig").setup()
|
||||||
|
EOF
|
||||||
|
|
||||||
|
" Use <C-L> to clear the highlighting of :set hlsearch.
|
||||||
|
if maparg('<C-L>', 'n') ==# ''
|
||||||
|
nnoremap <silent> <C-L> :nohlsearch<CR><C-L>
|
||||||
|
endif
|
||||||
|
|
||||||
" Remember cursor position between vim sessions
|
" Remember cursor position between vim sessions
|
||||||
autocmd BufReadPost *
|
autocmd BufReadPost *
|
||||||
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
|
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
|
||||||
\ exe "normal! g'\"" |
|
\ exe "normal! g'\"" |
|
||||||
\ endif
|
\ endif
|
||||||
" center buffer around cursor when opening files
|
" center buffer around cursor when opening files
|
||||||
autocmd BufRead * normal zz
|
autocmd BufRead * normal zz
|
||||||
|
|
||||||
|
|
||||||
|
"" KEY-BINDINGS
|
||||||
|
|
||||||
|
" use <TAB> to fold/unfold
|
||||||
|
|
||||||
|
nnoremap <TAB> za
|
||||||
|
|
||||||
|
" <Tab>: completion
|
||||||
|
function! CheckBackSpace() abort
|
||||||
|
let col = col('.') - 1
|
||||||
|
return !col || getline('.')[col - 1] =~ '\s'
|
||||||
|
endfunction
|
||||||
|
inoremap <silent><expr> <Tab>
|
||||||
|
\ pumvisible() ? "\<C-N>" :
|
||||||
|
\ CheckBackSpace() ? "\<Tab>" :
|
||||||
|
\ coc#refresh()
|
||||||
|
" <S-Tab>: completion back
|
||||||
|
inoremap <silent><expr> <S-Tab> pumvisible() ? "\<C-P>" : "\<C-H>"
|
||||||
|
" <CR>: confirm completion, or insert <CR>
|
||||||
|
inoremap <expr> <CR> pumvisible() ? "\<C-Y>" : "\<CR>"
|
||||||
|
|
||||||
" use <C-J> to Jump to definition instead of <C-]> (default)
|
" use <C-J> to Jump to definition instead of <C-]> (default)
|
||||||
nmap <C-J> <C-]>
|
nmap <C-J> <C-]>
|
||||||
@ -151,204 +182,129 @@ inoremap <C-D> <esc>ddi
|
|||||||
|
|
||||||
tnoremap <C-t><C-t> <C-\><C-n>
|
tnoremap <C-t><C-t> <C-\><C-n>
|
||||||
|
|
||||||
" FANCY NEOVIM-MAGIC
|
""""""""""""""""""""""""""""""""""""""""""""" Coc Keys
|
||||||
|
" Use `[g` and `]g` to navigate diagnostics
|
||||||
|
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list
|
||||||
|
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
||||||
|
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
||||||
|
|
||||||
" setup mason, language-server & nvim-cmp for completion
|
" GoTo code navigation
|
||||||
lua <<EOF
|
nmap <silent> gd <Plug>(coc-definition)
|
||||||
|
nmap <silent> gy <Plug>(coc-type-definition)
|
||||||
|
nmap <silent> gi <Plug>(coc-implementation)
|
||||||
|
nmap <silent> gr <Plug>(coc-references)
|
||||||
|
|
||||||
require("mason").setup()
|
" Use K to show documentation in preview window
|
||||||
require("mason-lspconfig").setup()
|
nnoremap <silent> K :call ShowDocumentation()<CR>
|
||||||
|
|
||||||
local has_words_before = function()
|
function! ShowDocumentation()
|
||||||
unpack = unpack or table.unpack
|
if CocAction('hasProvider', 'hover')
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
call CocActionAsync('doHover')
|
||||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
else
|
||||||
end
|
call feedkeys('K', 'in')
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
local feedkey = function(key, mode)
|
" Highlight the symbol and its references when holding the cursor
|
||||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
|
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||||
end
|
|
||||||
|
|
||||||
-- Set up nvim-cmp.
|
" Symbol renaming
|
||||||
local cmp = require'cmp'
|
nmap <leader>rn <Plug>(coc-rename)
|
||||||
local lspkind = require'lspkind'
|
|
||||||
|
|
||||||
cmp.setup({
|
" Formatting selected code
|
||||||
snippet = {
|
xmap <leader>f <Plug>(coc-format-selected)
|
||||||
-- REQUIRED - you must specify a snippet engine
|
nmap <leader>f <Plug>(coc-format-selected)
|
||||||
expand = function(args)
|
|
||||||
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
|
||||||
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
|
||||||
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
|
||||||
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
|
||||||
end,
|
|
||||||
formatting = {
|
|
||||||
format = lspkind.cmp_format(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
window = {
|
|
||||||
-- completion = cmp.config.window.bordered(),
|
|
||||||
-- documentation = cmp.config.window.bordered(),
|
|
||||||
},
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
||||||
['<C-Space>'] = cmp.mapping.complete(),
|
|
||||||
['<C-e>'] = cmp.mapping.abort(),
|
|
||||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
if #cmp.get_entries() == 1 then
|
|
||||||
cmp.confirm({ select = true })
|
|
||||||
else
|
|
||||||
cmp.select_next_item()
|
|
||||||
end
|
|
||||||
elseif vim.fn["vsnip#available"](1) == 1 then
|
|
||||||
feedkey("<Plug>(vsnip-expand-or-jump)", "")
|
|
||||||
elseif has_words_before() then
|
|
||||||
cmp.complete()
|
|
||||||
if #cmp.get_entries() == 1 then
|
|
||||||
cmp.confirm({ select = true })
|
|
||||||
end
|
|
||||||
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()
|
augroup mygroup
|
||||||
if cmp.visible() then
|
autocmd!
|
||||||
cmp.select_prev_item()
|
" Setup formatexpr specified filetype(s)
|
||||||
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
|
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
|
||||||
feedkey("<Plug>(vsnip-jump-prev)", "")
|
" Update signature help on jump placeholder
|
||||||
end
|
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
|
||||||
end, { "i", "s" }),
|
augroup end
|
||||||
|
|
||||||
}),
|
" Applying code actions to the selected code block
|
||||||
sources = cmp.config.sources({
|
" Example: `<leader>aap` for current paragraph
|
||||||
{ name = 'nvim_lsp' },
|
xmap <leader>a <Plug>(coc-codeaction-selected)
|
||||||
{ name = 'vsnip' }, -- For vsnip users.
|
nmap <leader>a <Plug>(coc-codeaction-selected)
|
||||||
-- { name = 'luasnip' }, -- For luasnip users.
|
|
||||||
-- { name = 'ultisnips' }, -- For ultisnips users.
|
|
||||||
-- { name = 'snippy' }, -- For snippy users.
|
|
||||||
}, {
|
|
||||||
{ name = 'buffer' },
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Set configuration for specific filetype.
|
" Remap keys for applying code actions at the cursor position
|
||||||
cmp.setup.filetype('gitcommit', {
|
nmap <leader>ac <Plug>(coc-codeaction-cursor)
|
||||||
sources = cmp.config.sources({
|
" Remap keys for apply code actions affect whole buffer
|
||||||
{ name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
|
nmap <leader>as <Plug>(coc-codeaction-source)
|
||||||
}, {
|
" Apply the most preferred quickfix action to fix diagnostic on the current line
|
||||||
{ name = 'buffer' },
|
nmap <leader>qf <Plug>(coc-fix-current)
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
" Remap keys for applying refactor code actions
|
||||||
cmp.setup.cmdline({ '/', '?' }, {
|
nmap <silent> <leader>re <Plug>(coc-codeaction-refactor)
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
xmap <silent> <leader>r <Plug>(coc-codeaction-refactor-selected)
|
||||||
sources = {
|
nmap <silent> <leader>r <Plug>(coc-codeaction-refactor-selected)
|
||||||
{ name = 'buffer' }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
" Run the Code Lens action on the current line
|
||||||
cmp.setup.cmdline(':', {
|
nmap <leader>cl <Plug>(coc-codelens-action)
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'path' }
|
|
||||||
}, {
|
|
||||||
{ name = 'cmdline' }
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Set up lspconfig.
|
" Map function and class text objects
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
" NOTE: Requires 'textDocument.documentSymbol' support from the language server
|
||||||
|
xmap if <Plug>(coc-funcobj-i)
|
||||||
|
omap if <Plug>(coc-funcobj-i)
|
||||||
|
xmap af <Plug>(coc-funcobj-a)
|
||||||
|
omap af <Plug>(coc-funcobj-a)
|
||||||
|
xmap ic <Plug>(coc-classobj-i)
|
||||||
|
omap ic <Plug>(coc-classobj-i)
|
||||||
|
xmap ac <Plug>(coc-classobj-a)
|
||||||
|
omap ac <Plug>(coc-classobj-a)
|
||||||
|
|
||||||
local on_attach = function(client, bufnr)
|
" Remap <C-f> and <C-b> to scroll float windows/popups
|
||||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
if has('nvim-0.4.0') || has('patch-8.2.0750')
|
||||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
||||||
|
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
||||||
|
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
|
||||||
|
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
|
||||||
|
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
||||||
|
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
||||||
|
endif
|
||||||
|
|
||||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
" Use CTRL-S for selections ranges
|
||||||
end
|
" Requires 'textDocument/selectionRange' support of language server
|
||||||
|
nmap <silent> <C-s> <Plug>(coc-range-select)
|
||||||
|
xmap <silent> <C-s> <Plug>(coc-range-select)
|
||||||
|
|
||||||
require("lspconfig").gopls.setup {
|
" Add `:Format` command to format current buffer
|
||||||
cmd = {'gopls'},
|
command! -nargs=0 Format :call CocActionAsync('format')
|
||||||
-- on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
settings = {
|
|
||||||
gopls = {
|
|
||||||
experimentalPostfixCompletions = true,
|
|
||||||
analyses = {
|
|
||||||
unusedparams = true,
|
|
||||||
shadow = true,
|
|
||||||
},
|
|
||||||
staticcheck = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
init_options = {
|
|
||||||
usePlaceholders = true,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
require("lspconfig").eslint.setup {}
|
|
||||||
require("lspconfig").jsonls.setup {}
|
|
||||||
require("lspconfig").tsserver.setup {}
|
|
||||||
require("lspconfig").ast_grep.setup {}
|
|
||||||
require("lspconfig").golangci_lint_ls.setup {}
|
|
||||||
|
|
||||||
function swallow_output(callback, ...)
|
" Add `:Fold` command to fold current buffer
|
||||||
local old_print = print
|
command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
||||||
print = function(...) end
|
|
||||||
|
|
||||||
pcall(callback, arg)
|
" Add `:OR` command for organize imports of the current buffer
|
||||||
|
command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport')
|
||||||
|
|
||||||
print = old_print
|
" Add (Neo)Vim's native statusline support
|
||||||
end
|
" NOTE: Please see `:h coc-status` for integrations with external plugins that
|
||||||
|
" provide custom statusline: lightline.vim, vim-airline
|
||||||
|
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
|
||||||
|
|
||||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
" Mappings for CoCList
|
||||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
|
" Show all diagnostics
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
" Manage extensions
|
||||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
|
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr>
|
||||||
|
" Show commands
|
||||||
-- Use LspAttach autocommand to only map the following keys
|
nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr>
|
||||||
-- after the language server attaches to the current buffer
|
" Find symbol of current document
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr>
|
||||||
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
" Search workspace symbols
|
||||||
callback = function(ev)
|
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr>
|
||||||
|
" Do default action for next item
|
||||||
-- Buffer local mappings.
|
nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
|
||||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
" Do default action for previous item
|
||||||
local opts = { buffer = ev.buf }
|
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
|
||||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
" Resume latest coc list
|
||||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>
|
||||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
|
||||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
|
||||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
|
||||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
|
||||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
|
||||||
vim.keymap.set('n', '<space>wl', function()
|
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
|
||||||
end, opts)
|
|
||||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
|
||||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
|
||||||
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
|
|
||||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
|
||||||
vim.keymap.set('v', '<space>f', function()
|
|
||||||
vim.lsp.buf.format { async = true }
|
|
||||||
end, opts)
|
|
||||||
vim.api.nvim_create_autocmd('BufWrite', {
|
|
||||||
callback = function(ev)
|
|
||||||
vim.lsp.buf.format { async = false }
|
|
||||||
end
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
EOF
|
|
||||||
|
|
||||||
"" KEY-BINDINGS
|
|
||||||
|
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
" autoformat code if possible (read docs on vim-autoformat!)
|
||||||
|
"noremap <leader>f :Autoformat<CR>
|
||||||
noremap <leader>TM :TableModeToggle<CR>
|
noremap <leader>TM :TableModeToggle<CR>
|
||||||
|
|
||||||
" multi-cursor
|
" multi-cursor
|
||||||
|
Loading…
Reference in New Issue
Block a user