X-Git-Url: http://git.jankratochvil.net/?p=nethome.git;a=blobdiff_plain;f=.vimrc;h=782bf0477c4cad83c9f13e8166a01b2f8a64c1e0;hp=c97feba41e201c9fa90303ebb74e6fcf33d23b66;hb=c8c80f0a782c4b3a07b9d7f2d470455eab9b353d;hpb=0665322a6c3766e7fc488ed465622effe4227498 diff --git a/.vimrc b/.vimrc index c97feba..782bf04 100644 --- a/.vimrc +++ b/.vimrc @@ -1,16 +1,109 @@ -":version 4.x -autocmd BufEnter * set sw=8 tabstop=8 -autocmd BufEnter /home/{short,root}/{src,WWW}/* set sw=2 tabstop=2 -set autoindent +" $Id$ + + +if !exists("g:_kratochvil_vimrc") + let g:_kratochvil_vimrc=1 + +autocmd! filetypedetect +"remove 'set tw=78': +autocmd! BufRead *.txt + +"autocmd * * echo "test" + +"startup read existing file: BufReadPre BufReadPost BufEnter VimEnter +"command read non-existing file: BufCreate BufNewFile BufEnter +"immediate switch to existing file: BufReadPre BufReadPost BufEnter +"immediate switch to non-existing file: BufNewFile BufEnter + +autocmd BufCreate,VimEnter * let g:BufEnter_ts= 8 +autocmd BufEnter * call BufEnter() +autocmd VimEnter * call BufEnter() +set runtimepath=.,$VIMRUNTIME +function BufEnter() + if exists("g:BufEnter_ts") + unlet g:BufEnter_ts + + set autoindent + set nocindent + set nosmartindent + set indentexpr= + + 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=utf-8 +" fileencoding is detected from fileencodings, first one for empty files +" '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 +set swapsync= +" vim-7+ only +silent! set nofsync set noerrorbells set ruler set ignorecase set nobackup set nowritebackup set exrc +set nostartofline set nohlsearch -syntax off -ca X x -set fo=tcq2 +set noincsearch +set nofoldenable +set fo=tcq1 +set nojoinspaces +"set textwidth=78 set viminfo='100,\"1000,:100,/40 -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,/usr/src/redhat/BUILD/tags,/usr/src/redhat/BUILD/TAGS,/usr/include/tags,/usr/include/TAGS +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 + +" 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 q @q +noremap : @: +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 + noremap P :tpzz +endif +noremap M :cnzz +noremap L :cpzz +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 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 * :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 m :w:make + +endif "!exists("g:_kratochvil_vimrc")