Skip to content

Instantly share code, notes, and snippets.

@fbrundu
Last active March 7, 2017 15:29
Show Gist options
  • Save fbrundu/8688204 to your computer and use it in GitHub Desktop.
Save fbrundu/8688204 to your computer and use it in GitHub Desktop.
My vimrc
" no vi-compatible
set nocompatible
let g:python_host_prog=$HOME.'/.pyenv/versions/neovim2/bin/python'
let g:python3_host_prog=$HOME.'/.pyenv/versions/neovim3/bin/python'
" Setting up Vundle - the vim plugin bundler
let iCanHazVundle=1
let vundle_readme=expand('~/.vim/bundle/vundle/README.md')
if !filereadable(vundle_readme)
echo "Installing Vundle..."
echo ""
silent !mkdir -p ~/.vim/bundle
silent !git clone https://github.com/gmarik/vundle ~/.vim/bundle/vundle
let iCanHazVundle=0
endif
" required for vundle
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required
Bundle 'gmarik/vundle'
" Needed for powerline
Bundle 'SuperTab'
Bundle 'kien/ctrlp.vim'
Bundle 'fisadev/vim-ctrlp-cmdpalette'
Bundle 'IndexedSearch'
Bundle 'vim-multiple-cursors'
Plugin 'hynek/vim-python-pep8-indent'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'thirtythreeforty/lessspace.vim'
Plugin 'joshdick/onedark.vim'
" Installing plugins the first time
if iCanHazVundle == 0
echo "Installing Bundles, please ignore key map error messages"
echo ""
:BundleInstall
endif
" allow plugins by file type
filetype plugin indent on
filetype indent on
syntax enable
" no vertical split bar
set fillchars+=vert:\
hi VertSplit ctermfg=Black ctermbg=Black
hi IncSearch ctermfg=Grey ctermbg=Black
hi Search ctermfg=Black ctermbg=Grey
hi Visual ctermfg=Black ctermbg=Grey
hi DiffAdd ctermfg=Black ctermbg=Green
hi DiffChange ctermfg=Black ctermbg=Yellow
hi DiffDelete ctermfg=Black ctermbg=Red
hi DiffText ctermfg=Black ctermbg=Grey
set showmatch
set ignorecase
set cindent
set ai
set guioptions-=mlrbT
" tabs and spaces handling
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4
" tablength exceptions
autocmd FileType html setlocal shiftwidth=2 tabstop=2 softtabstop=2
autocmd FileType htmldjango setlocal shiftwidth=2 tabstop=2 softtabstop=2
autocmd FileType javascript setlocal shiftwidth=2 tabstop=2 softtabstop=2
autocmd FileType python setlocal shiftwidth=2 tabstop=2 softtabstop=2
" always show status bar
set ls=2
" incremental search
set incsearch
" highlighted search results
set hlsearch
" line numbers
set nu
" save as sudo
ca w!! w !sudo tee "%"
" CtrlP (new fuzzy finder)
let g:ctrlp_map = ',e'
nmap ,g :CtrlPBufTag<CR>
nmap ,G :CtrlPBufTagAll<CR>
nmap ,f :CtrlPLine<CR>
nmap ,m :CtrlPMRUFiles<CR>
nmap ,c :CtrlPCmdPalette<CR>
" to be able to call CtrlP with default search text
function! CtrlPWithSearchText(search_text, ctrlp_command_end)
execute ':CtrlP' . a:ctrlp_command_end
call feedkeys(a:search_text)
endfunction
" CtrlP with default text
nmap ,wg :call CtrlPWithSearchText(expand('<cword>'), 'BufTag')<CR>
nmap ,wG :call CtrlPWithSearchText(expand('<cword>'), 'BufTagAll')<CR>
nmap ,wf :call CtrlPWithSearchText(expand('<cword>'), 'Line')<CR>
nmap ,we :call CtrlPWithSearchText(expand('<cword>'), '')<CR>
nmap ,pe :call CtrlPWithSearchText(expand('<cfile>'), '')<CR>
nmap ,wm :call CtrlPWithSearchText(expand('<cword>'), 'MRUFiles')<CR>
nmap ,wc :call CtrlPWithSearchText(expand('<cword>'), 'CmdPalette')<CR>
" Don't change working directory
let g:ctrlp_working_path_mode = 0
" Ignore files on fuzzy finder
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/](\.git|\.hg|\.svn)$',
\ 'file': '\.pyc$\|\.pyo$',
\ }
" simple recursive grep
command! -nargs=1 RecurGrep lvimgrep /<args>/gj ./**/*.* | lopen | set nowrap
command! -nargs=1 RecurGrepFast silent exec 'lgrep! <q-args> ./**/*.*' | lopen
nmap ,R :RecurGrep
nmap ,r :RecurGrepFast
nmap ,wR :RecurGrep <cword><CR>
nmap ,wr :RecurGrepFast <cword><CR>
" when scrolling, keep cursor 3 lines away from screen border
set scrolloff=3
" autocompletion of files and commands behaves like shell
" (complete only the common part, list the options that match)
set wildmode=list:longest
" to use fancy symbols for powerline, uncomment the following line and use a
" patched font (more info on the README.rst)
" let g:Powerline_symbols = 'fancy'
set clipboard=unnamedplus
set guioptions-=l
set guioptions-=L
set guioptions-=m
set guioptions-=r
set guioptions-=R
set guioptions-=T
nnoremap <TAB> >>
nnoremap <S-TAB> <<
vnoremap <TAB> >gv
vnoremap <S-TAB> <gv
set directory=~/tmp,/var/tmp,/tmp
set backspace=indent,eol,start
set splitright
set splitbelow
let g:airline_theme='monochrome'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment