let mapleader="," " Map the leader key to comma. """ PLUGINS call plug#begin('~/.local/share/nvim/plugged') " Colorschemes collection Plug 'morhetz/gruvbox' set background=dark " File explorer Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': 'NERDTreeToggle' } nnoremap e :NERDTreeToggle " Comment functions Plug 'tomtom/tcomment_vim' map c :TComment " Javascript Plug 'pangloss/vim-javascript' Plug 'othree/javascript-libraries-syntax.vim' Plug 'othree/html5.vim' Plug 'kchmck/vim-coffee-script' call plug#end() """ OPTIONS colorscheme gruvbox set nowrap " Do not wrap the text set linebreak " Wrap lines at convenient points set mouse=a " Enable mouse interactivity. set showmatch " Show matching brackets. set number " Show the line numbers on the left. set formatoptions+=o " Continue comment marker in new line. set expandtab " Insert spaces when TAB is pressed. set tabstop=2 " Render TABs using this many spaces. set shiftwidth=2 " Indenfation amount for < and > commands. set ignorecase " Make searching case insensitive. set smartcase " ... unless the search query has capital letters. set gdefault " Use 'g' flag by default with :s/foo/bar/. set cursorline " Highlight current line set synmaxcol=200 " Use syntax highlighting only for 128 columns. Note: changing this with cursoline enabled can make scroll choppy set timeoutlen=900 ttimeoutlen=0 " Reduce Command timeout for faster escape and O set splitright " Set up new vertical splits positions set splitbelow " Set up new horizontal splits positions set lazyredraw " Do not redraw on registers and macros set updatetime=500 " Cursor hold timeout command! W write " :W will work like :w command! Q close " :Q will work like :q " Turn of swap files set noswapfile nobackup nowb " Keep undo history across sessions, by storing in file. silent !mkdir ~/.config/nvim/backups > /dev/null 2>&1 set undodir=~/.config/nvim/backups undofile if has("autocmd") " au vimrc FocusGained,BufEnter * checktime " Refresh file when vim gets focus au BufWinEnter * syntax sync minlines=3000 " Sync syntax highlighting au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif " Jump to previous position endif """ KEYBINDINGS " Redraw screen nnoremap r :redraw " Toggle number nnoremap n :setlocal number! " Toggle paste nnoremap p :set paste! " Toggle paste mode " Search and replace nnoremap s :%s/\<\>//cg " Navigation through splits (not working with TMUX) nnoremap nnoremap inoremap i inoremap i nnoremap nnoremap inoremap i inoremap i " Tabs navigation and move map :m +1 map :m -2 map :tabm -1 map :tabm +1 map :tabn map :tabp imap :tabni imap :tabpi " Allow saving of files as sudo when I forgot to start vim using sudo. cmap w!! w !sudo tee > /dev/null % " Map save to Ctrl + S map :w imap :w nnoremap s :w " Redo shortcut map map :redo map :redo "make < > shifts keep selection vnoremap < >gv