set ai iclower sm sw=4 ts=4
map gg 1G
"""""""""
" options
"""""""""
"set noautoindent
"set number
"set report=1
"set ruler
"set shiftwidth=2
"set showmatch
"set showmode
"set tabstop=2
"set terse
"set wrapscan
" autoindentation
set autoindent
" numéro de la ligne courante en bas
set autoprint
" voir les commandes avec :tab.
set cedit=	
" no bip, just flash
set flash
set ignorecase
set keytime=2
set matchtime=4
" voir la règle de status
set ruler
set searchincr
" autoindentation de 4 espaces
"set shiftwidth=4
" tab : 4 spaces in editor
"set tabstop=4
set shiftwidth=4
set tabstop=4
set showfilename
" montre ce qui match
set showmatch
" affiche le mode : insert, visual...
set showmode
set showmatch
set showmode
" print helpful messages on 1 line (eg, 4 lines yanked)
set report=1

"end key
map ^[OF $
"home key
map ^[OH ^
"move up
map ^[[1;5A :.m-2
"move down
map ^[[1;5B :.m+1
"save
map ^W :w
"quit
map ^D :q
"send sexp to repl
map ^X m<%:'<, w !tmux loadb - && tmux pasteb -d -t +1
 `<
"send line to repl
map ^E :. w !tmux loadb - && tmux pasteb -d -t +1
 `<
"load file
map ^L :!tmux send -t +1 '(load "%")' Enter

"format line
map \ :.!fmt -80
"format paragraph (backtick)
map M-BM-, !}fmt -80

" map gc :%!prettier --parser=css --write
" map ge :E
" map gj :%!prettier --parser=typescript --write
" map gJ :%!prettier --parser=json --write
" map gqip {!}fmt -72 -s -p
}}{j
" map gP :r!tmux show-buffer
" map gt mM:%s/[[:space:]]*$//
`M
" map gT :%!a=$(cat %);echo "$a"
" map gY !'mtmux load-buffer -
u
" set cedit=\

""""""""""""
" shortcuts
""""""""""""
" ^M is return : to make it, ctrl-v then return
" select and insert any snippets
map ga :!snippetsel >/tmp/vi-$USER.tmp

:r/tmp/vi-$USER.tmp
map ga :E %_test
" select and insert emoji
map ge :!emojisel >/tmp/vi-$USER.tmp

:r/tmp/vi-$USER.tmp
" paste selected text
map gp :r!pbpaste 
" go to the top
map gg 1G
" map gg :0
" insert date
map gd :r!date +"\# \%d-\%m-\%Y" 
" map gd :r!date +\%Y-\%m-\%d
" sort file
map gs {!}sort
map gS {!}sort -r
" map gs {!}sort -u
" map gS {j!}sort -ur
" git shortcuts
map ,; :!git add % && git commit -m "
map ,, :!git push
 
" format to 72 char width
map gf :%!fold -s -w 72 
"map gf :%!fmt -l 4 -p -w 80 
"map gf :%!gmipp 
" display lines
map g$ :set list
" check spell
map go :w
:!aspell -c %
:e!

" map go :%!gofmt
" latex recompile
map tt :w
:!pdflatex "%" 
" invert lines
map gi ddp
" comment lines
map gc :s/^/#/ 
" uncomment lines
map gu :k/\/\#/^M
" insert code block
map gv :r!echo '```' 
