Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/flatcap/vim-tabitha
⚙ Vim Plugin - Helps you switch between windows, tabs and files
https://github.com/flatcap/vim-tabitha
buffer file plugin script tab vim window
Last synced: about 5 hours ago
JSON representation
⚙ Vim Plugin - Helps you switch between windows, tabs and files
- Host: GitHub
- URL: https://github.com/flatcap/vim-tabitha
- Owner: flatcap
- License: other
- Created: 2015-05-03T22:46:44.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2022-06-12T19:25:23.000Z (over 2 years ago)
- Last Synced: 2024-05-02T02:16:53.347Z (7 months ago)
- Topics: buffer, file, plugin, script, tab, vim, window
- Language: Vim script
- Homepage:
- Size: 31.3 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# tabitha.vim
## Introduction
Tabitha helps you switch between windows, tabs and files.
The plugin creates two mappings: `` to move forwards and `` to move backwards.
Pressing `` in normal mode will move the focus to the next window. If there are no more windows, the next tab will be selected.If there is only one window and one tab, then Tabitha will switch to the next file in the arglist.
By pressing `` the focus will be moved to the previous window, tab or file.
The default mappings support a count. Therefore pressing `3` will move the focus forward three windows, tabs or files.
## Configuration
The behaviour of Tabitha is controlled by five global variables:
```viml
let g:tabitha_navigate_windows = 1
let g:tabitha_navigate_tabs = 1
let g:tabitha_navigate_files = 1
let g:tabitha_wrap_around = 1
let g:tabitha_select_window = 1
```The default behaviour is to switch to the next window. If there are no more windows, then the first window of the next tab will be selected. When the final window of the final tab is reached, the focus will wrap around to the first window of the first tab.
By choosing which variables to set, you can choose to cycle through:
- Just Windows
- Windows and Tabs
- Just Tabs
- Just FilesWhen switching between tabs, the `select_window` option controls whether the focus should be set to the first window in that tab.
## Mappings
By default, Tabitha will create two key mappings and eight plugin mappings:
Move forwards through windows/tabs
Move backwards through windows/tabsTabithaNextWindow
TabithaPreviousWindowTabithaNextTab
TabithaPreviousTabTabithaNextFile
TabithaPreviousFileTabithaSwitchForwards
TabithaSwitchBackwardsThese can be disabled by setting:
```viml
let g:tabitha_create_mappings = 0
```You can create your own Tabitha mappings, e.g.
```viml
" Move focus forwards
nmap TabithaSwitchForwards
nmap :call tabitha#Switch (1)" Move focus backwards
nmap TabithaSwitchBackwards
nmap :call tabitha#Switch (0)" Select next tab
nmap t TabithaNextTab
nmap t :call tabitha#NextTab (1, 0, 0)" Select previous file
nmap F TabithaPreviousFile
nmap F :call tabitha#NextFile (0, 0)
```## API
Tabitha introduces four functions to vim. Their behaviour is configured by five variables, described in 'Configuration', above.
```viml
function! tabitha#NextWindow (...)
function! tabitha#NextTab (...)
function! tabitha#NextFile (...)
function! tabitha#Switch (...)
```### NextWindow
NextWindow moves the cursor to the next/previous window.
It takes two optional parameters.
It returns 1 if the focus was changed, 0 otherwise.```viml
tabitha#NextWindow (forwards, wrap)
```| Parameter | Default | Description |
| --------- | -------- | --------------------------------- |
| forwards | 1 (true) | direction of change |
| wrap | 1 (true) | wrap around at end of window list |e.g.
```viml
call tabitha#NextWindow ()
call tabitha#NextWindow (1, 1)
```### NextTab
NextTab moves the cursor to the next/previous tab.
It takes three optional parameters.
It returns 1 if the focus was changed, 0 otherwise.```viml
tabitha#NextTab (forwards, wrap, select_window)
```| Parameter | Default | Description |
| ------------- | -------- | ----------------------------------------------- |
| forwards | 1 (true) | direction of change |
| wrap | 1 (true) | wrap around at end of tab list |
| select_window | 1 (true) | when switching tabs, pick the first/last window |e.g.
```viml
call tabitha#NextTab ()
call tabitha#NextTab (1, 0, 0)
```### NextFile
NextFile moves the cursor to the next/previous file.
It takes two optional parameters.
It returns 1 if the focus was changed, 0 otherwise.```viml
tabitha#NextFile (forwards, wrap)
```| Parameter | Default | Description |
| --------- | -------- | ------------------------------- |
| forwards | 1 (true) | direction of change |
| wrap | 1 (true) | wrap around at end of file list |e.g.
```viml
call tabitha#NextFile ()
call tabitha#NextFile (1, 1)
```### Switch
Switch moves the cursor to the next/previous window/tab/file (dependent on configuration).
It takes one optional parameter.
It returns the number of times the focus moved, 0 if nothing changed.```viml
tabitha#Switch (forwards)
```| Parameter | Default | Description |
| --------- | -------- | ------------------- |
| forwards | 1 (true) | direction of change |e.g.
```viml
call tabitha#Switch ()
call tabitha#Switch (1)
```## Naming
The plugin is whimsically named after the default key mapping.
The name 'Tabitha' is derived from an Aramaic word meaning gazelle.## License
Copyright © Richard Russon (flatcap).
Distributed under the GPLv3## See also
- [flatcap.org](https://flatcap.org)
- [GitHub](https://github.com/flatcap/vim-tabitha)