All Projects → m00qek → nvim-contabs

m00qek / nvim-contabs

Licence: other
contextual tabs for vim/neovim

Programming Languages

Vim Script
2826 projects
Makefile
30231 projects

Projects that are alternatives of or similar to nvim-contabs

fzf-checkout.vim
Manage branches and tags with fzf
Stars: ✭ 187 (+835%)
Mutual labels:  vim-plugin, fzf
fzf-hoogle.vim
(neo)vim plugin that uses fzf for previewing hoogle search results
Stars: ✭ 37 (+85%)
Mutual labels:  vim-plugin, fzf
fzf-preview.vim
fzf ❤️ preview
Stars: ✭ 49 (+145%)
Mutual labels:  vim-plugin, fzf
fzf-folds.vim
Vim plugin that lets you fuzzy search for folds in a file
Stars: ✭ 15 (-25%)
Mutual labels:  vim-plugin, fzf
Notational Fzf Vim
Notational velocity for vim.
Stars: ✭ 975 (+4775%)
Mutual labels:  vim-plugin, fzf
Fzf Mru.vim
Vim plugin that is using fzf.vim to display your most recently used files.
Stars: ✭ 79 (+295%)
Mutual labels:  vim-plugin, fzf
Fzf Filemru
File MRU with fzf.vim
Stars: ✭ 76 (+280%)
Mutual labels:  vim-plugin, fzf
Vim Airline
lean & mean status/tabline for vim that's light as air
Stars: ✭ 15,873 (+79265%)
Mutual labels:  vim-plugin, vim-airline
Indent Blankline.nvim
Indent guides for Neovim
Stars: ✭ 203 (+915%)
Mutual labels:  vim-plugin
Nerdtree
A tree explorer plugin for vim.
Stars: ✭ 16,380 (+81800%)
Mutual labels:  vim-plugin
Vim Color Spring Night
Low-contrast calm color scheme for Vim
Stars: ✭ 227 (+1035%)
Mutual labels:  vim-plugin
Vim Lsp Cxx Highlight
Vim plugin for C/C++/ObjC semantic highlighting using cquery, ccls, or clangd
Stars: ✭ 231 (+1055%)
Mutual labels:  vim-plugin
Coc.nvim
Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Stars: ✭ 18,268 (+91240%)
Mutual labels:  vim-plugin
Pathfinder.vim
Vim plugin to suggest better movements
Stars: ✭ 228 (+1040%)
Mutual labels:  vim-plugin
vim-mysticaltutor
Low-contrast flat colorscheme for Vim and terminals
Stars: ✭ 22 (+10%)
Mutual labels:  vim-plugin
Vim Lexical
Build on Vim’s spell/thes/dict completion
Stars: ✭ 223 (+1015%)
Mutual labels:  vim-plugin
Neomake
Asynchronous linting and make framework for Neovim/Vim
Stars: ✭ 2,512 (+12460%)
Mutual labels:  vim-plugin
dotfiles
My doots. Changes are frequent, stability not guaranteed. Supports Arch, CentOS and Darwin.
Stars: ✭ 27 (+35%)
Mutual labels:  fzf
qf helper.nvim
A collection of improvements for the quickfix buffer
Stars: ✭ 70 (+250%)
Mutual labels:  vim-plugin
Vim Ledger
Vim plugin for Ledger
Stars: ✭ 253 (+1165%)
Mutual labels:  vim-plugin

Contextual tabs for vim/neovim


Neovim (and just recently vim!) has a neat feature: each tab can have a different working directory. This plugin adds some functions and fzf commands to change the working directory of tabs.

nvim-contabs in action

Installation

nvim-contabs depends on fzf and, optionally, on vim-airline. If you use vim-plug:

Plug 'm00qek/nvim-contabs'

Configuration

You can use contabs in two ways. The first is by calling functions to change the tab working directory - which is great if you don't want to use FZF. Add to your config

" Change the working directory of current tab
command! -nargs=1 -complete=dir EP call contabs#project#edit(<q-args>)

" Open a new tab setting the working directory
command! -nargs=1 -complete=dir TP call contabs#project#tabedit(<q-args>)

Now you can run :EP ~/dev/myproject or :TP ~/dev/myproject.

The other way contabs work is by listing you projects in a FZF buffer. To use that you need to inform where to find your projects by setting g:contabs#project#locations in your config

let g:contabs#project#locations = [
  \ { 'path': '~/dev/aproject' },
  \ { 'path': '~/dev/anotherproject' },
  \]

Each item in the array is a location. You can add more options to the map:

option effect default
depth the level of subdirectories 0
git_only list only git repos v:false
entrypoint file to show when opening project []
formatter function to format project name on FZF buffer { x -> x }

Some examples of locations:

" directories using git satisfying '~/projects/*/*'
echo { 'path': '~/projects', 'depth': 2, 'git_only': v:true }

" point to '~/.config/nvim' and change its display on FZF buffer
echo { 'path': '~/.config/nvim', 'formatter': { _ -> 'Neovim Config' } }

" directories satisfying '$GOPATH/src/github.com/libgit2/*'
echo { 'path': '$GOPATH/src/github.com/libgit2', 'depth': 1 }

" directories using git satisfying '~/haskell/*' and show 'λ | ' before their paths
echo { 'path': '~/haskell', 'depth': 1, 'git_only': v:true, 'formatter': { dirpath -> 'λ | ' . dirpath } }

" directories using git satisfying '~/clojure/*' and, on project selection, open one of the entrypoint files
echo { 'path': '~/clojure', 'depth': 1, 'git_only': v:true, 'entrypoint': ['project.clj', 'tasks/build.boot'] }

The following nmaps open the FZF buffer:

"invoke fzf with the list of projects configured in g:contabs#project#locations
"the enabled hotkeys are { 'ctrl-t': 'tabedit', 'ctrl-e, <cr>': 'edit' }
nnoremap <silent> <Leader>p :call contabs#project#select()<CR>

"invoke fzf with the list of buffers of current tab working directory
"the enabled hotkeys are defined in g:fzf_action, but if this var is not 
"defined the command will use { 'ctrl-t': 'tabedit', 'ctrl-e, <cr>': 'edit', 'ctrl-v': 'vsp', 'ctrl-x': 'sp' }
nnoremap <silent> <Leader>b :call contabs#buffer#select()<CR>

vim-airline

When using contabs and vim-airline, by defautl, your tab titles will be the basename of it's current working directory. If you want to disable this feature add to your config:

let g:contabs#integrations#airline = v:false

vanilla vim/neovim tabline

If you use gvim, add to your config:

set guitablabel=%{contabs#integrations#tabline#label(tabpagenr())}

or, if you are using vim/neovim on terminal:

set tabline=%!contabs#integrations#tabline#create()

If you want to create your own tabline function, you can use the function contabs#integrations#tabline#raw_label(tabpagenr()) to just eval the chosen formatter.

Tabline

The labels are provided by formatters, which are functions operating over the tab current directory and location config. You can choose one of the predefined formatters using:

" you can use 'basename', 'path', 'pathshorten', 'project/path',
" 'project/pathshorten' or 'location/formatter'
let g:contabs#integrations#tabline#theme = 'project/path'

If you want to write you own formatter use

let g:contabs#integrations#tabline#theme = 'mytheme'
call contabs#integrations#tabline#register('mytheme',
\  { location, cwd ->  location.path . " | " . cwd })

where location is the related entry in g:contabs#project#locations and cwd is the current tab working directory

Contributing

To test you changes to the code you should use

make prepare
make nvim
make vim
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].