diff --git a/vim/vimrc b/vim/vimrc index 4ed7c0e..0798242 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -1,23 +1,3 @@ -" General settings {{{1 -nnoremap -let mapleader=' ' - -set number -set cursorline -set nocompatible -filetype plugin on -syntax on - -set expandtab -let shiftwidth=2 -let tabstop=2 -set autoindent - -" Folding {{{2 -set foldenable -set foldmethod=marker -nnoremap za - " Plugin configuration {{{1 if empty(glob('~/.vim/autoload/plug.vim')) @@ -30,16 +10,23 @@ call plug#begin('~/.vim/plugged') Plug 'itchyny/lightline.vim' Plug 'scrooloose/nerdtree' +Plug 'Xuyuanp/nerdtree-git-plugin' Plug 'ctrlpvim/ctrlp.vim' -" Language support +" Language and filetype support +" i3 config files +Plug 'mboughaba/i3config.vim' +" CSS Color highlight +Plug 'ap/vim-css-color' " > Ansible Plug 'pearofducks/ansible-vim' " > JavaScript -Plug 'Quramy/vim-js-pretty-template' +" Plug 'Quramy/vim-js-pretty-template' " > TypeScript Plug 'leafgarland/typescript-vim' -Plug 'Quramy/tsuquyomi' " Completion +"Plug 'Quramy/tsuquyomi' " Completion +" +Plug 'neoclide/coc.nvim', {'branch': 'release'} " Git integration @@ -49,14 +36,17 @@ Plug 'vimwiki/vimwiki' "Plug 'tbabej/taskwiki' " Colorscheme -Plug 'arcticicestudio/nord-vim' +" Plug 'arcticicestudio/nord-vim' +" Plug 'altercation/vim-colors-solarized' +Plug 'ajh17/Spacegray.vim' +Plug 'cocopon/iceberg.vim' call plug#end() " Plugin config for: lightline {{{2 set laststatus=2 let g:lightline={ - \ 'colorscheme': 'nord' } + \ 'colorscheme': 'iceberg' } let g:lightline.active = { \ 'left': [ [ 'mode', 'paste' ], \ [ 'readonly', 'relativepath', 'modified' ] ], @@ -73,15 +63,22 @@ let g:lightline.tabline = { " Plugin config for: Nerdtree {{{2 +let g:NERDTreeWinSize=50 map :NERDTreeToggle +nnoremap gn :NERDTreeFind " Plugin config for: vimwiki {{{2 +let wiki_private = {} +let wiki_private.path = '~/Documents/Notizen' +let wiki_private.syntax = 'markdown' +let wiki_private.ext = 'md' + let wiki_iteratec = {} let wiki_iteratec.path = '~/Documents/iteratec/Notes' let wiki_iteratec.syntax = 'markdown' let wiki_iteratec.ext = 'md' -let g:vimwiki_list = [wiki_iteratec] +let g:vimwiki_list = [wiki_private,wiki_iteratec] let g:vimwiki_ext2syntax = {'.md': 'markdown'} let g:vimwiki_folding = 'expr' @@ -100,10 +97,12 @@ let g:vimwiki_folding = 'expr' " Plugin config for: CtrlP {{{2 " Setup some default ignores let g:ctrlp_custom_ignore = { - \ 'dir': '\v[\/](\.(git|hg|svn)|\_site)$', + \ 'dir': '\v[\/](\.(git|hg|svn)|\_site|build|buildSrc|node_modules)$', \ 'file': '\v\.(exe|so|dll|class|png|jpg|jpeg)$', \} +let g:ctrlp_max_files = 50000 + " Use the nearest .git directory as the cwd " This makes a lot of sense if you are working on a project that is in version " control. It also supports works with .svn, .hg, .bzr. @@ -117,14 +116,173 @@ nmap bb :CtrlPBuffer nmap bm :CtrlPMixed nmap bs :CtrlPMRU +" Plugin config for: coc.nvim {{{2 +" if hidden is not set, TextEdit might fail. +set hidden +" Some servers have issues with backup files, see #649 +set nobackup +set nowritebackup +" Better display for messages +set cmdheight=2 +" You will have bad experience for diagnostic messages when it's default 4000. +set updatetime=300 +" don't give |ins-completion-menu| messages. +set shortmess+=c +" always show signcolumns +set signcolumn=yes + +" Use tab for trigger completion with characters ahead and navigate. +" Use command ':verbose imap ' to make sure tab is not mapped by other plugin. +inoremap + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() +inoremap pumvisible() ? "\" : "\" + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" Use to trigger completion. +inoremap coc#refresh() + +" Use to confirm completion, `u` means break undo chain at current position. +" Coc only does snippet and additional edit on confirm. +inoremap pumvisible() ? "\" : "\u\" + +" Use `[c` and `]c` to navigate diagnostics +nmap [c (coc-diagnostic-prev) +nmap ]c (coc-diagnostic-next) + +" Remap keys for gotos +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +" Use K to show documentation in preview window +nnoremap K :call show_documentation() + +function! s:show_documentation() + if (index(['vim','help'], &filetype) >= 0) + execute 'h '.expand('') + else + call CocAction('doHover') + endif +endfunction + +" Highlight symbol under cursor on CursorHold +autocmd CursorHold * silent call CocActionAsync('highlight') + +" Remap for rename current word +nmap rn (coc-rename) + +" Remap for format selected region +" xmap f (coc-format-selected) +" nmap f (coc-format-selected) + +augroup mygroup + autocmd! + " Setup formatexpr specified filetype(s). + autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') + " Update signature help on jump placeholder + autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') +augroup end + +" Remap for do codeAction of selected region, ex: `aap` for current paragraph +xmap a (coc-codeaction-selected) +nmap a (coc-codeaction-selected) + +" Remap for do codeAction of current line +nmap ac (coc-codeaction) +" Fix autofix problem of current line +nmap f :CocFix + +" Use for select selections ranges, needs server support, like: coc-tsserver, coc-python +nmap (coc-range-select) +xmap (coc-range-select) +xmap (coc-range-select-backword) + +" Use `:Format` to format current buffer +command! -nargs=0 Format :call CocAction('format') + +" Use `:Fold` to fold current buffer +command! -nargs=? Fold :call CocAction('fold', ) + +" use `:OR` for organize import of current buffer +command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') + +" Add status line support, for integration with other plugin, checkout `:h coc-status` +set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} + +" Using CocList +" Show all diagnostics +nnoremap a :CocList diagnostics +" Manage extensions +nnoremap e :CocList extensions +" Show commands +nnoremap c :CocList commands +" Find symbol of current document +nnoremap o :CocList outline +" Search workspace symbols +nnoremap s :CocList -I symbols +" Do default action for next item. +nnoremap j :CocNext +" Do default action for previous item. +nnoremap k :CocPrev +" Resume latest coc list +nnoremap p :CocListResume + + " Plugin config for: vim-js-pretty-template {{{2 -autocmd FileType typescript JsPreTmpl -autocmd FileType typescript syn clear foldBraces " For leafgarland/typescript-vim users only. Please see #1 for details. +"autocmd FileType typescript JsPreTmpl +"autocmd FileType typescript syn clear foldBraces " For leafgarland/typescript-vim users only. Please see #1 for details. +" Plugin config for: tsuquyomi {{{2 +" nnoremap td :TsuDefinition +" nnoremap tt :TsuTypeDefinition +" nnoremap tr :TsuReferences +" nnoremap ti :TsuImplementation +" nnoremap tf :TsuSearch " Plugin config for: nord-vim {{{2 let g:nord_cursor_line_number_background = 1 let g:nord_bold_vertical_split_line = 1 let g:nord_uniform_diff_background = 1 -colorscheme nord +"colorscheme nord + +" Plugin config for: solorarized theme {{{2 +"syntax enable +"set background=dark +"colorscheme solarized + + +" Plugin config for: iceberg theme {{{2 +colorscheme iceberg + +" General settings {{{1 +nnoremap +let mapleader=' ' + +set number +set cursorline +set nowrap + +filetype plugin on +syntax on + +set shiftwidth=2 +set tabstop=2 +set expandtab + +set autoindent +set smartindent + +set listchars=tab:>-,trail:~,extends:>,precedes:< +set list +" Folding {{{2 +set foldenable +set foldmethod=marker +nnoremap za