infra::additional_classes:
- accounts
- pp_tools
-# - vim
accounts::users:
ivan.prikhodko:
apply: true
sudo: true
-vim::opt_misc:
- - showcmd
- - showmatch
- - ignorecase
- - smartcase
- - incsearch
- - autowrite
- - hidden
- - ttyfast
- - t_Co=16
- - t_AB=^[[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm
- - t_AF=^[[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm
- - autoindent
- - nobackup
- - backspace=2
- - nocompatible
- - "comments=b:#,:%,fb:-,n:>,n:)" # has to be escaped because it uses yaml indicators
- - digraph
- - noerrorbells
- - esckeys
- - formatoptions=cqrt
- - helpheight=0
- - highlight=8r,db,es,hs,mb,Mr,nu,rs,sr,tb,vr,ws
- - nohlsearch
- - noicon
- - ignorecase
- - noinsertmode
- - iskeyword=@,48-57,_,192-255,-,.,@-@
- - joinspaces
- - laststatus=2
- - listchars=tab:��,trail:�,eol:$ #TODO
- - magic
- - modeline
- - modelines=2
- - nonumber #TODO
-# - path=.,,~/.P/vim,~/.P/vim/syntax,~/.P/vim/source,$VIM/syntax/ "sollte geaendert werden
- - report=0
- - ruler
-# - shell=/usr/bin/tcsh "muss angepasst/erweitert werden siehe zeile 174
- - shiftwidth=8
- - shortmess=at
- - showcmd
- - showmatch
- - showmode
- - suffixes=.aux,.bak,.dvi,.gz,.idx,.log,.ps,.swp,.tar
- - nostartofline
- - tabstop=8
- - notextmode #obsolete option, but sets fileformat to unix, which is the current best practice
- - notitle
- - ttyfast
- - ttybuiltin
- - ttytype=rxvt #TODO
- - viminfo="NONE" #required by ISO 27001/IT-Grundschutz
- - history=100 #keeps 100 lines in history, lost after closing session
- - visualbell #is disabled again by next option?
- - t_vb=
- - wildchar=<TAB>
- - wrap
- - nowritebackup #TODO
- - pastetoggle=<F5>
-
-
-
-vim::opt_code:
- - |
- if has("wildmenu")
- set wildmenu wildmode=longest:full,full
- endif
- - |
- if has("statusline")
- set statusline=%f%00(\ %2*%m%*%)%00(\ %3*%r%*%)%00(\ %h%w%)\ %=
- set statusline+=%36(\ [B:%2n][L:%3l/%3L][C:%2c-%2v][%%:%2p]%)
- if has("title")
- set title " use nice title
- set titlestring=VIM\ -\ %f%00(\ %m%)%00(\ %r%)%(
- set titlestring+=\ (%{expand(\"%:~:.:h\")})%)%(\ %a%)
- endif
- endif
- - |
- if has("autocmd")
-
- " In text files, always limit the width of text to 78 characters
- autocmd BufRead *.txt set tw=78
-
- augroup cprog
- " Remove all cprog autocommands
- au!
-
- " When starting to edit a file:
- " For C and C++ files set formatting of comments and set C-indenting on.
- " For other files switch it off.
- " Don't change the order, it's important that the line with * comes first.
- autocmd FileType * set formatoptions=tcql nocindent comments&
- autocmd FileType c,cpp set formatoptions=croql cindent comments=sr:/*,mb:*,el:*/,://
- augroup END
-
- augroup gzip
- " Remove all gzip autocommands
- au!
-
- " Enable editing of gzipped files
- " set binary mode before reading the file
- " use "gzip -d", gunzip isn't always available
- autocmd BufReadPre,FileReadPre *.gz,*.bz2 set bin
- autocmd BufReadPost,FileReadPost *.gz call GZIP_read("gzip -d")
- autocmd BufReadPost,FileReadPost *.bz2 call GZIP_read("bzip2 -d")
- autocmd BufWritePost,FileWritePost *.gz call GZIP_write("gzip")
- autocmd BufWritePost,FileWritePost *.bz2 call GZIP_write("bzip2")
- autocmd FileAppendPre *.gz call GZIP_appre("gzip -d")
- autocmd FileAppendPre *.bz2 call GZIP_appre("bzip2 -d")
- autocmd FileAppendPost *.gz call GZIP_write("gzip")
- autocmd FileAppendPost *.bz2 call GZIP_write("bzip2")
- " After reading compressed file: Uncompress text in buffer with "cmd"
- fun! GZIP_read(cmd)
- " set 'cmdheight' to two, to avoid the hit-return prompt
- let ch_save = &ch
- set ch=3
- " when filtering the whole buffer, it will become empty
- let empty = line("'[") == 1 && line("']") == line("$")
- let tmp = tempname()
- let tmpe = tmp . "." . expand("<afile>:e")
- " write the just read lines to a temp file "'[,']w tmp.gz"
- execute "'[,']w " . tmpe
- " uncompress the temp file: call system("gzip -d tmp.gz")
- call system(a:cmd . " " . tmpe)
- " delete the compressed lines
- '[,']d
- " read in the uncompressed lines "'[-1r tmp"
- set nobin
- execute "'[-1r " . tmp
- " if buffer became empty, delete trailing blank line
- if empty
- normal Gdd''
- endif
- " delete the temp file
- call delete(tmp)
- let &ch = ch_save
- " When uncompressed the whole buffer, do autocommands
- if empty
- execute ":doautocmd BufReadPost " . expand("%:r")
- endif
- endfun
-
- " After writing compressed file: Compress written file with "cmd"
- fun! GZIP_write(cmd)
- if rename(expand("<afile>"), expand("<afile>:r")) == 0
- call system(a:cmd . " " . expand("<afile>:r"))
- endif
- endfun
-
- " Before appending to compressed file: Uncompress file with "cmd"
- fun! GZIP_appre(cmd)
- call system(a:cmd . " " . expand("<afile>"))
- call rename(expand("<afile>:r"), expand("<afile>"))
- endfun
- augroup END
-
- " This is disabled, because it changes the jumplist. Can't use CTRL-O to go
- " back to positions in previous files more than once.
- if 0
- " When editing a file, always jump to the last cursor position.
- " This must be after the uncompress commands.
- autocmd BufReadPost * if line("'\"") && line("'\"") <= line("$") | exe "normal `\"" | endif
- endif
-
- endif " has("autocmd")
- - |
- if has("unix")
- let &shell="zsh\ -l"
- let &shell="tcsh"
- endif
- #Abreviations
- - |
- " Abbreviations for some important numbers:
- iab Npi 3.1415926535897932384626433832795028841972
- " iab Ne 2.7182818284590452353602874713526624977573
- "
- " Ydigit : The ten digits.
- iab Ydigit 1234567890
- "
- " Yruler : A ruler.
- iab Yruler 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
- "
- " Ysuper: A nice long word from the musical "Mary Poppins".
- iab Ysuper supercalifragilisticexpialidocious
- "
- " Inserting an ellipsis to indicate deleted text
- iab Yell [...]
- vmap ,ell c[...]<ESC>
-
- " First, some command to add date stamps (with and without time).
- " I use these manually after a substantial change to a webpage.
- " [These abbreviations are used with the mapping for ",L".]
- "
- iab Ydate <C-R>=strftime("%y%m%d")<CR>
- " Example: 971027
- "
- iab Ytime <C-R>=strftime("%H:%M")<CR>
- " Example: 14:28
- "
- iab YDT <C-R>=strftime("%y%m%d %T")<CR>
- " Example: 971027 12:00:00
- "
- iab YDATE <C-R>=strftime("%a %d.%b %Y %T")<CR>
- " Example: Tue Dec 16 12:07:00 CET 1997
- #Mappings
- - |
- " Caveat: Mapping must be "prefix free", ie no mapping must be the
- " prefix of any other mapping. Example: "map ,abc foo" and
- " "map ,abcd bar" will give you the error message "Ambigous mapping".
- "
- " The backslash ('\') is the only(?) unmapped key, so this is the best
- " key to start mappings with as this does not take away a command key.
- " However, the backslash is never in the same position with keyboards.
- " Eg on German keyboards it is AltGr-sz - don't ask.
- " Anyway, I have decided to start mappings with the comma as this
- " character is always on the same position on almost all keyboards
- " and I hardly have a need for that command.
- "
- " The following maps get rid of some basic problems:
- "
- " When the backspace key sends a "delete" character
- " then you simply map the "delete" to a "backspace" (CTRL-H):
- map <Del> <C-H>
- "
- " With Vim-4 the format command was just 'Q' and
- " I am too used to it. So I need this back!
- nnoremap Q gq
- vnoremap Q gq
- "
- " 980527 I often reformat a paragraph to fit some textwidth -
- " and I use the following mapping to adjust it to the
- " current position of the cursor:
- map #tw :set textwidth=<C-R>=col(".")<C-M>
- "
- " 981210 Whenever I paste some text into VIM I have to
- " toggle from "nopaste" to "paste" and back again:
- " map <f4> :set paste!<c-m>:set paste?<c-m>
- " map <esc>[14~ :set paste!<c-m>:set paste?<c-m>
- set pastetoggle=<F5>
-
- "
- " Disable the command 'K' (keyword lookup) by mapping it
- " to an "empty command". (thanks, Lawrence! :-):
- map K <NUL>
-
- " Make CTRL-^ rebound to the *column* in the previous file
- noremap <C-^> <C-^>`"
- "
- " Make "gf" rebound to last cursor position (line *and* column)
- noremap gf gf`"
- "
- " When I let Vim write the current buffer I frequently mistype the
- " command ":w" as ":W" - so I have to remap it to correct this typo:
- nmap :W :w
- "
- " Are you used to the Unix commands "alias" and "which"?
- " I sometimes use these to look up my abbreviations and mappings.
- " So I need them available on the command line:
- map :alias map
- map :which map
- "
- " The command {number}CTRL-G show the current nuffer number, too.
- " This is yet another feature that vi does not have.
- " As I always want to see the buffer number I map it to CTRL-G.
- " Pleae note that here we need to prevent a loop in the mapping by
- " using the comamnd "noremap"!
- noremap <C-G> 2<C-G>
- "
- " 980706 Sourcing syntax files from the distribution
- " A nice and fast way to both source syntax files
- " and to take a look at "what's there":
- map ,V :so $VIMRUNTIME/syntax/2html.vim<CR>kJ
- "
- " Make p in Visual mode replace the selected text with the "" register.
- vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc>
-
- #Customizing the command line
- - |
- " Valid names for keys are: <Up> <Down> <Left> <Right> <Home> <End>
- " <S-Left> <S-Right> <S-Up> <PageUp> <S-Down> <PageDown> <LeftMouse>
- "
- " Many shells allow editing in "Emacs Style".
- " Although I love Vi, I am quite used to this kind of editing now.
- " So here it is - command line editing commands in emacs style:
- cnoremap <C-A> <Home>
- cnoremap <C-F> <Right>
- cnoremap <C-B> <Left>
- cnoremap <C-E> <End>
- cnoremap <ESC>b <S-Left>
- cnoremap <ESC>f <S-Right>
- cnoremap <ESC><C-H> <C-W>
- "
- " Additional codes for that "English" keyboard at the Xterminal
- cnoremap <ESC>[D <Left>
- cnoremap <ESC>[C <Right>
-
- #VIM - Editing and updating the vimrc:
- - |
- " As I often make changes to this file I use these commands
- " to start editing it and also update it:
- if has("unix")
- let vimrc='~/.vimrc'
- else
- " ie: if has("dos16") || has("dos32") || has("win32")
- let vimrc='$VIM\_vimrc'
- endif
- nn ,u :source <C-R>=vimrc<CR><CR>
- #General Editing
- - |
- " Define "del" char to be the same backspace (saves a LOT of trouble!)
- " As the angle notation cannot be use with the LeftHandSide
- " with mappings you must type this in *literally*!
- " map <C-V>127 <C-H>
- "cmap <C-V>127 <C-H>
- " the same for Linux Debian which uses
- imap <Esc>[3~ <C-H>
- imap ^? <C-H>
- cmap ^? <C-H>
- "
- " ;rcm = remove "control-m"s - for those mails sent from DOS:
- cmap ;rcm %s/<C-M>//g
- "
- " Make whitespace visible:
- " Sws = show whitespace
- nmap ,Sws :%s/ /_/g<C-M>
- vmap ,Sws :%s/ /_/g<C-M>
- "
- " Sometimes you just want to *see* that trailing whitespace:
- " Stws = show trailing whitespace
- nmap ,Stws :%s/ *$/_/g<C-M>
- vmap ,Stws :%s/ *$/_/g<C-M>
- "
- " General Editing - Turning umlauts into ascii (for German keyboards)
- "
- " imap � ae
- " imap � oe
- " imap � ue
- " imap � ss
- "
- " Ä -> � :%s/\Ä/�/gc -> D
- " Ö -> � :%s/\Ö/�/gc -> V
- " Ü -> � :%s/\Ü/�/gc -> \
- " ä -> � :%s/\ä/�/gc -> d
- " ö -> � :%s/\ö/�/gc -> v
- " ü -> � :%s/\ü/�/gc -> |
-
-#Inserting Dates and Times / Updating Date+Time Stamps
- - |
- " ,L = "Last updated" - replace old time stamp with a new one
- " preserving whitespace and using internal "strftime" command:
- " requires the abbreviation "YDATE"
- if line("$") > 20
- let l = 20
- else
- let l = line("$")
- endif
-
- if exists("$REMOTEHOST")
- let $my_host = $REMOTEHOST
- else
- let $my_host = $HOST
- endif
-
- map ,L 1G/Last update:\s*/e+1<CR>CYDATE by user <ESC>D:r! echo "$USER" "($my_host)"<CR>kJ
- map ,,L 1G/Last change:\s*/e+1<CR>CYDATE by user <ESC>D:r! echo "$USER" "($my_host)"<CR>kJ
-
- " Example:
- " before: "Last update: Thu Apr 6 12:07:00 CET 1967"
- " after: "Last update: Tue Dec 16 12:07:00 CET 1997"
-
-#General Editing - link to program "screen"
- - |
- " ,Et = edit temporary file of "screen" program
- map ,Et :e /tmp/screen-exchange
- " as a user of Unix systems you *must* have this program!
- " see also: http://www.math.fu-berlin.de/~guckes/screen/
- "
-#shift + __ -> toggle syntax hl
- - |
- nn __ mg:if has("syntax_items")<Bar>syn clear<CR>else<Bar>syn on<CR>en<CR>`g
\ No newline at end of file