2015-03-09 10:02:16 -07:00
|
|
|
|
" make vim unusable for anyone else
|
2015-03-10 14:42:26 -07:00
|
|
|
|
" from the get-go, we assume version >= 703
|
2015-03-09 10:02:16 -07:00
|
|
|
|
|
2013-07-04 01:39:44 -07:00
|
|
|
|
set nocompatible " screw vi
|
2013-07-03 15:03:54 -07:00
|
|
|
|
|
2015-03-09 12:27:15 -07:00
|
|
|
|
" hacks {{{1
|
2013-07-04 01:39:44 -07:00
|
|
|
|
if has('multi_byte')
|
|
|
|
|
scriptencoding utf-8 " allow it in this script
|
|
|
|
|
set termencoding=utf-8 " and this terminal supports it
|
|
|
|
|
set encoding=utf-8 " and the default file is in it
|
2013-07-03 15:03:54 -07:00
|
|
|
|
endif
|
|
|
|
|
|
2015-03-08 15:59:44 -07:00
|
|
|
|
" awful things
|
|
|
|
|
if has("win32")
|
|
|
|
|
" assume directory structure:
|
|
|
|
|
" something/anything/.vimrc " this was passed to vim by the -u switch
|
|
|
|
|
" something/vim/
|
|
|
|
|
" something/vim/after
|
|
|
|
|
let $MYVIMRC=expand('<sfile>')
|
2015-03-10 15:21:29 -07:00
|
|
|
|
let g:rcvim=expand('<sfile>:p:h:h').'/vim'
|
2015-03-08 15:59:44 -07:00
|
|
|
|
else
|
2015-03-13 12:31:16 -07:00
|
|
|
|
let g:rcvim=$HOME.'/.vim'
|
2015-03-08 15:59:44 -07:00
|
|
|
|
endif
|
|
|
|
|
|
2015-03-10 15:21:29 -07:00
|
|
|
|
let &backupdir=g:rcvim.'/backup' " stash tilde files elsewhere
|
2015-03-09 10:02:16 -07:00
|
|
|
|
" the double slash at the end dumps the path of the file for uniqueness
|
2015-03-10 15:21:29 -07:00
|
|
|
|
let &directory=g:rcvim.'/swp//' " stash swap files too
|
|
|
|
|
let &undodir=g:rcvim.'/undo/' " undo files are cool
|
2015-03-09 10:02:16 -07:00
|
|
|
|
try | call mkdir(&backupdir, "p") | catch /E739/ | endtry
|
|
|
|
|
try | call mkdir(&directory, "p") | catch /E739/ | endtry
|
2015-03-10 15:21:29 -07:00
|
|
|
|
try | call mkdir(&undodir, "p") | catch /E739/ | endtry
|
2015-03-08 15:59:44 -07:00
|
|
|
|
|
2013-07-04 01:39:44 -07:00
|
|
|
|
if (&term =~ "^xterm") " enable colors on any xterm
|
|
|
|
|
let &t_Co=256
|
|
|
|
|
let &t_AF="\e[38;5;%dm"
|
|
|
|
|
let &t_AB="\e[48;5;%dm"
|
|
|
|
|
endif
|
|
|
|
|
|
2015-03-09 12:27:15 -07:00
|
|
|
|
" main config {{{1
|
|
|
|
|
|
2013-07-04 01:39:44 -07:00
|
|
|
|
if has('syntax')
|
|
|
|
|
syntax enable " required for folding as well
|
|
|
|
|
set hlsearch " highlight search results
|
|
|
|
|
endif
|
2015-03-24 19:54:57 -07:00
|
|
|
|
let g:python_highlight_builtin_funcs=1
|
2013-07-03 15:03:54 -07:00
|
|
|
|
|
|
|
|
|
if has('gui_running')
|
2015-03-08 15:59:44 -07:00
|
|
|
|
set guioptions-=M " skip loading $VIMRUNTIME/menu.vim
|
|
|
|
|
set guioptions-=m " hide menu which isn't loaded anyway
|
2013-07-04 01:39:44 -07:00
|
|
|
|
set guioptions-=T " hide toolbar
|
2015-03-08 15:59:44 -07:00
|
|
|
|
set guioptions-=r " hide scrollbar
|
2015-11-24 19:01:34 -08:00
|
|
|
|
if has("gui_gtk2")
|
|
|
|
|
set guifont=Consolas\ 11
|
|
|
|
|
else
|
|
|
|
|
set guifont=Consolas:h9
|
|
|
|
|
end
|
2013-07-04 01:39:44 -07:00
|
|
|
|
set columns=84
|
|
|
|
|
set lines=36
|
|
|
|
|
cd $HOME " might not be ideal...
|
2015-03-08 15:59:44 -07:00
|
|
|
|
endif
|
2013-07-04 01:39:44 -07:00
|
|
|
|
|
2015-03-09 12:27:15 -07:00
|
|
|
|
if has('title') | set title | endif " terminal title
|
2013-07-04 01:39:44 -07:00
|
|
|
|
set history=512 " command lines to remember
|
2015-03-09 12:27:15 -07:00
|
|
|
|
set number " lines
|
2013-07-04 01:39:44 -07:00
|
|
|
|
set ruler " write out the cursor position
|
2016-01-17 16:04:18 -08:00
|
|
|
|
set showcmd " show number of lines/etc. selected
|
2013-07-04 01:39:44 -07:00
|
|
|
|
set lazyredraw " when executing macros, untyped things
|
2015-03-09 12:27:15 -07:00
|
|
|
|
set shortmess=atI " be less verbose and shut up vim
|
|
|
|
|
set suffixes=.bak,~,.swp,.o,.log,.out " lower tab-completion priority
|
2013-07-04 01:39:44 -07:00
|
|
|
|
set noerrorbells visualbell t_vb= " disable bells
|
|
|
|
|
set scrolloff=3 " row context during scrolling
|
|
|
|
|
set sidescrolloff=2 " col context during scrolling
|
|
|
|
|
set incsearch " show first search result as we type
|
|
|
|
|
set ignorecase " insensitive searching
|
|
|
|
|
set smartcase " except when uppercase is used
|
|
|
|
|
set infercase " use existing case when ins-completing
|
2015-03-10 15:21:29 -07:00
|
|
|
|
set tabstop=8 shiftwidth=8 smarttab " 8 space tabs
|
2015-04-24 13:04:56 -07:00
|
|
|
|
set virtualedit=block " allow cursor anywhere in visual block
|
2016-01-23 23:00:53 -08:00
|
|
|
|
set foldmethod=marker " (performance issues with other methods)
|
2015-03-13 12:31:16 -07:00
|
|
|
|
set foldlevelstart=99 " start with everything unfolded...?
|
2015-03-09 12:27:15 -07:00
|
|
|
|
let c_syntax_for_h=1 " use C highlighting for .h files
|
|
|
|
|
set nowrap " word wrapping is pretty weak in vim
|
|
|
|
|
set ffs=unix,dos " ffs indeed
|
2015-03-10 15:21:29 -07:00
|
|
|
|
set nobomb " bombs are bad ok
|
|
|
|
|
set undofile " remember undos across files/sessions
|
2015-03-09 12:27:15 -07:00
|
|
|
|
set diffopt+=iwhite " ignore whitespace in diff command
|
2016-01-08 09:12:49 -08:00
|
|
|
|
set ttimeoutlen=50 " make changing modes a bit snappier
|
2016-07-06 22:33:39 -07:00
|
|
|
|
set hidden " allow swapping out of unsaved buffers
|
2015-03-10 15:21:29 -07:00
|
|
|
|
if has('mksession')
|
|
|
|
|
set sessionoptions=blank,buffers,curdir,options,folds,tabpages,winsize,resize,winpos
|
|
|
|
|
end
|
2013-07-03 15:03:54 -07:00
|
|
|
|
|
2013-07-04 01:39:44 -07:00
|
|
|
|
if 0
|
|
|
|
|
set autoindent " when creating newline, use same indent
|
|
|
|
|
if has('smartindent')
|
|
|
|
|
set smartindent " automatic indents with a lot of stuff
|
|
|
|
|
endif
|
|
|
|
|
endif " it's really just annoying though
|
|
|
|
|
|
2016-01-23 23:00:53 -08:00
|
|
|
|
if has('wildignore')
|
|
|
|
|
" a bunch of stuff that may or may not do any good
|
|
|
|
|
set wildignore=""
|
|
|
|
|
set wildignore+=.git,.svn,.hg,pkg,tmp,crap
|
|
|
|
|
set wildignore+=*.bak,*.tmp,*.log,*.cache,
|
|
|
|
|
set wildignore+=Desktop.ini,Thumbs.db,*.lnk,.DS_Store
|
|
|
|
|
set wildignore+=*.zip,*.tar,*.tar.*,
|
|
|
|
|
set wildignore+=*.suo,*.sln,*.pch,*.pdb,*.pgc,*.pgd
|
|
|
|
|
set wildignore+=*.o,*.obj,*.elf,*.lib,*.a,*.dll,*.so,*.so.*,*.exe,*.out
|
|
|
|
|
set wildignore+=__pycache__,*.pyc,*.pyo,*.pyd
|
|
|
|
|
set wildignore+=*.gem,.bundle
|
|
|
|
|
set wildignore+=CMake*,cmake_install.cmake,install_manifest.txt
|
2017-01-29 22:21:24 -08:00
|
|
|
|
set wildignore+=*.h5,*.npz
|
2016-01-23 23:00:53 -08:00
|
|
|
|
endif
|
|
|
|
|
|
2015-03-09 12:27:15 -07:00
|
|
|
|
" autocmd {{{1
|
2013-07-04 01:39:44 -07:00
|
|
|
|
|
2015-03-10 15:21:29 -07:00
|
|
|
|
fu! SaveSession()
|
|
|
|
|
let sf=g:rcvim.'/.session.vim'
|
|
|
|
|
execute 'mksession! '.sf
|
|
|
|
|
endf
|
|
|
|
|
|
|
|
|
|
fu! LoadSession()
|
|
|
|
|
let sf=g:rcvim.'/.session.vim'
|
|
|
|
|
if filereadable(sf)
|
|
|
|
|
execute 'so '.sf
|
|
|
|
|
endif
|
|
|
|
|
endf
|
|
|
|
|
|
2015-03-11 12:48:15 -07:00
|
|
|
|
fu! KillSession()
|
|
|
|
|
let sf=g:rcvim.'/.session.vim'
|
|
|
|
|
call delete(sf)
|
|
|
|
|
endf
|
|
|
|
|
|
2015-11-19 09:22:23 -08:00
|
|
|
|
fu! TabEight()
|
|
|
|
|
setlocal tabstop=8 shiftwidth=8 noexpandtab softtabstop=0
|
|
|
|
|
endf
|
|
|
|
|
|
2013-07-04 02:07:41 -07:00
|
|
|
|
fu! TabFour()
|
2015-03-09 10:02:16 -07:00
|
|
|
|
setlocal tabstop=8 shiftwidth=4 expandtab softtabstop=4
|
2013-07-04 02:07:41 -07:00
|
|
|
|
endf
|
2013-07-04 01:39:44 -07:00
|
|
|
|
|
2014-03-13 10:15:09 -07:00
|
|
|
|
fu! TabTwo()
|
|
|
|
|
setlocal tabstop=2 shiftwidth=2 expandtab
|
|
|
|
|
endf
|
|
|
|
|
|
2015-11-19 09:22:23 -08:00
|
|
|
|
" set TabFour as default
|
|
|
|
|
set tabstop=8 shiftwidth=4 expandtab softtabstop=4
|
|
|
|
|
|
2013-07-04 01:39:44 -07:00
|
|
|
|
if has('autocmd')
|
2015-11-19 09:22:23 -08:00
|
|
|
|
augroup tabs
|
2013-07-04 01:39:44 -07:00
|
|
|
|
au!
|
2016-06-27 04:32:34 -07:00
|
|
|
|
" au BufRead,BufNewFile *.c,*.h,*.cpp,*.hpp,*.cc,*.hh call TabEight()
|
2014-03-13 10:15:09 -07:00
|
|
|
|
au BufRead,BufNewFile PKGBUILD call TabTwo()
|
2014-06-02 06:54:57 -07:00
|
|
|
|
au FileType ruby call TabTwo()
|
2017-03-13 05:17:24 -07:00
|
|
|
|
au FileType nim call TabTwo()
|
2015-11-19 09:22:23 -08:00
|
|
|
|
au BufRead,BufNewFile *.bt,*.1sc call TabFour()
|
2017-05-25 19:24:48 -07:00
|
|
|
|
au FileType javascript,processing call TabTwo()
|
2014-03-13 10:15:09 -07:00
|
|
|
|
augroup END
|
|
|
|
|
|
2015-04-03 01:30:50 -07:00
|
|
|
|
augroup whatever
|
|
|
|
|
au!
|
|
|
|
|
au BufRead,BufNewFile *.lib setlocal ft=spice
|
2015-11-19 09:22:23 -08:00
|
|
|
|
au BufRead,BufNewFile *.bt setlocal ft=c
|
|
|
|
|
au BufRead,BufNewFile *.1sc setlocal ft=c
|
2016-01-07 19:42:51 -08:00
|
|
|
|
au BufRead,BufNewFile *.asm setlocal ft=lips
|
2017-03-13 05:17:24 -07:00
|
|
|
|
au BufRead,BufNewFile *.nim setlocal ft=nim
|
2017-05-25 19:24:48 -07:00
|
|
|
|
au BufRead,BufNewFile *.pde setlocal ft=processing
|
2015-04-03 01:30:50 -07:00
|
|
|
|
augroup END
|
|
|
|
|
|
2016-02-07 06:53:14 -08:00
|
|
|
|
augroup nocomment
|
|
|
|
|
au!
|
|
|
|
|
au FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
|
|
|
|
|
augroup END
|
|
|
|
|
|
2015-03-10 15:21:29 -07:00
|
|
|
|
augroup sessions
|
|
|
|
|
au!
|
|
|
|
|
au VimEnter * call LoadSession()
|
|
|
|
|
augroup END
|
|
|
|
|
|
2015-03-09 12:27:15 -07:00
|
|
|
|
augroup nobells " good lord vim you are archaic
|
|
|
|
|
au!
|
2015-03-08 15:59:44 -07:00
|
|
|
|
au GUIEnter * set vb t_vb=
|
|
|
|
|
augroup END
|
|
|
|
|
|
2015-03-13 12:31:16 -07:00
|
|
|
|
augroup reload
|
2014-03-13 10:15:09 -07:00
|
|
|
|
au!
|
2017-05-02 16:10:24 -07:00
|
|
|
|
" au BufWritePost .vimrc,_vimrc,vimrc so $MYVIMRC
|
2013-07-04 01:39:44 -07:00
|
|
|
|
augroup END
|
|
|
|
|
|
2013-07-04 02:07:41 -07:00
|
|
|
|
fu! ResCur() " attempt to preserve cursor position
|
|
|
|
|
if line("'\"") > 1 && line("'\"") <= line("$")
|
|
|
|
|
normal! g`"
|
|
|
|
|
return 1
|
|
|
|
|
endif
|
|
|
|
|
endf
|
|
|
|
|
augroup resCur
|
|
|
|
|
au!
|
2013-07-08 17:45:51 -07:00
|
|
|
|
au BufWinEnter * call ResCur()
|
2013-07-04 02:07:41 -07:00
|
|
|
|
augroup END
|
2013-07-04 01:39:44 -07:00
|
|
|
|
endif
|
|
|
|
|
|
2015-03-09 12:27:15 -07:00
|
|
|
|
" keys/binds {{{1
|
|
|
|
|
|
2013-07-04 01:39:44 -07:00
|
|
|
|
set backspace=eol,start,indent " make backspace useful
|
|
|
|
|
|
2015-03-09 10:02:16 -07:00
|
|
|
|
" tab completion in command-line
|
|
|
|
|
if has('wildmenu') | set wildmenu | endif
|
2015-03-05 10:10:22 -08:00
|
|
|
|
|
2013-07-04 01:39:44 -07:00
|
|
|
|
" easy indent/unindent
|
|
|
|
|
nn <tab> >>
|
|
|
|
|
nn <s-tab> <<
|
|
|
|
|
" indentation without ending selection
|
|
|
|
|
vn <silent> <tab> >gv
|
|
|
|
|
vn <silent> <s-tab> <gv
|
2013-07-03 15:03:54 -07:00
|
|
|
|
|
2013-07-04 01:39:44 -07:00
|
|
|
|
" might make return useful
|
|
|
|
|
"nn <s-cr> J
|
|
|
|
|
"nn <c-cr> dd
|
|
|
|
|
" oh wait, terminals don't do that...
|
|
|
|
|
|
2016-01-08 09:12:49 -08:00
|
|
|
|
fu! Inn(q)
|
2015-03-09 12:27:15 -07:00
|
|
|
|
" bind both normal and insert modes
|
2015-03-09 10:02:16 -07:00
|
|
|
|
let args=split(a:q, '^\s*\(<[^>]\+>\s\+\)\+\zs')
|
|
|
|
|
exec 'nn '.args[0].' '.args[1]
|
|
|
|
|
exec 'ino '.args[0].' <c-o>'.args[1]
|
|
|
|
|
endf
|
|
|
|
|
com! -nargs=+ Inn call Inn(<q-args>)
|
|
|
|
|
|
|
|
|
|
Inn <F5> :w<cr>
|
|
|
|
|
Inn <F8> :e<cr>
|
|
|
|
|
Inn <F10> :bd<cr>
|
|
|
|
|
Inn <c-F5> :w!<cr>
|
|
|
|
|
Inn <c-F8> :e!<cr>
|
|
|
|
|
Inn <c-F10> :bd!<cr>
|
|
|
|
|
Inn <s-F5> :wall<cr>
|
2016-01-23 23:00:53 -08:00
|
|
|
|
"Inn <s-F8> :tab ball<cr>
|
2015-03-11 12:48:15 -07:00
|
|
|
|
Inn <s-F10> :call KillSession()<cr>:qall<cr>
|
|
|
|
|
Inn <c-s-F10> :call KillSession()<cr>:qall!<cr>
|
2015-03-05 10:10:22 -08:00
|
|
|
|
|
2015-03-09 12:27:15 -07:00
|
|
|
|
" np++ habits
|
2015-03-09 10:02:16 -07:00
|
|
|
|
Inn <c-up> <c-y>
|
|
|
|
|
Inn <c-down> <c-e>
|
|
|
|
|
Inn <silent> <c-s-up> :m-2<cr>
|
|
|
|
|
Inn <silent> <c-s-down> :m+1<cr>
|
2015-03-10 14:42:26 -07:00
|
|
|
|
Inn <silent> <c-s-PageUp> :tabm -1<cr>
|
|
|
|
|
Inn <silent> <c-s-PageDown> :tabm +1<cr>
|
2015-03-09 10:02:16 -07:00
|
|
|
|
|
|
|
|
|
" hide search highlighting
|
|
|
|
|
Inn <silent> <c-]> :nohls<enter>
|
2013-07-04 01:39:44 -07:00
|
|
|
|
|
|
|
|
|
" rebind annoying things
|
2015-03-05 10:10:22 -08:00
|
|
|
|
" reflow text
|
2013-07-04 01:39:44 -07:00
|
|
|
|
nn Q gq
|
2015-03-24 19:54:57 -07:00
|
|
|
|
vn Q gq
|
2015-03-05 10:10:22 -08:00
|
|
|
|
" split lines (opposite of J)
|
|
|
|
|
nn K i<cr><esc>k$
|
2015-03-05 11:57:16 -08:00
|
|
|
|
vn K <nop>
|
2015-03-05 12:40:32 -08:00
|
|
|
|
" follow tag
|
|
|
|
|
nn <bar> <c-]>
|
2015-03-06 07:14:33 -08:00
|
|
|
|
" delete line
|
2015-03-24 19:54:57 -07:00
|
|
|
|
"nn D dd
|
2015-03-06 07:14:33 -08:00
|
|
|
|
|
2016-09-02 19:59:27 -07:00
|
|
|
|
" execute vim code in visual selection
|
|
|
|
|
vmap <space> "xy:@x<CR>
|
|
|
|
|
|
2015-03-09 10:02:16 -07:00
|
|
|
|
" this frees up x and X for use if you like
|
2015-03-06 07:14:33 -08:00
|
|
|
|
set <s-Del>=[3;2~
|
2015-03-09 12:27:15 -07:00
|
|
|
|
Inn <s-Del> X
|
2015-03-06 07:14:33 -08:00
|
|
|
|
|
|
|
|
|
" unfollow your leaders
|
2015-03-13 12:31:16 -07:00
|
|
|
|
let leader="\\"
|
2015-03-24 19:54:57 -07:00
|
|
|
|
" no-op
|
|
|
|
|
nn <Leader><Leader> :<cr>
|
2015-03-09 12:27:15 -07:00
|
|
|
|
"ino <c-\> <C-o><Leader> " this doesn't workkkkkkkkk
|
2015-04-04 00:14:55 -07:00
|
|
|
|
nm <Leader>i i?<Esc>r
|
|
|
|
|
nm <Leader>a a?<Esc>r
|
2015-03-06 07:14:33 -08:00
|
|
|
|
nn <Leader>p "0p
|
|
|
|
|
nn <Leader>P "0P
|
2016-01-23 23:00:53 -08:00
|
|
|
|
nn <Leader>e :e **/*
|
|
|
|
|
nn <Leader>b :ls<cr>:b<space>
|
2015-03-10 15:21:29 -07:00
|
|
|
|
nn <Leader><F10> :call SaveSession()<cr>:xall<cr>
|
2015-03-10 14:42:26 -07:00
|
|
|
|
nn <silent> <Leader>d :cd %:p:h<cr>:pwd<cr>
|
2015-03-07 07:57:26 -08:00
|
|
|
|
nn <Leader>. @:
|
2015-03-10 14:42:26 -07:00
|
|
|
|
"nn <Leader>? :exec getline(".")
|
|
|
|
|
nn <Leader>, :Tab /,\zs<cr>
|
2015-03-09 12:27:15 -07:00
|
|
|
|
"nn <Leader>x :system('chmod +x %') | e
|
2015-03-24 19:54:57 -07:00
|
|
|
|
|
2016-01-23 23:00:53 -08:00
|
|
|
|
" trying some copypasta from http://stackoverflow.com/a/16084326
|
|
|
|
|
set path=.,**
|
|
|
|
|
nn <Leader>f :find *
|
|
|
|
|
nn <Leader>F :find <c-r>=expand('%:h').'/*'<cr>
|
|
|
|
|
|
|
|
|
|
" extension binds {{{1
|
|
|
|
|
map <silent> <c-n> :CtrlPBuffer<cr>
|
|
|
|
|
|
2015-03-24 19:54:57 -07:00
|
|
|
|
" messing around with colors
|
|
|
|
|
" a la https://github.com/xolox/vim-colorscheme-switcher/blob/master/autoload/xolox/colorscheme_switcher.vim
|
|
|
|
|
fu! HiDump()
|
|
|
|
|
redir => out
|
|
|
|
|
silent hi
|
|
|
|
|
redir END
|
|
|
|
|
let @a = out
|
|
|
|
|
put a
|
|
|
|
|
endf
|
|
|
|
|
|
2015-03-10 14:42:26 -07:00
|
|
|
|
nn <Leader>s :call SyntaxAttr()<cr>
|
2017-05-02 16:10:24 -07:00
|
|
|
|
nn <Leader>1 :colo property16<cr>
|
|
|
|
|
nn <Leader>2 :colo Tomorrow-Night<cr>
|
2015-03-24 19:54:57 -07:00
|
|
|
|
nn <Leader>h :tabe<cr>:call HiDump()<cr>
|
2015-03-09 12:27:15 -07:00
|
|
|
|
|
2015-03-24 19:57:24 -07:00
|
|
|
|
" helper function to toggle hex mode
|
|
|
|
|
" http://vim.wikia.com/wiki/Improved_hex_editing
|
|
|
|
|
fu! ToggleHex()
|
|
|
|
|
" hex mode should be considered a read-only operation
|
|
|
|
|
" save values for modified and read-only for restoration later,
|
|
|
|
|
" and clear the read-only flag for now
|
|
|
|
|
let l:modified=&mod
|
|
|
|
|
let l:oldreadonly=&readonly
|
|
|
|
|
let &readonly=0
|
|
|
|
|
let l:oldmodifiable=&modifiable
|
|
|
|
|
let &modifiable=1
|
|
|
|
|
if !exists("b:editHex") || !b:editHex
|
|
|
|
|
" save old options
|
|
|
|
|
let b:oldft=&ft
|
|
|
|
|
let b:oldbin=&bin
|
|
|
|
|
" set new options
|
|
|
|
|
setlocal binary " make sure it overrides any textwidth, etc.
|
2016-01-23 23:00:53 -08:00
|
|
|
|
silent :e " this will reload the file without trickeries
|
2015-03-24 19:57:24 -07:00
|
|
|
|
"(DOS line endings will be shown entirely )
|
|
|
|
|
let &ft="xxd"
|
|
|
|
|
" set status
|
|
|
|
|
let b:editHex=1
|
|
|
|
|
" switch to hex editor
|
|
|
|
|
%!xxd
|
|
|
|
|
else
|
|
|
|
|
" restore old options
|
|
|
|
|
let &ft=b:oldft
|
|
|
|
|
if !b:oldbin
|
|
|
|
|
setlocal nobinary
|
|
|
|
|
endif
|
|
|
|
|
" set status
|
|
|
|
|
let b:editHex=0
|
|
|
|
|
" return to normal editing
|
|
|
|
|
%!xxd -r
|
|
|
|
|
endif
|
|
|
|
|
" restore values for modified and read only state
|
|
|
|
|
let &mod=l:modified
|
|
|
|
|
let &readonly=l:oldreadonly
|
|
|
|
|
let &modifiable=l:oldmodifiable
|
|
|
|
|
endf
|
|
|
|
|
|
|
|
|
|
nn <F2> :call ToggleHex()<cr>
|
|
|
|
|
|
2015-11-19 09:22:23 -08:00
|
|
|
|
"%s# \(\*\|\*\*\|/\|//\) #\1#g
|
|
|
|
|
|
2015-03-09 12:27:15 -07:00
|
|
|
|
" misc {{{1
|
2013-07-04 01:39:44 -07:00
|
|
|
|
|
2015-03-10 14:42:26 -07:00
|
|
|
|
set list listchars=tab:»·,trail:·,extends:…,nbsp:‗
|
|
|
|
|
" including this in case i'm on a _really_ bad terminal:
|
|
|
|
|
"set list listchars=tab:>-,trail:.,extends:>,nbsp:_
|
2015-03-05 10:10:22 -08:00
|
|
|
|
|
2015-03-09 10:02:16 -07:00
|
|
|
|
try | execute pathogen#infect() | catch /E117/ | endtry
|
2015-03-30 21:42:01 -07:00
|
|
|
|
|
|
|
|
|
set background=dark
|
|
|
|
|
try
|
2016-01-24 16:02:24 -08:00
|
|
|
|
colorscheme property16
|
2015-03-30 21:42:01 -07:00
|
|
|
|
catch /E185/
|
|
|
|
|
colorscheme desert
|
|
|
|
|
endtry
|
2016-01-08 09:12:49 -08:00
|
|
|
|
|
2016-01-23 23:00:53 -08:00
|
|
|
|
" set up default windows on a big terminal
|
|
|
|
|
fu! DefaultWin()
|
|
|
|
|
if &columns >= 84*2 && &lines >= 36*2
|
|
|
|
|
"/vim\
|
|
|
|
|
"| |_|
|
|
|
|
|
"|.| |
|
|
|
|
|
"\---/
|
|
|
|
|
vsplit
|
|
|
|
|
wincmd l
|
|
|
|
|
split
|
|
|
|
|
wincmd h
|
|
|
|
|
endif
|
|
|
|
|
endf
|
|
|
|
|
|
|
|
|
|
augroup DefaultWin
|
|
|
|
|
au!
|
|
|
|
|
au VimEnter * call DefaultWin()
|
|
|
|
|
augroup END
|
|
|
|
|
|
2017-01-23 11:56:26 -08:00
|
|
|
|
" ctrlp {{{1
|
2016-09-19 12:52:05 -07:00
|
|
|
|
|
2017-01-30 15:36:23 -08:00
|
|
|
|
let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:24,results:24'
|
2016-09-19 12:52:05 -07:00
|
|
|
|
|
2016-05-26 23:42:14 -07:00
|
|
|
|
" machine-specific configs {{{1
|
|
|
|
|
|
|
|
|
|
let s:hostname = hostname()
|
2016-06-27 04:33:41 -07:00
|
|
|
|
if s:hostname == "phantom-pi" || s:hostname == "wraith"
|
2016-05-26 23:42:14 -07:00
|
|
|
|
colo Tomorrow-Night
|
|
|
|
|
endif
|