mirror of
https://github.com/notwa/rc
synced 2025-02-05 07:43:22 -08:00
remove old, rarely used vim stuff
This commit is contained in:
parent
ca1265508d
commit
479c57fdd7
1 changed files with 4 additions and 127 deletions
131
home/vimrc
131
home/vimrc
|
@ -10,7 +10,6 @@ if has('multi_byte')
|
|||
set encoding=utf-8 " and the default file is in it
|
||||
endif
|
||||
|
||||
" awful things
|
||||
if has("win32")
|
||||
" assume directory structure:
|
||||
" something/anything/.vimrc " this was passed to vim by the -u switch
|
||||
|
@ -91,13 +90,6 @@ if has('mksession')
|
|||
set sessionoptions=blank,buffers,curdir,options,folds,tabpages,winsize,resize,winpos
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
if has('wildignore')
|
||||
" a bunch of stuff that may or may not do any good
|
||||
set wildignore=""
|
||||
|
@ -116,23 +108,6 @@ endif
|
|||
|
||||
" autocmd {{{1
|
||||
|
||||
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
|
||||
|
||||
fu! KillSession()
|
||||
let sf=g:rcvim.'/.session.vim'
|
||||
call delete(sf)
|
||||
endf
|
||||
|
||||
fu! TabEight()
|
||||
setlocal tabstop=8 shiftwidth=8 noexpandtab softtabstop=0
|
||||
endf
|
||||
|
@ -151,7 +126,6 @@ set tabstop=8 shiftwidth=4 expandtab softtabstop=4
|
|||
if has('autocmd')
|
||||
augroup tabs
|
||||
au!
|
||||
" au BufRead,BufNewFile *.c,*.h,*.cpp,*.hpp,*.cc,*.hh call TabEight()
|
||||
au BufRead,BufNewFile PKGBUILD call TabTwo()
|
||||
au FileType ruby call TabTwo()
|
||||
au FileType nim call TabTwo()
|
||||
|
@ -172,12 +146,7 @@ if has('autocmd')
|
|||
|
||||
augroup nocomment
|
||||
au!
|
||||
au FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
|
||||
augroup END
|
||||
|
||||
augroup sessions
|
||||
au!
|
||||
au VimEnter * call LoadSession()
|
||||
au FileType * setlocal fo-=c fo-=r fo-=o
|
||||
augroup END
|
||||
|
||||
augroup nobells " good lord vim you are archaic
|
||||
|
@ -185,11 +154,6 @@ if has('autocmd')
|
|||
au GUIEnter * set vb t_vb=
|
||||
augroup END
|
||||
|
||||
augroup reload
|
||||
au!
|
||||
" au BufWritePost .vimrc,_vimrc,vimrc so $MYVIMRC
|
||||
augroup END
|
||||
|
||||
fu! ResCur() " attempt to preserve cursor position
|
||||
if line("'\"") > 1 && line("'\"") <= line("$")
|
||||
normal! g`"
|
||||
|
@ -236,9 +200,6 @@ Inn <c-F5> :w!<cr>
|
|||
Inn <c-F8> :e!<cr>
|
||||
Inn <c-F10> :bd!<cr>
|
||||
Inn <s-F5> :wall<cr>
|
||||
"Inn <s-F8> :tab ball<cr>
|
||||
Inn <s-F10> :call KillSession()<cr>:qall<cr>
|
||||
Inn <c-s-F10> :call KillSession()<cr>:qall!<cr>
|
||||
|
||||
" np++ habits
|
||||
Inn <c-up> <c-y>
|
||||
|
@ -289,7 +250,6 @@ nn <Leader>p "0p
|
|||
nn <Leader>P "0P
|
||||
nn <Leader>e :e **/*
|
||||
nn <Leader>b :ls<cr>:b<space>
|
||||
nn <Leader><F10> :call SaveSession()<cr>:xall<cr>
|
||||
nn <silent> <Leader>d :cd %:p:h<cr>:pwd<cr>
|
||||
nn <Leader>. @:
|
||||
"nn <Leader>? :exec getline(".")
|
||||
|
@ -297,77 +257,12 @@ nn <Leader>, :Tab /,\zs<cr>
|
|||
"nn <Leader>x :system('chmod +x %') | e
|
||||
|
||||
" via bit101
|
||||
nn - :E<cr>
|
||||
nn _ :E <c-r>=expand('%:h')<cr><cr>
|
||||
nn <Leader>f :E .<cr>
|
||||
nn <Leader>F :E <c-r>=expand('%:h')<cr><cr>
|
||||
nn <Leader>f :E<cr>
|
||||
nn <Leader>F :E .<cr>
|
||||
|
||||
" alias :W to :w, via https://stackoverflow.com/a/3879737
|
||||
cnoreabbrev <expr> W ((getcmdtype() is# ':' && getcmdline() is# 'W')?('w'):('W'))
|
||||
|
||||
" extension binds {{{1
|
||||
map <silent> <c-n> :CtrlPBuffer<cr>
|
||||
|
||||
" 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
|
||||
|
||||
nn <Leader>s :call SyntaxAttr()<cr>
|
||||
nn <Leader>1 :colo property16<cr>
|
||||
nn <Leader>2 :colo Tomorrow-Night<cr>
|
||||
nn <Leader>h :tabe<cr>:call HiDump()<cr>
|
||||
|
||||
" 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.
|
||||
silent :e " this will reload the file without trickeries
|
||||
"(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>
|
||||
|
||||
"%s# \(\*\|\*\*\|/\|//\) #\1#g
|
||||
|
||||
" misc {{{1
|
||||
|
||||
set list listchars=tab:»·,trail:·,extends:…,nbsp:‗
|
||||
|
@ -385,27 +280,9 @@ catch /E185/
|
|||
colorscheme desert
|
||||
endtry
|
||||
|
||||
" 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
|
||||
|
||||
" ctrlp {{{1
|
||||
|
||||
map <silent> <c-n> :CtrlPBuffer<cr>
|
||||
let g:ctrlp_match_window='bottom,order:btt,min:1,max:24,results:24'
|
||||
|
||||
" machine-specific configs {{{1
|
||||
|
|
Loading…
Add table
Reference in a new issue