All Projects → LucHermitte → alternate-lite

LucHermitte / alternate-lite

Licence: other
a.vim rewriting

Programming Languages

Vim Script
2826 projects

Projects that are alternatives of or similar to alternate-lite

lh-tags
ctags base updating, and browsing from vim
Stars: ✭ 25 (+19.05%)
Mutual labels:  vim-plugins, viml-functions, viml-library
gotests-vim
Vim plugin for https://github.com/cweill/gotests
Stars: ✭ 129 (+514.29%)
Mutual labels:  vim-plugins
vim-sass-colors
sass/scss/less/css color literal and color variable highlighting (works with imports)
Stars: ✭ 24 (+14.29%)
Mutual labels:  vim-plugins
vim-debugstring
Debug printf()-style at the speed of light
Stars: ✭ 30 (+42.86%)
Mutual labels:  vim-plugins
tabulous
Vim plugin for setting the tabline including the tab page labels. It is lightweight and written in pure Vim script.
Stars: ✭ 21 (+0%)
Mutual labels:  vim-plugins
vim-jsonc
⚠️Deprecated⚠️: Vim syntax highlighting plugin for JSON with C-style line (//) and block (/* */) comments.
Stars: ✭ 52 (+147.62%)
Mutual labels:  vim-plugins
tmux-zsh-vim-titles
Unified terminal titles in tmux, zsh, and vim/nvim
Stars: ✭ 28 (+33.33%)
Mutual labels:  vim-plugins
vim-build-tools-wrapper
Projects building plugin for Vim
Stars: ✭ 23 (+9.52%)
Mutual labels:  vim-plugins
ranger-explorer.vim
Vim plugin to use ranger as a file explorer. Seamless switching between vim and ranger.
Stars: ✭ 30 (+42.86%)
Mutual labels:  vim-plugins
vimapt
A package manager for vim (VimApt => Vim's Advanced Package Tools)
Stars: ✭ 16 (-23.81%)
Mutual labels:  vim-plugins
vim-phpstan
A Vim plugin for PHPStan - https://github.com/phpstan/phpstan. It calls `phpstan` to do static analysis of your PHP code and displays the errors in Vim's quickfix list.
Stars: ✭ 26 (+23.81%)
Mutual labels:  vim-plugins
vim-drawer
VimDrawer is a Vim plugin to group related buffers in tabs automatically by the file name.
Stars: ✭ 26 (+23.81%)
Mutual labels:  vim-plugins
swifty-vim
⌨️ A Vim plugin for Swift which provides file detection, syntax highlighting, support for compiling and running tests, and optional support for formatting and linting tools.
Stars: ✭ 18 (-14.29%)
Mutual labels:  vim-plugins
ipynb notedown.vim
vim plugin for editing jupyter notebook (ipynb) files through notedown
Stars: ✭ 27 (+28.57%)
Mutual labels:  vim-plugins
vim-SystemVerilog
SystemVerilog syntax highlight/indent support in vim
Stars: ✭ 37 (+76.19%)
Mutual labels:  vim-plugins
name-assign.vim
Vim plugin to automate replacing expressions with assigned variables in any programming language
Stars: ✭ 45 (+114.29%)
Mutual labels:  vim-plugins
dotfiles
My hand crafted .dotfiles 🤚🛠❤️
Stars: ✭ 49 (+133.33%)
Mutual labels:  vim-plugins
nv-ide
Neovim custom configuration, oriented for full stack developers (rails, ruby, php, html, css, SCSS, javascript)
Stars: ✭ 363 (+1628.57%)
Mutual labels:  vim-plugins
filestyle
filestyle is a Vim plugin that highlights unwanted whitespace and characters.
Stars: ✭ 30 (+42.86%)
Mutual labels:  vim-plugins
vim-UT
Unit Testing plugin for Vim
Stars: ✭ 18 (-14.29%)
Mutual labels:  vim-plugins

alternate-lite Last release Project Stats

Features

This plugin is meant to be a simplification of Michael Sharpe's alternate.vim plugin.

The design decisions that distinguishes alternate-lite from alternate are the following:

  • Support for project/buffer specific settings
  • Use dictionaries to set variables
  • Lazy definition of functions through autoload plugin
  • :IH commands and related mappings are already defined in my SearchInRuntime plugin.

My main use case for this plugin is to build things like lh-cpp's :GOTOIMPL command.

Commands

alternate-lite implements slightly differently all :A commands provided by original a.vim plugin.

All these commands first deduce an alternate file for the current one. The priority is given to files that exist. Then, they try to jump to the window where this alternate file is displayed, if the file wasn't displayed, it'll be opened:

  • In the current window with :A,
  • In a horizontally split opened window with :AS,
  • In a vertically split opened window with :AV,
  • In a new tab with :AT.

In case several alternate files are found, we'll be asked to choose which one we wish to open or to jump-to.

The previous commands also take an optional parameter: the extension we wish precisally to use to deduce the alternate file.

There is also the :AN command that permits to cycle through the buffers associated to the current buffer. If possible, this command will search for a window where the next buffer is already displayed.

Options

Some usual extensions are already registered. This can be extended globally, locally, on project basis, etc. See lh#ft#option#get().

You can obtain the latest status with a :echo g:alternates.extensions.

Extension map

Globally change the extension mappings

Let's say you want to register .tpp as a new extension for files where C++ template functions would be defined, you'll need to execute (in your .vimrc for instance):

" The actual {extension -> extensions} map
call lh#alternate#register_extension('g', 'h'  , g:alternates.extensions.h + ['tpp'])
call lh#alternate#register_extension('g', 'hpp', g:alternates.extensions.hpp + ['tpp'])
call lh#alternate#register_extension('g', 'tpp', ['h', 'hpp'])

" The {filetype -> extensions} map
let g:alternates.fts.cpp += ['tpp']
" Note: this last command can only be done after a call to any lh#alternate#* function

This says that this new extension may be used in all your projects.

The last line is important and required with filetypes that share some extensions like C, C++, ObjectiveC, and so on. Other filetypes like lex, yacc, OCaml, ASP... aren't concerned.

If you see that g:alternates.fts exists for the filetype to which you wish to register a new extension, then, don't forget to extend the associated list with the new extension.

Change the extension mappings for a given project only

If you prefer to register it only in one project, with lh-vim-lib project feature, you could define instead:

" The actual {extension -> extensions} map
call lh#alternate#register_extension('p', 'h'  , g:alternates.extensions.h + ['tpp'])
call lh#alternate#register_extension('p', 'hpp', g:alternates.extensions.hpp + ['tpp'])
call lh#alternate#register_extension('p', 'tpp', ['h', 'hpp'])

" The {filetype -> extensions} map
LetTo p:alternates.fts.cpp = g:alternates.fts.cpp + ['tpp']
" Note: this last command can only be done after a call to any lh#alternate#* function

In order to override the default values, just don't reuse them.

Directory selection

The option (bpg):[{ft}_]alternates.searchpath can contain a comma separated list of directory alternance policy:

  • A path with a prefix of "wdr:" will be treated as relative to the working directory.

  • A path prefix of "abs:" will be treated as absolute.

  • No prefix or "sfr:" will result in the path being treated as relative to the source file (see sfPath argument).

  • A prefix of "reg:" will treat the pathSpec as a regular expression substitution that is applied to the source file path. The format is:

    reg:<sep><pattern><sep><subst><sep><flag><sep>
    
    • <sep> seperator character, we often use one of [/|%#]
    • <pattern> is what you are looking for
    • <subst> is the output pattern
    • <flag> can be g for global replace or empty

Examples:

  • 'reg:/inc/src/g/' will replace every instance of 'inc' with 'src' in the source file path. It is possible to use match variables so you could do something like: 'reg:|src/\([^/]*\)|inc/\1||' (see 'help :substitute', 'help pattern' and 'help sub-replace-special' for more details

Note: ',' (comma) are used internally so DON'T use it in your regular expressions or other pathSpecs.

TODO

Many features from the original a.vim plugin are still missing, starting with :A* commands. I should eventually define them. For now I just need a simpler tool to define correctly lh-cpp's :GOTOIMPL command.

Installation

  • Requirements: Vim 7.+, lh-vim-lib v4.6.3

  • With vim-addon-manager, install alternate-lite. This is the preferred method because of the various dependencies.

ActivateAddons alternate-lite
  • or with vim-flavor which also supports dependencies:
flavor 'LucHermitte/alternate-lite'
  • or you can clone the git repositories (expecting I haven't forgotten anything):
git clone [email protected]:LucHermitte/lh-vim-lib.git
git clone [email protected]:LucHermitte/alternate-lite.git
  • or with Vundle/NeoBundle (expecting I haven't forgotten anything):
Bundle 'LucHermitte/lh-vim-lib'
Bundle 'LucHermitte/alternate-lite'

Credits

  • Michael Sharpe for his original plugin
  • Directory & regex enhancements added by Bindu Wavell who is well known on vim.sf.net

License

We grant permission to use, copy modify, distribute, and sell this software for any purpose without fee, provided that the above copyright notice and this text are not removed. We make no guarantee about the suitability of this software for any purpose and we are not liable for any damages resulting from its use. Further, we are under no obligation to maintain or extend this software. It is provided on an "as is" basis without any expressed or implied warranty.

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