Hi,

R. Hicks wrote:
>
> function! AppendModeline()
>    let save_cursor = getpos('.')
>    let append = ' vim: set et ts='.&tabstop.' sw='.&shiftwidth.' 
> tw='.&textwidth.': '
>    $put =substitute(&commentstring, '%s', append, '')
>    call setpos('.', save_cursor)
> endfunction
> nnoremap <silent><Leader>ml :call AppendModeline()<CR>
> 
> I picked that up from the Vim wikia tips page. I like it but I would 
> like it to add a blank line before it places the text.
> 
> The current version:
> 
> 01: use strict;
> 02: # vim: et ts=# sw=# tw=#
> 
> I would like:
> 
> 01: use strict;
> 02:
> 03: # vim: et ts=# sw=# tw=#

just put a "\n" at the start of the append variable:

    let append = "\n" . ' vim: set et ts='.&tabstop.' sw='.&shiftwidth.' 
tw='.&textwidth.': '

The "\n" is a placeholder for a new-line character and when the variable
is put into the buffer you will get an additional empty line.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us.     (Calvin)

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to