endline : Easily add filetype-specific line-endings.
script karma |
Rating 8/2,
Downloaded by 1256 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Thomas Allen |
|
script type |
utility |
|
description |
This plugin maps (by default) <S-CR> to add a filetype's provided "line ending"
to the end of the current line if it is not already present. For instance, a ';'
would be added to the end of a line of JavaScript source.
This is similar to a feature provided by TextMate, mapped to
Command-Option-Return in that application.
Usage:
Somewhere in your .vimrc (or equivalent), provide a global dict mapping filetype
names to line endings, like so:
let g:Endlines = {
'erlang': '.',
'java': ';',
'javascript': ';',
'ocaml': ';;',
'perl': ';',
'php': ';',
'python': ':',
'sml': ';'
\}
Mappings can also be a list of patterns that will be tried in order. In the
following example, a " ->" is appended if the line starts with no whitespace
and ends with a ")", and a "," is appended if the line ends with
non-whitespace.
let g:Endlines = {
'erlang': [
\['^\S.*)$', ' ->'],
\['\S$', ',']]
\}
By default, <S-CR> is mapped in both insert and normal mode. In insert mode, a
new line is added as well.
Global Options:
g:EndlineMapping ('<S-CR>'): The default endline mapping.
g:EndlineInsertMapping (g:EndlineMapping): The insert mode mapping.
g:EndlineNormalMapping (g:EndlineMapping): The normal mode mapping.
g:EndlineInsert (1): 0 to disable the insert mode mapping.
g:EndlineNormal (1): 0 to disable the normal mode mapping.
g:Endlines ({}): See "Usage" |
|
install details |
1. Extract the downloaded endline.zip file
2. Copy endline/doc/endline.txt to .vim/doc/endline.txt
3. Copy endline/plugin/endline.vim to .vim/plugin/endline.vim
4. Run :helptags ~/.vim/doc to load the documentation
5. Map your filetype line-endings (see "Usage" above, or :h Endline-usage) |
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 3.236.112.101
|