vim-alias : versatile vim-command line aliases
script karma |
Rating 13/4,
Downloaded by 2660 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Enno Nagel |
|
script type |
utility |
|
description |
This plugin lets you define command-line abbreviations by `:Alias` which only expand at the beginning of the command prompt.
You can pass the optional parameters
-buffer or -range
to create a buffer local alias or one that accepts a range preceding the
alias.
These command line abbreviations work like the bash aliases, except that
the alias is substituted in-place.
# Usage
:Alias [-range] [-buffer] <lhs> <rhs>
:UnAlias <lhs> ...
:Aliases [<lhs> ...]
## Examples:
:Alias -range dg <c-r>=&l;:diff?"diffget":"dg"<cr>
:Alias -buffer spl setlocal\ spell<bar>setlocal\ spelllang=en
:Alias w!! write\ !sudo\ tee\ >\ /dev/null\ %
:Alias F find\ *<c-r>=EatChar("\ ")<cr>
:Alias th tab\ help
:Alias sft setfiletype
:Alias g !git
:UnAlias g
:Aliases
See :help abbreviations for Eatchar(c).
## Persistent Aliases:
To define the Aliases after Vim has started up, put them in ~/.vim/after/plugin/alias.vim (on Linux) or %USERPROFILE%/vimfiles/after/plugin/alias.vim (on Microsoft Windows).
# Configuration
The variable `g:cmdaliasCmdPrefixes` lists the patterns of all commands by
which an alias command may be preceded and yet expand. It defaults to
let g:cmdaliasCmdPrefixes = [
\ '\d*verb\%[ose]', 'debug', 'sil\%[ent]!\?', '\%uns[ilent]' 'redir\?!\?',
\ 'ld!\?', '[cl]fd!\?', '[cl]f\?do!\?',
\ '\%(\%([.$]\|\d\+\)\%([,;]\%([.$]\|\d\+\)\)*\)\?\s*' .
\ '\%(argdo\?!\?\|bufdo\?!\?\|windo\?\|tabdo\?\)' ]
# Development
vim-alias is developed at
https://github.com/Konfekt/vim-alias
where issues can be filed.
# Credits
This plugin builds and improves on cmdalias.vim 3. 0 by Hari Krishna Dara by
- allowing for aliases of commands preceded by a range (like :Alias -range dg
diffget),
- allowing for alias names ending in non-word chars (like :Alias w!! ...),
- having a Vim documentation, and
- more checks for proper usage, more consistent parameter parsing and a finer
check for blanks or commands (such as : silent! ) preceding the alias.
|
|
install details |
Unpack vim-alias into ~/.vim on Linux or Mac and into %USERPROFILE%/vimfiles on Microsoft Windows. |
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 207.241.232.185
|