From 0768d8cf9bf589be46d7a5162cb131229d3784bf Mon Sep 17 00:00:00 2001 From: j-james Date: Tue, 18 Jan 2022 00:53:21 -0800 Subject:  Add tab navigation functionality --- README.md | 5 +++++ autoload/novim_mode.vim | 13 +++++++++++++ doc/novim_mode.txt | 5 +++++ plugin/novim_mode.vim | 3 ++- 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 73d8941..be156b9 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,10 @@ One further common problem is that `tmux` can change key combination behaviour, * `ALT+;` or `ALT+c`: Vim's command prompt. * `ALT+o`: Replaces native `CTRL+O` to give one-off Normal Mode commands. +#### Tab navigation + * `CTRL+T`: Open a new tab. + * `CTRL+SHIFT+T`: Cycle through open tabs. + #### Pane controls * `ALT+ARROW`: Change pane/buffer focus. * `CTRL+W`: Closes current pane-like thing. Also closes associated quickfix and location panes. @@ -98,6 +102,7 @@ call novim_mode#StartNoVimMode() Shortcuts are also grouped roughly under the headings described above, so you may be able to disable one of the following: ```vim let g:novim_mode_use_general_app_shortcuts = 1 +let g:novim_mode_use_tab_shortcuts = 1 let g:novim_mode_use_pane_controls = 1 let g:novim_mode_use_copypasting = 1 let g:novim_mode_use_indenting = 1 diff --git a/autoload/novim_mode.vim b/autoload/novim_mode.vim index 3e003d2..28e3305 100644 --- a/autoload/novim_mode.vim +++ b/autoload/novim_mode.vim @@ -118,6 +118,19 @@ function! g:SetNoVimModeShortcuts() inoremap :call novim_mode#PageUp() endif + " Open and cycle between tabs + if g:novim_mode_use_tab_shortcuts == 1 + " Open a new tab + nnoremap :tabnew + inoremap :tabnew + snoremap :tabnew + " Cycle through tabs + " I would prefer , but can't use it due to technical limitations. + nnoremap :tabnext + inoremap :tabnext + snoremap :tabnext + end + " Move between splits, panes, windows, etc and close them if g:novim_mode_use_pane_controls == 1 inoremap diff --git a/doc/novim_mode.txt b/doc/novim_mode.txt index e464937..0e69079 100644 --- a/doc/novim_mode.txt +++ b/doc/novim_mode.txt @@ -81,6 +81,10 @@ General editor shortcuts * `ALT+;` or `ALT+c`: Vim command prompt. * `ALT+o`: Replaces native `CTRL+O` to give one-off Normal Mode commands. +Tab navigation + * `CTRL+T`: Open a new tab. + * `CTRL+SHIFT+T`: Cycle through open tabs. + Pane controls * `ALT+ARROW`: Change pane/buffer focus. * `CTRL+W`: Closes current pane-like thing. Also closes associated @@ -146,6 +150,7 @@ so you may be able to disable one of the following: > let g:novim_mode_use_general_app_shortcuts = 1 + let g:novim_mode_use_tab_shortcuts = 1 let g:novim_mode_use_pane_controls = 1 let g:novim_mode_use_copypasting = 1 let g:novim_mode_use_indenting = 1 diff --git a/plugin/novim_mode.vim b/plugin/novim_mode.vim index c30d5de..889a297 100644 --- a/plugin/novim_mode.vim +++ b/plugin/novim_mode.vim @@ -9,6 +9,7 @@ set cpo&vim let s:settings = { \ 'use_general_app_shortcuts': 1, + \ 'use_tab_shortcuts': 1, \ 'use_editor_fixes': 1, \ 'use_pane_controls': 1, \ 'use_copypasting': 1, @@ -40,7 +41,7 @@ call s:init_settings(s:settings) if has('timers') == 0 echo "Novim-mode: Your Vim version (Vim <7.5 or Neovim <0.1.5) doesn't " echo "support `timer()`, which causes a bug where Insert Mode is " - echo "innapropriately set for some panes." + echo "inappropriately set for some panes." endif " Plugin entry point -- cgit v1.2.3-70-g09d2