clean and stuff

This commit is contained in:
Christian Nieves
2023-07-12 21:32:04 -05:00
parent ab28a85172
commit ff24d719b1
11 changed files with 66 additions and 388 deletions

View File

@ -1,172 +0,0 @@
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'IngoMeyer441/coc_current_word'
" Set internal encoding of vim, not needed on neovim, since coc.nvim using some
" unicode characters in the file autoload/float.vim
set encoding=utf-8
" TextEdit might fail if hidden is not set.
set hidden
" Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup
" Give more space for displaying messages.
set cmdheight=2
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300
" Don't pass messages to |ins-completion-menu|.
set shortmess+=c
" Formatting selected code.
" xmap <leader>f <Plug>(coc-format-selected)
" nmap <leader>f <Plug>(coc-format-selected)
nmap <leader>rn <Plug>(coc-rename)
" pc = pick color
nmap <leader>pc :call CocAction('pickColor')<CR>
" yaml outline
nmap <leader>yo <C-S-O><cr>
nmap <leader>pm :CocCommand markdown-preview-enhanced.openPreview
nmap <leader>cr :CocRestart<CR>
" let g:node_client_debug = 1
let g:coc_global_extensions = [ 'coc-emoji', 'coc-eslint', 'coc-tsserver', 'coc-tslint', 'coc-tslint-plugin', 'coc-css', 'coc-json', 'coc-pyls', 'coc-yaml', 'coc-html', 'coc-go', 'coc-git', 'coc-css', 'coc-sql', 'coc-sh', 'coc-rust-analyzer', 'coc-java', 'coc-kotlin', 'coc-explorer', 'coc-highlight', 'coc-marketplace', 'coc-zi', 'coc-syntax', 'coc-fzf-preview', 'coc-mocword']
" Don't pass messages to |ins-completion-menu|.
set shortmess+=c
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
if has("nvim-0.5.0") || has("patch-8.1.1564")
" Recently vim can merge signcolumn and number column into one
set signcolumn=number
else
set signcolumn=yes
endif
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
" Make <CR> auto-select the first completion item and notify coc.nvim to
" format on enter, <cr> could be remapped by other vim plugin
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
" Applying codeAction to the selected region.
" Example: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
vmap <leader>a <Plug>(coc-codeaction-selected)
" Remap keys for applying codeAction to the current buffer.
nmap <leader>ca <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>qf <Plug>(coc-fix-current)
" Run the Code Lens action on the current line.
nmap <leader>cl <Plug>(coc-codelens-action)
"" Remap for do codeAction of selected region
function! s:cocActionsOpenFromSelected(type) abort
execute 'CocCommand actions.open ' . a:type
endfunction
" Use `[g` and `]g` to navigate diagnostics
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" Remap keys for gotos
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)
" Apply AutoFix to problem on the current line.
nmap <leader>qf <Plug>(coc-fix-current)
" 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)
" We're going to define single-letter keymaps, so don't try to define them
" in the terminal window. The debugger CLI should continue accepting text commands.
function! NvimGdbNoTKeymaps()
tnoremap <silent> <buffer> <esc> <c-\><c-n>
endfunction
let g:nvimgdb_config_override = {
\ 'key_next': 'n',
\ 'key_step': 's',
\ 'key_finish': 'f',
\ 'key_continue': 'c',
\ 'key_until': 'u',
\ 'key_breakpoint': 'b',
\ 'set_tkeymaps': "NvimGdbNoTKeymaps",
\ }
" Use K to show documentation in preview window.
nnoremap <silent> L :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
elseif (coc#rpc#ready())
call CocActionAsync('doHover')
else
execute '!' . &keywordprg . " " . expand('<cword>')
endif
endfunction
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
" Apply AutoFix to problem on the current line.
nmap <leader>qf <Plug>(coc-fix-current)
nmap zg :CocCommand cSpell.addWordToDictionary<CR>
" Mappings for CoCList
" Show all diagnostics.
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
" Manage extensions.
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr>
" Show commands.
nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr>
" Find symbol of current document.
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr>
" Search workspace symbols.
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
" Resume latest coc list.
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>

View File

@ -1,42 +0,0 @@
" -------- CTRL-P --------
let g:ctrlp_map = '<c-o>'
let g:ctrlp_show_hidden = 1
let g:ctrlp_working_path_mode = 'ra'
set wildignore+=*/tmp/*,*.so,*.swo,*.swp,*.zip,*.o,*.d " MacOSX/Linux
"let g:ctrlp_custom_ignore = '\v[\/](vendor|node_modules|target|dist|build)|(\.(swp|ico|git|svn))$'
let g:ctrlp_custom_ignore = {
\ 'dir': 'vendor\|node_modules\|target\|dist\|build\|mntdeps',
\'file': '\v\.(swp|ico|git|svn|exe)'
\ }
"let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
let g:ctrlp_extensions = ['smarttabs']
let g:ctrlp_switch_buffer = 'ETVH'
let g:ctrlp_open_new_file = 't'
" Let CtrlP not go all the way up to the root of the client. Instead, consider a
" METADATA file to delimit a project.
let g:ctrlp_root_markers = ['METADATA']
" CtrlP auto cache clearing.
function! SetupCtrlP()
if exists("g:loaded_ctrlp") && g:loaded_ctrlp
augroup CtrlPExtension
autocmd!
autocmd FocusGained * CtrlPClearCache
autocmd BufWritePost * CtrlPClearCache
augroup END
endif
endfunction
if has("autocmd")
autocmd VimEnter * :call SetupCtrlP()
endif
" Ripgrep (rg) is a super fast search utility
" Use rg for ctrl-p plugin
if executable('rg')
set grepprg=rg\ --hidden\ --color=never
let g:ctrlp_use_caching = 0
let g:ctrlp_user_command = 'rg --files --hidden --color=never * %s'
endif

View File

@ -1,30 +0,0 @@
"nnoremap <silent> <C-p> :FZF -m<cr>
"let $FZF_DEFAULT_COMMAND = 'ag -g ""'
" nmap <C-P> :FZF<CR>
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
let g:fzf_preview_window = ['right:50%', 'ctrl-/']
let g:fzf_history_dir = '~/.local/share/fzf-history'
let g:fzf_command_prefix = 'Fzf'
" use the same keybindings for fzf as in shell
" nnoremap <silent> <c-s-t> :FzfHgFiles<CR>
" nnoremap <silent> <c-s-f> :FzfHgRg<space>
let s:hg_command = 'hg pstatus -ma -n --template= -- 2>/dev/null'
let s:rg_command = 'rg --ignore-case --hidden --follow --color auto --line-number'
command! -bang FzfHgFiles
\ call fzf#run(fzf#wrap({
\ 'source': s:hg_command,
\ }),
\ <bang>0
\ )
command! -bang -nargs=* ClSearch
\ call fzf#vim#grep(
\ s:rg_command . " " . <q-args> . " " . "$(" . s:hg_command . ")", 1,
\ <bang>0 ? fzf#vim#with_preview('up:60%')
\ : fzf#vim#with_preview('right:50%'),
\ <bang>0)

View File

View File

@ -18,20 +18,12 @@ vmap <leader>` c`<C-R>"`<ESC>
" unhilight search
nnoremap <leader><space> :nohlsearch<CR>
" EZ Ack search
" nnoremap <leader>a :Ack!<Space>
" nnoremap <leader>A :Ack!<Space> <C-r><C-w>
" --------- CLIPBOARD MAPPINGS ---------
" Paste from OS clipboard
map <leader>v i<ESC>"+pa<ESC>
vmap <leader>v c<ESC>"+p<ESC>
imap <leader>v <ESC>"+pa
" Copy to OS clipboard
" vnoremap <leader>y "yy <Bar> :call system('xclip', @y)<CR>
" map <leader>y "yy <Bar> :call system('xclip', @y)<CR>
" --------- WINDOW/PANE MAPPINGS ---------
map <leader>wr <C-W>r
map <leader>H :wincmd H<cr>
@ -48,31 +40,11 @@ nnoremap <silent> <Leader>s- :exe "vertical resize " . (winwidth(0) * 4/5)<CR>
nnoremap <silent> <Leader>x+ :exe "resize " . (winheight(0) * 3/2)<CR>
nnoremap <silent> <Leader>x- :exe "resize " . (winheight(0) * 2/3)<CR>
" --------- FORMATTING MAPPINGS ---------
" indent file
map <leader>= gg=G ``
" format HTML/JSON
map <leader>fh :%s/>\s*</>\r</g<cr>
map <leader>fj :%!python -m json.tool<cr>
map <leader>fjs :call UnMinify()<cr>
"command! UnMinify call UnMinify()
function! UnMinify()
%s/{\ze[^\r\n]/{\r/g
%s/){/) {/g
%s/};\?\ze[^\r\n]/\0\r/g
%s/;\ze[^\r\n]/;\r/g
%s/[^\s]\zs[=&|]\+\ze[^\s]/ \0 /g
normal ggVG=
endfunction
nmap <leader>toi :CocCommand tsserver.organizeImports<cr>
nmap <leader>yf :let @+ = expand("%")<cr>
nmap <leader>ut :UndotreeToggle<cr>
nmap <leader>e :e %%
" replace currently selected text with default register
@ -81,16 +53,6 @@ vnoremap <leader>p "_dP
nnoremap <leader>rp :VimuxOpenRunner<cr> :VimuxRunCommand '!!'<cr> :call VimuxSendKeys("Enter")<cr>
"Showing highlight groups
" nmap <leader>sp :call <SID>SynStack()<CR>
nmap <leader>shg :call <SID>SynStack()<CR>
function! <SID>SynStack()
if !exists("*synstack")
return
endif
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunc
nnoremap <leader>s :SessionSave<CR>
" copy to attached terminal using the yank(1) script:

View File

@ -1,36 +0,0 @@
Glug youcompleteme-google
let g:ycm_key_invoke_completion = '<C-Space>'
let g:ycm_filetype_specific_completion_to_disable = {'cpp': 1, 'c': 1}
let g:ycm_language_server =
\ [
\ {
\ 'name': 'ciderlsp',
\ 'cmdline': [ '/google/bin/releases/cider/ciderlsp/ciderlsp', '--noforward_sync_responses' ],
\ 'filetypes': [ 'java' ]
\ },
\ ]
nmap <silent> gd :YcmCompleter GoToDeclaration<CR>
nmap <silent> gt :YcmCompleter GetType<CR>
nmap <silent> gr :YcmCompleter GoToReferences<CR>
nmap <leader>qf :YcmCompleter FixIt<CR>
nmap <leader>rn :YcmCompleter RefactorRename<space>
let s:ycm_hover_popup = -1
function s:Hover()
let response = youcompleteme#GetCommandResponse( 'GetDoc' )
if response == ''
return
endif
call popup_hide( s:ycm_hover_popup )
let s:ycm_hover_popup = popup_atcursor( balloon_split( response ), {} )
endfunction
" CursorHold triggers in normal mode after a delay
autocmd CursorHold * call s:Hover()
" Or, if you prefer, a mapping:
" nnoremap <silent> <leader>D :call <SID>Hover()<CR>
nnoremap <silent> <leader>D <plug>(YCMHover)