Created
September 25, 2013 19:55
-
-
Save kewah/6705135 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
" change the mapleader from / to , | |
let mapleader="," | |
execute pathogen#infect() | |
execute pathogen#helptags() | |
filetype plugin indent on " enable detection, plugins and indenting in one step | |
syntax on | |
" Set syntax highlighting options. | |
set t_Co=256 | |
set background=dark | |
colorscheme twilight | |
set guifont=Consolas\ for\ Powerline:h13 | |
set guioptions-=T " remove toolbar | |
set guioptions-=l | |
set guioptions-=r " remove right-hand scrollbar | |
set guioptions-=L " remove left-hand scrollbar | |
set gcr=n:blinkon0 " Turn off the blinking cursor in normal mode | |
" Change the bracket highlight | |
hi MatchParen guibg=NONE guifg=yellow gui=bold | |
set autoindent | |
set autoread " reload files when changed on disk, i.e. via `git checkout` | |
set paste | |
set clipboard=unnamed " yank and paste with the system clipboard | |
set copyindent | |
set backspace=indent,eol,start | |
set cursorline " Highlight current line | |
set nu " Enable line numbers | |
set relativenumber | |
set encoding=utf-8 nobomb " BOM often causes trouble | |
set history=1000 " Increase history from 20 default to 1000 | |
set undolevels=1000 | |
set hlsearch " Highlight searches | |
set hidden | |
set ignorecase " Ignore case of searches. | |
set smartcase " Ignore case if search pattern is all lowercase | |
set incsearch " Highlight dynamically as pattern is typed. | |
set linespace=2 " Line height | |
set mousehide " Hide mouse when typing | |
set noerrorbells " don't beep | |
set visualbell " don't beep | |
set nostartofline | |
set numberwidth=4 | |
set scrolloff=3 " Start scrolling three lines before horizontal border of window. | |
set smartindent " use smart indent if there is no indent file | |
set softtabstop=2 | |
set tabstop=2 | |
set shiftwidth=2 | |
set expandtab " Expand TABs to spaces | |
set title " change the terminal's title | |
set nobackup | |
set noswapfile | |
set noundofile | |
set laststatus=2 " Always show status line | |
set statusline=[%<%f] " Filename | |
set statusline+=%w%h%m%r " Options | |
set statusline+=\ %y " Type | |
set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info | |
" set list " Show 'invisible' characters | |
set listchars=tab:▸\ ,trail:·,trail:·,nbsp:_ " Set characters used to indicate 'invisible' characters | |
set wrap | |
set linebreak | |
set nolist | |
" folding settings | |
set foldmethod=indent " fold based on indent | |
set foldnestmax=10 " deepest fold is 10 levels | |
set nofoldenable " dont fold by default | |
set foldlevel=1 | |
" Wild settings | |
set wildchar=<TAB> " Character for CLI expansion (TAB-completion). | |
set wildmenu | |
set wildmode=full " autocomplete menu like ZSH | |
set wildignore="" " reset | |
set wildignore+=*.o,*.out,*.obj,.git,*.rbc,*.rbo,*.class,.svn,*.gem " Disable output and VCS files | |
set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz " Disable archive files | |
set wildignore+=*/.sass-cache/* " Ignore sass cache | |
set wildignore+=*/.settings/* " Ignore settings folders | |
set wildignore+=*.pyc " Python byte code | |
set wildignore+=*.swp,*~,._* " Ignore temp and backup files | |
set wildignore+=*.png,*.jpg,*.jpeg,*.gif,*.psd,*.tiff,*.swf,*.fla " Ignore image files | |
set wildignore+=*.DS_Store " Ignore .DS_Store files | |
set wildignore+=*.ogg,*.mp3,*.aac " Ignore sound files | |
" JSON | |
autocmd BufNewFile,BufRead *.json set ft=javascript | |
" Markdown | |
autocmd BufNewFile,BufRead *.md set ft=markdown | |
"-----------------------------------------------------------" | |
" KEY MAPPING | |
"-----------------------------------------------------------" | |
" Give a try | |
nnoremap <up> <nop> | |
nnoremap <down> <nop> | |
nnoremap <left> <nop> | |
nnoremap <right> <nop> | |
inoremap <up> <nop> | |
inoremap <down> <nop> | |
inoremap <left> <nop> | |
inoremap <right> <nop> | |
map <silent> <leader>V :source ~/.vimrc<CR>:filetype detect<CR>:exe ":echo 'vimrc reloaded'"<CR> | |
" Delete the current buffer | |
nnoremap <leader>q :bp\|bd #<CR> | |
nnoremap <leader>) :bp<CR> | |
nnoremap <leader>( :bn<CR> | |
" Quickly get out of insert mode without your fingers having to leave the | |
" home row (either use 'jj' or 'jk') | |
inoremap jj <Esc> | |
" Indent | |
nnoremap <Tab> >>_ | |
nnoremap <S-Tab> <<_ | |
inoremap <S-Tab> <C-D> | |
vnoremap <Tab> >gv | |
vnoremap <S-Tab> <gv | |
" Remap j and k to act as expected when used on long, wrapped, lines | |
nnoremap j gj | |
nnoremap k gk | |
" Center search matches | |
nnoremap n nzzzv | |
nnoremap N Nzzzv | |
" Use ,d (or ,dd or ,dj or 20,dd) to delete a line without adding it to the | |
" yanked stack (also, in visual mode) | |
nmap <silent> <leader>d "_d | |
vmap <silent> <leader>d "_d | |
" Quick yanking to the end of the line | |
nmap Y y$ | |
" Yank/paste to the OS clipboard with ,y and ,p | |
nmap <leader>y "+y | |
nmap <leader>Y "+yy | |
nmap <leader>p "+p | |
nmap <leader>P "+P | |
" Select just-pasted text | |
nnoremap gp `[v`] | |
" add a blank line below or above and keep the cursor in place | |
nmap <S-Return> O<Esc>j | |
nmap <CR> o<Esc>k | |
" Speed up viewport scrolling | |
nnoremap <C-e> 4<C-e> | |
nnoremap <C-y> 4<C-y> | |
" Search | |
nnoremap <silent> <leader><space> :noh<cr> | |
" Better split switching (Ctrl-j, Ctrl-k, Ctrl-h, Ctrl-l) | |
map <C-j> <C-W>j | |
map <C-k> <C-W>k | |
map <C-H> <C-W>h | |
map <C-L> <C-W>l | |
" window resize | |
map <leader>rm :10winc ><CR> | |
map <leader>rl :10winc <<CR> | |
" change window position | |
map <leader>wh <C-w>t<C-w>H | |
map <leader>wv <C-w>t<C-w>K | |
" swtich between tabs (like macos apps) CMD + ALT + RIGHT/LEFT | |
map <D-A-Right> :tabn<CR> | |
map <D-A-Left> :tabp<CR> | |
" Auto indent with a new line | |
imap <C-Return> <CR><CR><C-o>k<Tab> | |
" Insert a new link before/after (like ST) | |
imap <D-Return> <C-o>o | |
imap <S-Return> <C-o>O | |
" automatically expands to the path of the active buffer | |
cnoremap %% <C-R>=fnameescape(expand('%:h')).'/'<cr> | |
map <leader>ow :e %% | |
map <leader>os :sp %% | |
map <leader>ov :vsp %% | |
map <leader>ot :tabe %% | |
" Make Vim Curly Braces, Square Braces, Parens act like ST | |
" inoremap {<cr> {<CR><CR>}<Esc>-cc | |
" Strip trailing whitespace (,ss) | |
function! StripWhitespace() | |
let save_cursor=getpos(".") | |
let old_query=getreg('/') | |
:%s/\s\+$//e | |
call setpos('.', save_cursor) | |
call setreg('/', old_query) | |
endfunction | |
noremap <leader>ss :call StripWhitespace()<CR> | |
" CSS Format | |
function! CssFormat() | |
" one space after a colon | |
:%s/: */: /g | |
endfunction | |
noremap <leader>cf :call CssFormat()<CR> | |
" Soft wrapping text with :Wrap | |
command! -nargs=* Wrap set wrap linebreak nolist | |
command! -nargs=* UnWrap set list | |
"-----------------------------------------------------------" | |
" PLUGIN SETTINGS | |
"-----------------------------------------------------------" | |
" Nerdtree | |
map <F2> :NERDTreeToggle<CR> " Give a shortcut key to NERD Tree | |
map <leader>nf :NERDTreeFind<cr> " Show the current buffer in NERDTree | |
let NERDTreeShowHidden = 1 | |
let NERDTreeShowBookmarks = 1 | |
let NERDTreeChDirMode = 2 " the CWD is changed whenever the tree root is changed | |
let NERDTreeQuitOnOpen = 1 " close nerdtree when we open a file | |
let NERDTreeIgnore = [ '\.pyc$', '\.pyo$', '\.py\$class$', '\.obj$', '\.o$', '\.so$', '\.egg$', '\.swf$', '^\.git$', '\.os$', '\.dylib$', '\.a$', '^\.DS_Store$', '\.pdf', '\.sass-cache$', '\.settings$' ] | |
" Nerdtree tabs | |
let g:nerdtree_tabs_open_on_gui_startup = 0 | |
let g:nerdtree_tabs_open_on_new_tab = 0 | |
let g:nerdtree_tabs_synchronize_view = 0 | |
" EasyMotion | |
let g:EasyMotion_leader_key = '<Leader>' | |
" ctrlp | |
nmap <C-b> :CtrlPBuffer<CR> | |
let g:ctrlp_working_path_mode = 'a' " current working dir | |
let g:ctrlp_use_caching = 1 | |
let g:ctrlp_clear_cache_on_exit = 0 | |
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git\|aac' | |
let g:ctrlp_map = '<c-p>' | |
let g:ctrlp_extensions = ['buffertag', 'line', 'dir'] | |
" Airline | |
let g:airline_theme = 'powerlineish' | |
let g:airline_powerline_fonts = 1 | |
let g:airline_enable_branch = 0 | |
let g:airline_enable_hunks = 0 | |
let g:airline#extensions#whitespace#checks = ['indent', 'trailing'] | |
" Insert JSDoc | |
map <leader>l :JsDoc<CR> | |
let g:jsdoc_default_mapping = 0 | |
" Git gutter | |
nmap gh :GitGutterNextHunk<CR> | |
nmap gH :GitGutterPrevHunk<CR> | |
nmap <leader>g :GitGutterToggle<CR> | |
let g:gitgutter_enabled = 0 | |
" Emmet | |
" Render with ctrl + e | |
imap <C-e> <C-y>, | |
" CloseTag | |
autocmd FileType html,htmldjango,jinjahtml,eruby,mako let b:closetag_html_style=1 | |
autocmd FileType html,xhtml,xml,htmldjango,jinjahtml,eruby,mako source ~/.vim/bundle/closetag-vim/plugin/closetag.vim | |
" Syntastic | |
map <F10> :Errors<CR> | |
map <F4> :lnext<CR> | |
map <F3> :lprev<CR> | |
let g:syntastic_check_on_open = 0 | |
let g:syntastic_enable_signs = 1 | |
let g:syntastic_javascript_checkers = ['jshint'] | |
let g:syntastic_mode_map = { 'mode': 'active', | |
\ 'active_filetypes': [], | |
\ 'passive_filetypes': ['html', 'py'] } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment