Compare commits

..

3 commits

Author SHA1 Message Date
Dmytro Meleshko
da7c44af35 [nvim] fix FixWhitespaceOnSave flooding the search history 2021-02-05 11:36:25 +00:00
Dmytro Meleshko
618995cc7f [nvim] add functions to workaround some interesting behaviors of vim 2021-02-05 11:36:25 +00:00
Dmytro Meleshko
a27c05856a [zsh] add a timestamp printing function 2021-02-05 11:36:25 +00:00
3 changed files with 8 additions and 2 deletions

View file

@ -152,6 +152,11 @@ set commentstring=//%s
\|xmap # <Cmd>call <SID>VisualStarSearch('?')<CR>N \|xmap # <Cmd>call <SID>VisualStarSearch('?')<CR>N
augroup END augroup END
" <https://vim.fandom.com/wiki/Searching_for_expressions_which_include_slashes#Searching_for_slash_as_normal_text>
command! -nargs=+ Search let @/ = escape(<q-args>, '/') | normal /<C-R>/<CR>
" <https://vim.fandom.com/wiki/Searching_for_expressions_which_include_slashes#Searching_for_all_characters_as_normal_text>
command! -nargs=+ SearchLiteral let @/ = '\V'.escape(<q-args>, '/\') | normal /<C-R>/<CR>
" }}} " }}}

View file

@ -144,9 +144,9 @@ nnoremap <silent><expr> <CR> empty(&buftype) ? ":write<bar>wall\<CR>" : "\<CR>"
function s:FixWhitespaceOnSave() function s:FixWhitespaceOnSave()
let l:pos = getpos('.') let l:pos = getpos('.')
" remove trailing whitespace " remove trailing whitespace
%s/\s\+$//e keeppatterns %s/\s\+$//e
" remove trailing newlines " remove trailing newlines
%s/\($\n\s*\)\+\%$//e keeppatterns %s/\($\n\s*\)\+\%$//e
call setpos('.', l:pos) call setpos('.', l:pos)
endfunction endfunction
" }}} " }}}

View file

@ -83,6 +83,7 @@ declare -A date_formats=(
compact '%Y%m%d%H%M%S' compact '%Y%m%d%H%M%S'
only-date '%Y-%m-%d' only-date '%Y-%m-%d'
only-time '%H:%M:%S' only-time '%H:%M:%S'
timestamp '%s'
) )
for format_name format in "${(kv)date_formats[@]}"; do for format_name format in "${(kv)date_formats[@]}"; do