" General syntax on filetype on filetype plugin on set nocompatible set autoread set shortmess=atI " Start scrolling when we're 8 lines from the bottom set scrolloff=8 " Set fonts let s:maxfontsize = 25 let s:minfontsize = 6 let s:regularfontsize = 10 set guifont=Menlo\ for\ Powerline\ 10 set encoding=utf-8 set linespace=2 " Turn backup off " set nobackup " set nowb " set noswapfile " Undo dir set undodir=~/.vim/undodir set dir=~/.vim/swapdir " Set colors colorscheme Tomorrow-Night set t_Co=256 set cursorline autocmd BufEnter * :syntax sync fromstart " Set line numbers, tabulations and indentations set number set tabstop=4 softtabstop=4 shiftwidth=4 expandtab set autoindent set smartindent set colorcolumn=80 " Set the Command Line set showcmd set showmode set laststatus=2 " Code Folding set foldlevelstart=20 set foldmethod=indent " Edit my vimrc file nnoremap ev :vsplit $MYVIMRC " Source my vimrc file nnoremap sv :source $MYVIMRC set langmap+=чявертъуиопшщасдфгхйклзьцжбнмЧЯВЕРТЪУИОПШЩАСДФГХЙКЛЗѝЦЖБНМ;`qwertyuiop[]asdfghjklzxcvbnm~QWERTYUIOP{}ASDFGHJKLZXCVBNM,ю\\,Ю\|, " Disable some keys inoremap inoremap inoremap inoremap " Buffer Management nnoremap j :bp nnoremap k :bn nnoremap d :NERDTreeClose:bd:NERDTreeTogglel " Move lines up/down nnoremap :m .+1== nnoremap :m .-2== vnoremap :m '>+1gv=gv vnoremap :m '<-2gv=gv " Ease visual shifting vnoremap > >gv vnoremap < p "+p vnoremap y "+y " Automatically change current directory to that of the file in the buffer " autocmd BufEnter * cd %:p:h " Search the word under the cursor recursively in the entire working " directory, and show all files that contain it map :execute "vimgrep /" . expand("") . "/j **" cw " Disable gvim toolbars by default set guioptions-=T set guioptions-=m " Use Ctrl+F3 to toggle gui " map :if &guioptions =~# 'T' " \set guioptions-=T " \set guioptions-=m " \else " \set guioptions+=T " \set guioptions+=m " \endif " Display trailing tabs and spaces set list listchars=tab:\ \ ,trail:· " Remove trailing spaces on save autocmd BufWritePre * :%s/\s\+$//e " Use CTRL+S to save file changes command -nargs=0 -bar Update if &modified \| if empty(bufname('%')) \| browse confirm write \| else \| confirm write \| endif \|endif nnoremap :Update inoremap :Update " Disable netrw let g:loaded_netrw = 1 let g:loaded_netrwPlugin = 1 " Opens a split and switches over (\v, \s) nnoremap v vl nnoremap s sj " Shift-Tab to go backwards in insert mode imap < :tabprevious nnoremap :tabnext nnoremap :tabnew inoremap :tabpreviousi inoremap :tabnexti inoremap :tabnew " increase/decrease/reset font size let s:pattern = '^\(.* \)\([1-9][0-9]*\)$' function! AdjustFontSize(amount) if has("gui_gtk2") && has("gui_running") let fontname = substitute(&guifont, s:pattern, '\1', '') if (a:amount == 0) let newfont = fontname . s:regularfontsize let &guifont = newfont else let cursize = substitute(&guifont, s:pattern, '\2', '') let newsize = cursize + a:amount if (newsize >= s:minfontsize) && (newsize <= s:maxfontsize) let newfont = fontname . newsize let &guifont = newfont endif endif else echoerr "You need to run the GTK2 version of Vim to use this function." endif endfunction function! LargerFont() call AdjustFontSize(1) endfunction command! LargerFont call LargerFont() function! SmallerFont() call AdjustFontSize(-1) endfunction command! SmallerFont call SmallerFont() function! DefaultFont() call AdjustFontSize(0) endfunction command! ResetFont call DefaultFont() nnoremap = :LargerFont nnoremap - :SmallerFont nnoremap 0 :ResetFont " autocmd FileType html set shiftwidth=2 " autocmd FIleType html set tabstop=2 " ------------------------------------------- " ------------------ Bundles ---------------- " ------------------------------------------- set rtp+=~/.vim/bundle/Vundle.vim call vundle#rc() " From vim-scripts Plugin 'The-NERD-tree' Plugin 'SingleCompile' Plugin 'genutils' Plugin 'Nibble' Plugin 'ZoomWin' Plugin 'gmarik/vundle' Plugin 'bling/vim-airline' Plugin 'brysgo/quickfixfix' Plugin 'ecomba/vim-ruby-refactoring' Plugin 'ervandew/supertab' Plugin 'terryma/vim-multiple-cursors' Plugin 'kien/ctrlp.vim' Plugin 'godlygeek/tabular' Plugin 'majutsushi/tagbar' Plugin 'jiangmiao/auto-pairs' Plugin 'bronson/vim-trailing-whitespace' Plugin 'abijr/colorpicker' Plugin 'scrooloose/syntastic' Plugin 'tpope/vim-commentary' Plugin 'tpope/vim-endwise' Plugin 'tpope/vim-fugitive' Plugin 'tpope/vim-repeat' Plugin 'tpope/vim-sensible' Plugin 'tpope/vim-surround' Plugin 'xolox/vim-notes' Plugin 'xolox/vim-misc' Plugin 'tpope/vim-rake' Plugin 'airblade/vim-gitgutter' Plugin 'rking/ag.vim' Plugin 'chriskempson/base16-vim' " Plugin 'szw/vim-ctrlspace' " Language Specific Plugin 'vim-ruby/vim-ruby' Plugin 'tpope/vim-cucumber' Plugin 'tpope/vim-rails' Plugin 'jelera/vim-javascript-syntax' Plugin 'JulesWang/css.vim' " NERDTree map :NERDTreeToggle map :NERDTree let NERDTreeChDirMode=2 " Tagbar map :TagbarToggle " Powerline " let g:Powerline_symbols = 'fancy' " Airline let g:airline#extensions#tabline#enabled = 1 let g:airline_powerline_fonts = 1 " SimpleCompile nmap :SCCompile nmap :SCCompileRun " Multiple-Cursors let g:multi_cursor_use_default_mapping=0 let g:multi_cursor_next_key='' let g:multi_cursor_prev_key='' let g:multi_cursor_skip_key='' let g:multi_cursor_quit_key='' " Tabular map a= :Tabularize /= map a: :Tabularize /:\zs " GitGutter set signcolumn=yes let g:airline#extensions#tabline#fnamemod = ':t'