Last active
June 26, 2020 07:11
-
-
Save 0x0efe/0329471115e2a90209e6f68450453ce7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Editor settings | |
" ----------------------------------------------------------------------------- | |
syntax on | |
set number | |
set relativenumber | |
set ruler | |
set cursorline | |
set modeline | |
set vb | |
set incsearch | |
set hlsearch | |
set sw=2 | |
set expandtab | |
set smarttab | |
set encoding=utf-8 | |
set termencoding=utf-8 | |
set textwidth=0 | |
set wrapmargin=0 | |
set nowrap | |
set nolist " Unset by default | |
set listchars=tab:→\ ,space:·,nbsp:␣,trail:•,eol:¶,precedes:«,extends:» | |
" Plugins | |
" ----------------------------------------------------------------------------- | |
call plug#begin('~/.vim/plugged') | |
"" Dev | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
"" Scala | |
Plug 'scalameta/coc-metals', {'do': 'yarn install --frozen-lockfile'} | |
"" Haskell | |
Plug 'neovimhaskell/haskell-vim' | |
Plug 'alx741/vim-hindent' | |
"" Status line | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
let g:airline_powerline_fonts = 1 | |
let g:airline_theme='simple' | |
let g:airline#extensions#tabline#enabled = 1 | |
"" Tree | |
Plug 'scrooloose/nerdtree' | |
Plug 'xuyuanp/nerdtree-git-plugin' | |
"" Snippets | |
Plug 'MarcWeber/vim-addon-mw-utils' | |
Plug 'tomtom/tlib_vim' | |
Plug 'garbas/vim-snipmate' | |
"" Tools | |
Plug 'ctrlpvim/ctrlp.vim' | |
Plug 'tpope/vim-fugitive' | |
Plug 'flazz/vim-colorschemes' | |
call plug#end() | |
" Color settings | |
" ----------------------------------------------------------------------------- | |
colorscheme iceberg | |
" Shortcuts | |
" ----------------------------------------------------------------------------- | |
nnoremap <F1> <C-W>w | |
nmap <F2> :NERDTreeToggle<CR> | |
nmap <F3> :NERDTreeFocus<CR> | |
map <F12> :bn<CR> | |
map <F11> :bp<CR> | |
function ToggleWhitespace() | |
if &list == '0' | |
echom "Showing invisible characters" | |
execute 'set list' | |
else | |
echom "Hiding invisible characters" | |
execute 'set nolist' | |
endif | |
endfunction | |
nmap <F6> :call ToggleWhitespace()<CR> | |
" Search settings | |
" ----------------------------------------------------------------------------- | |
let g:ctrlp_working_path_mode='ra' | |
let g:ctrlp_use_caching=0 | |
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files'] | |
let g:ctrlp_custom_ignore = { | |
\ 'dir': '\v[\/]\.(git)$', | |
\ 'file': '\v\.(class)$' | |
\ } | |
set wildignore+=*/tmp/*,*.so,*.swp,*.zipl | |
" CoC Setup | |
" ----------------------------------------------------------------------------- | |
set hidden | |
set nobackup | |
set nowritebackup | |
set updatetime=300 | |
set shortmess+=c | |
set signcolumn=yes | |
au BufRead,BufNewFile *.sbt,*.sc set filetype=scala | |
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 | |
inoremap <silent><expr> <c-space> coc#refresh() | |
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | |
nmap <silent> [g <Plug>(coc-diagnostic-prev) | |
nmap <silent> ]g <Plug>(coc-diagnostic-next) | |
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) | |
nmap <Leader>ws <Plug>(coc-metals-expand-decoration) | |
nnoremap <silent> K :call <SID>show_documentation()<CR> | |
function! s:show_documentation() | |
if (index(['vim','help'], &filetype) >= 0) | |
execute 'h '.expand('<cword>') | |
else | |
call CocAction('doHover') | |
endif | |
endfunction | |
autocmd CursorHold * silent call CocActionAsync('highlight') | |
nmap <leader>rn <Plug>(coc-rename) | |
xmap <leader>f <Plug>(coc-format-selected) | |
nmap <leader>f <Plug>(coc-format-selected) | |
augroup mygroup | |
autocmd! | |
autocmd FileType scala setl formatexpr=CocAction('formatSelected') | |
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') | |
augroup end | |
xmap <leader>a <Plug>(coc-codeaction-selected) | |
nmap <leader>a <Plug>(coc-codeaction-selected) | |
nmap <leader>ac <Plug>(coc-codeaction) | |
nmap <leader>qf <Plug>(coc-fix-current) | |
command! -nargs=0 Format :call CocAction('format') | |
command! -nargs=? Fold :call CocAction('fold', <f-args>) | |
nnoremap <leader>cl :<C-u>call CocActionAsync('codeLensAction')<CR> | |
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr> | |
nnoremap <silent> <space>e :<C-u>CocList extensions<cr> | |
nnoremap <silent> <space>c :<C-u>CocList commands<cr> | |
nnoremap <silent> <space>o :<C-u>CocList outline<cr> | |
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr> | |
nnoremap <silent> <space>j :<C-u>CocNext<CR> | |
nnoremap <silent> <space>k :<C-u>CocPrev<CR> | |
nnoremap <silent> <space>p :<C-u>CocListResume<CR> | |
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() | |
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>" | |
nnoremap <silent> <space>t :<C-u>CocCommand metals.tvp<CR> | |
nnoremap <silent> <space>tp :<C-u>CocCommand metals.tvp metalsPackages<CR> | |
nnoremap <silent> <space>tc :<C-u>CocCommand metals.tvp metalsCompile<CR> | |
nnoremap <silent> <space>tb :<C-u>CocCommand metals.tvp metalsBuild<CR> | |
nnoremap <silent> <space>tf :<C-u>CocCommand metals.revealInTreeView metalsPackages<CR> | |
nmap <Leader>ws <Plug>(coc-metals-expand-decoration) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
coc-settings.json