Last active
April 29, 2017 09:00
-
-
Save troyp/6a5669785a25f626866bd1398ff422a6 to your computer and use it in GitHub Desktop.
Pentadactyl code to add `:closealltoright` and `:closealltoleft` commands (and corresponding keybindings). Add to `~/.pentadactylrc`. Vimperator versions in https://gist.github.com/troyp/20e4b1f744c5e799f1df
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
command! closetabstoleft | |
\ -description "Close all tabs to the left of the current tab" | |
\ -js | |
\ var firstTab = tabs.getTab(0); | |
\ var numToClose = tabs.getTab().dactylOrdinal - 1; | |
\ tabs.remove(firstTab, numToClose); | |
command! closetabstoright | |
\ -description "Close all tabs to the right of the current tab" | |
\ -js | |
\ tabIndex = tabs.getTab().dactylOrdinal - 1; | |
\ var nextTabIndex = tabIndex + 1; | |
\ var firstTab = tabs.getTab(nextTabIndex); | |
\ var N = tabs.allTabs.length; | |
\ var numToClose = N - nextTabIndex; | |
\ tabs.remove(firstTab, numToClose); | |
map v< -ex closetabstoleft | |
map v> -ex closetabstoright | |
" close tabs to right (inclusive) " | |
map <C-k> v>d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment