Skip to content

Instantly share code, notes, and snippets.

@rga-odoo
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rga-odoo/10959500 to your computer and use it in GitHub Desktop.
Save rga-odoo/10959500 to your computer and use it in GitHub Desktop.
my vimrc
set nocompatible " be iMproved, required
filetype off " required
filetype indent on
syntax on
set backspace=indent,eol,start
" Better modes. Remember where we are
set viminfo=!,'100,\"100,:20,<50,s10,h,n~/.viminfo
set encoding=utf-8
set laststatus=2
set hidden
set number
set mouse=a
set smarttab
" Batter Search
set hlsearch
set incsearch
set ic "case insensitive search
" Show command in bottom right portion of the screen
set showcmd
" Display extra white space
set list listchars=tab:»·,trail:·
" Customize the wildmenu
set wildmenu
set wildignore+=*.dll,*.o,*.pyc,*.bak,*.exe,*.jpg,*.jpeg,*.png,*.gif,*$py.class,*.class,*/*.dSYM/*,*.dylib
" Sets leader to ',' and localleader to "\"
let mapleader=","
let maplocalleader="\\"
" Quicker window switching
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" tab navigation
:nmap <C-t> :tabnew<cr>
:map <C-t> :tabnew<cr>
:map <C-w> :tabclose<cr>
:imap <C-t> <ESC>:tabnew<cr>
" Map escape key to jj -- much faster
imap jj <esc>
" Easy navigation through multiline
noremap j gj
noremap k gk
" CtrlP mapping
map <leader>f :CtrlPCurWD<CR>
map <leader>b :CtrlPBuffer<cr>
map <leader>m :CtrlPMRU<cr>
" NERDTree toggle
map <leader>n :NERDTreeToggle<CR>
map <leader>t :NERDTreeFind<CR>
" Open NERDTree by default
autocmd VimEnter * NERDTree
map <leader>r :!xdg-open %:p:h
" Ack on <leader>a
nnoremap <leader>a :Ack
nnoremap <leader>A :AckFromSearch
let g:ackhighlight = 1
let g:ackpreview = 1
" hide matchecks on <leader>space
nnoremap <leader><space> :nohlsearch<cr>
" Keep some more lines for scope
set scrolloff=5
" Pasettogle use when pasting text that's already indented. vim don't fuck it using your autoindent
:set pastetoggle=<F3>
" Copy/paste from system register
noremap <leader>y "+y
noremap <leader>Y "+Y
noremap <leader>p "+p
" Sometime you just need to enter newline without mode changing
nmap <silent> <leader>o o<ESC>
nmap <silent> <leader>O O<ESC>
" Remove trailing whitespace on <leader>S
nnoremap <leader>S :%s/\s\+$//<cr>:let @/=''<CR>
" Quick edit .vimrc and reload
nmap <silent> <leader>ev :e ~/.vimrc<CR>
nmap <silent> <leader>sv :so ~/.vimrc<CR>
"Force me to use hjkl ;)
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
" Return to last edit position when opening files (You want this!)
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" When forgot sudo at opening file
"command WRITE w !sudo tee % > /dev/null
syntax enable
set background=light
colorscheme lucius
LuciusWhite
let g:solarized_termcolors=256
let NERDTreeIgnore = ['\.pyc$']
let g:airline_theme = 'solarized'
let g:airline_enable_branch = 1
let g:airline_enable_syntastic = 1
let g:airline_detect_modified = 1
let g:airline_left_sep = '⮀'
let g:airline_left_alt_sep = '⮁'
let g:airline_right_sep = '⮂'
let g:airline_right_alt_sep = '⮃'
let g:airline_branch_prefix = '⭠'
let g:airline_readonly_symbol = '⭤'
let g:airline_linecolumn_prefix = '⭡'
" airline configuration
" Python file smart setting
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=8
\ formatoptions=croqj softtabstop=4 textwidth=74 comments=:#\:,:#
let python_highlight_all=1
let python_highlight_exceptions=0
let python_highlight_builtins=0
let python_slow_sync=1
let g:syntastic_python_checkers=['flake8', 'python']
" Don't warn on
" " E121 continuation line indentation is not a multiple of four
" " E128 continuation line under-indented for visual indent
" " E711 comparison to None should be 'if cond is not None:'
" " E301 expected 1 blank line, found 0
" " E261 at least two spaces before inline comment
" " E241 multiple spaces after ':'
" " E124 closing bracket does not match visual indentation
" " E126 continuation line over-indented for hanging indent
" " E721 do not compare types, use 'isinstance()'
" " E501 line too long (82 characters)
" " E231 missing whitespace after ','
let g:syntastic_python_flake8_args='--ignore=E121,E128,E711,E301,E261,E241,E124,E126,E721,E501,E231
\ --max-line-length=84'
" Javascript
autocmd FileType javascript setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4
let g:syntastic_javascript_checkers = ['jshint']
" XML, HTML, Jinja
autocmd FileType xml,html,htmljinja,htmldjango setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4
let g:syntastic_html_checkers = []
" CSS
autocmd FileType css setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4
"autocmd FileType css noremap <buffer> <leader>r :call CSSBeautify()<cr
au BufWritePost,FileWritePost *.sass :!sass -t expanded --unix-newlines <afile> > "%:p:r.css"
set rtp+=~/.vim/bundle/Vundle
call vundle#begin()
Bundle 'gmarik/Vundle'
Bundle 'tpope/vim-fugitive'
Bundle 'altercation/vim-colors-solarized'
Bundle 'scrooloose/nerdtree'
Bundle 'kien/ctrlp.vim'
Bundle 'scrooloose/nerdcommenter'
Bundle 'bling/vim-airline'
Bundle 'mileszs/ack.vim'
Bundle 'scrooloose/syntastic'
Bundle 'michaeljsmith/vim-indent-object'
call vundle#end()
filetype plugin indent on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment