+.config/yt-dlp.conf
[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 if !has('nvim')
55         set swapsync=
56 endif
57 " vim-7+ only
58 silent! set nofsync
59 set noerrorbells
60 set ruler
61 set ignorecase
62 set nobackup
63 set nowritebackup
64 set exrc
65 set nostartofline
66 set nohlsearch
67 set noincsearch
68 set nofoldenable
69 set fo=tcq1
70 set nojoinspaces
71 set clipboard=
72 "set textwidth=78
73 set viminfo='100,\"1000,:100,/40
74 let g:netrw_home = $HOME
75 " https://bugzilla.redhat.com/show_bug.cgi?id=970190
76 if &term=="xterm" || &term=="xterm-256color"
77         set t_Co=8
78 endif
79 set mouse=
80
81 " FIXME: Learn how to do :tag instead of :tselect with :cstag (used by :tag and CTRL-] if set cst)
82 set nocst
83 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
84
85 noremap <Esc>p :set invpaste paste?<cr>
86 noremap <Esc>l :set invlist list?<cr>
87 noremap <Esc>q @q
88 noremap <Esc>: @:
89 noremap <C-n> :next<cr>zz<C-g>
90 noremap <C-p> :prev<cr>zz<C-g>
91 noremap <Esc>N :tn<cr>zz<C-g>
92 if $ANDROID_DATA!=#"/data" && $SSH_CLIENT!~"^2a02:2b88:2:1::3b57:[89]f "
93   " It auto-types random data after starting it from Termux
94   " Now all VIM version are affected:
95   noremap <Esc>P :tp<cr>zz<C-g>
96   noremap <Esc>P1$r0<Space>q <Nop>
97 endif
98 " Termux types <F11>
99 noremap! <Esc>[23~ <Nop>
100 noremap <Esc>M :cn<cr>zz<C-g>
101 noremap <Esc>L :cp<cr>zz<C-g>
102 noremap <Esc>f "myiw:grep<Space>-Ew<Space>'<C-r>m'<Space>`git ls-files`
103 noremap <Esc>g "myiw:grep<Space>-rEw<Space>'<C-r>m'<Space>.
104 noremap <C-]> <C-]>zz<C-g>
105 noremap <C-t> <C-t>zz<C-g>
106 noremap <C-d> G:r !date '+\%H:\%M:\%S-'<cr>kA
107 noremap <Esc>s :set hlsearch<cr>/^[+-]\([^+-].*\\|\)$<cr>
108 noremap <Esc>S :set hlsearch<cr>/^[+-][+-]\([^+-].*\\|\)$<cr>
109 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
110 noremap <Esc>e :syntax on<cr>:set syntax=wdiff<cr>
111 noremap * :let ic_save=&ic<cr>:set noic<cr>*:let &ic=ic_save<cr>
112 noremap # :let ic_save=&ic<cr>:set noic<cr>#:let &ic=ic_save<cr>
113 noremap <C-k> :w<cr>:!aspell --check '%'<cr>:e<cr>
114 noremap gq] gq/^. \?$<cr>
115 noremap <Esc>1 :w<cr>:make -j1<cr>
116 noremap <Esc>3 /^<char-60><char-60><char-60><char-60><char-60><char-60><char-60><cr>ddV/^<bar><bar><bar><bar><bar><bar><bar><cr>k:w! 1<cr>gvxddV/^=======<cr>k:w! 2<cr>gvxddV/^<char-62><char-62><char-62><char-62><char-62><char-62><char-62><cr>k:w! 3<cr>/^<char-62><char-62><char-62><char-62><char-62><char-62><char-62><cr>dd''0:!diff -u 2 1<cr>
117 noremap <Esc>m :w<cr>:set makeprg=make<cr>:make<cr>
118 noremap <Esc>n :w<cr>:set makeprg=ninja<cr>:make<cr>
119
120 endif "!exists("g:_kratochvil_vimrc")