Skip to content

Instantly share code, notes, and snippets.

@0xKD
Last active May 18, 2016 16:18
Show Gist options
  • Save 0xKD/7a702aaf34a8a311557e to your computer and use it in GitHub Desktop.
Save 0xKD/7a702aaf34a8a311557e to your computer and use it in GitHub Desktop.
set nocompatible " be iMproved, required
filetype off " required!
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle
" required!
Plugin 'gmarik/Vundle.vim'
" git helper
Plugin 'fugitive.vim'
" Autocomplete
Plugin 'Valloric/YouCompleteMe'
" Syntax check
Plugin 'Syntastic'
" Directory browser
Plugin 'scrooloose/nerdtree.git'
" Emmet (HTML)
Plugin 'mattn/emmet-vim'
" Markdown
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
" Colorschemes
Plugin 'flazz/vim-colorschemes'
Plugin 'yosiat/oceanic-next-vim'
Plugin 'Solarized'
" fuzzy search
Plugin 'kien/ctrlp.vim'
" ag
Plugin 'rking/ag.vim'
" cycle colorschemes
" Plugin 'qualiabyte/vim-colorstepper'
" surround.vim
Plugin 'tpope/vim-surround'
" golang
Plugin 'fatih/vim-go'
"swift
Plugin 'keith/swift.vim'
call vundle#end()
"========== Rest of the stuff ==============
" Indent automatically depending on filetype
filetype plugin indent on
set autoindent
" Turn on line numbering. Turn it off with 'set nonu'
set number
" Set syntax on
syntax on
" Case insensitive search
set ic
" Higlhight search
set hls
" Wrap text instead of being on one line
set lbr
" Change colorscheme
colorscheme sol
" Enable 256 colors
set t_Co=256
" Fancy menu
set wildmenu
" from Example_vimrc
set hidden
set showcmd
set hlsearch
set ignorecase
set smartcase
set confirm
" last window will always have a status line
set laststatus=2
" show line number / column / position in file
set ruler
" ignored by NERDTree
let NERDTreeIgnore = ['\.pyc$']
set encoding=utf-8
set backspace=2
" autocmd Filetype python setlocal tabstop=4 shiftwidth=4 expandtab
autocmd Filetype sh setlocal tabstop=4 shiftwidth=4 noexpandtab
autocmd Filetype go setlocal tabstop=4 shiftwidth=4 noexpandtab
autocmd Filetype js setlocal tabstop=2 shiftwidth=2 softtabstop=2 expandtab
autocmd Filetype html setlocal tabstop=2 shiftwidth=2 softtabstop=2 expandtab
autocmd Filetype htmldjango setlocal tabstop=2 shiftwidth=2 softtabstop=2 expandtab
autocmd Filetype swift setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab
" legacy python
" autocmd Filetype python setlocal tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab
" modern python
autocmd Filetype python setlocal tabstop=4 softtabstop=4 shiftwidth=4 expandtab
colorscheme monokain
if has("gui_macvim")
colorscheme Tomorrow-Night
set guioptions-=r
set guifont=Meslo\ LG\ M\ Regular\ for\ Powerline:h18
elseif has("gui_running")
colorscheme Tomorrow-Night
set guioptions-=r
set guifont=Meslo\ LG\ M\ for\ Powerline\ 12
endif
" Indent Python in the Google way.
setlocal indentexpr=GetGooglePythonIndent(v:lnum)
let s:maxoff = 50 " maximum number of lines to look backwards.
function GetGooglePythonIndent(lnum)
" Indent inside parens.
" Align with the open paren unless it is at the end of the line.
" E.g.
" open_paren_not_at_EOL(100,
" (200,
" 300),
" 400)
" open_paren_at_EOL(
" 100, 200, 300, 400)
call cursor(a:lnum, 1)
let [par_line, par_col] = searchpairpos('(\|{\|\[', '', ')\|}\|\]', 'bW',
\ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :"
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
\ . " =~ '\\(Comment\\|String\\)$'")
if par_line > 0
call cursor(par_line, 1)
if par_col != col("$") - 1
return par_col
endif
endif
" Delegate the rest to the original function.
return GetPythonIndent(a:lnum)
endfunction
let pyindent_nested_paren="&sw*2"
let pyindent_open_paren="&sw*2"
" nmap <F6> <Plug>ColorstepPrev
" nmap <F7> <Plug>ColorstepNext
" nmap <S-F7> <Plug>ColorstepReload
" sensible.vim
" file will reload if change outside vim
set autoread
set fileformats+=mac
set display+=lastline
" relative line numbers
set rnu
let mapleader=","
nnoremap j gj
nnoremap k gk
" for perl
let g:syntastic_perl_checkers=['perl']
let g:syntastic_perl_interpreter='/usr/local/bin/perl6'
let g:syntastic_enable_perl_checker = 1
" faster window switching
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
nnoremap <C-h> <C-w>h
" code folding
set foldmethod=indent
set foldlevel=99
nnoremap <space> za
" ycm
let g:ycm_autoclose_preview_window_after_completion=1
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment