aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorj-james2020-11-15 09:04:57 +0000
committerj-james2020-11-15 09:04:57 +0000
commit7eaf050abcd5d8f94e6a1cb3db44736322e857f3 (patch)
treed306142e8239c5254e68f9df4c07d88a76d14990
parent0ba5c5211d96dd53af9d3b47b9a436048de4a3b1 (diff)
Add new tab navigation functionality
-rw-r--r--README.md6
-rw-r--r--autoload/heresy.vim12
-rw-r--r--doc/heresy.txt6
-rw-r--r--plugin/heresy.vim1
4 files changed, 25 insertions, 0 deletions
diff --git a/README.md b/README.md
index eb8f518..28e508e 100644
--- a/README.md
+++ b/README.md
@@ -66,6 +66,11 @@ One further common problem is that `tmux` can change key combination behaviour,
* `F3` and `SHIFT+F3`: Find next and previous occurences.
* `CTRL+H`: Find and replace. `[FIND]` and `[REPLACE]` are prepopulated.
+#### Tab navigation
+ * `CTRL+T`: Open a new tab.
+ * `CTRL+TAB`: Cycle to the next tab.
+ * `CTRL+SHIFT+T`: Cycle to the previous tab.
+
#### Undoing
* `CTRL+Z` or `CTRL+U`: Undo.
* `CTRL+Y`: Redo.
@@ -101,6 +106,7 @@ let g:heresy_copypaste_shortcuts = 1
let g:heresy_undo_shortcuts = 1
let g:heresy_find_shortcuts = 1
let g:heresy_line_shortcuts = 1
+let g:heresy_tab_shortcuts = 1
let g:heresy_pane_shortcuts = 1
let g:heresy_indentation_shortcuts = 1
diff --git a/autoload/heresy.vim b/autoload/heresy.vim
index 02dc3bd..0468d58 100644
--- a/autoload/heresy.vim
+++ b/autoload/heresy.vim
@@ -152,6 +152,18 @@ function! g:SetShortcuts()
snoremap <silent> <C-Down> <C-O>:m '>+1<CR>gv=gv<C-G>
endif
+ if g:heresy_tab_shortcuts == 1
+ " Open a new tab
+ inoremap <silent> <C-T> <C-O>:tabnew<CR>
+ snoremap <silent> <C-T> <C-O>:tabnew<CR>
+ " Cycle through tabs
+ inoremap <silent> <C-Tab> <C-O>:tabnext<CR>
+ snoremap <silent> <C-Tab> <C-O>:tabnext<CR>
+ " Cycle backwards through tabs
+ inoremap <silent> <C-S-Tab> <C-O>:tabprevious<CR>
+ snoremap <silent> <C-S-Tab> <C-O>:tabprevious<CR>
+ endif
+
if g:heresy_pane_shortcuts == 1
" Move between splits, panes, windows, etc and close them
inoremap <silent> <M-Left> <C-O><C-W><Left>
diff --git a/doc/heresy.txt b/doc/heresy.txt
index 7135bc5..5017388 100644
--- a/doc/heresy.txt
+++ b/doc/heresy.txt
@@ -105,6 +105,11 @@ Finding, replacing
* `F3` and `SHIFT+F3`: Find next and previous occurences.
* `CTRL+H`: Find and replace. `[FIND]` and `[REPLACE]` are prepopulated.
+Tab navigation
+ * `CTRL+T`: Open a new tab.
+ * `CTRL+TAB`: Cycle to the next tab.
+ * `CTRL+SHIFT+T`: Cycle to the previous tab.
+
Undoing
* `CTRL+Z` or `CTRL+U`: Undo.
* `CTRL+Y`: Redo.
@@ -149,6 +154,7 @@ following: >
let g:heresy_undo_shortcuts = 1
let g:heresy_find_shortcuts = 1
let g:heresy_line_shortcuts = 1
+ let g:heresy_tab_shortcuts = 1
let g:heresy_pane_shortcuts = 1
let g:heresy_indentation_shortcuts = 1
diff --git a/plugin/heresy.vim b/plugin/heresy.vim
index f414a66..708b80f 100644
--- a/plugin/heresy.vim
+++ b/plugin/heresy.vim
@@ -17,6 +17,7 @@ let s:settings = {
\ 'undo_shortcuts': 1,
\ 'find_shortcuts': 1,
\ 'line_shortcuts': 1,
+ \ 'tab_shortcuts': 1,
\ 'pane_shortcuts': 1,
\ 'indentation_shortcuts': 1,
\ 'navigation_fixes': 1,