more cleanup

This commit is contained in:
elkowar 2021-04-04 15:08:59 +02:00
parent d6d42a3852
commit 1a7be45469
5 changed files with 4 additions and 382 deletions

View file

@ -71,9 +71,6 @@
(set nvim.o.timeoutlen 200)
; TODO
; autocmd! VimEnter * :unmap <space>ig
; autocmd! FileType which_key)
(nvim.command
"autocmd! VimEnter * :unmap <space>ig
autocmd! FileType which_key")

View file

@ -346,25 +346,9 @@ nnoremap ö a
source $VIM_ROOT/whichkeyConfig.vim
"luafile $VIM_ROOT/lsp.lua
"source $VIM_ROOT/lsp.vim
"source $VIM_ROOT/whichkeyConfig.vim
let g:aniseed#env = v:true
let g:lexima_no_default_rules = v:true
call lexima#set_default_rules()
"inoremap <silent><expr> <C-Space> compe#complete()
"inoremap <silent><expr> <CR> compe#confirm('<CR>')
"inoremap <silent><expr> <esc> compe#close('<esc>')
"nnoremap <silent> <C-d> <cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<CR>
"nnoremap <silent> <C-u> <cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<CR>

96
lsp.lua
View file

@ -1,96 +0,0 @@
local lsp = require('lspconfig')
local util = lsp.util
local saga = require('lspsaga')
local on_attach = function(client, bufnr)
if client.resolved_capabilities.document_highlight then
vim.api.nvim_exec([[
hi LspReferenceRead cterm=bold ctermbg=red guibg='#8ec07c' guifg='#282828'
hi LspReferenceText cterm=bold ctermbg=red guibg='#8ec07c' guifg='#282828'
hi LspReferenceWrite cterm=bold ctermbg=red guibg='#8ec07c' guifg='#282828'
augroup lsp_document_highlight
autocmd! * <buffer>
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
augroup END
]], false)
end
end
lsp.rust_analyzer.setup { on_attach = on_attach }
lsp.jsonls.setup { on_attach = on_attach }
lsp.vimls.setup { on_attach = on_attach }
lsp.tsserver.setup { on_attach = on_attach }
lsp.bashls.setup { on_attach = on_attach }
lsp.html.setup { on_attach = on_attach }
lsp.denols.setup {
root_dir = lsp.util.root_pattern(".git");
on_attach = on_attach
}
lsp.hls.setup {
on_attach = on_attach,
settings = {
languageServerHaskell = {
formattingProvider = "stylish-haskell"
}
}
}
require('compe').setup {
enabled = true;
autocomplete = true;
debug = false;
min_length = 1;
preselect = 'enable';
throttle_time = 80;
source_timeout = 200;
incomplete_delay = 400;
max_abbr_width = 100;
max_kind_width = 100;
max_menu_width = 100;
documentation = true;
source = {
path = true;
buffer = true;
calc = true;
nvim_lsp = true;
nvim_lua = true;
vsnip = false;
};
}
--vim.lsp.handlers['textDocument/codeAction'] = require('lsputil.codeAction').code_action_handler
--vim.lsp.handlers['textDocument/references'] = require('lsputil.locations').references_handler
--vim.lsp.handlers['textDocument/definition'] = require('lsputil.locations').definition_handler
--vim.lsp.handlers['textDocument/declaration'] = require('lsputil.locations').declaration_handler
--vim.lsp.handlers['textDocument/typeDefinition'] = require('lsputil.locations').typeDefinition_handler
--vim.lsp.handlers['textDocument/implementation'] = require('lsputil.locations').implementation_handler
--vim.lsp.handlers['textDocument/documentSymbol'] = require('lsputil.symbols').document_handler
--vim.lsp.handlers['workspace/symbol'] = require('lsputil.symbols').workspace_handler
saga.init_lsp_saga {
border_style = 1,
code_action_keys = { quit = '<esc>', exec = '<CR>' },
rename_action_keys = { quit = '<esc>', exec = '<CR>' },
finder_action_keys = {
quit = '<esc>',
open = '<CR>',
vsplit = 'v',
split = 'b',
scroll_up = '<C-u>',
scroll_down = '<C-d>'
},
}

120
lsp.vim
View file

@ -1,120 +0,0 @@
hi link haskellOperators GruvboxAqua
hi link haskellImportKeywords GruvboxPurple
let g:vista_default_executive = 'coc'
let g:vista_sidebar_position = 'vertical topleft'
let g:vista_sidebar_width = '50'
let g:coc_global_extensions = [
\ 'coc-yank', 'coc-vimlsp', 'coc-prettier', 'coc-eslint',
\ 'coc-diagnostic', 'coc-yaml', 'coc-tsserver',
\ 'coc-json', 'coc-go', 'coc-html', 'coc-css', 'coc-clangd',
\ 'coc-actions', 'coc-yank'
\ ]
" 'coc-rust-analyzer',
let g:echodoc#enable_at_startup = 1
let g:echodoc#type = "echo"
" vim-jsx
autocmd! BufRead,BufNewFile *.tsx setlocal syntax=javascript.jsx
" make emmet behave well with JSX in JS and TS files
let g:user_emmet_settings = { 'javascript': { 'extends': 'jsx' }, 'typescript': { 'extends': 'tsx' }}
let g:user_emmet_mode='n'
" Use <c-space> to trigger completion.
inoremap <silent><expr> <c-space> coc#refresh()
"? idk
"inoremap <silent><expr> <TAB> pumvisible() ? "\<C-n>" : <SID>check_back_space() ? "\<TAB>" : coc#refresh()
"inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
" Show documentation for vim stuff, and run doHover otherWise
function! Show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" Show all diagnostics.
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
"Close preview window when completion is done.
autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
setlocal formatprg=floskell\ --style\ chris-done
set signcolumn=yes
set cmdheight=1
set updatetime=300
" maybe helps coc?
set nobackup
set nowritebackup
hi CocUnderline gui=undercurl term=undercurl
hi CocErrorHighlight ctermfg=red guifg=#c4384b gui=undercurl term=undercurl
hi CocWarningHighlight ctermfg=yellow guifg=#c4ab39 gui=undercurl term=undercurl
autocmd CursorHold * silent call CocActionAsync('highlight')
hi link CocWarningSign GruvboxYellow
hi link CocInfoSign GruvboxAqua
hi link CocHintErrorSign GruvboxBlue
hi link CocErrorSign GruvboxRed
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
" Map function and class text objects
" 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)
" Snippet stuff {{{
" Use <C-l> for trigger snippet expand.
imap <C-l> <Plug>(coc-snippets-expand)
" Use <C-j> for select text for visual placeholder of snippet.
vmap <C-j> <Plug>(coc-snippets-select)
" Use <C-j> for jump to next placeholder, it's default of coc.nvim
let g:coc_snippet_next = '<c-j>'
" Use <C-k> for jump to previous placeholder, it's default of coc.nvim
let g:coc_snippet_prev = '<c-k>'
" Use <C-j> for both expand and jump (make expand higher priority.)
imap <C-j> <Plug>(coc-snippets-expand-jump)
" Use <leader>x for convert visual selected code to snippet
xmap <leader>x <Plug>(coc-convert-snippet)
" }}}

View file

@ -1,143 +0,0 @@
"nnoremap <silent> <leader> :<c-u>WhichKey '<Space>'<CR>
"vnoremap <silent> <leader> :<c-u>'WhichKeyVisual '<Space>'<CR>
"let g:which_key_map = {}
"call which_key#register('<Space>', "g:which_key_map")
"\ 'h' : 'which_key_ignore', 'l' : 'which_key_ignore' ,
"\ 'h' : ':bprevious', 'l' : ':bnext' ,
"\ 'h' : [':BufferPrevious', 'prev buffer'], 'l' : [':BufferNext', 'next buffer'] ,
"let g:which_key_map = {
"\ 'h' : [':bprevious', 'prev buffer'], 'l' : [':bnext', 'next buffer'],
"\ 'f' : 'which_key_ignore', 's': 'which_key_ignore' ,
"\ 'c' : { 'name': '+comment_out' },
"\ 'e' : { 'name': '+emmet' },
"\ '[' : ['<Plug>(YoinkPostPasteSwapBack)', 'Swap last paste backwards' ],
"\ ']' : ['<Plug>(YoinkPostPasteSwapForward)', 'Swap last paste backwards' ],
"\ ':' : [':Commands' , 'Search command with fzf' ],
"\ 'z' : { 'name': '+folds', 'c': ['foldclose', 'close fold'],
"\ 'o': ['foldopen', 'open fold'] ,
"\ }
"\ }
"\ 's' : [ ':CocFzfList symbols' , 'list symbols' ] ,
" Maps for code actions
"let g:which_key_map['m'] = {
"\ 'name' : '+Code-actions' ,
"\ 'd' : [ ':call luaeval("vim.lsp.buf.hover()")' , 'show documentation' ] ,
"\ 'b' : [ ':Lspsaga lsp_finder' , 'find stuff' ] ,
"\ 'x' : [ ':Lspsaga preview_definition' , 'Preview definition' ] ,
"\ 'o' : [ ':Telescope lsp_document_symbols' , 'symbols in document' ] ,
"\ 's' : [ ':Telescope lsp_workspace_symbols' , 'symbols in workspace' ] ,
"\ 'g' : [ ':call luaeval("vim.lsp.buf.definition()")' , 'go to definition' ] ,
"\ 't' : [ ':call luaeval("vim.lsp.buf.signature_help()")' , 'Show signature help' ] ,
"\ 'i' : [ ':call luaeval("vim.lsp.buf.implementation()")' , 'show implementation' ] ,
"\ 'r' : [ ':call luaeval("vim.lsp.buf.references()")' , 'show references' ] ,
"\ 'n' : [ ':call luaeval("vim.lsp.buf.rename()")' , 'rename' ] ,
"\ 'f' : [ ':call luaeval("vim.lsp.buf.formatting()")' , 'format file' ] ,
"\ 'v' : [ ':call luaeval("vim.lsp.buf.code_action()")' , 'apply codeaction' ] ,
"\ 'e' : [ ':call luaeval("vim.lsp.diagnostic.goto_next()")' , 'Jump to next error' ] ,
"\ 'E' : [ ':call luaeval("vim.lsp.diagnostic.goto_prev()")' , 'Jump to previous error' ] ,
"\ 'a' : [ ':call luaeval("vim.lsp.diagnostic.show_line_diagnostics()")' , 'diagnostics info' ] ,
"\ }
" this is the one!
"let g:which_key_map['m'] = {
"\ 'name' : '+Code-actions' ,
"\ 'd' : [ ':Lspsaga hover_doc' , 'show documentation' ] ,
"\ 'b' : [ ':Lspsaga lsp_finder' , 'find stuff' ] ,
"\ 'x' : [ ':Lspsaga preview_definition' , 'Preview definition' ] ,
"\ 'o' : [ ':Telescope lsp_document_symbols' , 'symbols in document' ] ,
"\ 's' : [ ':Telescope lsp_workspace_symbols' , 'symbols in workspace' ] ,
"\ 'g' : [ ':call luaeval("vim.lsp.buf.definition()")' , 'go to definition' ] ,
"\ 't' : [ ':Lspsaga signature_help' , 'Show signature help' ] ,
"\ 'i' : [ ':call luaeval("vim.lsp.buf.implementation()")' , 'show implementation' ] ,
"\ 'r' : [ ':call luaeval("vim.lsp.buf.references()")' , 'show references' ] ,
"\ 'n' : [ ':Lspsaga rename' , 'rename' ] ,
"\ 'f' : [ ':call luaeval("vim.lsp.buf.formatting()")' , 'format file' ] ,
"\ 'v' : [ ':Lspsaga code_action' , 'apply codeaction' ] ,
"\ 'e' : [ ':call luaeval("vim.lsp.diagnostic.goto_next()")' , 'Jump to the next error' ] ,
"\ 'E' : [ ':Telescope lsp_workspace_diagnostics' , 'List diagnostics' ] ,
"\ 'a' : [ ':Lspsaga show_cursor_diagnostics' , 'Cursor diagnostics' ] ,
"\ 'A' : [ ':Lspsaga show_line_diagnostics' , 'Line diagnostics' ] ,
"\ }
"let g:which_key_map['m'] = {
"\ 'name' : '+Code-actions' ,
"\ 'd' : [ ':call Show_documentation()' , 'show documentation' ] ,
"\ 's' : [ ':CocFzfList symbols' , 'list symbols' ] ,
"\ 'o' : [ ':CocFzfList outline' , 'show outline' ] ,
"\ 'c' : [ ':CocFzfList commands' , 'show all coc-commands' ] ,
"\ 'g' : [ '<Plug>(coc-definition)' , 'go to definition' ] ,
"\ 't' : [ '<Plug>(coc-type-definition)' , 'show type definition' ] ,
"\ 'i' : [ '<Plug>(coc-implementation)' , 'show implementation' ] ,
"\ 'r' : [ '<Plug>(coc-references-used)' , 'show references' ] ,
"\ 'b' : [ '<Plug>(coc-refactor)' , 'refactor' ] ,
"\ 'n' : [ '<Plug>(coc-rename)' , 'rename' ] ,
"\ 'F' : [ '<Plug>(coc-format-selected)' , 'format selection' ] ,
"\ 'f' : [ '<Plug>(coc-format)' , 'format file' ] ,
""\ 'v' : [ ':CocCommand actions.open' , 'apply codeaction' ] ,
"\ 'v' : [ '<Plug>(coc-codeaction-cursor)', 'apply codeaction' ] ,
"\ 'V' : [ '<Plug>(coc-codeaction-line)' , 'codeaction current line'] ,
"\ 'e' : [ ':CocList diagnostics' , 'list all errors' ] ,
"\ 'L' : [ '<Plug>(coc-diagnostic-next)' , 'go to next error' ] ,
"\ 'H' : [ '<Plug>(coc-diagnostic-prev)' , 'go to prev error' ] ,
"\ 'a' : [ '<Plug>(coc-diagnostic-info)' , 'diagnostics info' ] ,
"\ 'O' : [ '<Plug>(coc-openlink)' , 'open link under cursor' ] ,
"\}
"let g:which_key_map['f'] = {
"\ 'name': '+folds',
"\ 'o': [ ':foldopen' , 'open fold' ] ,
"\ 'n': [ ':foldclose' , 'close fold' ] ,
"\ 'j': [ 'zj' , 'jump to next fold' ] ,
"\ 'k': [ 'zk' , 'jump to previous fold' ] ,
"\ }
"" mappings for view and layout
"let g:which_key_map['v'] = {
"\ 'name' : '+view-and-layout',
"\ 'n' : [':set relativenumber!' , 'toggle relative numbers' ] ,
"\ 'm' : [':set nonumber! norelativenumber' , 'toggle numbers'] ,
"\ 'g' : [':Goyo | set linebreak' , 'toggle focus mode' ] ,
"\ 'i' : [':IndentGuidesToggle' , 'toggle indent guides' ] ,
"\ }
"" :bwipeout! bdelete!
""\ 'b' : ['BufferPick' , 'select open buffer' ] ,
""\ 'c' : ['BufferClose', 'close open buffer' ] ,
""\ 'w' : ['BufferWipeout', 'wipeout open buffer' ] ,
"let g:which_key_map['b'] = {
"\ 'name': '+buffers',
"\ 'b' : [':Buffers' , 'select open buffer' ] ,
"\ 'c' : [':bdelete!', 'close open buffer' ] ,
"\ 'w' : [':bwipeout!', 'wipeout open buffer' ] ,
"\ }
"let g:which_key_map['x'] = {
"\ 'name' : '+other',
"\ 'f' : ['NERDTreeToggle' , '<Ctrl+F> show file tree'],
"\ 'p' : ['FZF' , '<Ctrl+p> search file (c-v/c-x to open in split)' ] ,
"\ 'h' : [':History:' , 'search command history'],
"\ 'c' : [':Commands' , 'search through commands'],
"\ 's' : ['OverCommandLine', 'Substitute with preview'],
"\ 'y' : [':CocFzfList yank', 'Show yank history']
"\ }
" CocList -A --normal yank needs :CocInstall coc-yank
"nnoremap <silent> m :<c-u>WhichKey 'm'<CR>
autocmd! VimEnter * :unmap <space>ig
autocmd! FileType which_key
"autocmd! FileType which_key set laststatus=2 noshowmode noruler
"\| autocmd! BufLeave <buffer> set laststatus=2 showmode ruler
"set timeoutlen=200