Last active
March 21, 2018 00:32
-
-
Save cedmundo/5e709179d883a02d197ed216daa2ee72 to your computer and use it in GitHub Desktop.
My personal vimrc (no golang)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"{{{Auto Commands | |
" Automatically cd into the directory that the file is in | |
autocmd VimEnter * silent! :cd%:p:h | |
" Remove any trailing whitespace that is in the file | |
autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif | |
" Restore cursor position to where it was before | |
augroup JumpCursorOnEdit | |
au! | |
autocmd BufReadPost * | |
\ if expand("<afile>:p:h") !=? $TEMP | | |
\ if line("'\"") > 1 && line("'\"") <= line("$") | | |
\ let JumpCursorOnEdit_foo = line("'\"") | | |
\ let b:doopenfold = 1 | | |
\ if (foldlevel(JumpCursorOnEdit_foo) > foldlevel(JumpCursorOnEdit_foo - 1)) | | |
\ let JumpCursorOnEdit_foo = JumpCursorOnEdit_foo - 1 | | |
\ let b:doopenfold = 2 | | |
\ endif | | |
\ exe JumpCursorOnEdit_foo | | |
\ endif | | |
\ endif | |
" Need to postpone using "zv" until after reading the modelines. | |
autocmd BufWinEnter * | |
\ if exists("b:doopenfold") | | |
\ exe "normal zv" | | |
\ if(b:doopenfold > 1) | | |
\ exe "+".1 | | |
\ endif | | |
\ unlet b:doopenfold | | |
\ endif | |
augroup END | |
"}}} | |
"{{{ Vundle | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'VundleVim/Vundle.vim' | |
Plugin 'vim-airline/vim-airline' | |
Plugin 'vim-airline/vim-airline-themes' | |
Plugin 'scrooloose/nerdtree' | |
call vundle#end() " required | |
filetype plugin indent on " required | |
"}}} | |
"{{{ Vundle plugins settings | |
" Airline | |
let g:airline_powerline_fonts = 1 | |
"}}} | |
"{{{Misc Settings | |
" Needed for Syntax Highlighting and stuff | |
syntax enable | |
set grepprg=grep\ -nH\ $* | |
" Necesary for lots of cool vim things | |
set nocompatible | |
" Cool colors | |
colorscheme anderson | |
" Show line numbers | |
set number | |
" Who doesn't like autoindent? | |
set autoindent | |
" Spaces are better than a tab character | |
set expandtab | |
set smarttab | |
" Who wants an 8 character tab? Not me! | |
set shiftwidth=3 | |
set softtabstop=3 | |
" Enable mouse support in console | |
set mouse=a | |
" Got backspace? | |
set backspace=2 | |
" Incremental searching is sexy | |
set incsearch | |
" Highlight things that we find with the search | |
set hlsearch | |
" GLSL Syntax | |
au BufNewFile,BufRead *.frag,*.vert,*.fp,*.vp,*.glsl setf glsl | |
" W to w | |
:command WQ wq | |
:command Wq wq | |
:command W w | |
:command Q q | |
" Replace visual selection | |
vnoremap <C-r> "hy:%s/<C-r>h//gc<left><left><left> | |
" Two spces on html files | |
au FileType html set expandtab smarttab shiftwidth=2 softtabstop=2 | |
au FileType js set expandtab smarttab shiftwidth=2 softtabstop=2 | |
au FileType css set expandtab smarttab shiftwidth=2 softtabstop=2 | |
au BufReadPost,BufNewFile *.hbs set filetype=handlebars smartindent expandtab smarttab shiftwidth=2 softtabstop=2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment