My .vimrc file (January 20, 2019)

I believe in minimalism. That’s why I only have a very small number of plugins in my vimrc file. This is my vimrc file as of now:

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()
Plugin 'gmarik/Vundle.vim'
Plugin 'altercation/vim-colors-solarized'
Plugin 'tpope/vim-commentary'
Plugin 'junegunn/fzf'
Plugin 'junegunn/fzf.vim'
Plugin 'dotlang/vim-dotlang'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
syntax on
scriptencoding utf-8
au BufRead,BufNewFile *.dot setfiletype python

set encoding=utf8
set laststatus=0 " do not show status line (cmd line shows current position and also filename when vim starts)
set t_Co=256
set tabstop=4 " number of spaces that a <Tab> is counted for
set history=1000 " store last 1000 commands entered in command line, avilable via `q:`
set textwidth=0 " do not wrap text
set report=0 " after yank/delete/... report number of lines affected
set completeopt=longest,menuone,preview
set shiftwidth=4 " number of spaces to use for each indent level
set softtabstop=4 " 
set scrolloff=1 " make 1 line visible when search match is the the first or last line of the visible screen
set invnumber " show line number for current line only
set backspace=indent,eol,start
set mouse-=a " disable visual and scroll in a buffer using mouse (its easier to select text by mouse click just like bash)
set relativenumber
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set ignorecase " Do case insensitive matching
set smartcase " Do smart case matching
set smarttab
set expandtab " insert space instead of tabs
set incsearch " Incremental search
set hidden " Hide buffers when they are abandoned
set autoindent " copy indentation from previous line
set smartindent " increase indent level in some cases
set copyindent " copy the previous indentation on autoindenting
set lazyredraw " redraw only when we need to.
set modeline " if first or last line indicate file type, use it insted of extension
set ttyfast
set wildmenu
set incsearch " search as characters are entered
set hlsearch " highlight matches
set linebreak 
set nolist
set nowrap
set visualbell " don't beep
set noerrorbells " don't beep
set nobackup
set noswapfile
" set ruler

let $BASH_ENV = "~/.bash_profile"
let g:netrw_liststyle=1 " in Ex command display dir tree
let perl_extended_vars = 1 "highlight complex expressions such as @{[$x, $y]}
let perl_sync_dist = 250 "use more context for highlighting

" " Other potential fzf commands: BLines, Files, GFiles
nnoremap <C-\> :Lines!<CR>
nnoremap \\ :Buffers<CR>
nnoremap <leader>' :History<CR>
map <Leader> <Plug>(easymotion-prefix)
nnoremap <Space><Space> :GFiles!<CR>
nnoremap <BS> :noh<CR>
nnoremap <silent> <C-l> :set syntax=off<CR>:redraw!<CR>:set syntax=on<CR>
nnoremap <C-S-L> <C-W>>
nnoremap <C-S-H> <C-W><
nnoremap <C-S-J> <C-W>+
nnoremap <C-S-K> <C-W>-

inoremap <Up> <NOP>
inoremap <Down> <NOP>
inoremap <Left> <NOP>
inoremap <Right> <NOP>
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>

" "C-c prevents execution of Leave commands. Esc is the preferred way
" " When we press Esc in insert mode it takes a little while to run InsertLeave command - so we move cursor back and forth to force run
" This causes issues when pasting from system clipboard using Cmd+V
" ino <Esc> <Esc>hl

:command! GG echom 'git branch: ' . substitute(system("git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* //'"), '\n', '', 'g')
:command! GF call GitFile(expand('%:t'))

" Without this, I can goto root of project, then in vim I can run git find
" commands for the whole repository
autocmd BufEnter * silent! lcd %:p:h
" autocmd InsertEnter,InsertLeave * set cul!

try
set background=dark
colorscheme solarized
catch /^Vim\%((\a\+)\)\=:E185/
endtry

"set path+=~/netty/** - this will help you finding files when pressing `gf` on
"a java import statement like `import a.b.c.d` it will lookup d.java file in
"a/b/c directory in the given path, also you will be able to use `gf` on any
"identifier like ChannelFactory to open files who have the same name.
set path=$PWD/**

function! GitFile(file)
new
exe "silent r! git show master:$(git ls-tree --full-name --name-only master " . a:file . ")"
1d
exe "silent file master-" . a:file
filetype detect
setlocal readonly "don't allow saving
setlocal nomodified "allow easy quitting without saving
setlocal nomodifiable "don't allow modification
execute "normal! gg"
only
endfunction</pre>

Well, it consists of below parts:

  1. Plugins that are really useful for me
  2. Some shortcuts (I have disabled arrow keys so I get used to hjkl keys)
  3. Default settings for vim (e.g. enable incremental search, …)