All Projects → jpetrie → vim-counterpoint

jpetrie / vim-counterpoint

Licence: MIT license
Cycle between file counterparts in vim or neovim.

Programming Languages

Vim Script
2826 projects

Projects that are alternatives of or similar to vim-counterpoint

code runner.nvim
Neovim plugin.The best code runner you could have, it is like the one in vscode but with super powers, it manages projects like in intellij but without being slow
Stars: ✭ 234 (+1850%)
Mutual labels:  vim-plugin, neovim-plugin
Coc.nvim
Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Stars: ✭ 18,268 (+152133.33%)
Mutual labels:  vim-plugin, neovim-plugin
Indent Blankline.nvim
Indent guides for Neovim
Stars: ✭ 203 (+1591.67%)
Mutual labels:  vim-plugin, neovim-plugin
Animate.vim
A Vim Window Animation Library
Stars: ✭ 173 (+1341.67%)
Mutual labels:  vim-plugin, neovim-plugin
42header.vim
Add and update the 42 comment header at the top of your files
Stars: ✭ 15 (+25%)
Mutual labels:  vim-plugin, neovim-plugin
Visual Split.vim
Vim plugin to control splits with visual selections or text objects
Stars: ✭ 190 (+1483.33%)
Mutual labels:  vim-plugin, neovim-plugin
Vim Ghost
Vim/Nvim client for GhostText - Edit browser text areas in Vim/Neovim
Stars: ✭ 245 (+1941.67%)
Mutual labels:  vim-plugin, neovim-plugin
Ale
Check syntax in Vim asynchronously and fix files, with Language Server Protocol (LSP) support
Stars: ✭ 11,380 (+94733.33%)
Mutual labels:  vim-plugin, neovim-plugin
stable-windows
Keeps vim windows stable on layout changes
Stars: ✭ 41 (+241.67%)
Mutual labels:  vim-plugin, neovim-plugin
vim-readme-viewer
📖 Viewing plugin's README easily like vim help
Stars: ✭ 26 (+116.67%)
Mutual labels:  vim-plugin, neovim-plugin
Neotex
latex live preview - plugin for neovim and vim 8
Stars: ✭ 170 (+1316.67%)
Mutual labels:  vim-plugin, neovim-plugin
beacon.nvim
Whenever cursor jumps some distance or moves between windows, it will flash so you can see where it is
Stars: ✭ 217 (+1708.33%)
Mutual labels:  vim-plugin, neovim-plugin
Vim Dadbod Completion
Database autocompletion powered by https://github.com/tpope/vim-dadbod
Stars: ✭ 163 (+1258.33%)
Mutual labels:  vim-plugin, neovim-plugin
auto-pairs
Vim plugin, insert or delete brackets, parentheses, and quotes in pairs
Stars: ✭ 109 (+808.33%)
Mutual labels:  vim-plugin, neovim-plugin
Targets.vim
Vim plugin that provides additional text objects
Stars: ✭ 2,114 (+17516.67%)
Mutual labels:  vim-plugin, neovim-plugin
Vim Vsnip
Snippet plugin for vim/nvim that supports LSP/VSCode's snippet format.
Stars: ✭ 224 (+1766.67%)
Mutual labels:  vim-plugin, neovim-plugin
Vim Clap
👏 Modern performant fuzzy picker for Vim and NeoVim
Stars: ✭ 1,802 (+14916.67%)
Mutual labels:  vim-plugin, neovim-plugin
Vem Tabline
A lightweight Vim/Neovim plugin to display buffers and tabs in the tabline
Stars: ✭ 129 (+975%)
Mutual labels:  vim-plugin, neovim-plugin
qf helper.nvim
A collection of improvements for the quickfix buffer
Stars: ✭ 70 (+483.33%)
Mutual labels:  vim-plugin, neovim-plugin
skim.vim
vim support for skim
Stars: ✭ 127 (+958.33%)
Mutual labels:  vim-plugin, neovim-plugin

counterpoint.vim

Use Counterpoint to easily switch between file counterparts (.h and .cpp, et cetera) using :CounterpointNext and :CounterpointPrevious.

Counterpoint works by taking the current file, determining the root file name, and switching between files with the same root but different extensions. The root of the file is the portion of the file name before the first .; this allows Counterpoint to operate as you would expect when used in a context containing "multi-level" file extensions, such as a source tree containing Window.h and Window.cpp as well as Window.mac.mm and Window.win.cpp (Window is the root and all four variations are valid counterparts).

By default, if the current file starts with a ., Counterpoint uses the everything before the second dot in the filename as the root. This allows Counterpoint to support switching between alternate versions of invisible files.

Counterpoint switches between counterparts in alphabetical order. If you invoke the Counterpoint commands with the postfix bang modifier (:CounterpointNext!), Counterpoint will try to switch to an existing window containing the counterpart file before it tries to open it. It's also possible to specify arguments to the commands to control how the file is opened (for example, to open it in a new split). See :help counterpoint for details.

Installation

Counterpoint has no special installation requirements and can be installed via your preferred plugin management method.

Counterpoint does not provide mappings for its commands by default. It is recommended that you map Counterpoint's commands in your .vimrc, for example:

:nnoremap <leader>a :CounterpointNext<CR> :nnoremap <leader>A :CounterpointPrevious<CR>

Appending a ! to a command causes it to try to switch to an existing window showing the counterpart buffer if possible. Supplying arguments to a command allows you to define how the counterpart is opened, if needed. For example:

:nnoremap <leader>a :CounterpointNext! aboveleft vsplit

This mapping will open the next counterpart in a split window on the left, unless that counterpart is already visible in another window (in which case that window will get the focus).

Customization

Counterpoint's manual (:help counterpoint) describes the available configuration options in more detail; this section provides a brief overview of the most common options.

Search Paths

Counterpoint can search multiple directories for counterpart files (this can be useful in cases where source and header files are kept in separate, sibling directories). If you've already configured your path setting in vim (for gf and the like), you can instruct Counterpoint to read path by setting g:counterpoint_include_path to 1.

To add additional search paths, set g:counterpoint_search_paths to an array containing the desired paths:

let g:counterpoint_search_paths = ["relative/path/here", "another/path/here"]

Absolute or relative paths are permitted. Counterpoint will treat relative paths as being relative to the directory containing the current file. The current file's directory will always be searched for counterparts as well; you don't need to explicitly specify it in the search path array.

Excluding Files

Counterpoint can be configured to exclude files, based on regular expressions, from the counterpart set. By default, the exclusion pattern list is empty, but can be manipulated by changing the value of the g:counterpoint_exclude_patterns array:

let g:counterpoint_exclude_patterns = ["patternA", "patternB"]

When cycling between counterparts, any file that matches any of the regular expressions in the exclusion set will be removed from the set of available counterparts.

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].