Skip to content

Instantly share code, notes, and snippets.

@pa5aribu
Last active December 14, 2017 13:26
Show Gist options
  • Select an option

  • Save pa5aribu/ce02894c6631a643ff420fe4a0de66ee to your computer and use it in GitHub Desktop.

Select an option

Save pa5aribu/ce02894c6631a643ff420fe4a0de66ee to your computer and use it in GitHub Desktop.
My VIMRC
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
" fzf vim runtime path
set rtp+=/usr/local/opt/fzf
" Vundle begin
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" Plugin list
Plugin 'flazz/vim-colorschemes'
Plugin 'vim-syntastic/syntastic'
Plugin 'scrooloose/nerdtree'
Plugin 'jiangmiao/auto-pairs'
Plugin 'junegunn/fzf.vim'
Plugin 'ap/vim-buftabline'
Plugin 'itchyny/lightline.vim'
Plugin 'mileszs/ack.vim'
Plugin 'tpope/vim-sleuth' " adjusts shiftab and expandtab
Plugin 'tpope/vim-commentary'
Plugin 'tpope/vim-surround'
Plugin 'marcweber/vim-addon-mw-utils' " vim-snipmate depedency
Plugin 'tomtom/tlib_vim' " vim-snipmate depedency
Plugin 'garbas/vim-snipmate'
Plugin 'honza/vim-snippets'
Plugin 'digitaltoad/vim-pug'
Plugin 'xolox/vim-misc' " vim-session dependency
Plugin 'xolox/vim-session'
Plugin 'qpkorr/vim-bufkill'
Plugin 'tpope/vim-unimpaired'
" Plugin 'matze/vim-move'
" Vundle end
call vundle#end()
filetype plugin indent on
syntax on
colorscheme monokai
" ALL MAPPINGS
" --------------------------------
" Nmap and nnoremap only work on normal mode
" Map and noremap work on visual, insert, replace
" Insert newline in normal mode
nmap <leader><Enter> o<Esc>
" nmap <Backspace> O<Esc>k
" add 50 unit to right and left
" map <silent> <C-W>. 50<C-W>>
" Disable arrow keys
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
inoremap <Up> <NOP>
inoremap <Down> <NOP>
inoremap <Left> <NOP>
inoremap <Right> <NOP>
" REMAPPING CURSOR
" Press [C-i] for insert mode http://vim.wikia.com/wiki/Use_ijkl_to_move_the_cursor_and_h_to_insert
noremap i k
noremap j h
noremap k j
noremap <Enter> i
" Go to end of character
nnoremap <C-l> g_
inoremap <C-l> g_
vnoremap <C-l> g_
" Go to beginning of character
nnoremap <C-j> ^
inoremap <C-j> ^
vnoremap <C-j> ^
" Move to the next buffer
nmap <C-W>ll :bnext<CR>
" Move to the previous buffer
nmap <C-W>jj :bprevious<CR>
" nmap <C-W>o <NOP>
" nmap <C-W><C-o> <NOP>
" Remap vim switch panes
" Go to left pane
nnoremap <C-W><C-J> <C-W><C-H>
" Go to bottom pane
nnoremap <C-W><C-K> <C-W><C-J>
" Go to top pane
nnoremap <C-W><C-I> <C-W><C-K>
" Map colon to semicolon
nnoremap ; :
" Use FZF with Ctrl + P
nnoremap <silent> <C-p> :FZF<CR>
" Ag remap
nnoremap <C-g> :Ag<CR>
" kill buffer without leaving split window, ! is used to force kill terminal
map <C-c> :BD!<cr>
" escape terminal from nvim
tnoremap <C-\><C-\> <C-\><C-n>
" FZF map
autocmd FileType fzf tnoremap <buffer> <C-k> <Down>
autocmd FileType fzf tnoremap <buffer> <C-i> <Up>
" ===
" ALL SETTINGS
" ===
" buftabline settings
hi BufTabLineHidden ctermbg=241
hi BufTabLineCurrent ctermbg=148 ctermfg=022 cterm=bold
hi BufTabLineActive ctermfg=240 ctermbg=white cterm=bold
hi BufTabLineFill ctermbg=241
let g:buftabline_numbers=2 " ordinal number, not buffer number
" CMD like shortcuts
nmap <leader>1 <Plug>BufTabLine.Go(1)
nmap <leader>2 <Plug>BufTabLine.Go(2)
nmap <leader>3 <Plug>BufTabLine.Go(3)
nmap <leader>4 <Plug>BufTabLine.Go(4)
nmap <leader>5 <Plug>BufTabLine.Go(5)
nmap <leader>6 <Plug>BufTabLine.Go(6)
nmap <leader>7 <Plug>BufTabLine.Go(7)
nmap <leader>8 <Plug>BufTabLine.Go(8)
nmap <leader>9 <Plug>BufTabLine.Go(9)
nmap <leader>0 <Plug>BufTabLine.Go(10)
" disable vim-session autosave
let g:session_autosave = 'no'
" disable auto load
let g:session_autoload = 'no'
" silver searcher
let g:ackprg = 'ag --nogroup --nocolor --column'
let g:ackprg = "ag --vimgrep"
" Background transparent, iterm2 background will be visible
hi Normal guibg=NONE ctermbg=NONE
hi linenr term=bold cterm=none ctermfg=darkgrey ctermbg=none gui=none guifg=darkgrey guibg=grey
" change background of unused lines on vim
" hi EndOfBuffer ctermbg=234
" Enable mouse
" set mouse=a
" Highlight search results
set hlsearch
" Already jump to the first hit during a search process
set incsearch
" NO backup and swap files
set nobackup
set noswapfile
" Disable bell
set vb t_vb=
" Show current command in the lower right corner
set showcmd
" Allow pattern matching with special characters (ie: newline)
set magic
" Ctrlp, it's like cmd + p in sumblime
set runtimepath^=~/.vim/bundle/ctrlp.vim
set noexpandtab " Make sure that every file uses real tabs, not spaces
set shiftround " Round indent to multiple of 'shiftwidth'
set smartindent " Do smart indenting when starting a new line
set autoindent " Copy indent from current line, over to the new line
set softtabstop=2
set tabstop=2
set shiftwidth=2
set laststatus=2
" set autoindent
" Set relative number
set relativenumber
set number
" This allows buffers to be hidden if you've modified a buffer.
" This is almost a must if you wish to use buffers in this way.
set hidden
" Enable line numbers
let NERDTreeShowLineNumbers=1
" make sure relative line numbers are used
autocmd FileType nerdtree setlocal relativenumber
" pretty nerdtree
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
" Disable open split in nerdtree
" Because i is now <UP>, pressing i will open split nerdtree
" Open split bt pressing 0 instead
let NERDTreeMapOpenSplit = "$"
" let NERDTreeMapOpenVSplit = 0
let g:NERDTreeMouseMode = 3
" disable html checker on syntastic
let g:syntastic_html_checkers=['']
" CUSTOM SETTINGS WITH FUNCTION
" ----------------------------
" Disable automatic comment insertion
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" On current session, might be useful
" Set formatoptions-=cro
" highlight current line only on active buffer
augroup CursorLine
au!
au VimEnter,WinEnter,BufWinEnter * setlocal cursorline
au WinLeave * setlocal nocursorline
augroup END
" Auto open nerdtree
"autocmd StdinReadPre * let s:std_in=1
"autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" make Esc happen without waiting for timeoutlen
" fixes Powerline delay
augroup FastEscape
autocmd!
au InsertEnter * set timeoutlen=0
au InsertLeave * set timeoutlen=1000
augroup END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment