.vimrc: +<Esc>s: wdiff
[nethome.git] / .vimrc
1 " $Id$
2
3
4 if !exists("g:_kratochvil_vimrc")
5         let g:_kratochvil_vimrc=1
6
7 autocmd! filetypedetect
8 "remove 'set tw=78':
9 autocmd! BufRead *.txt
10
11 "autocmd * * echo "test"
12
13 "startup   read      existing     file: BufReadPre BufReadPost BufEnter VimEnter
14 "command   read      non-existing file: BufCreate   BufNewFile BufEnter
15 "immediate switch to existing     file: BufReadPre BufReadPost BufEnter
16 "immediate switch to non-existing file:             BufNewFile BufEnter
17
18 autocmd BufCreate,VimEnter *                                             let g:BufEnter_ts= 8
19 autocmd BufEnter * call BufEnter()
20 autocmd VimEnter * call BufEnter()
21 set runtimepath=.,$VIMRUNTIME
22 function BufEnter()
23         if exists("g:BufEnter_ts")
24                 unlet g:BufEnter_ts
25
26                 set autoindent
27                 set nocindent
28                 set nosmartindent
29                 set indentexpr=
30
31                 runtime! ./../../../../../../../../../../../.vimrc ./../../../../../../../../../../.vimrc ./../../../../../../../../../.vimrc ./../../../../../../../../.vimrc ./../../../../../../../.vimrc ./../../../../../../.vimrc ./../../../../../.vimrc ./../../../../.vimrc ./../../../.vimrc ./../../.vimrc ./../.vimrc ./.vimrc
32         endif
33 endfunction
34 " From Red Hat vimrc - restore the cursor position after the file got opened:
35 autocmd BufReadPost * call BufReadPost()
36 function BufReadPost()
37         if line("'\"") > 0 && line ("'\"") <= line("$")
38                 exe "normal! g'\""
39         endif
40 endfunction
41
42 set encoding=utf-8
43 set termencoding=utf-8
44 " fileencoding is detected from fileencodings, first one for empty files
45 " 'iso-8859-2,euc-jp' really does not work for 'euc-jp'
46 set fileencodings=utf-8,euc-jp,iso-8859-2
47
48 set ts=8
49 set sw=2
50 set sts=2
51 ca X x
52 syntax off
53 let g:loaded_matchparen = 1
54 set swapsync=
55 " vim-7+ only
56 silent! set nofsync
57 set noerrorbells
58 set ruler
59 set ignorecase
60 set nobackup
61 set nowritebackup
62 set exrc
63 set nostartofline
64 set nohlsearch
65 set noincsearch
66 set nofoldenable
67 set fo=tcq1
68 set nojoinspaces
69 "set textwidth=78
70 set viminfo='100,\"1000,:100,/40
71 let g:netrw_home = $HOME
72 " https://bugzilla.redhat.com/show_bug.cgi?id=970190
73 if &term=="xterm" || &term=="xterm-256color"
74         set t_Co=8
75 endif
76 set mouse=
77
78 " FIXME: Learn how to do :tag instead of :tselect with :cstag (used by :tag and CTRL-] if set cst)
79 set nocst
80 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
81
82 noremap <Esc>p :set invpaste paste?<cr>
83 noremap <Esc>l :set invlist paste?<cr>
84 noremap <Esc>q @q
85 noremap <Esc>: @:
86 noremap <C-n> :next<cr>zz<C-g>
87 noremap <C-p> :prev<cr>zz<C-g>
88 noremap <Esc>N :tn<cr>zz<C-g>
89 noremap <Esc>P :tp<cr>zz<C-g>
90 "<Esc>P would auto-type random data after starting it on recent distros or Termux.
91 "read(0, "\33P1$r0 q\33\\\33[?12;4$y", 4096) = 19
92 noremap <Esc>P$r0<Space>q <Nop>
93 " Termux types <F11>
94 noremap! <Esc>[23~ <Nop>
95 noremap <Esc>M :cn<cr>zz<C-g>
96 noremap <Esc>L :cp<cr>zz<C-g>
97 noremap <Esc>f "myiw:grep<Space>-Ew<Space>'<C-r>m'<Space>`git ls-files`
98 noremap <Esc>g "myiw:grep<Space>-rEw<Space>'<C-r>m'<Space>.
99 noremap <C-]> <C-]>zz<C-g>
100 noremap <C-t> <C-t>zz<C-g>
101 noremap <C-d> G:r !date '+\%H:\%M:\%S-'<cr>kA
102 noremap <Esc>d :set hlsearch<cr>/^[+-]\([^+-].*\\|\)$<cr>
103 noremap <Esc>D :set hlsearch<cr>/^[+-][+-]\([^+-].*\\|\)$<cr>
104 noremap <Esc>w 0i <Esc>/[^ ]<cr>vf.h"kyf./[^ ]<cr>vf.h"ly0x:r !date -d "`date '+\%Y'`-<C-r>l-<C-r>k" '+\%u'<cr>yypkV:!tr '1234567' 'PUSCPSN'<cr>jV:!tr '1234567' 'otttaoe'<cr>kJxv0xk0llllllplxxjddk0
105 noremap <Esc>s :syntax on<cr>:set syntax=wdiff<cr>
106 noremap * :let ic_save=&ic<cr>:set noic<cr>*:let &ic=ic_save<cr>
107 noremap # :let ic_save=&ic<cr>:set noic<cr>#:let &ic=ic_save<cr>
108 noremap <C-k> :w<cr>:!aspell --check '%'<cr>:e<cr>
109 noremap gq] gq/^. \?$<cr>
110 noremap <Esc>1 :w<cr>:make -j1<cr>
111 noremap <Esc>m :w<cr>:make<cr>
112
113 endif "!exists("g:_kratochvil_vimrc")