Skip to content

Instantly share code, notes, and snippets.

@Keda87
Last active July 18, 2019 14:37
Show Gist options
  • Save Keda87/d9c5ae6765acd977c8e0284e7ab2e61f to your computer and use it in GitHub Desktop.
Save Keda87/d9c5ae6765acd977c8e0284e7ab2e61f to your computer and use it in GitHub Desktop.
My simple vim setup
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" Put your plugins definition below.
" ----------------------------------
Plugin 'scrooloose/nerdtree' " NERDTree for file explorer.
Plugin 'kien/ctrlp.vim' " Fuzzy file search.
Plugin 'airblade/vim-gitgutter' " Git diff file.
Plugin 'szw/vim-tags' " Go to definition easily in Vim.
Plugin 'davidhalter/jedi-vim' " Static analysis for autocomplete python in Vim.
Plugin 'bling/vim-airline' " Status or Tabline for Vim.
Plugin 'fisadev/vim-isort' " Auto re-order import python code.
" ----------------------------------
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" VIM override default configuration.
set number
syntax on
" NERDTree custom configuration.
let NERDTreeIgnore = ['\.pyc$', '\.swp$']
map <C-n> :NERDTreeToggle<CR>
map <C-e> :NERDTreeFocus<CR>
" Isort custom configurationt
let g:vim_isort_map = '<C-i>'
let g:vim_isort_python_version = 'python2'
" Ctags custom configuration.
let g:vim_tags_auto_generate = 1 " Auto generate tags on file saving.
" Change cursor on INSERT, REPLACE and NORMAL mode.
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_SR = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=2\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
" Move window split vim.
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" Commenting blocks of code.
autocmd FileType c,cpp,java,scala let b:comment_leader = '// '
autocmd FileType sh,ruby,python let b:comment_leader = '# '
autocmd FileType conf,fstab let b:comment_leader = '# '
autocmd FileType tex let b:comment_leader = '% '
autocmd FileType mail let b:comment_leader = '> '
autocmd FileType vim let b:comment_leader = '" '
noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment