Skip to content

Instantly share code, notes, and snippets.

@agscala
Created October 7, 2013 21:26
Show Gist options
  • Save agscala/6875228 to your computer and use it in GitHub Desktop.
Save agscala/6875228 to your computer and use it in GitHub Desktop.
"
" | |
" . , . . ,---. ,---| | ,---.
" \ / | | | | | | | |---'
" ' '---' ' ' `---' '--- `---
"
" -----------------------------------
" :BundleList - list configured bundles
" :BundleInstall(!) - install(update) bundles
" :BundleSearch(!) foo - search(or refresh cache first) for foo
" :BundleClean(!) - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle command are not allowed..
" (required)
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
" GITHUB REPOS:
Bundle 'bronson/vim-trailing-whitespace'
Bundle 'daltoad/vim-jade'
Bundle 'godlygeek/tabular'
Bundle 'kchmck/vim-coffee-script'
Bundle 'kien/ctrlp.vim'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'Lokaltog/vim-powerline'
Bundle 'lunaru/vim-less'
Bundle 'majutsushi/tagbar'
Bundle 'MarcWeber/vim-addon-local-vimrc'
Bundle 'mhinz/vim-startify'
Bundle 'rosstimson/scala-vim-support'
Bundle 'scrooloose/nerdtree'
Bundle 'scrooloose/nerdcommenter'
Bundle 'tpope/vim-markdown'
Bundle 'tpope/vim-repeat'
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-git'
Bundle 'tsaleh/vim-align'
Bundle 'tsaleh/vim-matchit'
Bundle 'tsaleh/vim-supertab'
Bundle 'vim-ruby/vim-ruby'
Bundle 'vim-scripts/DirDiff.vim'
Bundle 'vim-scripts/DoxygenToolkit.vim'
Bundle 'vim-scripts/python.vim'
Bundle 'wavded/vim-stylus'
" Bundle 'Valloric/YouCompleteMe.git'
" VIMSCRIPTS REPOS:
Bundle 'FSwitch'
Bundle 'Gist.vim'
Bundle 'WebAPI.vim'
" GIT REPOS:
" Bundle 'git://git.wincent.com/command-t.git'
" (required)
filetype plugin indent on
" ---------- END VUNDLE -------------
" Print out the syntax groups under the cursor for debugging
map <F12> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
" Testing "
set encoding=utf-8
set scrolloff=3
set sidescroll=1
set sidescrolloff=10
" set scrolljump=6
set showmode
set showcmd
set hidden
set wildmenu
set wildmode=list:longest
set visualbell
set ttyfast
set ruler
set backspace=indent,eol,start
set laststatus=2
set noswapfile
set lazyredraw
set splitbelow
set splitright
set wildignore+=*/tmp/*,*.so,*.swp,*.zip
"""""""""""
" Reselect visual block after indent
vnoremap < <gv
vnoremap > >gv
" Don't save deleted text
vnoremap p "_dP
augroup resCur
autocmd!
autocmd BufReadPost * call setpos(".", getpos("'\""))
augroup END
" Shortcut for writing read-only files
cmap w!! %!sudo tee > /dev/null %
set nocompatible
set noswapfile
set number
" set relativenumber " (Don't like too much after trying)
"-- Default Indenting --"
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set shiftround
"---------------"
"
let mapleader = ","
set nocompatible
set noswapfile
set number
" set relativenumber " (Don't like too much after trying)
"-- Searching --"
" nnoremap / /\v
" vnoremap / /\v
set ignorecase
set smartcase
" set gdefault "FUCKIN WITH MY SUBSTITUTIN
set incsearch
set showmatch
set nohlsearch
nnoremap <leader><space> :noh<cr>
"---------------"
" Show Git Diff in window split when committing
autocmd FileType gitcommit DiffGitCached | wincmd p
set showmatch
colorscheme agscala
set background=dark
" colorscheme solarized
set gfn=Inconsolata\ Medium\ 11
set linespace=1
syntax enable
" Highlighting the cursor
set cursorline
set cursorcolumn
set list
set listchars=tab:»\ ,trail:·
" Use _ as a word separator.
" NOTE: If this stops working, watch for FileType after
" set iskeyword-=_
" autocmd CursorHold * setlocal cursorline cursorcolumn
" autocmd CursorMoved,InsertEnter *
" \ if &l:cursorline | setlocal nocursorline nocursorcolumn | endif
" PHP settings.
let php_sql_query=1
let php_htmlInStrings=1
" Fold toggling with <Space> if a fold exists at the cursor.
nnoremap <silent> <Space> @=(foldlevel('.')?'za':'l')<CR>
vnoremap <Space> zf
" 256 Color support in the terminal
set t_Co=256
" Enter inserts inserts blank lines without entering insert mode.
nmap [<space> O<Esc>
nmap ]<space> o<Esc>
" Map ctrl-movement keys to window switching & resizing
noremap <C-k> <C-w><Up>
noremap <C-j> <C-w><Down>
noremap <C-l> <C-w><Right>
noremap <C-h> <C-w><Left>
" Resizing windows. (doesn't work)
" noremap <C-S-k> <C-w>+
" noremap <C-S-j> <C-w>-
" noremap <C-S-h> <C-w><
" noremap <C-S-l> <C-w>>
" Fix [<section> commands so that it matches both formats of function braces
map [[ ?{<CR>w99[{
map ][ /}<CR>b99]}
map ]] j0[[%/{<CR>
map [] k$][%?}<CR>
" NERDTree
imap <F8> <Esc>:NERDTreeToggle<CR>
nmap <F8> :NERDTreeToggle<CR>
let NERDTreeIgnore=['\.pyc$']
" Run the script based on the filetype with <F5>
autocmd FileType python map <F5> <Esc>:!python %<CR>
autocmd FileType perl map <F5> <Esc>:!perl %<CR>
autocmd FileType ruby map <F5> <Esc>:!ruby %<CR>
" Show trailing whitepace and spaces before a tab:
autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/ containedin=ALL
" Shortcut to sudo write a file
cmap w!! %!sudo tee > /dev/null %
" Remove GUI from GVIM
set guioptions=
" Go to last file(s) if invoked without arguments. (ANNOYING CAUSE IT CHANGES
" CWD TO THE LAST FILES DIR)
" autocmd VimLeave * nested if (!isdirectory($HOME . "/.vim")) |
" \ call mkdir($HOME . "/.vim") |
" \ endif |
" \ execute "mksession! " . $HOME . "/.vim/Session.vim"
" autocmd VimEnter * nested if argc() == 0 && filereadable($HOME . "/.vim/Session.vim") |
" \ execute "source " . $HOME . "/.vim/Session.vim"
" AckGrep.vim
" let g:ackprg="ack-grep -H --nocolor --nogroup "
let g:ackprg="ack-grep -H"
" NERD_Commenter.vim settings
let NERDSpaceDelims = 1
let NERDCompactSexyComs = 1
" EasyMotion.vim settings
" let g:EasyMotion_leader_key = '<Leader>'
""" TagList.vim settings
" let Tlist_Ctags_Cmd="ctags-exuberant"
" let Tlist_Sort_Type="name"
" let Tlist_Process_File_Always=1
" let Tlist_WinWidth=50
" map <F7> <Esc>:TlistToggle<CR>
" map <F6> :!/usr/bin/ctags-exuberant -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
" " Tags -- add new ones with `ctags -R -f ~/.vim/tags/language.ctags /location/to/tag/from
" " set tags+=$HOME/.vim/tags/python.ctags
" " Taglist variables
" " Display function name in status bar:
" let g:ctags_statusline=1
" " Automatically start script
" let generate_tags=1
" " Displays taglist results in a vertical window:
" let Tlist_Use_Horiz_Window=0
" " Shorter commands to toggle Taglist display
" nnoremap TT :TlistToggle<CR>
" " Various Taglist diplay config:
" let Tlist_Use_Right_Window = 1
" let Tlist_Compact_Format = 1
" let Tlist_Exit_OnlyWindow = 1
" let Tlist_GainFocus_On_ToggleOpen = 1
" let Tlist_File_Fold_Auto_Close = 1
""" Powerline.vim
" let g:Powerline_symbols = 'fancy'
""" Tagbar.vim
map <F7> <Esc>:TagbarToggle<CR>
""" CommandT.vim
map <F6> <Esc>:CommandT<CR>
nnoremap <silent> <Leader>b :CommandTBuffer<CR>
""" Supertab.vim
" let g:SuperTabDefaultCompletionType = "context"
""" Doxygen
let g:DoxygenToolkit_briefTag_pre="@details "
let g:DoxygenToolkit_paramTag_pre="@param "
let g:DoxygenToolkit_returnTag="@return"
let g:DoxygenToolkit_authorName="Andrew Scala"
""" MRU (Most Recently Used
map <F9> <Esc>:CtrlPMRUFiles<CR>
map <C-@> <Esc>:CtrlP<CR>
" map <F9> <Esc>:MRU<CR>
" let MRU_Max_Menu_Entries = 20
""" FSwitch
autocmd FileType cpp map <F5> <Esc>:FSHere<CR>
autocmd FileType c map <F5> <Esc>:FSHere<CR>
set completeopt=menuone,longest
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#CompleteCpp
autocmd FileType cpp set omnifunc=omni#cpp#complete#Main
"========= VIM DIFF ========="
function! s:DiffAllWindows(on) " {{{2
windo call <SID>DiffThisWindow(a:on)
endfunc
function! s:DiffThisWindow(on) " {{{2
if a:on
silent! set diff scrollbind fdm=diff
else
silent! set nodiff noscrollbind fdm=syntax
end
endfunc
function! s:DiffThese(file1, file2) " {{{2
exe "tabedit " . a:file1
exe "vsplit " . a:file2
call <SID>DiffAllWindows(1)
endfunc
command! -nargs=0 DiffThis call <SID>DiffThisWindow(1)
command! -nargs=0 DiffOff call <SID>DiffThisWindow(0)
command! -nargs=0 DiffToggle call <SID>DiffThisWindow(!&diff)
command! -nargs=0 DiffAll call <SID>DiffAllWindows(1)
command! -nargs=0 DiffAllOff call <SID>DiffAllWindows(0)
command! -nargs=* -complete=file DiffThese call <SID>DiffThese(<f-args>)
"====== END VIM DIFF ========
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment