Ben Schmidt | 1 Jan 2008 01:03
Picon
Gravatar

Re: omap bug - changes too many characters


David Fishburn wrote:
> Ahh, thank you for that explanation.  So in fact I ended up executing
> a cw twice in a row.  You are correct, changing the normal command to
> "normal! w" behaves as I expected.

Cool. No worries.

> You created that patch based on my initial post about the YankRing.  I
> have noticed it is officially included in the current SVN version.  So
> I am beginning to modify my plugin to take advantage of this now.

LOL. I'm evidently losing track of who's writing what!

Grins,

Ben.

Send instant messages to your online friends http://au.messenger.yahoo.com 

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

Cyril Slobin | 1 Jan 2008 01:40
Picon

Re: SUGGESTION: make "undo/redo" commands also show the "modified" status of the file?


Tony Mechelynck wrote:
> When the buffer is 'modified', there is a [+] mark on the default
> status line (and nothing for not modified).

Cyril Slobin wrote:
> I found that [+] mark is too unnoticeable: my eye just doesn't catch
> it. So I put a simple autocommand in my _vimrc that changes the
> background color of the statusline itself from black to darkblue and
> back depending of "modified" state. Life became much better for me!

Jeffrey 'jf' Lim wrote:
> oh, and btw - I realize this doesn't work as expected with multiple
> buffers open? The change in the statusline seems to only affect the
> "current" buffer which the cursor is in... So it's not possible in
> that sense, to have a "quick overview" of which buffers have changed
> based on the statusline color...

Tony Mechelynck wrote:
> You would need a custom 'statusline' then. Maybe grab the User1
> highlight group to highlight the [+] differently than the rest
> in the status line regardless of whether the buffer is current
> or not.

Three months passed, and I have done this at last! Tony's suggestion is
not very useful for me: I want the whole statusline to change color, not
the [+] flag only. The solution is to make `statusline` option local and
to change it on the fly. Here is a quotation from my _vimrc file:

" Modified statusline color and default status
(Continue reading)

arctgx | 1 Jan 2008 03:28
Picon

Re: Split: Dragging borderline in URxvt


Problem disappeared with coming the new urxvt version (8.7-1 from
Debian package).
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

arctgx | 1 Jan 2008 03:45
Picon

Simple hiding all comments by folding


Is there a simple universal command which hides all comments in file
by current syntax? I would like, for example hide comments in my shell
scripts (syntax=sh) or xorg.conf (syntax=xf86conf). There is a lot
text about folding but I still can't find a good solution.

I tried
set foldmarker=#,$ | set foldmethod=marker

but it is not universal solution and... hides all lines of shell
script ;) ($ doesn't denote end of line?)
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Tony Mechelynck | 1 Jan 2008 04:29
Picon
Gravatar

Re: Simple hiding all comments by folding


arctgx wrote:
> Is there a simple universal command which hides all comments in file
> by current syntax? I would like, for example hide comments in my shell
> scripts (syntax=sh) or xorg.conf (syntax=xf86conf). There is a lot
> text about folding but I still can't find a good solution.
> 
> I tried
> set foldmarker=#,$ | set foldmethod=marker
> 
> but it is not universal solution and... hides all lines of shell
> script ;) ($ doesn't denote end of line?)

 From ":help 'foldmarker'":

"The marker is a literal string (a regular explession would be too slow)."

So, no, $ means a literal dollar sign, not the end of the line.

You could define a custom 'foldexpr' and set 'foldmethod' to "expr".

Maybe (untested)

	:setlocal fdm=expr fde=getline(v:lnum)[0]\ ==\ '#'

to tell Vim that a line is "in a fold" iff it starts with a #

This is adapted from what is said at ":help fold-expr".

A little more powerful, but slower (and also untested):
(Continue reading)

Ben Schmidt | 1 Jan 2008 05:00
Picon
Gravatar

Re: Simple hiding all comments by folding


arctgx wrote:
> Is there a simple universal command which hides all comments in file
> by current syntax? I would like, for example hide comments in my shell
> scripts (syntax=sh) or xorg.conf (syntax=xf86conf). There is a lot
> text about folding but I still can't find a good solution.
> 
> I tried
> set foldmarker=#,$ | set foldmethod=marker
> 
> but it is not universal solution and... hides all lines of shell
> script ;) ($ doesn't denote end of line?)

No. Foldmarker needs to include two literal strings that need to occur on 
different lines to define a fold. What you have above will be folding between a 
line that contains # and a line that contains $ (though with multiple lines 
containing # without enough matching $s it will end up with lots of nested folds 
that don't end).

I don't think there's currently really any way to do what you want. You could 
conceivably write or modify syntax files to do it and use foldmethod=syntax, but 
there'd be plenty of work involved, particularly since, for the most part, 'long' 
comments in shell scripts and such are actually not long comments, but lots of 
short comments one after the other. You'd have to modify the syntax highlighting 
to recognise multiple consecutive comments actually as large single comments. 
Folding single /* ... */ C comments would be relatively easy, as they don't suffer 
from that problem, but folding multiple // ... C++ or # ... shell script comments 
together in one fold would be relatively hard.

What most people do is manually mark comments for folding if they want it. Using 
(Continue reading)

Charles E. Campbell, Jr. | 1 Jan 2008 06:41

Re: Simple hiding all comments by folding


arctgx wrote:

>Is there a simple universal command which hides all comments in file
>by current syntax? I would like, for example hide comments in my shell
>scripts (syntax=sh) or xorg.conf (syntax=xf86conf). There is a lot
>text about folding but I still can't find a good solution.
>
>I tried
>set foldmarker=#,$ | set foldmethod=marker
>
>but it is not universal solution and... hides all lines of shell
>script ;) ($ doesn't denote end of line?)
>  
>

Inline comments can't be folded away; at least, not without Vince 
Negri's "conceal" patch to vim.  Others have already made suggestions 
about folding markers, so I won't repeat that.  One thing you could do 
instead is to highlight-link comments to something like Ignore and then 
back to Comment.  For example, *.sh scripts' comments are shComment, so 
you could use (untested) something like:

map <f1> if !exists("cmmnt_toggle")<bar><bar>cmmnt_toggle == 0<bar>let 
cmmnt_toggle=1<bar>hi link shComment Ignore<bar>else<bar>let 
cmmnt_toggle= 0<bar>hi link shComment Comment<bar>endif<cr>

to toggle between normally highlighted comments and "Ignore"'d comments.

Regards,
(Continue reading)

A.Politz | 1 Jan 2008 10:10
Picon

Re: Simple hiding all comments by folding


arctgx wrote:

>Is there a simple universal command which hides all comments in file
>by current syntax? I would like, for example hide comments in my shell
>scripts (syntax=sh) or xorg.conf (syntax=xf86conf). There is a lot
>text about folding but I still can't find a good solution.
>
>I tried
>set foldmarker=#,$ | set foldmethod=marker
>
>but it is not universal solution and... hides all lines of shell
>script ;) ($ doesn't denote end of line?)
>>
>  
>
The following will fold commented lines,including pre- and succeeding
empty ones. All it needs is a correct syntax plugin.
This can be slow, as noted at ':h synID'. It would maybe be faster to
use 'comment*' options, but then it wouldn't be simple anymore ;-).

-----------------%<-----------------
"(no linebreaks intended)
set fdm=expr
set 
fde=IsComment(v:lnum)?1:IsComment(prevnonblank(v:lnum))?1:IsComment(nextnonblank(v:lnum))?1:0

func! IsComment( lnum )
  return synIDattr(synID(a:lnum, match(getline(a:lnum),'\S')+1, 1), 
"name") =~? 'comment'
(Continue reading)

A.Politz | 1 Jan 2008 10:24
Picon

Re: Simple hiding all comments by folding


A.Politz wrote:

>arctgx wrote:
>
>  
>
>>Is there a simple universal command which hides all comments in file
>>by current syntax? I would like, for example hide comments in my shell
>>scripts (syntax=sh) or xorg.conf (syntax=xf86conf). There is a lot
>>text about folding but I still can't find a good solution.
>>
>>I tried
>>set foldmarker=#,$ | set foldmethod=marker
>>
>>but it is not universal solution and... hides all lines of shell
>>script ;) ($ doesn't denote end of line?)
>>    
>>
>> 
>>
>>    
>>
>The following will fold commented lines,including pre- and succeeding
>empty ones. All it needs is a correct syntax plugin.
>This can be slow, as noted at ':h synID'. It would maybe be faster to
>use 'comment*' options, but then it wouldn't be simple anymore ;-).
>
>-----------------%<-----------------
>"(no linebreaks intended)
(Continue reading)

A.Politz | 1 Jan 2008 12:11
Picon

Re: SUGGESTION: make "undo/redo" commands also show the "modified" status of the file?


Cyril Slobin wrote:

>Tony Mechelynck wrote:
>  
>
>>When the buffer is 'modified', there is a [+] mark on the default
>>status line (and nothing for not modified).
>>    
>>
>
>Cyril Slobin wrote:
>  
>
>>I found that [+] mark is too unnoticeable: my eye just doesn't catch
>>it. So I put a simple autocommand in my _vimrc that changes the
>>background color of the statusline itself from black to darkblue and
>>back depending of "modified" state. Life became much better for me!
>>    
>>
>
>Jeffrey 'jf' Lim wrote:
>  
>
>>oh, and btw - I realize this doesn't work as expected with multiple
>>buffers open? The change in the statusline seems to only affect the
>>"current" buffer which the cursor is in... So it's not possible in
>>that sense, to have a "quick overview" of which buffers have changed
>>based on the statusline color...
>>    
(Continue reading)


Gmane