" Fisa-nvim-config " http://nvim.fisadev.com " version: 9.5 beta " TODO current problems: " * end key not working undef tmux+fish " ============================================================================ " Vim-plug initialization " Avoid modify this section, unless you are very sure of what you are doing let vim_plug_just_installed = 0 let vim_plug_path = expand('~/.config/nvim/autoload/plug.vim') if !filereadable(vim_plug_path) echo "Installing Vim-plug..." echo "" silent !mkdir -p ~/.config/nvim/autoload silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim let vim_plug_just_installed = 1 endif " manually load vim-plug the first time if vim_plug_just_installed :execute 'source '.fnameescape(vim_plug_path) endif " Obscure hacks done, you can now modify the rest of the .vimrc as you wish :) " ============================================================================ " Active plugins " You can disable or add new ones here: " this needs to be here, so vim-plug knows we are declaring the plugins we " want to use call plug#begin('~/.config/nvim/plugged') " Now the actual plugins: Plug 'ntpeters/vim-better-whitespace' Plug 'lervag/vimtex' " Override configs by directory Plug 'arielrossanigo/dir-configs-override.vim' " Code commenter Plug 'scrooloose/nerdcommenter' " Better file browser Plug 'scrooloose/nerdtree' " Class/module browser Plug 'majutsushi/tagbar' " TODO known problems: " * current block not refreshing " Search results counter Plug 'vim-scripts/IndexedSearch' " Terminal Vim with 256 colors colorscheme Plug 'patstockwell/vim-monokai-tasty' " Airline Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' " Code and files fuzzy finder " Plug 'ctrlpvim/ctrlp.vim' " Extension to ctrlp, for fuzzy command finder " Plug 'fisadev/vim-ctrlp-cmdpalette' Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' " Pending tasks list Plug 'fisadev/FixedTaskList.vim' " Async autocompletion "Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } " Completion from other opened files "Plug 'Shougo/context_filetype.vim' " Python autocompletion "Plug 'zchee/deoplete-jedi', { 'do': ':UpdateRemotePlugins' } " Just to add the python go-to-definition and similar features, autocompletion " from this plugin is disabled "Plug 'davidhalter/jedi-vim' Plug 'neoclide/coc.nvim', {'branch': 'release'} " Use tab for trigger completion with characters ahead and navigate. " NOTE: Use command ':verbose imap ' to make sure tab is not mapped by " other plugin before putting this into your config. 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. if has('patch8.1.1068') " Use `complete_info` if your (Neo)Vim version supports it. inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" else imap pumvisible() ? "\" : "\u\" endif " Use `[g` and `]g` to navigate diagnostics nmap [g (coc-diagnostic-prev) nmap ]g (coc-diagnostic-next) " GoTo code navigation. 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 the symbol and its references when holding the cursor. autocmd CursorHold * silent call CocActionAsync('highlight') " Symbol renaming. nmap rn (coc-rename) " Formatting selected code. xmap f (coc-format-selected) nmap f (coc-format-selected) " Add `:Format` command to format current buffer. command! -nargs=0 Format :call CocAction('format') " Mappings 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 " -- END COC SETUP -- " Automatically close parenthesis, etc "Plug 'Townk/vim-autoclose' " Surround Plug 'tpope/vim-surround' " Indent text object Plug 'michaeljsmith/vim-indent-object' " Indentation based movements Plug 'jeetsukumaran/vim-indentwise' " Better language packs Plug 'sheerun/vim-polyglot' let g:polyglot_disabled = ['latex'] " Ack code search (requires ack installed in the system) Plug 'mileszs/ack.vim' " TODO is there a way to prevent the progress which hides the editor? " Paint css colors with the real color Plug 'lilydjwg/colorizer' " TODO is there a better option for neovim? " Window chooser Plug 't9md/vim-choosewin' " Automatically sort python imports Plug 'fisadev/vim-isort' " Highlight matching html tags Plug 'valloric/MatchTagAlways' " Generate html in a simple way Plug 'mattn/emmet-vim' " Git integration Plug 'tpope/vim-fugitive' " Git/mercurial/others diff icons on the side of the file lines Plug 'mhinz/vim-signify' " Linters "Plug 'neomake/neomake' " TODO is it running on save? or when? " TODO not detecting errors, just style, is it using pylint? " Relative numbering of lines (0 is the current line) " (disabled by default because is very intrusive and can't be easily toggled " on/off. When the plugin is present, will always activate the relative " numbering every time you go to normal mode. Author refuses to add a setting " to avoid that) Plug 'myusuf3/numbers.vim' " Official rust plugin Plug 'rust-lang/rust.vim' " Tell vim-plug we finished declaring plugins, so it can load them call plug#end() " ============================================================================ " Install plugins the first time vim runs if vim_plug_just_installed echo "Installing Bundles, please ignore key map error messages" :PlugInstall endif " ============================================================================ " Vim settings and mappings " You can edit them as you wish " tabs and spaces handling set expandtab set tabstop=4 set softtabstop=4 set shiftwidth=4 " show line numbers set nu " use 256 colors when possible colorscheme vim-monokai-tasty " needed so deoplete can auto select the first suggestion set completeopt+=noinsert " comment this line to enable autocompletion preview window " (displays documentation related to the selected completion option) set completeopt-=preview " autocompletion of files and commands behaves like shell " (complete only the common part, list the options that match) set wildmode=list:longest " save as sudo ca w!! w !sudo tee "%" " tab navigation mappings map tt :tabnew map :tabn imap :tabn map :tabp imap :tabp " when scrolling, keep cursor 3 lines away from screen border set scrolloff=3 " clear search results nnoremap // :noh " clear empty spaces at the end of lines on save of python files autocmd BufWritePre *.py :%s/\s\+$//e " ============================================================================ " Plugins settings and mappings " Edit them as you wish. " Tagbar ----------------------------- " toggle tagbar display map :TagbarToggle " autofocus on tagbar open let g:tagbar_autofocus = 1 " NERDTree ----------------------------- " toggle nerdtree display map :NERDTreeToggle " open nerdtree with the current file selected nmap ,t :NERDTreeFind " don;t show these file types let NERDTreeIgnore = ['\.pyc$', '\.pyo$'] " Tasklist ------------------------------ " show pending tasks list map :TaskList " Neomake ------------------------------ " Run linter on write "autocmd! BufWritePost * Neomake " Fzf ------------------------------ " file finder mapping nmap ,e :Files " buffer search nmap ,b :Buffers " Ag search nmap ,a :Ag " tags (symbols) in current file finder mapping nmap ,g :BTag " tags (symbols) in all files finder mapping nmap ,G :Tag " general code finder in current file mapping nmap ,f :BLines " general code finder in all files mapping nmap ,F :Lines " commands finder mapping nmap ,c :Commands " to be able to call CtrlP with default search text "function! CtrlPWithSearchText(search_text, ctrlp_command_end) "execute ':CtrlP' . a:ctrlp_command_end "call feedkeys(a:search_text) "endfunction " same as previous mappings, but calling with current word as default text "nmap ,wg :call CtrlPWithSearchText(expand(''), 'BufTag') "nmap ,wG :call CtrlPWithSearchText(expand(''), 'BufTagAll') "nmap ,wf :call CtrlPWithSearchText(expand(''), 'Line') "nmap ,we :call CtrlPWithSearchText(expand(''), '') "nmap ,pe :call CtrlPWithSearchText(expand(''), '') "nmap ,wm :call CtrlPWithSearchText(expand(''), 'MRUFiles') "nmap ,wc :call CtrlPWithSearchText(expand(''), 'CmdPalette') " Ack.vim ------------------------------ " mappings nmap ,r :Ack nmap ,wr :Ack " Window Chooser ------------------------------ " mapping nmap - (choosewin) " show big letters let g:choosewin_overlay_enable = 1 " Signify ------------------------------ " this first setting decides in which order try to guess your current vcs " UPDATE it to reflect your preferences, it will speed up opening files let g:signify_vcs_list = [ 'git', 'hg' ] " mappings to jump to changed blocks nmap sn (signify-next-hunk) nmap sp (signify-prev-hunk) " nicer colors highlight DiffAdd cterm=bold ctermbg=none ctermfg=119 highlight DiffDelete cterm=bold ctermbg=none ctermfg=167 highlight DiffChange cterm=bold ctermbg=none ctermfg=227 highlight SignifySignAdd cterm=bold ctermbg=237 ctermfg=119 highlight SignifySignDelete cterm=bold ctermbg=237 ctermfg=167 highlight SignifySignChange cterm=bold ctermbg=237 ctermfg=227 " Autoclose ------------------------------ " Fix to let ESC work as espected with Autoclose plugin " (without this, when showing an autocompletion window, ESC won't leave insert " mode) let g:AutoClosePumvisible = {"ENTER": "\", "ESC": "\"} " Airline ------------------------------ let g:airline_powerline_fonts = 0 let g:airline_theme = 'bubblegum' let g:airline#extensions#whitespace#enabled = 0 " to use fancy symbols for airline, uncomment the following lines and use a " patched font (more info on docs/fancy_symbols.rst) "if !exists('g:airline_symbols') "let g:airline_symbols = {} "endif "let g:airline_left_sep = '⮀' "let g:airline_left_alt_sep = '⮁' "let g:airline_right_sep = '⮂' "let g:airline_right_alt_sep = '⮃' "let g:airline_symbols.branch = '⭠' "let g:airline_symbols.readonly = '⭤' "let g:airline_symbols.linenr = '⭡' set clipboard=unnamedplus inccommand=nosplit set mouse=a let g:tex_flavor = "latex" au BufNewFile,BufRead *.tex,*.latex,*.sty,*.dtx,*.ltx set sw=2 sts=2 function PrintFile(fname) call system("gtklp " . a:fname) call delete(a:fname) return v:shell_error endfunction set printexpr=PrintFile(v:fname_in) " TUT: " color murphy