From e492c5d8505328a03032c59f0c58c8df0107689c Mon Sep 17 00:00:00 2001 From: Cody Hiar Date: Mon, 28 May 2018 16:27:42 -0600 Subject: Spring Cleaning --- plugin/vim-options.vim | 487 +++++++------------------------------------------ 1 file changed, 64 insertions(+), 423 deletions(-) (limited to 'plugin/vim-options.vim') diff --git a/plugin/vim-options.vim b/plugin/vim-options.vim index cbcd5e0..2b72899 100644 --- a/plugin/vim-options.vim +++ b/plugin/vim-options.vim @@ -1,32 +1,20 @@ -"----------------------------------------------------------------------------------------------------------------------- " General Settings -"---------------------------------------------------------------------------------------------------------------------- filetype plugin on " Enable default plugins -let mapleader="\" -" Vim options that neovim has turned on but vim has off/ignores -set backspace=indent,eol,start -set nocompatible " Vim is non-compatible with vi. Neovim ignores this -set wildmenu " Turn on wildmenu for vim, Neovim defaults to on -set incsearch " Shows results for '/' search as you are typing the search -set hlsearch " After a '/' search, highlight the matches -" Regular settings -" Don't be a fool, setting path will make all kinds of funky things happen -" with the autocomplete -"set path=** " Set path to look at all directories under current root -set wildignore=*/app/cache,*/vendor,*/env,*.pyc,*/venv,*/__pycache__ " Wildmenu will ignore these folder/file types -set expandtab " Expand tabs into spaces -set tabstop=4 " Default to 4 spaces +set nocompatible " Disable vi-compatible +set wildmenu " Enable autocomple menu +set incsearch " Show search results as typing string +set hlsearch " Highlight matches to previos search string +set expandtab " In Insert mode: Use the appropriate number of spaces to insert . +set tabstop=4 "Number of spaces that a counts for set shiftwidth=0 " Make shiftwidth value the same as tabstop -set history=1000 " Set number of ':' commands -set relativenumber " Use relative numbers in the sidebar -set number " Show line numbers in side bar +set relativenumber " Use relative numbers in the side bar set nowrap " Turn off text wrapping long lines +set history=1000 " Set number of ':' commands set wildmode=list:full " wildmenu show list complete to first result set splitright " New windows split to the right of current one set splitbelow " New windows split below the current one -set sessionoptions+=globals " Append globals to the default session options -set foldmethod=indent " Fold on Indent levels -set foldlevel=99 " Open all folds when entering file +set completeopt-=preview " Hide the preview/scratch window + " Custom status line set statusline= set statusline+=%1*\ %02c\ " Color @@ -34,112 +22,42 @@ set statusline+=%2*\ » " RIGHT-POINTING DOUBLE ANGLE QUO set statusline+=%3*\ %<%F\ " File+path set statusline+=%2*\« " LEFT-POINTING DOUBLE ANGLE QUOTATION MARK set statusline+=%2*\ %=\ %l/%L\ (%02p%%)\ " Rownumber/total (%) -" Set spacing of file types -autocmd FileType html setlocal tabstop=2 -autocmd FileType htmljinja setlocal tabstop=2 -autocmd FileType htmldjango setlocal tabstop=2 -autocmd FileType php setlocal tabstop=4 -autocmd FileType python setlocal tabstop=4 -autocmd FileType sh setlocal tabstop=4 -autocmd FileType javascript setlocal tabstop=4 -autocmd FileType json setlocal tabstop=4 + +" Set spacing of filetypes +autocmd FileType sh,python setlocal tabstop=4 autocmd FileType make setlocal tabstop=4 noexpandtab -autocmd FileType scss setlocal tabstop=2 autocmd FileType ledger setlocal tabstop=2 autocmd FileType vim setlocal tabstop=2 -autocmd FileType mkd setlocal tw=80 -" Make netrw prettier -let g:netrw_banner = 0 " Hide the banner -let g:netrw_liststyle = 3 " Tree view -let g:netrw_list_hide = '\(^\|\s\s\)\zs\.\S\+' " Hide dotfiles -"----------------------------------------------------------------------------------------------------------------------- - - -"----------------------------------------------------------------------------------------------------------------------- -" Color/Theming Options -"----------------------------------------------------------------------------------------------------------------------- -" 0 = dark background // 1 = red -" 2 = green // 3 = yellow -" 4 = light blue // 5 = pink -" 6 = cyan // 7 = beige -" 8 = dark blue // 9 = orange -" 10 = dark grey // 11 = grey -" 12 = light grey // 13 = purple -" 14 = grey // 15 = white -" 16 = black -syntax enable " Enable syntax highlighiting of files +" Setup colorscheme +syntax enable colorscheme gruvbox " Set the colorscheme set background=dark " Use dark colorscheme + " Set vimdiff colors, make it easier to read highlight DiffAdd cterm=BOLD ctermfg=NONE ctermbg=22 highlight DiffDelete cterm=BOLD ctermfg=NONE ctermbg=52 highlight DiffChange cterm=BOLD ctermfg=NONE ctermbg=23 highlight DiffText cterm=BOLD ctermfg=NONE ctermbg=23 -" Set syntax of files that vim doesn't recognize -au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm set ft=jinja -au BufNewFile,BufRead *.yml set filetype=yaml -au BufNewFile,BufRead *.sls set filetype=yaml -au BufNewFile,BufRead *.inc set filetype=php -au BufNewFile,BufRead *.module set filetype=php -au BufRead,BufNewFile *.ejs set syntax=htmljinja -au BufRead,BufNewFile *.md set filetype=markdown -" Highligh current cursorline -hi CursorLineNR cterm=bold ctermfg=226 -" Status line colors per mode -hi User1 ctermfg=NONE ctermbg=NONE cterm=bold -hi User3 ctermfg=NONE ctermbg=NONE -hi User2 ctermfg=NONE ctermbg=NONE -" Change gutter color -highlight SignColumn cterm=NONE ctermfg=0 ctermbg=None -" Highlight long lines at 80 mark -highlight ColorColumn ctermbg=cyan -au BufNewFile,BufRead * call matchadd('ColorColumn', '\%81v', 100) -" Highlight super long lines -au BufNewFile,BufRead * call matchadd('Error', '\%121v', 100) -" Disable background colors for transparency -hi Normal guibg=NONE ctermbg=NONE -"----------------------------------------------------------------------------------------------------------------------- - +" Highlight lines at 80 mark/120 mark +highlight ColorColumn ctermbg=cyan +autocmd FileType python call matchadd('ColorColumn', '\%81v', 100) +autocmd FileType python call matchadd('Error', '\%121v', 100) -"----------------------------------------------------------------------------------------------------------------------- -" Vim vs Neovim settings -"----------------------------------------------------------------------------------------------------------------------- +" Neovim (Docker) vs Vim if has('nvim') let $HOME='/root/.vimcache' let $EditorDir='/root/.config/nvim/' let $SessionDir='.vimcache' silent! execute '!mkdir -p .vimcache/backup' - " Set Backup dirs - set backupdir=.vimcache/backup/ - set directory=.vimcache/swp/ - let g:syntastic_python_python_exec = '/usr/bin/python3' - set completeopt=menu,noinsert " default is menu,preview. Don't insert text until selection is made - nnoremap er :call RestoreSession() - nnoremap y :call system('nc -w 1 172.17.0.1 41401', @0) - tnoremap h - tnoremap j - tnoremap k - tnoremap l - nmap :!isort % - nmap sk:edit term://bashi - nmap sk:edit term://htopj else let $EditorDir=$HOME.'/.vim/' let $SessionDir='.' - " Set Backup dirs - set backupdir=~/.vim/vim-files/backups/ - set directory=~/.vim/vim-files/swaps/ - let g:vimwiki_list = [{'path': '~/Wiki/wiki', 'path_html': '~/Wiki/wiki_html/', 'ext': '.wiki'}] - nnoremap y :call system('nc -w 1 localhost 41401', @0) endif - - -"----------------------------------------------------------------------------------------------------------------------- -" Custom functions -"----------------------------------------------------------------------------------------------------------------------- +" My Shorcuts +let mapleader="\" " type jj to get out of insert mode inoremap jj " Ctags for python project @@ -148,36 +66,17 @@ command! MakeTagsPython !ctags --languages=python --python-kinds=-i -R . map hi :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" . " FG:" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"fg#") " Turn off syntax highlighting nnoremap :noh -" Shortcuts for window +" New tab nnoremap t :tabnew -" Shorcut for stubbing out find command -" should be in fzf command block -nnoremap s :Files -nnoremap b :Buffers -nnoremap t :Tags -" Formating a json file -com! Formatjson %!python -m json.tool " Visually select pasted text nnoremap gp `[v`] -" Yank withouth newline -nmap yY ^y$$ " Vimdiff commands nnoremap du :diffupdate nnoremap dd :diffget nnoremap df :diffput nnoremap _ [c nnoremap = ]c -" Function for saving session -function! SaveSession() - :mksession! $SessionDir/session.vim - :echo 'Session Saved!' -endfunction -nnoremap ee :call SaveSession() -" Function for restoring session -function! RestoreSession() - :source $SessionDir/session.vim -endfunction -" Functions for deleting, changing, yanking 'in-line' +" Visually select line without ending nnoremap v ^v$h " Some very useful shortcuts for editing Ledger entries " Copy the last entry @@ -190,56 +89,8 @@ nnoremap ln {jV}y}p10l nnoremap ld j^f$lC " After searching pull entry to current position nnoremap ly vapyp{{jvEy}jvEpl -" Snippets -nnoremap ,date :-1read !date +\%F -nnoremap ,fabfile :-1read $EditorDir/plugged/vim-options/snippets/python/fabfile.py -nnoremap ,cutf8 :-1read $EditorDir/plugged/vim-options/snippets/python/cutf8.pyjf.i -nnoremap ,pudb :-1read $EditorDir/plugged/vim-options/snippets/python/pudb.pyV -nnoremap ,pydef :-1read $EditorDir/plugged/vim-options/snippets/python/pydef.py/jumpV12j -nnoremap ,pyclass :-1read $EditorDir/plugged/vim-options/snippets/python/pyclass.py/jump -" Arrow keys move windows -inoremap h -inoremap j -inoremap k -inoremap l -noremap k -noremap j -noremap h -noremap l -" Faster next functions -nnoremap [q :cprev -nnoremap ]q :cnext -" Some formatting shortcuts -nnoremap g1 V:s/\<./\u&/g:noh -nnoremap g2 V:s/-/ /g:noh -nnoremap g3 ^v$:s/\%V /-/g:noh -nnoremap g4 V:s/ /_/g:noh -nnoremap g5 ^v$:s/\%V /_/g:noh: -function! WordsToChoices() - python3 << EOF -import vim -buf = vim.current.buffer -(lnum1, col1) = buf.mark('<') -(lnum2, col2) = buf.mark('>') -lspaces = len(buf[lnum1]) - len(buf[lnum1].lstrip(' ')) -start_choices = lnum1 + (lnum2 - lnum1) -end_choices = lnum2 + (lnum2 - lnum1) -end_line = end_choices + 1 -choices_and_values = [] -for line_num in range(lnum1-1, lnum2): - word = buf[line_num].strip() - line = buf[line_num] - buf[line_num] = "{} = '{}'".format(line.upper(), word) - choices_and_values.append((word.upper(), "'{}'".format(word))) -buf[lnum2] = '{}TEST_CHOICES = ('.format(' ' * lspaces) -for line_num in range(start_choices + 1, end_choices + 2): - choice, value = choices_and_values.pop(0) - buf[line_num] = "{}({}, ({})),".format(' ' * (lspaces + 4), choice, value) -buf[end_choices + 2] = '{})'.format(' ' * lspaces) -EOF -endfunction -nnoremap `>op`]o`<:call WordsToChoices() -"----------------------------------------------------------------------------------------------------------------------- +" Accept current autocomplete suggestion +inoremap pumvisible() ? "\" : "\" @@ -248,7 +99,7 @@ nnoremap `>op`]o`<:call WordsToChoices() "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/ack.vim/plugin/ack.vim')) nnoremap / :call AckSearch() - noremap a :Ack + noremap ea :Ack function! AckSearch() call inputsave() let term = input('Search: ') @@ -269,19 +120,7 @@ endif " Argwrap "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/vim-argwrap/plugin/argwrap.vim')) - nnoremap w :ArgWrap -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" CamelCaseMotion -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/CamelCaseMotion/plugin/camelcasemotion.vim')) - map ,w CamelCaseMotion_w - map ,e CamelCaseMotion_e - map ,b CamelCaseMotion_b + nnoremap ew :ArgWrap endif "----------------------------------------------------------------------------------------------------------------------- @@ -291,7 +130,7 @@ endif " Fugitive "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/vim-fugitive/plugin/fugitive.vim')) - " Command for toggling git status + " Command for toggling git status function! ToggleGStatus() if buflisted(bufname('.git/index')) bd .git/index @@ -309,7 +148,22 @@ endif "----------------------------------------------------------------------------------------------------------------------- -" Indent Lines Plugin +" fzf.vim +"----------------------------------------------------------------------------------------------------------------------- +if !empty(glob($EditorDir.'plugged/fzf.vim/plugin/fzf.vim')) + nnoremap ff :Files + nnoremap fb :Buffers + nnoremap ft :Tags + nnoremap fm :Marks + nnoremap fc :Commits + nnoremap fg :GFiles? +endif +"----------------------------------------------------------------------------------------------------------------------- + + + +"----------------------------------------------------------------------------------------------------------------------- +" Indent Guides "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/vim-indent-guides/plugin/indent_guides.vim')) let g:indent_guides_enable_on_vim_startup = 1 @@ -319,76 +173,9 @@ if !empty(glob($EditorDir.'plugged/vim-indent-guides/plugin/indent_guides.vim')) let g:indent_guides_guide_size = 1 autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd ctermbg=235 autocmd VimEnter,Colorscheme * :hi IndentGuidesEven ctermbg=237 - autocmd VimEnter,Colorscheme * :IndentGuidesEnable -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" Ledger -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/SimpylFold/ftplugin/python/SimpylFold.vim')) - au BufNewFile,BufRead *.ldg,*.ledger setf ledger | comp ledger -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" Markdown -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/vim-markdown/indent/markdown.vim')) - let g:vim_markdown_folding_disabled=1 -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" Python-Syntax -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/python-syntax/syntax/python.vim')) - let python_highlight_all = 1 -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" Syntastic -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/syntastic/plugin/syntastic.vim')) - let g:syntastic_php_checkers = ['php', 'phpcs'] - let g:syntastic_javascript_checkers = ['eslint'] - let g:syntastic_python_checkers = ['pyton3', 'flake8', 'mypy'] - let g:syntastic_scss_checkers = ['sass_lint'] - let g:syntastic_php_phpcs_args = "--standard=/root/PEARish.xml,PSR2,Symfony2" - let g:syntastic_always_populate_loc_list = 0 - let g:syntastic_auto_loc_list = 0 - let g:syntastic_check_on_wq = 0 - let g:syntastic_check_on_open = 0 - let g:syntastic_aggregate_errors = 1 - let g:syntastic_mode_map = { 'mode': 'active' } - function! ToggleSyntasticMode() -python << EOF -import vim -import ast -value = dict(vim.eval('g:syntastic_mode_map')) -vim.command('let l:syntastic_current_mode = \''+value['mode']+'\'') -EOF - SyntasticToggleMode - if l:syntastic_current_mode == 'passive' - SyntasticCheck - let g:syntastic_check_on_wq = 0 - let g:syntastic_check_on_open = 0 - else - let g:syntastic_check_on_wq = 1 - let g:syntastic_check_on_open = 1 - endif - endfunction - " nnoremap a :call ToggleSyntasticMode() - " nnoremap a :SyntasticCheck + autocmd FileType python :IndentGuidesEnable + autocmd FileType html :IndentGuidesEnable + autocmd FileType jinja :IndentGuidesEnable endif "----------------------------------------------------------------------------------------------------------------------- @@ -398,7 +185,6 @@ endif " Taboo "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/taboo.vim/plugin/taboo.vim')) - au BufNewFile,BufRead *.ldg,*.ledger setf ledger | comp ledger function! RenameTab() call inputsave() let term = input('Tabname: ') @@ -407,70 +193,7 @@ if !empty(glob($EditorDir.'plugged/taboo.vim/plugin/taboo.vim')) execute ":TabooRename " . term endif endfunction -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" Vdebug Plugin -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/vdebug/plugin/vdebug.vim')) - let g:vdebug_options = { - \ "watch_window_style" : 'compact', - \ "port" : 9000, - \ "path_maps" : { - \ "/var/www/html": "/Users/hiarc/myprojectdir", - \ }, - \} - "Delete all breakpoints - :command! BR BreakpointRemove * -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" Vim JSON -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/vim-json/indent/json.vim')) - let g:vim_json_syntax_conceal = 0 -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" Vim EasyMotion Incsearch -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/incsearch-easymotion.vim/plugin/incsearch/easymotion.vim')) - " You can use other keymappings like instead of if you want to - " use these mappings as default search and somtimes want to move cursor with - " EasyMotion. - function! s:incsearch_config(...) abort - return incsearch#util#deepextend(deepcopy({ - \ 'modules': [incsearch#config#easymotion#module({'overwin': 1})], - \ 'keymap': { - \ "\": '(easymotion)' - \ }, - \ 'is_expr': 0 - \ }), get(a:, 1, {})) - endfunction - noremap / incsearch#go(incsearch_config()) - noremap ? incsearch#go(incsearch_config({'command': '?'})) - noremap g/ incsearch#go(incsearch_config({'is_stay': 1})) -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" EasyMotion -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/vim-easymotion/autoload/EasyMotion.vim')) - " f{char} to move to {char}{char} - map f (easymotion-bd-f2) - nmap f (easymotion-overwin-f2) + nnoremap er :call RenameTab() endif "----------------------------------------------------------------------------------------------------------------------- @@ -487,18 +210,8 @@ if !empty(glob($EditorDir.'plugged/ale/autoload/ale.vim')) let g:ale_history_enabled = 0 highlight clear ALEErrorSign highlight clear ALEWarningSign -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" Tagbar -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/tagbar/plugin/tagbar.vim')) - nmap :TagbarToggle - let g:tagbar_foldlevel = 1 - autocmd VimEnter * nested :TagbarOpen + " Change gutter color + highlight SignColumn cterm=NONE ctermfg=0 ctermbg=None endif "----------------------------------------------------------------------------------------------------------------------- @@ -534,41 +247,21 @@ endif -"----------------------------------------------------------------------------------------------------------------------- -" SuperTab Plugin -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/supertab/plugin/supertab.vim')) - let g:SuperTabDefaultCompletionType = "" -endif -"----------------------------------------------------------------------------------------------------------------------- - - - "----------------------------------------------------------------------------------------------------------------------- " Pymode "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/python-mode/plugin/pymode.vim')) - " I like my coloring better + let g:pymode_run = 1 + let g:pymode_indent = 1 + let g:pymode_motion = 1 let g:pymode_options_colorcolumn = 0 - let g:pymode_warnings = 1 - let g:pymode_python = 'python3' - let g:pymode_breakpoint = 0 let g:pymode_lint = 0 let g:pymode_rope = 0 - let g:pymode_doc_bind = '' - let g:pymode_motion = 0 -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" Dasht -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/vim-dasht/plugin/dasht.vim')) - nnoremap K :Dasht - let g:dasht_filetype_docsets = {} - let g:dasht_filetype_docsets['python'] = ['django', 'python_3'] + let g:pymode_doc = 0 + let g:pymode_breakpoint = 0 + let g:pymode_lint = 0 + let g:pymode_folding = 0 + let g:pymode_motion = 0 " Disable error when using fzf to switch files endif "----------------------------------------------------------------------------------------------------------------------- @@ -580,68 +273,16 @@ endif if !empty(glob($EditorDir.'plugged/ranger.vim/plugin/ranger.vim')) let g:ranger_map_keys = 0 nnoremap n :Ranger - " Ranger plugin disables relative numbering - " (https://github.com/francoiscabrol/ranger.vim/issues/29) - nnoremap ds :set rnu + let g:ranger_replace_netrw = 1 " open ranger when vim open a directory endif "----------------------------------------------------------------------------------------------------------------------- "----------------------------------------------------------------------------------------------------------------------- -" Pencil (Markdown files +" Jinja Highlighting "----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/vim-pencil/plugin/pencil.vim')) - autocmd FileType markdown,mk call pencil#init({'wrap': 'hard'}) +if !empty(glob($EditorDir.'plugged/vim-jinja2-syntax/indent/jinja.vim')) + au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm set ft=jinja endif "----------------------------------------------------------------------------------------------------------------------- - - -"----------------------------------------------------------------------------------------------------------------------- -" Basic movements (h, j, k, l) require a number prefix. Break bad habits -"----------------------------------------------------------------------------------------------------------------------- -function! DisableIfNonCounted(move) range - if v:count - return a:move - else - " You can make this do something annoying like: - " echoerr "Count required!" - " sleep 2 - return "" - endif -endfunction - -function! SetDisablingOfBasicMotionsIfNonCounted(on) - let keys_to_disable = get(g:, "keys_to_disable_if_not_preceded_by_count", ["j", "k", "l", "h"]) - if a:on - for key in keys_to_disable - execute "noremap " . key . " DisableIfNonCounted('" . key . "')" - endfor - let g:keys_to_disable_if_not_preceded_by_count = keys_to_disable - let g:is_non_counted_basic_motions_disabled = 1 - else - for key in keys_to_disable - try - execute "unmap " . key - catch /E31:/ - endtry - endfor - let g:is_non_counted_basic_motions_disabled = 0 - endif -endfunction - -function! ToggleDisablingOfBasicMotionsIfNonCounted() - let is_disabled = get(g:, "is_non_counted_basic_motions_disabled", 0) - if is_disabled - call SetDisablingOfBasicMotionsIfNonCounted(0) - else - call SetDisablingOfBasicMotionsIfNonCounted(1) - endif -endfunction - -command! ToggleDisablingOfNonCountedBasicMotions :call ToggleDisablingOfBasicMotionsIfNonCounted() -command! DisableNonCountedBasicMotions :call SetDisablingOfBasicMotionsIfNonCounted(1) -command! EnableNonCountedBasicMotions :call SetDisablingOfBasicMotionsIfNonCounted(0) - -" Call this function to enable Hard Mode -"DisableNonCountedBasicMotions -- cgit v1.2.3