Skip to content

Instantly share code, notes, and snippets.

@inmatarian
Created August 3, 2015 22:27
Show Gist options
  • Save inmatarian/a5373553908b59c4e5a6 to your computer and use it in GitHub Desktop.
Save inmatarian/a5373553908b59c4e5a6 to your computer and use it in GitHub Desktop.
" Header ---------------------------------------------------------------------
filetype on
call pathogen#infect() " Load Scripts from .vim/bundle
call pathogen#helptags()
set nocompatible
" Basic Options --------------------------------------------------------------
filetype plugin indent on
syntax on
set encoding=utf-8
set showmode
set showcmd
set hidden
set number
set lazyredraw
set ttyfast
"set list
set listchars=tab:>·
set splitbelow
set splitright
set timeoutlen=3000
set ttimeoutlen=300
set more
" set tildeop
set clipboard=unnamed
set mouse=a
set backspace=2
" Indentation Behavior -------------------------------------------------------
set tabstop=4
set softtabstop=4
set shiftwidth=4
set smarttab
set expandtab
set autoindent
" Auto Completion ------------------------------------------------------------
set wildmenu
set wildmode=list,full
set complete-=k complete+=k
set completefunc=syntaxcomplete#Complete
set omnifunc=syntaxcomplete#Complete
set tags=tags;/
if has("win32") || has("win64")
set dictionary-=~/vimfiles/linux_words.dict dictionary+=~/vimfiles/linux_words.dict
else
set dictionary-=/usr/share/dict/words dictionary+=/usr/share/dict/words
endif
" GUI ------------------------------------------------------------------------
set noeb vb t_vb= " disable beep and flash
if has("gui_running")
set guioptions-=T
set guioptions+=e
colorscheme tango2
set background=dark
set guifont=DejaVu_Sans_Mono:h10:cANSI
endif
" File Behavior --------------------------------------------------------------
function SetLovePrefs()
if has("win32") || has("win64")
setlocal dictionary-=~/vimfiles/love-dictionary/love.dict dictionary+=~/vimfiles/love-dictionary/love.dict
setlocal dictionary-=~/vimfiles/lua.dict dictionary+=~/vimfiles/lua.dict
setlocal iskeyword+=.
end
endfunction
if has("autocmd")
augroup prog
au!
" Don't expand tabs to spaces in Makefiles
au BufEnter [Mm]akefile* set noet
au BufLeave [Mm]akefile* set et
autocmd FileType lua setlocal tabstop=2 shiftwidth=2 softtabstop=2
autocmd FileType lua call SetLovePrefs()
augroup END
end
au BufReadPost *.py set syntax=python " instead of conf
" Leader Mapping -------------------------------------------------------------
map <Space> <Leader>
map <Space><Space> <Leader><Leader>
" Searching and Movement -----------------------------------------------------
set incsearch " do incremental searching
set hlsearch " highlight searched
set ignorecase " ignore case when searching
set scrolloff=1
set sidescrolloff=3
set whichwrap=b,s,h,l,<,>,[,] " move freely between files
nn <silent> <Cr> :noh<Cr>
" Up and down are more logical with g
nn <silent> k gk
nn <silent> j gj
nn <silent> <Up> gk
nn <silent> <Down> gj
ino <silent> <Up> <C-O>gk
ino <silent> <Down> <C-O>gj
" Status Line ----------------------------------------------------------------
set laststatus=2
hi statusline ctermbg=black
set statusline=\ %n:\ %f\ %y%r%m%h%w%<%=%v\,\ %l\/%L\,\ %3P\
" Key Mappings ---------------------------------------------------------------
nmap <F1> <nop>
imap <F1> <nop>
nn <silent> <F2> <esc>:NERDTreeToggle<cr>
nn <silent> <Leader><F2> <esc>:NERDTreeFind<cr>
nn <silent> <F3> <esc>:TlistToggle<cr>
nn <silent> <F4> <esc>:BuffergatorToggle<cr>
nn <silent> <F6> :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR>
nn <silent> <F9> :bn!<Cr>
nn <silent> <Leader><F9> :bp!<Cr>
nn <silent> <F12> <c-]>
nn <silent> <Leader>rt <esc>:!ctags -R --exclude=.git<Cr>
nn ; :
nn <silent> , ;
nn Q gq
nn <silent> <Leader>dt :r !date<cr>
nn <C-s> <esc>:w<cr>
nn <leader>w <esc>:w<cr>
nn <leader>W <esc>:wall<cr>
" Pastemode Stuff
map <silent> <F8> :set paste<cr>
map <silent> <S-F8> :set nopaste<cr>
imap <silent> <F8> <C-O>:set paste<cr>
imap <silent> <S-F8> <nop>
set pastetoggle=<S-F8>
" x plz dont kill muh yanks
nn <silent> x "_d
"make Y behave more like C and D
nmap Y y$
" \d to delete without storing in a register.
nn <silent> <Leader>d "_d
nn <silent> <Leader>D "_D
vn <silent> <Leader>d "_d
vn <silent> <Leader>D "_D
" \p to paste what was recently yanked ignoring deletes.
nn <silent> <Leader>p "0p
nn <silent> <Leader>P "0P
" Tildeops is magic, but let's get around the voodoo for a second.
nn <silent> <Leader>~ g~l
nn <silent> <Leader>l <esc>:set list!<CR>
" Change directory more easily
nn <Leader>cd :cd %:p:h<CR>:pwd<CR>
" window switching like weechat
nn <silent> <M-Left> <esc><C-W><Left>
nn <silent> <M-Right> <esc><C-W><Right>
nn <silent> <M-Up> <esc><C-W><Up>
nn <silent> <M-Down> <esc><C-W><Down>
nn <silent> <Leader><Left> <esc><C-W><Left>
nn <silent> <Leader><Right> <esc><C-W><Right>
nn <silent> <Leader><Up> <esc><C-W><Up>
nn <silent> <Leader><Down> <esc><C-W><Down>
if has("win32") || has("win64")
nn <silent> <leader>v :e ~/_vimrc<cr>
else
nn <silent> <leader>v :e ~/.vimrc<cr>
end
" Folding --------------------------------------------------------------------
set foldmethod=indent
set foldlevel=99
nn <silent> <leader><leader> za
" Aliases for common typos ---------------------------------------------------
cnoreabbrev E e
cnoreabbrev W w
cnoreabbrev WQ wq
cnoreabbrev Wa wa
cnoreabbrev WA wa
cnoreabbrev Wall wall
cnoreabbrev WAll wall
cnoreabbrev WALL wall
cnoreabbrev Q q
cnoreabbrev QA qa
" Custom Commands ------------------------------------------------------------
if has("win32") || has("win64")
command -nargs=* Love :!"C:\Program Files\LOVE\love.exe" . <args>
command -nargs=* Lua51 :!"C:\Program Files (x86)\Lua\5.1\lua.exe" <args>
end
" Preventing Spam ------------------------------------------------------------
set suffixes+=.bak
set suffixes+=.swp
set suffixes+=.o
set suffixes+=.class
set suffixes+=.pyc
set suffixes+=.pyo
set suffixes+=.png
set suffixes+=.jpg
set suffixes+=.gif
set suffixes+=.bmp
" swap files make me a sad panda
if has("win32") || has("win64")
set directory=$TMP
else
set directory=/tmp
end
" Settings for Plugins -------------------------------------------------------
" -- taglist.vim
let Tlist_Use_Right_Window=1
let Tlist_Auto_Open=0
let Tlist_Enable_Fold_Column=0
let Tlist_Compact_Format=0
let Tlist_Exit_OnlyWindow=1
let Tlist_File_Fold_Auto_Close = 1
" -- NERDTree
let NERDTreeIgnore = []
for suffix in split(&suffixes, ',')
let NERDTreeIgnore += [ escape(suffix, '.~') . '$' ]
endfor
let NERDTreeWinSize = 19
" -- Buffer Explorer
let g:bufExplorerSortBy='name'
" -- Buffer Gator
let g:buffergator_viewport_split_policy="T"
let g:buffergator_autoexpand_on_split=0
let g:buffergator_split_size=10
let g:buffergator_display_regime='filepath'
" -- xolox's Notes.vim
let g:notes_directory = '~/Documents/Notes'
let g:notes_suffix = '.txt'
let g:notes_lists_bullets = ['*', '-', '+', '.']
let g:notes_smart_quotes = 0
" -- xolox's Session.vim
let g:session_autoload = 'no'
let g:session_autosave = 'yes'
let g:session_command_aliases = 1
" -- SuperTab
"autocmd FileType *
" \ if &omnifunc != '' |
" \ call SuperTabChain(&omnifunc, "<c-x><c-]>") |
" \ call SuperTabSetDefaultCompletionType("context") |
" \ endif
"
let g:SuperTabSetDefaultCompletionType = "context"
" -- vim-lua-ftplugin
if has("win32") || has("win64")
let g:lua_compiler_name = "C:/Program Files (x86)/Lua/5.1/luac.exe"
endif
let g:lua_check_globals = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment