sponsor Vim development Vim logo Vim Book Ad

endline : Easily add filetype-specific line-endings.

 script karma  Rating 4/1, Downloaded by 247    Comments, bugs, improvements  Vim wiki

created by
Oink Soft
script type
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.


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': ';'

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.tgz 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)

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
endline.tgz 0.1 2010-07-22 7.0 Oink Soft Initial upload
ip used for rating:

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