From 582d3748def22a8301fb826283a9141e744e3b59 Mon Sep 17 00:00:00 2001 From: Adam Hovorka Date: Mon, 10 Jul 2017 14:20:52 -0600 Subject: Fixed errors, merged Aristotle --- base/.vimrc | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 64 insertions(+), 5 deletions(-) (limited to 'base') diff --git a/base/.vimrc b/base/.vimrc index ebdcd21..e9d7c33 100644 --- a/base/.vimrc +++ b/base/.vimrc @@ -46,11 +46,11 @@ set ignorecase " ignore case when searching set smartcase " ignore case if search pattern is all lowercase, " case-sensitive otherwise -nnoremap :noh +nnoremap :noh " Case insensitive -nnoremap * /\<=expand('')\> -nnoremap # ?\<=expand('')\> +nmap * /\<=expand('')\> +nmap # ?\<=expand('')\> set showmatch nnoremap % @@ -63,7 +63,7 @@ set wrap "set formatoptions=tqrn1 set colorcolumn=85 set ruler -"set number " always show line numbers +set number set relativenumber set laststatus=2 set cursorline @@ -85,6 +85,8 @@ set wildignore=*.swp,*.bak,*.pyc,*.class set ttyfast +hi Folded ctermbg=0 ctermfg=12 + " Stop using arrow keys ====---- nnoremap nnoremap @@ -99,7 +101,7 @@ inoremap " nnoremap k gk " Splits ====---- -nnoremap w vl split +nnoremap w vl nnoremap h nnoremap j nnoremap k @@ -141,3 +143,60 @@ vnoremap Q gq nnoremap Q gqap cnoremap w!! w !sudo tee % >/dev/null + +" helper function to toggle hex mode +function! 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. + 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 +endfunction + +command! -bar Hexmode call ToggleHex() +nnoremap h :Hexmode + +function! NumberToggle() + if(&relativenumber == 1) + set number + else + set relativenumber + endif +endfunc + +nnoremap N :call NumberToggle() +autocmd InsertEnter * :set number +autocmd InsertLeave * :set relativenumber + + +" To move elsewhere ====---- +au BufNewFile,BufRead *.less set filetype=less -- cgit v1.2.3-70-g09d2