" Required settings set nocompatible filetype off set rtp+=~/.vim/bundle/Vundle.vim set rtp+=/opt/homebrew/opt/fzf call vundle#begin() " let Vundle manage Vundle, required Plugin 'VundleVim/Vundle.vim' " Plugins Plugin 'morhetz/gruvbox' Plugin 'preservim/nerdtree' Plugin 'tpope/vim-fugitive' Plugin 'tpope/vim-surround' Plugin 'tpope/vim-commentary' Plugin 'ryanoasis/vim-devicons' Plugin 'vim-airline/vim-airline' Plugin 'vim-syntastic/syntastic' " All of your Plugins must be added before the following line call vundle#end() filetype plugin indent on " Search options set incsearch set ignorecase set showmatch set hlsearch " History options set history=1000 set showcmd " Indent options set autoindent set smartindent " Common options set guioptions= set showmode set showtabline=0 set smartcase set autochdir set number set ruler set wrap linebreak nolist set textwidth=80 set cursorline " Force 256 color support set t_Co=256 " Enable syntax highlighting syntax enable syntax on " Set syntax highlight for specified file types autocmd BufRead,BufNewFile *.conf setf dosini autocmd BufRead,BufNewFile *.cnf setf dosini " Set tab sizes and use spaces instead of tabs set tabstop=2 set shiftwidth=2 set softtabstop=2 set expandtab set smarttab " Encoding and file format order set ffs=unix,dos,mac set fencs=utf-8,cp1251,koi8-r,ucs-2,cp866 " Disable mouse support in terminal mode if !has('gui_running') set mouse= endif " Fix keyboard mapping for and buttons map [H cmap [H imap [H map [F cmap [F imap [F " Save and exit in Insert and Normal mode inoremap :wq nnoremap :wq " Toggle NERDTree open and close in Normal mode nnoremap :NERDTreeToggle " Have nerdtree ignore certain files and directories. let NERDTreeIgnore=['\.git$', '\.jpg$', '\.mp4$', '\.ogg$', '\.iso$', '\.pdf$', '\.pyc$', '\.odt$', '\.png$', '\.gif$', '\.db$'] " Map to comment line in Normal, Visual and Insert modes. nmap CommentaryLine vmap CommentaryLine imap CommentaryLine " Map (Ctrl+u) to undo the changes made since you typed in Insert mode. " Start a new change before using this mapping. Normally Ctrl+u while in Insert mode " would delete the text without undo history and it would be lost forever. inoremap u " You can split the window in Vim by typing :split or :vsplit. " Navigate the split view easier by pressing CTRL+j, CTRL+k, CTRL+h, or CTRL+l. nnoremap j nnoremap k nnoremap h nnoremap l " Resize split windows using arrow keys by pressing: " CTRL+UP, CTRL+DOWN, CTRL+LEFT, or CTRL+RIGHT. noremap + noremap - noremap > noremap < " Wildmenu set wildmenu set wildmode=full set wildoptions=pum runtime! menu.vim set wildcharm= nnoremap :emenu " Set colorscheme colorscheme molokai let g:molokai_original = 1 let g:rehash256 = 1 " Airline options let g:airline_powerline_fonts = 1 let g:airline#extensions#keymap#enabled = 0 let g:airline_section_z = "\ue0a1:%l/%L Col:%c" let g:Powerline_symbols='unicode' let g:airline#extensions#xkblayout#enabled = 0 let g:airline#extensions#syntastic#enabled = 1 " Syntastic options let g:syntastic_always_populate_loc_list = 1 let g:syntastic_auto_loc_list = 1 let g:syntastic_check_on_open = 1 let g:syntastic_check_on_wq = 0 " Change mode cursor color in xterm " Avoid spawning shell (silent !echo) which causes garbage output in some terminals. " t_EI is sent on VimEnter automatically when leaving insert mode context. if &term =~ "xterm-256color\\|rxvt" let &t_SI = "\033]Pl00d7ff\033\\" let &t_SR = "\033]Plf00000\033\\" let &t_EI = "\033]Plff8708\033\\" autocmd VimEnter * let &t_EI = "\033]Plff8708\033\\" | redraw autocmd VimLeave * call writefile(["\033]Plc1ffc1\033\\"], '/dev/tty') endif " Show tabs and trails set list set listchars=tab:--,trail:. " Override theme color settings for tabs and trails function! MyHighlights() abort highlight NonText ctermbg=None ctermfg=DarkGrey highlight SpecialKey ctermbg=None ctermfg=DarkGrey endfunction augroup MyColors autocmd! autocmd ColorScheme * call MyHighlights() augroup END " Jump to the last position when reopening a file if has("autocmd") au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") \| exe "normal! g'\"" | endif endif " Cleaning up tabs and spaces in file function! RemoveTrailingSpaces() %s/\s\+$//e %s/ //ge endfunction function! ConvertTabsToSpaces() %retab endfunction function! CleanFile() call ConvertTabsToSpaces() call RemoveTrailingSpaces() endfunction " Key binding \f to clean up file nmap f :call CleanFile() " Fold lines starting with input arg " function! FoldSomething(lnum) " let line1=getline(a:lnum) " if line2=~#'^\s*;' " return >1 " endif " return = " endfunction "set foldexpr=FoldSomething(v:lnum) " set foldmethod=expr " set foldcolumn=3 " finish " command! FL :call FoldSomething()