Skip to content

Instantly share code, notes, and snippets.

@categulario
Created January 7, 2019 15:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save categulario/35b124cd73053af582b6fc2eb5c06206 to your computer and use it in GitHub Desktop.
Save categulario/35b124cd73053af582b6fc2eb5c06206 to your computer and use it in GitHub Desktop.
set encoding=utf-8
scriptencoding utf-8
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'vim-scripts/Align'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'editorconfig/editorconfig-vim'
Plugin 'bogado/file-line'
Plugin 'airblade/vim-gitgutter'
Plugin 'henrik/vim-indexed-search'
Plugin 'xolox/vim-misc'
Plugin 'vim-scripts/ebnf.vim'
Plugin 'Jinja'
Plugin 'Valloric/YouCompleteMe'
Plugin 'sheerun/vim-polyglot'
call vundle#end()
filetype plugin indent on
set expandtab
autocmd Filetype html setlocal tabstop=2
autocmd Filetype html setlocal softtabstop=2
autocmd Filetype html setlocal shiftwidth=2
autocmd Filetype vue setlocal tabstop=2
autocmd Filetype vue setlocal softtabstop=2
autocmd Filetype vue setlocal shiftwidth=2
autocmd Filetype xml setlocal tabstop=2
autocmd Filetype xml setlocal softtabstop=2
autocmd Filetype xml setlocal shiftwidth=2
autocmd Filetype rng setlocal tabstop=2
autocmd Filetype rng setlocal softtabstop=2
autocmd Filetype rng setlocal shiftwidth=2
autocmd Filetype rst setlocal tabstop=3
autocmd Filetype rst setlocal softtabstop=3
autocmd Filetype rst setlocal shiftwidth=3
autocmd Filetype javascript setlocal tabstop=2
autocmd Filetype javascript setlocal softtabstop=2
autocmd Filetype javascript setlocal shiftwidth=2
autocmd Filetype yaml setlocal tabstop=2
autocmd Filetype yaml setlocal softtabstop=2
autocmd Filetype yaml setlocal shiftwidth=2
autocmd Filetype r setlocal tabstop=2
autocmd Filetype r setlocal softtabstop=2
autocmd Filetype r setlocal shiftwidth=2
autocmd Filetype php setlocal tabstop=4
autocmd Filetype php setlocal softtabstop=4
autocmd Filetype php setlocal shiftwidth=4
autocmd Filetype blade setlocal tabstop=2
autocmd Filetype blade setlocal softtabstop=2
autocmd Filetype blade setlocal shiftwidth=2
syntax on
set incsearch
set tabstop=4
set softtabstop=4
set shiftwidth=4
set ignorecase
set smartcase
set showmatch
set hlsearch
set relativenumber
set number
set linebreak
set pastetoggle=<F2>
set grepprg=git\ grep\ -n
set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)%y%{&fileencoding?&fileencoding:&encoding}\ %P
set laststatus=2
set efm+=%f:%l
set updatetime=250
set cursorline
set listchars=space:·,tab:»\
set list
set scrolloff=10
set directory=~/.vim/swapfiles//
set colorcolumn=80
highlight ColorColumn ctermbg=8
let $BASH_ENV = "~/.bash_aliases"
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']
let g:ycm_server_python_interpreter = '/usr/bin/python2'
let mapleader = ','
let g:netrw_liststyle = 3
let g:netrw_banner = 0
nnoremap <c-o> :tabe<cr>
nnoremap <C-J> <C-W>j
nnoremap <C-K> <C-W>k
nnoremap <C-L> <C-W>l
nnoremap <C-H> <C-W>h
nnoremap <leader>ev :tabe $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
nnoremap <Space> @@
nnoremap <c-left> :tabp<cr>
nnoremap <c-right> :tabn<cr>
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
command W w !sudo tee % > /dev/null
command Q qa
"------------------------------------------------------------------------+
" Magic Vim Sessions .......................................|
" |
" From: |
" http://vim.wikia.com/wiki/Automatic_session_restore_in_git_directories |
"------------------------------------------------------------------------+
function! FindProjectName()
let s:name = getcwd()
if !isdirectory(".git")
let s:name = substitute(finddir(".git", ".;"), "/.git", "", "")
end
if s:name != ""
let s:name = matchstr(s:name, ".*", strridx(s:name, "/") + 1)
end
return s:name
endfunction
" Sessions only restored if we start Vim without args.
function! RestoreSession(name)
if a:name != ""
if filereadable($HOME . "/.vim/sessions/" . a:name)
execute 'source ' . $HOME . "/.vim/sessions/" . a:name
end
end
endfunction
" Sessions only saved if we start Vim without args.
function! SaveSession(name)
if a:name != ""
execute 'mksession! ' . $HOME . '/.vim/sessions/' . a:name
end
endfunction
" Restore and save sessions.
if argc() == 0
autocmd VimEnter * call RestoreSession(FindProjectName())
autocmd VimLeave * call SaveSession(FindProjectName())
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment