aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorj-james2022-01-18 08:53:21 +0000
committerj-james2022-01-18 09:02:04 +0000
commit0768d8cf9bf589be46d7a5162cb131229d3784bf (patch)
treef11280ca12f6567975dde50cf473a3e199c7b0a6
parent498a7e77539e44d7bee60c5e5379dafbd98a19e8 (diff)
 Add tab navigation functionalitytabs
-rw-r--r--README.md5
-rw-r--r--autoload/novim_mode.vim13
-rw-r--r--doc/novim_mode.txt5
-rw-r--r--plugin/novim_mode.vim3
4 files changed, 25 insertions, 1 deletions
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 <silent> <PageUp> <C-O>:call novim_mode#PageUp()<CR>
endif
+ " Open and cycle between tabs
+ if g:novim_mode_use_tab_shortcuts == 1
+ " Open a new tab
+ nnoremap <silent> <C-T> :tabnew<CR>
+ inoremap <silent> <C-T> <C-O>:tabnew<CR>
+ snoremap <silent> <C-T> <C-O>:tabnew<CR>
+ " Cycle through tabs
+ " I would prefer <C-Tab>, but can't use it due to technical limitations.
+ nnoremap <silent> <C-S-T> :tabnext<CR>
+ inoremap <silent> <C-S-T> <C-O>:tabnext<CR>
+ snoremap <silent> <C-S-T> <C-O>:tabnext<CR>
+ end
+
" Move between splits, panes, windows, etc and close them
if g:novim_mode_use_pane_controls == 1
inoremap <silent> <M-Left> <C-O><C-W><Left>
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