X-Git-Url: http://git.jankratochvil.net/?p=nethome.git;a=blobdiff_plain;f=.vimrc;h=44871db88402fcd903e7d3ead58825e3188ec18b;hp=a1db382111e3573d750d6fb4218e49cd04bbfabb;hb=HEAD;hpb=0461fcdcd58c3b8a9a32d3dc007f80abffd65d91 diff --git a/.vimrc b/.vimrc index a1db382..2322696 100644 --- a/.vimrc +++ b/.vimrc @@ -1,13 +1,10 @@ +" $Id$ + + if !exists("g:_kratochvil_vimrc") let g:_kratochvil_vimrc=1 -autocmd! filetypedetect -autocmd! gzip BufRead -autocmd! gzip BufWritePost -autocmd! gzip FileAppendPost -autocmd! gzip FileAppendPre -autocmd! gzip FileReadPost -autocmd! gzip FileWritePost +"autocmd! filetypedetect "remove 'set tw=78': autocmd! BufRead *.txt @@ -19,16 +16,11 @@ autocmd! BufRead *.txt "immediate switch to non-existing file: BufNewFile BufEnter autocmd BufCreate,VimEnter * let g:BufEnter_ts= 8 -autocmd BufCreate,VimEnter */home/{short,kratochvil,root}/{src,WWW}/* let g:BufEnter_ts= 2 -autocmd BufCreate,VimEnter */home/{short,kratochvil,root}/src/*gnokii*/* let g:BufEnter_ts= 8 -autocmd BufCreate,VimEnter *.{i{,.as},s} let g:BufEnter_ts=20 autocmd BufEnter * call BufEnter() autocmd VimEnter * call BufEnter() -set runtimepath=.,$VIMRUNTIME +set runtimepath+=.,$VIMRUNTIME function BufEnter() if exists("g:BufEnter_ts") - let &ts=g:BufEnter_ts - let &sw=g:BufEnter_ts unlet g:BufEnter_ts set autoindent @@ -39,14 +31,31 @@ function BufEnter() runtime! ./../../../../../../../../../../../.vimrc ./../../../../../../../../../../.vimrc ./../../../../../../../../../.vimrc ./../../../../../../../../.vimrc ./../../../../../../../.vimrc ./../../../../../../.vimrc ./../../../../../.vimrc ./../../../../.vimrc ./../../../.vimrc ./../../.vimrc ./../.vimrc ./.vimrc endif endfunction +" From Red Hat vimrc - restore the cursor position after the file got opened: +autocmd BufReadPost * call BufReadPost() +function BufReadPost() + if line("'\"") > 0 && line ("'\"") <= line("$") + exe "normal! g'\"" + endif +endfunction -set encoding=utf-8 -set termencoding=iso-8859-2 +"set encoding=utf-8 +"set termencoding=utf-8 " fileencoding is detected from fileencodings, first one for empty files -set fileencodings=utf-8,iso-8859-2 +" 'iso-8859-2,euc-jp' really does not work for 'euc-jp' +"set fileencodings=utf-8,euc-jp,iso-8859-2 +set ts=8 +set sw=2 +set sts=2 ca X x syntax off +let g:loaded_matchparen = 1 +if !has('nvim') + set swapsync= +endif +" vim-7+ only +silent! set nofsync set noerrorbells set ruler set ignorecase @@ -55,25 +64,59 @@ set nowritebackup set exrc set nostartofline set nohlsearch -set fo=tcq +set noincsearch +set nofoldenable +set fo=tcq1 +set nojoinspaces +set clipboard= +"set textwidth=78 set viminfo='100,\"1000,:100,/40 +let g:netrw_home = $HOME +" https://bugzilla.redhat.com/show_bug.cgi?id=970190 +if &term=="xterm" || &term=="xterm-256color" + set t_Co=8 +endif +set mouse= + +" FIXME: Learn how to do :tag instead of :tselect with :cstag (used by :tag and CTRL-] if set cst) +set nocst set tags=./tags,./TAGS,./../tags,./../TAGS,./../../tags,./../../TAGS,./../../../tags,./../../../TAGS,./../../../../tags,./../../../../TAGS,./../../../../../tags,./../../../../../TAGS,./../../../../../../tags,./../../../../../../TAGS,./../../../../../../../tags,./../../../../../../../TAGS,./../../../../../../../../tags,./../../../../../../../../TAGS,./../../../../../../../../../tags,./../../../../../../../../../TAGS,./../../../../../../../../../../tags,./../../../../../../../../../../TAGS,./../../../../../../../../../../../tags,./../../../../../../../../../../../TAGS,./reactos/tags,./../reactos/tags,./../../reactos/tags,,./../../../reactos/tags,./../../../../reactos/tags,./../../../../../reactos/tags,./../../../../../../reactos/tags,./w32/inc/tags,./../w32/inc/tags,./../../w32/inc/tags,,./../../../w32/inc/tags,./../../../../w32/inc/tags,./../../../../../w32/inc/tags,./../../../../../../w32/inc/tags,./../../../../../../../w32/inc/tags,/usr/src/redhat/BUILD/tags,/usr/src/redhat/BUILD/TAGS,/usr/include/tags,/usr/include/TAGS noremap p :set invpaste paste? -noremap l :set invlist paste? +noremap l :set invlist list? noremap q @q noremap : @: -noremap N :nextzz -noremap B :cnzz -noremap P :prevzz -noremap O :cpzz +noremap :nextzz +noremap :prevzz +noremap N :tnzz +if $ANDROID_DATA!=#"/data" && $SSH_CLIENT!~"^2a02:2b88:2:1::3b57:[89]f " + " It auto-types random data after starting it from Termux + " Now all VIM version are affected: + noremap P :tpzz + noremap P1$r0q +endif +" Termux types +noremap! [23~ +noremap M :cnzz +noremap L :cpzz +" dnf install vim-fugitive +noremap f "myiw:Ggrep-Ew'm' +noremap F "myiw:grep-Ew'm'`git ls-files` +noremap g "myiw:grep-rEw'm'. noremap zz noremap zz noremap G:r !date '+\%H:\%M:\%S-'kA -noremap d :set hlsearch/^[+-]\([^+-].*\\|\)$ -noremap D :set hlsearch/^[+-][+-]\([^+-].*\\|\)$ +noremap s :set hlsearch/^[+-]\([^+-].*\\|\)$ +noremap S :set hlsearch/^[+-][+-]\([^+-].*\\|\)$ noremap w 0i /[^ ]vf.h"kyf./[^ ]vf.h"ly0x:r !date -d "`date '+\%Y'`-l-k" '+\%u'yypkV:!tr '1234567' 'PUSCPSN'jV:!tr '1234567' 'otttaoe'kJxv0xk0llllllplxxjddk0 +noremap e :syntax on:set syntax=wdiff noremap * :let ic_save=&ic:set noic*:let &ic=ic_save noremap # :let ic_save=&ic:set noic#:let &ic=ic_save +noremap :w:!aspell --check '%':e +noremap gq] gq/^. \?$ +noremap 1 :w:make -j1 +noremap 3 /^kmajd$V/^k:w! 1gvxd$V/^=======k:w! 2gvxd$V/^k:w! 3gvxdd'a0:!diff -u 2 1;diff -u 2 3 +noremap m :w:set makeprg=make:make +noremap n :w:set makeprg=ninja:make endif "!exists("g:_kratochvil_vimrc")