diff --git a/.gitignore b/.gitignore index 7090f34..cdf53fc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.swp *.swo vim/bundle - +vim/autoload +vim/plugged diff --git a/config/.vimrc b/config/.vimrc index 59917a7..5cc5928 100755 --- a/config/.vimrc +++ b/config/.vimrc @@ -398,29 +398,17 @@ noremap gj """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Plugins " - -" -" Detect Vundle -" -let s:vundle_path = '~/.vim/bundle/Vundle.vim' -if filereadable(expand('C:/devel/scripts/vim/bundle/Vundle.vim/README.md')) - let s:vundle_path = 'C:/devel/scripts/vim/bundle/Vundle.vim' -endif - -" -" Vundle stuff here. -" -if filereadable(expand(s:vundle_path.'/README.md')) - filetype off - let &rtp=&rtp.','.s:vundle_path - call vundle#begin() - Plugin 'VundleVim/Vundle.vim' +if filereadable(expand("~/.vim/autoload/plug.vim")) + " Specify a directory for plugins + " - For Neovim: stdpath('data') . '/plugged' + " - Avoid using standard Vim directory names like 'plugin' + call plug#begin('~/.vim/plugged') " " Adds nice status and tabline. " - Plugin 'vim-airline/vim-airline' - "Plugin 'vim-airline/vim-airline-themes' + Plug 'vim-airline/vim-airline' + Plug 'vim-airline/vim-airline-themes' let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#left_sep = ' ' let g:airline#extensions#tabline#left_alt_sep = '|' @@ -428,7 +416,7 @@ if filereadable(expand(s:vundle_path.'/README.md')) " - Plugin 'scrooloose/nerdtree' + Plug 'scrooloose/nerdtree' let g:NERDTreeQuitOnOpen = 1 let g:NERDTreeDirArrows = 1 let g:NERDTreeDirArrowExpandable = '+' @@ -439,7 +427,7 @@ if filereadable(expand(s:vundle_path.'/README.md')) " " Commented out in favour of NERDTree " - "Plugin 'eiginn/netrw' + "Plug 'eiginn/netrw' "let g:netrw_altv = 1 "let g:netrw_fastbrowse = 2 "let g:netrw_keepdir = 0 @@ -452,7 +440,7 @@ if filereadable(expand(s:vundle_path.'/README.md')) " " Manipulation with buffers and tabs. " - Plugin 'vim-scripts/Buffergator' + Plug 'vim-scripts/Buffergator' let g:buffergator_autodismiss_on_select = 0 let g:buffergator_autoupdate = 1 let g:buffergator_suppress_keymaps = 1 @@ -475,7 +463,7 @@ if filereadable(expand(s:vundle_path.'/README.md')) " cursor (e.g. on switches to foo.cpp) " ihn cycles through matches " - Plugin 'vim-scripts/a.vim' + Plug 'vim-scripts/a.vim' let g:alternateExtensions_h = "cpp,c" let g:alternateExtensions_cpp = "h" let g:alternateExtensions_c = "h" @@ -484,31 +472,31 @@ if filereadable(expand(s:vundle_path.'/README.md')) " " Tmux integration. " - Plugin 'benmills/vimux' + Plug 'benmills/vimux' " " Extends modeline to variables. " Needed by CF5 compile to read options right from file. " - Plugin 'vim-scripts/let-modeline.vim' + Plug 'vim-scripts/let-modeline.vim' " " CF5 compile. " Compiling cpp files without make file. " - Plugin 'vishap/cf5-compile' + Plug 'vishap/cf5-compile' map ac :call CF5CompileOnly() map ar :call CF5CompileAndRun() " " Provide templates " - Plugin 'aperezdc/vim-template' + Plug 'aperezdc/vim-template' "let g:templates_no_autocmd = 1 let g:templates_no_builtin_templates = 1 " " Local vimrc " - Plugin 'embear/vim-localvimrc' + Plug 'embear/vim-localvimrc' let g:localvimrc_name = [ ".vimrc.local" ] let g:localvimrc_ask = 0 @@ -516,15 +504,17 @@ if filereadable(expand(s:vundle_path.'/README.md')) " Comment code. " gc - visual mode - comment selection. " - Plugin 'tpope/vim-commentary' + Plug 'tpope/vim-commentary' + Plug 'tpope/vim-surround' + " Plug 'tpope/vim-repeat' nmap al CommentaryLine vmap al Commentary " " Git wrapper. " - Plugin 'tpope/vim-fugitive' - nmap git :Git - nmap gst :Gstatus + Plug 'tpope/vim-fugitive' + " nmap git :Git + " nmap gst :Gstatus " " Shows git diff. " [c - jump prev diff @@ -538,7 +528,7 @@ if filereadable(expand(s:vundle_path.'/README.md')) " :GitGutterToggle " :GitGutterLineHighlightsToggle " - Plugin 'airblade/vim-gitgutter' + Plug 'airblade/vim-gitgutter' let g:gitgutter_map_keys = 0 let g:gitgutter_realtime = 0 let g:gitgutter_eager = 0 @@ -547,7 +537,7 @@ if filereadable(expand(s:vundle_path.'/README.md')) " " Check syntaxis on fly. " - "Plugin 'scrooloose/syntastic' + "Plug 'scrooloose/syntastic' "let g:syntastic_cpp_compiler_options = ' -std=c++1y' "let g:syntastic_mode_map = { " \ "mode": "active", @@ -559,29 +549,16 @@ if filereadable(expand(s:vundle_path.'/README.md')) " Actual colorscheme is set outside as vundle resets it. " if &t_Co >= 256 || has('gui_running') - Plugin 'nanotech/jellybeans.vim' + Plug 'nanotech/jellybeans.vim' let g:jellybeans_use_lowcolor_black = 0 let g:jellybeans_use_gui_italics = 0 "colorscheme jellybeans endif - if &t_Co >= 256 || has('gui_running') - Plugin 'altercation/vim-colors-solarized.git' - let g:solarized_termcolors=256 - "set backgroung=dark - "set backgroung=light - "colorscheme solarized - endif - if &t_Co >= 256 || has('gui_running') - Plugin 'morhetz/gruvbox.git' - "set backgroung=dark - "set backgroung=light - "colorscheme solarized - endif " " :set syntax=cpp.doxygen to highlight doxygen comments. " - Plugin 'vim-scripts/DoxyGen-Syntax' + Plug 'vim-scripts/DoxyGen-Syntax' " " In vim, place the cursor on the line and " :DoxLic - generates license comment. @@ -591,24 +568,47 @@ if filereadable(expand(s:vundle_path.'/README.md')) " DEBUG. " :DoxBlock - " - Plugin 'vim-scripts/DoxygenToolkit.vim' + Plug 'vim-scripts/DoxygenToolkit.vim' " " Color table and picker. " :XtermColorTable " press: # to yank, t to toggle, f to set text color " - "Plugin 'xterm-color-table.vim' + "Plug 'xterm-color-table.vim' " Promising GDB manager. " - Plugin 'vim-scripts/gdbmgr' + Plug 'vim-scripts/gdbmgr' + " Completion " - call vundle#end() - filetype plugin indent on - filetype plugin on + Plug 'neoclide/coc.nvim', {'branch': 'release'} + " See configuration below + Plug 'w0rp/ale' + " Set up hack support through vim-hack and ale + let g:ale_hack_hack_executable = 'hh' + let g:ale_linters = { 'hack': ['hack', 'aurora'] } + let g:ale_echo_msg_format = '[%linter%]% [code]% %s' + " Set up haskell support though ale + " Some suggestions oh how it works. + " First start haxlsh with `haxlsh --lsp` + " Then start `sigma_lsp` (proxy for the LSP client) + " Load the module in haxlsh and voila + " Some wiki: https://fburl.com/wiki/grt9tzi1 + let g:ale_haskell_hie_executable = 'sigma_lsp' + " let g:ale_haskell_hie_executable = '/home/nedyalkop/nedy_sigma_lsp' + let g:ale_haskell_hdevtools_options = '' + " Set up IDE type bindings with ALE + nnoremap K :ALEHover + nnoremap . :ALEGoToDefinition + nnoremap fr :ALEFindReferences + + Plug 'hhvm/vim-hack' + Plug 'raichoo/haskell-vim' + endif +call plug#end() " " Vundle resets this if set inside vundle section. @@ -621,21 +621,21 @@ endif if exists("dddd") -"Plugin 'Rip-Rip/clang_complete' -"Plugin 'flazz/vim-colorschemes' -"Plugin 'Valloric/YouCompleteMe' -"Plugin 'rhysd/vim-clang-format' -Plugin 'vim-scripts/Mark' -Plugin 'danro/rename.vim' -Plugin 'kana/vim-operator-user' +"Plug 'Rip-Rip/clang_complete' +"Plug 'flazz/vim-colorschemes' +"Plug 'Valloric/YouCompleteMe' +"Plug 'rhysd/vim-clang-format' +Plug 'vim-scripts/Mark' +Plug 'danro/rename.vim' +Plug 'kana/vim-operator-user' -Plugin 'kien/ctrlp.vim' +Plug 'kien/ctrlp.vim' let g:ctrlp_root_markers = ['.ctrlp'] let g:ctrlp_custom_ignore = { \ 'file': '\v\.(o|d|dd)$', \ } -Plugin 'majutsushi/tagbar' +Plug 'majutsushi/tagbar' map :TagbarToggle let g:tagbar_autoclose = 1 let g:tagbar_autofocus = 1 @@ -646,19 +646,19 @@ let g:tagbar_sort = 1 let g:tagbar_width = 60 let g:tagbar_ctags_bin = "/opt/swt/bin/ctags" -Plugin 'mattn/emmet-vim' -Plugin 'tmhedberg/matchit' -Plugin 'tpope/vim-dispatch' -Plugin 'tpope/vim-unimpaired' -Plugin 'vim-scripts/Align' -Plugin 'vim-scripts/taglist.vim' -Plugin 'vim-scripts/xml.vim' -Plugin 'junegunn/vim-easy-align' -Plugin 'ntpeters/vim-better-whitespace' +Plug 'mattn/emmet-vim' +Plug 'tmhedberg/matchit' +Plug 'tpope/vim-dispatch' +Plug 'tpope/vim-unimpaired' +Plug 'vim-scripts/Align' +Plug 'vim-scripts/taglist.vim' +Plug 'vim-scripts/xml.vim' +Plug 'junegunn/vim-easy-align' +Plug 'ntpeters/vim-better-whitespace' let g:strip_whitespace_on_save = 1 -"Plugin 'vim-scripts/TagHighlight' -"Plugin 'gcmt/taboo.vim' +"Plug 'vim-scripts/TagHighlight' +"Plug 'gcmt/taboo.vim' "let g:taboo_tab_format = "[%m:%N:%W] %f" " - - - - - - - - - - - - - - @@ -667,10 +667,137 @@ let g:strip_whitespace_on_save = 1 let g:Powerline_symbols = "unicode" " Ack -Plugin 'mileszs/ack.vim' +Plug 'mileszs/ack.vim' let g:ack_default_options = " --ignore-file=is:tags -s -H --nocolor --nogroup --column" let g:ack_highlight = 1 endif + + +"------------------------------------------------------------ +" COC configuration +" +if 1 + " 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 qf (coc-fix-current) + + " 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 +endif diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..a2b97e9 --- /dev/null +++ b/install.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +if [ ! -z "$1" ]; then + SCRIPTS=$1 +else + SCRIPTS=${HOME}/devel/scripts +fi + +find ${SCRIPTS}/config -name .\* -type f -exec ln \{\} . \; + +#mkdir -p .vim/autoload .vim/bundle +curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ + https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim +# curl -LSso .vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim +# git clone https://github.com/VundleVim/Vundle.vim.git .vim/bundle/Vundle.vim + + +# [ -x ~/.bashrc.vahagn ] && source ~/.bashrc.vahagn