vim9script noclear import autoload '../autoload/myfunctions.vim' as mf import autoload '../autoload/custom/unimpaired.vim' import autoload '../autoload/custom/endofline.vim' import autoload '../autoload/custom/last_edit.vim' import autoload '../autoload/custom/search.vim' import autoload '../autoload/mypopup.vim' import autoload '../autoload/myterm.vim' import autoload '../autoload/popupurls.vim' g:maplocalleader = "," noremap ; : map Q gq sunmap Q noremap Y y$ noremap getcharsearch().forward ? ',' : ';' noremap getcharsearch().forward ? ';' : ',' if !!exists(':LF') nnoremap LF endif nnoremap n Lexplore nnoremap / nohlsearch nnoremap gx mf.OpenPath() nnoremap g; last_edit.Jump() nnoremap zS mf.Synnames() nnoremap q cnext nnoremap cprevious nnoremap cprevious nnoremap a nnoremap y "+y nnoremap Y "+y$ nnoremap p "+ nnoremap i g nnoremap nnoremap nnoremap mypopup.ScrollDownOrJumpNextHunk() nnoremap mypopup.ScrollUpOrJumpPrevHunk() nnoremap w nnoremap c nnoremap o nnoremap endofline.Toggle(';') nnoremap mf.ToggleQfWindow() nnoremap mf.ToggleLoclistWindow() nnoremap yow unimpaired.ToggleOption('wrap') nnoremap yoc unimpaired.ToggleOption('cursorline') nnoremap yox unimpaired.ToggleOption('cursorcolumn') nnoremap yos unimpaired.ToggleOption('spell') nnoremap yop unimpaired.ToggleOption('paste') nnoremap yol unimpaired.ToggleOption('list') nnoremap yof unimpaired.SwitchOption('foldcolumn', 0, 1) nnoremap yoy unimpaired.SwitchOption('colorcolumn', '', 100) nnoremap fu popupurls.Open() nnoremap [ unimpaired.PasteBlanklineAbove() nnoremap ] unimpaired.PasteBlanklineBelow() nnoremap let &iminsert = !&iminsert nnoremap myterm.Toggle() nnoremap mypopup.ClosePopupOrPvwOrPressEsc() xnoremap xnoremap xnoremap y "+y xnoremap i g xnoremap * search.Selection() xnoremap # search.Selection(true) noremap! let &iminsert = !&iminsert inoremap inoremap u inoremap inoremap inoremap cnoremap cnoremap cnoremap cnoremap cnoremap pumvisible() ? "\" : "\" cnoremap pumvisible() ? "\" : "\" cnoremap pumvisible() ? "\" : "\" set termwinkey= tnoremap w tnoremap close! tnoremap myterm.Toggle() tnoremap N tnoremap ; : tnoremap N if !has('gui_running') # Fix Alt maps, so it correctly works in vim and it's terminal. # Should include every character for map. const alt_keys = [ '`', '1', '2', '3', '4', '5', 'q', 'w', 'e', 'r', 'i', 'o', 'p', 'a', 's', 'f', 'h', 'k', 'l', "'", '"', 'b', 'n', 'd', ] def InitAltMaps(keys: list) def ImitateUnmap(alt_key: string, mode: string) if empty(maparg(alt_key, mode, false, true)) exe $'{mode}map {alt_key} ""' endif enddef var alt_key: string for key in keys alt_key = $'' exe $"set {alt_key}=\e{key}" ImitateUnmap(alt_key, 'i') ImitateUnmap(alt_key, 'c') if empty(maparg(alt_key, 't', false, true)) exe $'tnoremap {alt_key} {key}' endif endfor enddef InitAltMaps(alt_keys) endif # example ':Time 50 call str2nr(102)' command! -nargs=1 -complete=command Time mf.PrintTime()