Last active
January 18, 2016 01:42
-
-
Save Kurniawandering/8de8bfc37219adf7d819 to your computer and use it in GitHub Desktop.
vim configuration
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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => General | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" load plugins from vundle | |
filetype off | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#begin() | |
" let vundle manage vundle | |
Plugin 'gmarik/vundle' | |
" utilities | |
Plugin 'ctrlpvim/ctrlp.vim' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'tpope/vim-commentary' | |
Plugin 'airblade/vim-gitgutter' | |
Plugin 'terryma/vim-multiple-cursors' | |
Plugin 'cakebaker/scss-syntax.vim' | |
Plugin 'itchyny/lightline.vim' | |
Plugin 'scrooloose/syntastic' | |
Plugin 'Valloric/YouCompleteMe' | |
Plugin 'rking/ag.vim' | |
Plugin 'sjl/gundo' | |
" colorschemes | |
Plugin 'chriskempson/base16-vim' | |
Plugin 'junegunn/seoul256.vim' | |
" JavaScript plugins | |
Plugin 'pangloss/vim-javascript' | |
Plugin 'jelera/vim-javascript-syntax' | |
Plugin 'mxw/vim-jsx' | |
Plugin 'othree/yajs.vim' | |
" Miscellanea | |
Plugin 'Yggdroot/indentLine' | |
call vundle#end() | |
filetype plugin indent on | |
set nocompatible " not compatible with vi | |
set autoread " detect when a file is changed | |
" make backspace behave in a sane manner | |
set backspace=indent,eol,start | |
" set a map leader for more key combos | |
let mapleader = ',' | |
" Tab control | |
set expandtab " tabs ftw | |
set smarttab " tab respects 'tabstop', 'shiftwidth', and 'softtabstop' | |
set tabstop=4 " the visible width of tabs | |
set softtabstop=4 " edit as if the tabs are 4 characters wide | |
set shiftwidth=4 " number of spaces to use for indent and unindent | |
set shiftround " round indent to a multiple of 'shiftwidth' | |
set clipboard=unnamed | |
" faster redrawing | |
set ttyfast | |
" code folding settings | |
set foldmethod=syntax " fold based on indent | |
set foldnestmax=10 " deepest fold is 10 levels | |
set nofoldenable " don't fold by default | |
set foldlevel=1 | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => User Interface | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Searching | |
set ignorecase " case insensitive searching | |
set smartcase " case-sensitive if expresson contains a capital letter | |
set hlsearch | |
set incsearch " set incremental search, like modern browsers | |
set nolazyredraw " don't redraw while executing macros | |
set magic " Set magic on, for regex | |
set showmatch " show matching braces | |
set mat=2 " how many tenths of a second to blink | |
" switch syntax highlighting on | |
syntax on | |
set encoding=utf8 | |
let base16colorspace=256 " Access colors 256 | |
set t_Co=256 " Explicitly tell vim that the terminal supports 256 colors | |
set background=dark | |
let g:seoul256_background = 236 | |
colorscheme seoul256 | |
let g:indentLine_char = '|' | |
let g:jsx_ext_required = 0 | |
"let g:indentLine_char = '\e711' | |
set number | |
set cursorline | |
set wildmenu | |
set autoindent " automatically set indent of new line | |
set smartindent | |
set laststatus=2 " show the satus line all the time | |
let g:lightline = { | |
\ 'colorscheme': 'landscape', | |
\ 'active': { | |
\ 'left': [ [ 'mode', 'paste' ], | |
\ [ 'fugitive', 'filename' ] ] | |
\ }, | |
\ 'component_function': { | |
\ 'fugitive': 'LightLineFugitive', | |
\ 'readonly': 'LightLineReadonly', | |
\ 'modified': 'LightLineModified', | |
\ 'filename': 'LightLineFilename' | |
\ }, | |
\ 'separator': { 'left': '', 'right': '' } | |
\ } | |
function! LightLineModified() | |
if &filetype == "help" | |
return "" | |
elseif &modified | |
return "+" | |
elseif &modifiable | |
return "" | |
else | |
return "" | |
endif | |
endfunction | |
function! LightLineReadonly() | |
if &filetype == "help" | |
return "" | |
elseif &readonly | |
return "" | |
else | |
return "" | |
endif | |
endfunction | |
function! LightLineFugitive() | |
return exists('*fugitive#head') ? fugitive#head() : '' | |
endfunction | |
function! LightLineFilename() | |
return ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') . | |
\ ('' != expand('%:t') ? expand('%:t') : '[No Name]') . | |
\ ('' != LightLineModified() ? ' ' . LightLineModified() : '') | |
endfunction | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => Mappings | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
map <leader>ev :e! ~/.vimrc<cr> " edit ~/.vimrc | |
map <leader>wc :wincmd q<cr> | |
" moving up and down work as you would expect | |
nnoremap <silent> j gj | |
nnoremap <silent> k gk | |
" space open/closes folds | |
nnoremap <space> za | |
" helpers for dealing with other people's code | |
nmap \t :set ts=4 sts=4 sw=4 noet<cr> | |
nmap \s :set ts=4 sts=4 sw=4 et<cr> | |
" near pasta-experience | |
nnoremap <leader>p p`[v`]= | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => Functions | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
map <C-h> :call WinMove('h')<cr> | |
map <C-j> :call WinMove('j')<cr> | |
map <C-k> :call WinMove('k')<cr> | |
map <C-l> :call WinMove('l')<cr> | |
" Window movement shortcuts | |
" move to the window in the direction shown, or create a new window | |
function! WinMove(key) | |
let t:curwin = winnr() | |
exec "wincmd ".a:key | |
if (t:curwin == winnr()) | |
if (match(a:key,'[jk]')) | |
wincmd v | |
else | |
wincmd s | |
endif | |
exec "wincmd ".a:key | |
endif | |
endfunction | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => Plugin settings | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
set statusline+=%#warningmsg# | |
set statusline+=%{SyntasticStatuslineFlag()} | |
set statusline+=%* | |
let g:syntastic_javascript_checkers = ['eslint'] | |
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 = 1 | |
let g:syntastic_loc_list_height=5 | |
" close NERDTree after a file is opened | |
let g:NERDTreeQuitOnOpen=0 | |
" show hidden files in NERDTree | |
let NERDTreeShowHidden=1 | |
" Toggle NERDTree | |
nmap <silent> <leader>k :NERDTreeToggle<cr> | |
" expand to the path of the file in the current buffer | |
nmap <silent> <leader>y :NERDTreeFind<cr> | |
" map fuzzyfinder (CtrlP) plugin | |
" nmap <silent> <leader>t :CtrlP<cr> | |
nmap <silent> <leader>r :CtrlPBuffer<cr> | |
let g:ctrlp_map='<leader>t' | |
let g:ctrlp_dotfiles=1 | |
let g:ctrlp_working_path_mode = 'ra' | |
" CtrlP ignore patterns | |
let g:ctrlp_custom_ignore = { | |
\ 'dir': '\.git$\|node_modules$\|\.hg$\|\.svn$', | |
\ 'file': '\.exe$\|\.so$' | |
\ } | |
" search the nearest ancestor that contains .git, .hg, .svn | |
let g:ctrlp_working_path_mode = 2 | |
" Silver search | |
let g:ag_working_path_mode="r" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment