sponsor Vim development Vim logo go to HTTPS page Vim Book Ad

vim-alias : versatile vim-command line aliases

 script karma  Rating 4/1, Downloaded by 365    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).

## 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 MS Windows.
 

Rating scripts is only available on the HTTPS page

script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-alias.zip 1.4 2016-11-02 7.0 Enno Nagel Handle Aliases that extend each other and end in non-word characters
vim-alias.zip 1.2 2016-06-13 7.0 Enno Nagel fix minor quirks
vim-alias.zip 1.1 2016-04-09 7.0 Enno Nagel - secure alias names & expansions
- extend doc
- minor bug fix
vim-alias.zip 1.0 2016-04-06 7.0 Enno Nagel Initial upload
ip used for rating: 54.90.237.148

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo