"Many ideas from https://github.com/nicknisi/dotfiles/blob/master/config/nvim/init.vim "https://github.com/mhartington/dotfiles/blob/master/vimrc "and https://dougblack.io/words/a-good-vimrc.html " Plugins call plug#begin('~/.config/nvim/plugged') Plug 'NLKNguyen/papercolor-theme' " PaperColor Theme (old: [vim-colors-solarized]) Plug 'itchyny/lightline.vim' Plug 'scrooloose/nerdtree' " file tree browser Plug 'ctrlpvim/ctrlp.vim' " fuzzy file finder Plug 'bronson/vim-trailing-whitespace' Plug 'ryanoasis/vim-devicons' " awesome icons Plug 'tiagofumo/vim-nerdtree-syntax-highlight' Plug 'ashisha/image.vim' " Display images in vim Plug 'Yggdroot/indentLine' " Display indent line Plug 'neomake/neomake' " asynchronous make functionality :NeoMake! Plug 'Shougo/deoplete.nvim' " autocomplete function "Plug 'Shougo/neocomplcache.vim' "Plug 'terryma/vim-multiple-cursors' "Sublime multiple cursor support Plug 'Shougo/neosnippet.vim' " snippet manager Plug 'Shougo/neosnippet-snippets' " default snippets Plug 'Raimondi/delimitMate' " automatic closing of quotes, parenthesis, brackets, etc. Plug 'tpope/vim-commentary' " comment stuff out Plug 'tpope/vim-ragtag' " endings for html, xml, etc. - ehances surround Plug 'tpope/vim-surround' " mappings to easily delete, change and add such Plug 'tpope/vim-fugitive' " Git support Plug 'airblade/vim-gitgutter' " show git diff in gutter " surroundings in pairs, such as quotes, parens, etc. Plug 'simnalamburt/vim-mundo' " undo tree visualizer DOESN'T WORK ATM "Plug 'junegunn/limelight.vim', { 'on': 'Limelight' } " focus tool. Dim text. Good for presentating with vim "language-specific plugins " HTML Plug 'gregsexton/MatchTag' "highlight the current tag " LaTex Plug 'lervag/vimtex' " R Plug 'jalvesaq/Nvim-R' call plug#end() " Theme syntax enable colorscheme PaperColor " set dark/light background based on time if (strftime("%H") < 20 && strftime("%H") > 7 ) set background=light else set background=dark endif " always light background if gui is running if has('gui_running') set background=light endif "deoplete settings let g:deoplete#enable_at_startup = 1 let g:deoplete#ignore_sources = {} "let g:deoplete#ignore_sources._ = ["neosnippet"] " I want to use my tab more smarter. If we are inside a completion menu jump " to the next item. Otherwise check if there is any snippet to expand, if yes " expand it. Also if inside a snippet and we need to jump tab jumps. If none " of the above matches we just call our usual 'tab'. function! s:neosnippet_complete() if pumvisible() return "\" else if neosnippet#expandable_or_jumpable() return "\(neosnippet_expand_or_jump)" endif return "\" endif endfunction imap neosnippet_complete() :inoremap / " nerdtree setting " start with vim if no file is specified if has("autocmd") autocmd StdinReadPre * let s:std_in=1 "autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif " close vim if only nerd tree is open autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif endif map :NERDTreeToggle " Highlight full name (not only icons) let g:NERDTreeFileExtensionHighlightFullName = 1 let g:NERDTreeExactMatchHighlightFullName = 1 let g:NERDTreePatternMatchHighlightFullName = 1 " Disable uncommon file extensions highlighting (good idea if lag when scrolling) let g:NERDTreeLimitedSyntax = 1 " after a re-source, fix syntax matching issues (concealing brackets): if exists('g:loaded_webdevicons') call webdevicons#refresh() endif " toggle gundo nnoremap u :MundoToggle " general set relativenumber set number set history=200 "set Ex command history set autoread " detect when a file is changed au FocusGained * :checktime "workaround for autoread: neovim/#1936 set cursorline set mouse=a " mouse function set backspace=indent,eol,start " backspace over multiple lines set ignorecase " ignore case in search set smartcase " switch to case-sensitive search if capital letters are used " enable global undo set undofile set undodir=~/.config/nvim/undo " jump to the last position when reopening a file if has("autocmd") au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif endif set shortmess=I "disable intro message " Tab control set expandtab " insert spaces rather than tabs for [noexpandtab for invert] set smarttab " tab respects 'tabstop', 'shiftwidth', and 'softtabstop' set tabstop=2 " the visible width of tabs set softtabstop=2 " edit as if the tabs are 4 characters wide set shiftwidth=2 " number of spaces to use for indent and unindent set shiftround " round indent to a multiple of 'shiftwidth' set completeopt+=longest " Vim Splits set splitbelow set splitright " substitute live preview set inccommand=nosplit " Key Bindings "ReMap leader key let mapleader = "," " for learning: disable arrow keys " noremap " noremap " noremap " noremap " better movement in Vim Splits nnoremap nnoremap nnoremap nnoremap " enable copy to clipboard map y "+y map p "*p " move vertically by visual line " if there is a very long line that gets visually wrapped to two lines, wouldn't skip over the "fake" part of the visual line nnoremap gk nnoremap gj nnoremap j gj nnoremap k gk " fast movement map J 5j map K 5k " cursor to begin or end of line nnoremap B ^ nnoremap E $ " Align block of text and keep them selected vmap < >gv " Faster delete. nmap nmap db nmap dw imap dwi " turn off last search highlight map :noh " highlight last inserted text nnoremap gV `[v`] " jk is escape inoremap jk " Toggle background dark/light map :let &background = ( &background == "dark"? "light" : "dark" ) " Toggle number lines map :set number!:set relativenumber! " Toggle | for indent lines map :IndentLinesToggle " lightline let g:lightline = { 'colorscheme': 'PaperColor' } " vim-airline (old, now using lightline) "let g:airline_theme='papercolor' "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 = '' "let g:airline_powerline_fonts = 1 "required for devicons " Enable Airline Tabbar "let g:airline#extensions#tabline#enabled = 1 set encoding=utf8 set guifont=DroidSansMonoForPowerline\ Nerd\ Font " EOF