Skip to content

Instantly share code, notes, and snippets.

@jonalmeida
Created November 24, 2014 21:40
Show Gist options
  • Save jonalmeida/b2317eb58470b4ea2893 to your computer and use it in GitHub Desktop.
Save jonalmeida/b2317eb58470b4ea2893 to your computer and use it in GitHub Desktop.
Current vim config
set ffs=unix,dos,mac " set file formats
set number " line numbers
set background=dark " background
colorscheme vividchalk " theme
"colorscheme molokai
"let g:molokai_original = 1
call pathogen#incubate()
call pathogen#helptags()
filetype off
syntax on
filetype plugin indent on
" Automatically cd into the directory that the file is in
autocmd BufEnter * execute "chdir ".escape(expand("%: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
" Vim config for Rust
filetype on
au BufNewFile,BufRead *.rs set filetype=rust
" Necesary for lots of cool vim things
set nocompatible
" This shows what you are typing as a command. I love this!
set showcmd
" Folding Stuffs
set foldmethod=marker
" Needed for Syntax Highlighting and stuff
"filetype on
"filetype plugin on
"syntax enable
set grepprg=grep\ -nH\ $*
" Who doesn't like autoindent?
set autoindent
" Cool tab completion stuff
set wildmenu
set wildmode=list:longest,full
" Enable mouse support in console
"set mouse=a
" Ignoring case is a fun trick
set ignorecase
" And so is Artificial Intellegence!
set smartcase
" This is totally awesome - remap jj to escape in insert mode. You'll never type jj anyway, so it's great!
inoremap jj <Esc>
" Keep all the temporary and backup files in one place
set backup
set backupdir=~/.vim/backup
set directory=~/.vim/tmp
" For converting tabs to spaces
set tabstop=4
set shiftwidth=4
set expandtab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment