Skip to content

Instantly share code, notes, and snippets.

@octagonal octagonal/.vimrc
Created Mar 15, 2017

Embed
What would you like to do?
vimrc
set nocp
execute pathogen#infect()
syntax on
filetype plugin indent on
syntax enable
set background=dark
colorscheme solarized
autocmd vimenter * NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
let g:NERDTreeDirArrowExpandable = ''
let g:NERDTreeDirArrowCollapsible = ''
map <C-n> :NERDTreeToggle<CR>
let g:airline#extensions#tabline#enabled = 1
set runtimepath^=~/.vim/bundle/ctrlp.vim
set number
set relativenumber
"get out of insert mode more quickly
inoremap kj <Esc>
"add a semicolon ';' at the end of the line
nnoremap ;; A;<Esc>
"formatting
set nowrap " Don't wrap long lines
set smartindent " Do smart autoindenting when starting a new line
" works for C-like programs
set autoindent " Indent at the same level of the previous line
set shiftwidth=2 " Use indents of 4 spaces
set expandtab " Tabs are spaces, not tabs
set tabstop=2 " Number of spaces that a <Tab> in the file counts for
" an indentation every 4 columns
set softtabstop=2 " Let backspace delete indent
set pastetoggle=<F12> " Sane indentation on pastes
" Remove trailing whitespaces and ^M chars
autocmd FileType c,cpp,java,php,js,python,twig,xml,yml autocmd BufWritePre <buffer> :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))
" JavaScript & Ruby - set 2 spaces for tabs
au FileType javascript set shiftwidth=2
au FileType javascript set tabstop=2
au FileType javascript set softtabstop=2
au FileType ruby set shiftwidth=2
au FileType ruby set tabstop=2
au FileType ruby set softtabstop=2
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
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 = 0
let g:syntastic_javascript_checkers = ['eslint']
function! FindConfig(prefix, what, where)
let cfg = findfile(a:what, escape(a:where, ' ') . ';')
return cfg !=# '' ? ' ' . a:prefix . ' ' . shellescape(cfg) : ''
endfunction
autocmd FileType javascript let b:syntastic_javascript_eslint_args =
\ get(g:, 'syntastic_javascript_eslint_args', '') .
\ FindConfig('-c', '.eslintrc', expand('<afile>:p:h', 1))
" Make Vim more useful
set nocompatible
" " Use path '~/.vim' even on non-unix machine
set runtimepath+=~/.vim
" " Enhance command-line completion
set wildmenu
" " Ignore when expanding wildcards
set wildignore=*.swp,*.swo,*.class
" " Number of things to remember in history
set history=256
" " Use the OS clipboard by default (on versions compiled with `+clipboard`)
set clipboard=unnamed
" " Optimize for fast terminal connections
set ttyfast
" " Walk directory tree upto $HOME looking for tags
set tags=./tags;$HOME
""" Auto Commands {{{
if has("autocmd")
augroup restore_cursor
autocmd!
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
endif
""" }}}
" Turn on folding
set foldenable
" Make folding indent sensitive
set foldmethod=indent
" Don't autofold anything
set foldlevel=99
" Don't open folds when search into them
set foldopen-=search
" Don't open folds when undo stuff
set foldopen-=undo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.