Last active
March 4, 2018 10:43
-
-
Save buddhike/643516d8456731b57b16 to your computer and use it in GitHub Desktop.
vim setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be iMproved, required | |
filetype off " required | |
let g:ctrlp_custom_ignore = '\v[\/](node_modules|jspm_packages|target|dist|vendor)|(\.(swp|ico|git|svn))$' | |
let g:airline#extensions#tabline#enabled = 1 | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" let Vundle manage Vundle, required | |
Plugin 'VundleVim/Vundle.vim' | |
Plugin 'pangloss/vim-javascript' | |
Plugin 'tpope/vim-surround' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'tpope/vim-unimpaired' | |
Plugin 'kien/ctrlp.vim' | |
Plugin 'editorconfig/editorconfig-vim' | |
Bundle '29decibel/codeschool-vim-theme' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'maksimr/vim-jsbeautify' | |
Plugin 'einars/js-beautify' | |
Plugin 'jiangmiao/auto-pairs' | |
Plugin 'bling/vim-airline' | |
Plugin 'chriskempson/base16-vim' | |
Plugin 'vim-scripts/YankRing.vim' | |
Plugin 'tpope/vim-dispatch' | |
Plugin 'scrooloose/syntastic' | |
Plugin 'OmniSharp/omnisharp-vim' | |
Plugin 'rking/ag.vim' | |
Plugin 'nsf/gocode', {'rtp': 'vim/'} | |
call vundle#end() " required | |
filetype plugin indent on " required | |
syntax on | |
colorscheme dim | |
set background=dark | |
set antialias | |
set number | |
set tabstop=2 | |
set shiftwidth=2 | |
set expandtab | |
set noswapfile | |
set nowrap | |
" Mappings | |
autocmd FileType javascript noremap <buffer> <leader>f :call JsxBeautify()<cr> | |
autocmd FileType html noremap <buffer> <leader>f :call HtmlBeautify()<cr> | |
autocmd FileType css noremap <buffer> <leader>f :call CSSBeautify()<cr> | |
nmap <unique> nt :NERDTreeToggle <CR> | |
let g:ctrlp_map = '<leader>t' | |
let g:ctrlp_show_hidden = 1 | |
imap jj <Esc> | |
nmap <unique> <leader>s :bn<cr> | |
nmap <unique> <leader>a :bp<cr> | |
nmap <unique> <leader>w :bd<cr> | |
" Mappings for Transpose | |
function! MoveLineUp() | |
call MoveLineOrVisualUp(".", "") | |
endfunction | |
function! MoveLineDown() | |
call MoveLineOrVisualDown(".", "") | |
endfunction | |
function! MoveVisualUp() | |
call MoveLineOrVisualUp("'<", "'<,'>") | |
normal gv | |
endfunction | |
function! MoveVisualDown() | |
call MoveLineOrVisualDown("'>", "'<,'>") | |
normal gv | |
endfunction | |
function! MoveLineOrVisualUp(line_getter, range) | |
let l_num = line(a:line_getter) | |
if l_num - v:count1 - 1 < 0 | |
let move_arg = "0" | |
else | |
let move_arg = a:line_getter." -".(v:count1 + 1) | |
endif | |
call MoveLineOrVisualUpOrDown(a:range."move ".move_arg) | |
endfunction | |
function! MoveLineOrVisualDown(line_getter, range) | |
let l_num = line(a:line_getter) | |
if l_num + v:count1 > line("$") | |
let move_arg = "$" | |
else | |
let move_arg = a:line_getter." +".v:count1 | |
endif | |
call MoveLineOrVisualUpOrDown(a:range."move ".move_arg) | |
endfunction | |
function! MoveLineOrVisualUpOrDown(move_arg) | |
let col_num = virtcol(".") | |
execute "silent! ".a:move_arg | |
execute "normal! ".col_num."|" | |
endfunction | |
nnoremap <silent> <C-Up> :<C-u>call MoveLineUp()<CR> | |
nnoremap <silent> <C-Down> :<C-u>call MoveLineDown()<CR> | |
inoremap <silent> <C-Up> <C-o>:call MoveLineUp()<CR> | |
inoremap <silent> <C-Down> <C-o>:call MoveLineDown()<CR> | |
"vnoremap <silent> <C-Up> :<C-u>call MoveVisualUp()<CR> | |
"vnoremap <silent> <C-Down> :<C-u>call MoveVisualDown()<CR> | |
xnoremap <silent> <C-Up> :<C-u>call MoveVisualUp()<CR> | |
xnoremap <silent> <C-Down> :<C-u>call MoveVisualDown()<CR> | |
" Machine specific settings | |
set gfn=Inconsolata:h16 | |
set laststatus=2 | |
if $TERM_PROGRAM =~ "iTerm.app" | |
let &t_SI = "\<Esc>]50;CursorShape=1\x7" " Vertical bar in insert mode | |
let &t_EI = "\<Esc>]50;CursorShape=0\x7" " Block in normal mode | |
let &t_SR = "\<esc>]50;CursorShape=2\x7" " Underline in replace mode | |
endif | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment