Search the web
Sign In
New User? Sign Up
vim · Vim (Vi IMproved) text editor users list
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Messages 105692 - 105721 of 110441   Newest  |  < Newer  |  Older >  |  Oldest
Messages: Show Message Summaries   (Group by Topic) Sort by Date v  
#105721 From: Matt Wozniski <mjw@...>
Date: Fri Jul 10, 2009 3:10 am
Subject: Re: Text formatting tools
mjw@...
Send Email Send Email
 
On Thu, Jul 9, 2009 at 12:19 PM, Xavier de Gaye wrote:
>
> On Thu, Jul 9, 2009 at 11:17 AM, Carsten Agger wrote:
>> ...
>> This script allows simple formatting like *italics* and _underline_, but
>> I'd like something a but more "shiny", which would e.g. also recognize
>> chapter and section headings and maybe even generate a TOC.
>>
>> Does anybody have any recommendations? There's txt2tags, which I just
>> found (http://txt2tags.sourceforge.net/writing-book.html), and I suppose
>> one could write something similar to easily convert a text file to a
>> LaTex file, but as I said - do anyone have any experience using such
>> tools?
>
>
> You may want to have a look at docutils, http://docutils.sourceforge.net/
>
> "Docutils is an open-source text processing system for processing
> plaintext documentation into useful formats, such as HTML or LaTeX. It
> includes reStructuredText, the easy to read, easy to use,
> what-you-see-is-what-you-get plaintext markup language."
>
> reStructuredText handles TOC, headings, lists, tables. The markup
> is such that the original text can be easily read as a plain text.
>
> reStructuredText is used for the Python documentation.
>
> I am using docutils and reStructuredText in a moinmoin wiki and find
> it very useful.

+1 for reStructuredText.  Easy to write, readable in source form, and
looks good both in html and as latex converted to pdf.

~Matt

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

#105720 From: Tony Mechelynck <antoine.mechelynck@...>
Date: Fri Jul 10, 2009 2:27 am
Subject: Re: File info disappears in vim status line after startup from command line
antoine.mechelynck@...
Send Email Send Email
 
On 08/07/09 01:24, Ben wrote:
>
>> As you remarked, the message appears, but it gets overwritten. However,
>> you can get it back by means of the |:messages| command.
>
> Actually, that doesn't seem to work for this particular message (in
> vim or gvim).
[...]

Hm, I just tried it, and

	 ~/foobar [New File]

doesn't appear, but the following do:

	 "~/foobar" 0L, 3C [New] written
	 "~/foobar" 0L, 0C written
	 "~/foobar" 0L, 0C
	 "ru-fr.03.html" 2923L, 516224C written

etc. Note that the _first_ write has an additional [New] in it, and that
reading is indicated by the _absence_ of the word "written".


Best regards,
Tony.
--
Old age is the most unexpected of things that can happen to a man.
		 -- Trotsky

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

#105719 From: Robert Mark Bram <robertmarkbram@...>
Date: Fri Jul 10, 2009 2:19 am
Subject: Re: autosave
robertmarkbram@...
Send Email Send Email
 
Thanks for the answer Christian and Matt!

> >> but :autosave 5 gives "Not an editor command"
> >> and :set autosave 5 gives "Unknown option: autosave"

> > It's in the todo list. That means, it is not yet implemented.
>
> And, even if it were implemented, it would be an option, not a command

Bugger. :)
Swap files will do for now then.

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

#105718 From: "Britton Kerin" <bkerin@...>
Date: Fri Jul 10, 2009 1:08 am
Subject: getting quicklist to work with GNU Make/gcc
bkerin@...
Send Email Send Email
 
I'm getting strange behavior from :make.  I have a build that
produces this output at the shell:

     rhino$ make
     make  all-am
     make[1]: Entering directory `/home/bkerin/projects/isymchoose'
     if gcc -DHAVE_CONFIG_H -I. -I. -I.
     -DSCRIPTDIR='"/home/bkerin/local/share/isymchoose"'  -Wall -Wextra
     -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wpointer-arith
     -Wcast-qual -Wcast-align -Wwrite-strings -Wnested-externs
     -fno-common -I/home/bkerin/local/include/gtk-2.0
     -I/home/bkerin/local/lib/gtk-2.0/include
     -I/home/bkerin/local/include/atk-1.0
     -I/home/bkerin/local/include/cairo
     -I/home/bkerin/local/include/pango-1.0
     -I/home/bkerin/local/include/glib-2.0
     -I/home/bkerin/local/lib/glib-2.0/include
     -I/home/bkerin/local/include/freetype2 -I/home/bkerin/local/include
     -I/home/bkerin/local/include/pixman-1 -I/usr/include/libpng12 -g -O2
     -MT isymchoose.o -MD -MP -MF ".deps/isymchoose.Tpo" -c -o
     isymchoose.o isymchoose.c; \
             then mv -f ".deps/isymchoose.Tpo" ".deps/isymchoose.Po";
             else rm -f ".deps/isymchoose.Tpo"; exit 1; fi
     In file included from
     /home/bkerin/local/include/gtk-2.0/gtk/gtk.h:224,
                      from isymchoose.c:20:
     /home/bkerin/local/include/gtk-2.0/gtk/gtkitemfactory.h:47: warning:
     function declaration isn’t a prototype
     isymchoose.c:43: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
     ‘__attribute__’ before ‘now’
     make[1]: *** [isymchoose.o] Error 1
     make[1]: Leaving directory `/home/bkerin/projects/isymchoose'
     make: *** [all] Error 2

When I do :make while editing a file in the director containing that
Makefile,
I get this:

     :!make  | tee /tmp/v198942/0
     make  all-am
     make[1]: Entering directory `/home/bkerin/projects/isymchoose'
     if gcc -DHAVE_CONFIG_H -I. -I. -I.
     -DSCRIPTDIR='"/home/bkerin/local/share/isymchoose"'  -Wall -Wextra
     -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wpointe
     r-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wnested-externs
     -fno-common -I/home/bkerin/local/include/gtk-2.0
     -I/home/bkerin/local/lib/gtk-2.0/include -I/ho
     me/bkerin/local/include/atk-1.0 -I/home/bkerin/local/include/cairo
     -I/home/bkerin/local/include/pango-1.0
     -I/home/bkerin/local/include/glib-2.0 -I/home/bkerin/lo
     cal/lib/glib-2.0/include -I/home/bkerin/local/include/freetype2
     -I/home/bkerin/local/include -I/home/bkerin/local/include/pixman-1
     -I/usr/include/libpng12   -g -
     O2 -MT isymchoose.o -MD -MP -MF ".deps/isymchoose.Tpo" -c -o
     isymchoose.o isymchoose.c; \
             then mv -f ".deps/isymchoose.Tpo" ".deps/isymchoose.Po";
             else rm -f ".deps/isymchoose.Tpo"; exit 1; fi
     In file included from
     /home/bkerin/local/include/gtk-2.0/gtk/gtk.h:224,
                      from isymchoose.c:20:
     /home/bkerin/local/include/gtk-2.0/gtk/gtkitemfactory.h:47: warning:
     function declaration isn’t a prototype
     isymchoose.c:43: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
     ‘__attribute__’ before ‘now’
     make[1]: *** [isymchoose.o] Error 1
     make[1]: Leaving directory `/home/bkerin/projects/isymchoose'
     make: *** [all] Error 2
     (1 of 5): make  all-am
     :clist
      1: make  all-am
      2: make[1]: Entering directory `/home/bkerin/projects/isymchoose'
      3: if gcc -DHAVE_CONFIG_H -I. -I. -I.
      -DSCRIPTDIR='"/home/bkerin/local/share/isymchoose"'  -Wall -Wextra
      -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wpo
     inter-arith -Wcast-qual -Wcast-align -Wwrite-strings
     -Wnested-externs -fno-common -I/home/bkerin/local/include/gtk-2.0
     -I/home/bkerin/local/lib/gtk-2.0/include -
     I/home/bkerin/local/include/atk-1.0
     -I/home/bkerin/local/include/cairo
     -I/home/bkerin/local/include/pango-1.0
     -I/home/bkerin/local/include/glib-2.0 -I/home/bkeri
     n/local/lib/glib-2.0/include -I/home/bkerin/local/include/freetype2
     -I/home/bkerin/local/include -I/home/bkerin/local/include/pixman-1
     -I/usr/include/libpng12
     -g -O2 -MT isymchoose.o -MD -MP -MF ".deps/isymchoose.Tpo" -c -o
     isymchoose.o isymchoose.c; \
      4:         then mv -f ".deps/isymchoose.Tpo" ".deps/isymchoose.Po";
      else rm -f ".deps/isymchoose.Tpo"; exit 1; fi
      5: make[1]: Leaving directory `/home/bkerin/projects/isymchoose'

Note that the quicklist doesn't include the lines that have the actual
errors.
Also, :cnext doesn't ever take me to the actual error sites (line 43 in
this
case).

I have the defualt setting for errorformat.  I have tried ':compiler
gcc' but
it doesn't seem to make and difference.  Any ideas what might be going
on here?

Thanks,
Britton



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

#105717 From: Matt Wozniski <mjw@...>
Date: Fri Jul 10, 2009 12:34 am
Subject: Re: autosave
mjw@...
Send Email Send Email
 
On Wed, Jul 8, 2009 at 3:59 AM, Christian Brabandt wrote:
>
> Hi Robert!
>
> On Mi, 08 Jul 2009, Robert Mark Bram wrote:
>
>> From :help autosave:
>>
>>    *'autosave'* *'as'* *'noautosave'* *'noas'*
>>     'autosave' 'aw' number  (default 0)
>>           Automatically write the current buffer to file N seconds after
>> the
>>           last change has been made and when |'modified'| is still set.
>>           Default: 0 = do not autosave the buffer.
>>     Alternative: have 'autosave' use 'updatetime' and 'updatecount'
>> but make
>>     them save the file itself besides the swapfile.
>>
>> but :autosave 5 gives "Not an editor command"
>> and :set autosave 5 gives "Unknown option: autosave"
>>
>> What am I missing? :/
>
> It's in the todo list. That means, it is not yet implemented.

And, even if it were implemented, it would be an option, not a command
- you'd use

     :set autosave=5

and not

     :autosave 5

~Matt

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

#105716 From: Christian Brabandt <cblists@...>
Date: Thu Jul 9, 2009 8:17 pm
Subject: Re: check if only whitespaces before cursor in current line
cblists@...
Send Email Send Email
 
Hi TheLonelyStar!

On Do, 09 Jul 2009, TheLonelyStar wrote:

> > Please provide an exact example. Where is the cursor and what does
> > the line look like?
> >
> >
> Examples (| marsk the cursor):
>  let| x=getline('.')
>  |let ws=match(x, y)
>   | jde
>
> All these return -1

Sure, because there is just not any amount of space followed by the
line end.

I guess I misread your question. If you want to check, that there is
no space between line start and the cursor use something like this:

echo match(getline('.'), '^\s\{' . col('.') . '}')


regards,
Christian
--
:wq!

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

#105715 From: Tim Chase <vim@...>
Date: Thu Jul 9, 2009 7:59 pm
Subject: Re: Submatch question in a substitute
vim@...
Send Email Send Email
 
> When I execute this line
>
> :%s/\<[01]\+\>/\=Bin2Hex(submatch(0))/
>
> on this binary tabel
>
> 0000
> 0001
> [...]
> 1111
>
> it is all converted nicely to hexadecimal
>
> However, my binary numbers are prefixed with a % character.
>
> How to I change the substitute command above so that it works again?
> I tried
> :%s/\<%[01]\+\>/\=Bin2Hex(submatch(1))/
> But this one gives an pattern not found error
> And
> :%s/%\<[01]\+\>/\=Bin2Hex(submatch(1))/
> changes everything into zero.
> So I assume the submatch position is wrong

The \< won't match on the left of a "%" (unless the "%" is in
your 'isk' setting:  ":help 'isk' for more on that").  Move your
"%" to the other side of the "\<" and it should work.
Alternatively, since you've specified the context as requiring a
"%", you can just skip the "\<" altogether.

That takes care of the pattern-not-found problem.  However, then
the results of submatch(1) in the replacement now hold "%0001" or
whatever.  Vim tries to run this through your Bin2Hex, but
"%0001" isn't a a valid number for parsing, so it chokes.  I
noticed you also shifted from submatch(0) [the whole match] to
submatch(1) [something tagged with \(...\) for later
backreferencing].  The final solution could look something like

    :%s/%\([01]\+\)\>/\=Bin2Hex(submatch(1))

which captures the stuff after the "%" as submatch(1) but
replaces the whole thing with the output of Bin2Hex().

Hope this helps shed some light on what's going on, as well as
provide you with a solution.

-tim



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

#105714 From: Jeri Raye <jeri.raye@...>
Date: Thu Jul 9, 2009 7:35 pm
Subject: Submatch question in a substitute
jeri.raye@...
Send Email Send Email
 
Hi,

When I execute this line

:%s/\<[01]\+\>/\=Bin2Hex(submatch(0))/

on this binary tabel

0000
0001
[...]
1111

it is all converted nicely to hexadecimal

However, my binary numbers are prefixed with a % character.
So
%0000
%0001
[...]
%1111

How to I change the substitute command above so that it works again?
I tried
:%s/\<%[01]\+\>/\=Bin2Hex(submatch(1))/
But this one gives an pattern not found error

And
:%s/%\<[01]\+\>/\=Bin2Hex(submatch(1))/
changes everything into zero.
So I assume the submatch position is wrong


Here below the Bin2Hex function is described.
Note: Not developed by my but provided trough this fantastic mailing group
+-------------------------------------------------------------------------------\
-------------------------+
func! Bin2Hex(bin)
      let bin = matchstr(a:bin, '[01]\+')
      if bin == ""
          return "0"
      endif
      let bin = repeat("0", PadSize(strlen(bin), 4)). bin
      let runs = split(bin, '....\zs')
      call map(runs, 's:fourbd2hd(v:val)')
      return join(runs, '')
endfunc

" return the first run of hex digits in string {hex} converted into
" binary digits (a match at "0x" is skipped)
func! Hex2Bin(hex)
      let hex = matchstr(a:hex, '\%(0x\)\@!\x\+')
      if hex == ""
          return "0"
      endif
      return join(map(split(hex, '\m'), 's:hd2fourbd(v:val)'), '')
endfunc

" convert 4 bin digits (string) into 1 (lower case) hex digit
func! s:fourbd2hd(bd)
      let bd = a:bd
      return printf("%x", 8*bd[0] + 4*bd[1] + 2*bd[2] + bd[3])
endfunc

" convert 1 hex digit (string) into 4 bin digits
func! s:hd2fourbd(hd)
      let hd = eval("0x". a:hd)
      return (hd/8) . (hd/4%2) . (hd/2%2) . (hd%2)
endfunc

" calculate number of pad chars to make {len} a multiple of {chunksize}
func! PadSize(len, chunksize)
      return -1 + (a:chunksize - (a:len + a:chunksize - 1) % a:chunksize)
endfunc
" padsize := PadSize(len,chunksize) <=>
" 0 <= padsize < chunksize AND (len + padsize) mod chunksize = 0

" NOTE: must not use substitute() in the functions to avoid recursive
" submatch() when called from :s/.../\=.../
" substitute(bin,'[01]\{4}', '\=s:fourbd2hd(submatch(0))', 'g')
" substitute(a:hex, '\x', '\=s:hd2fourbd(submatch(0))', 'g')
+-------------------------------------------------------------------------------\
-------------------------+

Rgds,
Jeri

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

#105713 From: TheLonelyStar <nabble2@...>
Date: Thu Jul 9, 2009 7:18 pm
Subject: Re: check if only whitespaces before cursor in current line
nabble2@...
Send Email Send Email
 
>
> Please provide an exact example. Where is the cursor and what does the
> line look like?
>
>
Examples (| marsk the cursor):
	 let| x=getline('.')
	 |let ws=match(x, y)
   | jde

All these return -1
--
View this message in context:
http://www.nabble.com/check-if-only-whitespaces-before-cursor-in-current-line-tp\
24390733p24416087.html
Sent from the Vim - General mailing list archive at Nabble.com.


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

#105712 From: Jeri Raye <jeri.raye@...>
Date: Thu Jul 9, 2009 6:25 pm
Subject: Re: how to add only one space character before and after a ,
jeri.raye@...
Send Email Send Email
 
Tony Mechelynck wrote on 8-7-2009 18:47:
>> If a line contains a , this , should have only one space character and
>> also only one space character
>> after it. How do you do that?

[deleted]

> Are you sure?
>
> It is possible, but the usual typographical (and programming) convention
> is to have no space before a comma, and one space after it except at the
> end of a line or before another comma, closing quote etc.

[deleted]

Hi Tony,

I agree to the usual convention.
Only for this matter I need to tweak the code style to another kind of
style. And then I need to have the , between two spaces.
My vim-script relies on that.

Rgds,
Jeri

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

#105711 From: Christian Brabandt <cblists@...>
Date: Thu Jul 9, 2009 6:07 pm
Subject: Re: check if only whitespaces before cursor in current line
cblists@...
Send Email Send Email
 
Hi TheLonelyStar!

On Do, 09 Jul 2009, TheLonelyStar wrote:

> In my case it returns -1 ....
>
>
> it echos -1 no matter what I do.

Please provide an exact example. Where is the cursor and what does the
line look like?

> And I also do not get it to work typing for
> Example:
> :echo ws=match(x,y)
:echo match(x,y)

regards,
Christian
--
:wq!

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

#105710 From: TheLonelyStar <nabble2@...>
Date: Thu Jul 9, 2009 5:58 pm
Subject: Re: check if only whitespaces before cursor in current line
nabble2@...
Send Email Send Email
 
In my case it returns -1 ....

Here is my complete function from .vimrc:

map <tab> :call TestComplete()<cr>

function TestComplete()
	 let x=getline('.')
	 let y='\%>' . col('.') . 'v\s\+$'
	 let ws=match(x, y)
	 echo ws
endfunction

it echos -1 no matter what I do. And I also do not get it to work typing for
Example:
:echo ws=match(x,y)
--
View this message in context:
http://www.nabble.com/check-if-only-whitespaces-before-cursor-in-current-line-tp\
24390733p24414975.html
Sent from the Vim - General mailing list archive at Nabble.com.


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

#105709 From: Christian Brabandt <cblists@...>
Date: Thu Jul 9, 2009 5:54 pm
Subject: Re: Checking if the current word is spelled wrong and correct it in script
cblists@...
Send Email Send Email
 
Hi TheLonelyStar!

On Do, 09 Jul 2009, TheLonelyStar wrote:

> I have a my tab key mapped to a function which should react
> different depending on the situation

> 1. If I am in a comment, the current word is completet from dictonary
> 2. If I am in code, curstom completions is called (elim sits behind it here)
> Now I want a third thing:
> 3. If I am in a comment and the current word is misspelled, spell correct
> it.
>
> The function works for the first 2 things, but the last thing I do not know
> how to do:
> This is the function:
>

I have never used spellbadword() but this works for me:

fu! Spell()
      let badword = spellbadword(expand("<cword>"))
      if badword == [ '', '']
               echo "Current word is good"
      else
          echo "Found: " . badword[0] . " Type: " . badword[1]
      endif
endfu

Hope that helps.

regards,
Christian
--
:wq!

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

#105708 From: Brett Stahlman <brettstahlman@...>
Date: Thu Jul 9, 2009 5:48 pm
Subject: Re: Text formatting tools
brettstahlman@...
Send Email Send Email
 
On Jul 9, 6:40 am, Stahlman Family <brettstahl...@...> wrote:
> Carsten Agger wrote:
> > I've been using vim to write articles and recently started using it for
> > a book as well.
>
...snip...

>
> Carsten,
> It doesn't do table of contents or chapter/section headings, but the
> Txtfmt plugin provides bold, underline, italic (and if you enable the
> option, standout, reverse and undercurl) attributes, as well as 8
> configurable foreground text colors. I'm about to release version 2.0,
> which will additionally support up to 8 configurable background colors.
> I noticed that another user mentioned OTL (TVO - The Vim Outliner)...
> Txtfmt highlighting regions can be nested inside other regions with the
> appropriate option setting, so you could, for example, create Txtfmt
> highlighting regions within TVO's indentation regions.
>
> http://www.vim.org/scripts/script.php?script_id=2208

I may not have made it clear in my original post, but Txtfmt permits
not just bold, underline, italic, etc..., but also all the
permutations thereof. So, for example, you could create a red, bold-
underline-italic region. Also, one of the things that distinguishes
Txtmft from a traditional markup language is that it is WYSIWYG: i.e.,
you see the text highlighted the way you want it as you type it within
Vim, and you don't see the markup tokens. Txtfmt version 2.0 (soon to
be released) can be made to be even more WYSIWIG, as it can use Vince
Negri's "conceal" patch (when it's applied) to conceal the
highlighting tokens completely. (Currently, Txtfmt simply makes each
highlighting token appear as a single space, which is fine for most
applications, but is less than optimal when you want to put several
tokens back to back (e.g., a red fg color token followed by a bold-
underline-italic format token).

Brett S.

...snip...

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

#105707 From: Christian Brabandt <cblists@...>
Date: Thu Jul 9, 2009 5:32 pm
Subject: Re: check if only whitespaces before cursor in current line
cblists@...
Send Email Send Email
 
Hi TheLonelyStar!

On Do, 09 Jul 2009, TheLonelyStar wrote:

> It just does not work, if I do
>
> let x=getline('.')
> let y='\%>' . col('.') . 'v\s\+$'
> let ws=match(x, y)
> echo ws
>

Let's take this line (| denotes the place where the cursor is, _
stands for Spaces):

Here is some whitespace|_________

If I do
:echo ws=match(x,y) it returns 24.


regards,
Christian
--
:wq!

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

#105706 From: TheLonelyStar <nabble2@...>
Date: Thu Jul 9, 2009 5:21 pm
Subject: Re: check if only whitespaces before cursor in current line
nabble2@...
Send Email Send Email
 
Hi,

It just does not work, if I do

let x=getline('.')
let y='\%>' . col('.') . 'v\s\+$'
let ws=match(x, y)
echo ws

The result is always "-1", now matter of whitespaces before cursor or not.
So, the '\%>' . col('.') . 'v' matches everything after cursor and \s\+
should match the whitespaces.
I think I understand ... but it does not work :(
--
View this message in context:
http://www.nabble.com/check-if-only-whitespaces-before-cursor-in-current-line-tp\
24390733p24414449.html
Sent from the Vim - General mailing list archive at Nabble.com.


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

#105705 From: Dennis Benzinger <Dennis.Benzinger@...>
Date: Thu Jul 9, 2009 4:24 pm
Subject: Re: check if only whitespaces before cursor in current line
Dennis.Benzinger@...
Send Email Send Email
 
Am 09.07.2009 17:44, TheLonelyStar schrieb:
>
>
>
> Christian Brabandt-3 wrote:
>>
>>
>> something like this maybe?
>> let x=getline('.')
>> let y='\%>' . col('.') . 'v\s\+$'
>> let ws=match(x, y)
>>
>>
>
> Hi,
>
> Sorry, if this is getting a stupid question. I searched the documentation,
> but I can not find another definition for "match" than higlighting in the
> current buffer.
> [...]

:help match()


Regards,
Dennis Benzinger

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

#105704 From: Xavier de Gaye <xdegaye@...>
Date: Thu Jul 9, 2009 4:19 pm
Subject: Re: Text formatting tools
xdegaye@...
Send Email Send Email
 
On Thu, Jul 9, 2009 at 11:17 AM, Carsten Agger wrote:
> ...
> This script allows simple formatting like *italics* and _underline_, but
> I'd like something a but more "shiny", which would e.g. also recognize
> chapter and section headings and maybe even generate a TOC.
>
> Does anybody have any recommendations? There's txt2tags, which I just
> found (http://txt2tags.sourceforge.net/writing-book.html), and I suppose
> one could write something similar to easily convert a text file to a
> LaTex file, but as I said - do anyone have any experience using such
> tools?


You may want to have a look at docutils, http://docutils.sourceforge.net/

"Docutils is an open-source text processing system for processing
plaintext documentation into useful formats, such as HTML or LaTeX. It
includes reStructuredText, the easy to read, easy to use,
what-you-see-is-what-you-get plaintext markup language."

reStructuredText handles TOC, headings, lists, tables. The markup
is such that the original text can be easily read as a plain text.

reStructuredText is used for the Python documentation.

I am using docutils and reStructuredText in a moinmoin wiki and find
it very useful.


Xavier

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

#105703 From: TheLonelyStar <nabble2@...>
Date: Thu Jul 9, 2009 3:44 pm
Subject: Re: check if only whitespaces before cursor in current line
nabble2@...
Send Email Send Email
 
Christian Brabandt-3 wrote:
>
>
> something like this maybe?
> let x=getline('.')
> let y='\%>' . col('.') . 'v\s\+$'
> let ws=match(x, y)
>
>

Hi,

Sorry, if this is getting a stupid question. I searched the documentation,
but I can not find another definition for "match" than higlighting in the
current buffer.

I mean, I need something like this:
if "only_whitespaces_before_cursor" then
    do_something
else
   do_something_else
endif

Thanks!
Nathan
--
View this message in context:
http://www.nabble.com/check-if-only-whitespaces-before-cursor-in-current-line-tp\
24390733p24412419.html
Sent from the Vim - General mailing list archive at Nabble.com.


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

#105702 From: "Christian Brabandt" <cblists@...>
Date: Thu Jul 9, 2009 2:24 pm
Subject: Re: check if only whitespaces before cursor in current line
cblists@...
Send Email Send Email
 
On Thu, July 9, 2009 3:39 pm, TheLonelyStar wrote:
>
>
> Can no pne help we with this?
> I can get the current line:
>
> let x=line(".")
>
> But how do I check if there are only whitespaces before cursor?

something like this maybe?
let x=getline('.')
let y='\%>' . col('.') . 'v\s\+$'
let ws=match(x, y)


regards,
Christian


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

#105701 From: TheLonelyStar <nabble2@...>
Date: Thu Jul 9, 2009 2:12 pm
Subject: Checking if the current word is spelled wrong and correct it in script
nabble2@...
Send Email Send Email
 
Hi,

I have a my tab key mapped to a function which should react different
depending on the situation
1. If I am in a comment, the current word is completet from dictonary
2. If I am in code, curstom completions is called (elim sits behind it here)
Now I want a third thing:
3. If I am in a comment and the current word is misspelled, spell correct
it.

The function works for the first 2 things, but the last thing I do not know
how to do:
This is the function:

function TabDo()
   let col = col('.') == col('$') ? col('.') - 1 : col('.')
   let syntax = synIDattr(synID(line('.'), col, 1), "name")
   if syntax =~ 'Comment' || syntax =~ 'String'
"   let badword = spellbadword()
"   if badword =~ ''
		   return "\<c-x>\<c-k>"
"   endif
"   return 'z='
   endif
   return "\<c-x>\<c-u>"
endfunction

The commented part are my tries for adding the extra option. What am I doing
wrong?

Thanks!
Nathan
--
View this message in context:
http://www.nabble.com/Checking-if-the-current-word-is-spelled-wrong-and-correct-\
it-in-script-tp24410540p24410540.html
Sent from the Vim - General mailing list archive at Nabble.com.


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

#105700 From: TheLonelyStar <nabble2@...>
Date: Thu Jul 9, 2009 2:08 pm
Subject: Re: changing spelling error highlight
nabble2@...
Send Email Send Email
 
Hi,

Thanks for the colorsheme. I tried it and after a few days, I discovered
that plain underlining is not enough for me!
So I tried this:
if version >= 700
   hi SpellBad   guisp=red    gui=undercurl guifg=NONE guibg=NONE ctermfg=red
ctermbg=NONE term=underline cterm=underline
   hi SpellCap   guisp=yellow gui=undercurl guifg=NONE guibg=NONE
ctermfg=yellow ctermbg=NONE term=underline cterm=underline
   hi SpellRare  guisp=blue   gui=undercurl guifg=NONE guibg=NONE
ctermfg=yellow ctermbg=NONE term=underline cterm=underline
   hi SpellLocal guisp=orange gui=undercurl guifg=NONE guibg=NONE
ctermfg=yellow ctermbg=NONE term=underline cterm=underline

(I also change the  fg color).
Works fine, but when current line highlighting is on:
setlocal cursorline

Spelling mistakes in the current line do not have a different color ...

How can I fix this?
Thanks!

Nathan
--
View this message in context:
http://www.nabble.com/changing-spelling-error-highlight-tp24391160p24410512.html
Sent from the Vim - General mailing list archive at Nabble.com.


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

#105699 From: Carsten Agger <agger@...>
Date: Thu Jul 9, 2009 1:45 pm
Subject: Re: Text formatting tools
agger@...
Send Email Send Email
 
On Thu, 2009-07-09 at 15:21 +0200, J.A.J. Pater wrote:
> Carsten Agger wrote:
> > ...snip...
> >
> > > This script allows simple formatting like *italics* and _underline_, but
> > > I'd like something a but more "shiny", which would e.g. also recognize
> > > chapter and section headings and maybe even generate a TOC.
> > >
> You could try (multi) markdown (extended):
> http://en.wikipedia.org/wiki/Markdown
>
> Relatively simple syntax (I use it, though I don't really like the
> syntax) and convertible to a lot of formats (pdf, html, rtf, latex)
> with pandoc:
> http://johnmacfarlane.net/pandoc/
>
> See http://en.wikipedia.org/wiki/Category:Lightweight_markup_languages
> for an overview of lightweight markup languages.
> See http://sange.fi/~atehwa/cgi-bin/piki.cgi/stx2any for some
> discussion.

Thanks for all the tips - I'll check all of your suggestions out! It
seems there are quite a few ways of doing this. :-)



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

#105698 From: Sapfeer <sapfeer@...>
Date: Thu Jul 9, 2009 1:41 pm
Subject: Re: How to change the color of cursor line in terminal session
sapfeer@...
Send Email Send Email
 
I've already done it! Thanks a lot!

On 7/9/09, bill lam <cbill.lam@...> wrote:
>
> you may add these 2 lines in ~/.vimrc,
>
> set cursorline
> hi CursorLine ctermbg=lightblue guibg=lightblue
>
> --
> regards,
> ====================================================
> GPG key 1024D/4434BAB3 2008-08-24
> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
>
> >
>

--
Sent from my mobile device

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

#105697 From: TheLonelyStar <nabble2@...>
Date: Thu Jul 9, 2009 1:39 pm
Subject: Re: check if only whitespaces before cursor in current line
nabble2@...
Send Email Send Email
 
Can no pne help we with this?
I can get the current line:

let x=line(".")

But how do I check if there are only whitespaces before cursor?

Thanks!
Nathan


TheLonelyStar wrote:
>
> Hi.
>
> I want to bind "tab" to autocompletion in python mode.
> But when I am on a line, where there are only are whitespaces in front of
> the cursor, autocompletion does not make sense.
> Can I somehow detect this situation and insert an "tab" in that case?
>
> Thanks!
> Nathan
>

--
View this message in context:
http://www.nabble.com/check-if-only-whitespaces-before-cursor-in-current-line-tp\
24390733p24410328.html
Sent from the Vim - General mailing list archive at Nabble.com.


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

#105696 From: bill lam <cbill.lam@...>
Date: Thu Jul 9, 2009 1:36 pm
Subject: Re: How to change the color of cursor line in terminal session
cbill.lam@...
Send Email Send Email
 
you may add these 2 lines in ~/.vimrc,

set cursorline
hi CursorLine ctermbg=lightblue guibg=lightblue

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3

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

#105695 From: "J.A.J. Pater" <jajpater@...>
Date: Thu Jul 9, 2009 1:21 pm
Subject: Re: Text formatting tools
jajpater@...
Send Email Send Email
 
Carsten Agger wrote:
...snip...
This script allows simple formatting like *italics* and _underline_, but
I'd like something a but more "shiny", which would e.g. also recognize
chapter and section headings and maybe even generate a TOC.
You could try (multi) markdown (extended): http://en.wikipedia.org/wiki/Markdown

Relatively simple syntax (I use it, though I don't really like the syntax) and convertible to a lot of formats (pdf, html, rtf, latex) with pandoc:
http://johnmacfarlane.net/pandoc/

See http://en.wikipedia.org/wiki/Category:Lightweight_markup_languages for an overview of lightweight markup languages.
See http://sange.fi/~atehwa/cgi-bin/piki.cgi/stx2any for some discussion.

Hope this helps.

Adriaan


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


#105694 From: Dennis Benzinger <Dennis.Benzinger@...>
Date: Thu Jul 9, 2009 1:06 pm
Subject: Re: How to change the color of cursor line in terminal session
Dennis.Benzinger@...
Send Email Send Email
 
Am 09.07.2009 14:51, Sapfeer schrieb:
> Is it possible?.. I've tried to use :hi CursorLine gui* commands, but
> they don't work... As I suppose, this group is for use in GUI only
> [...]

Yes, the gui* groups are for the GUI only. You need to set the ctermbg
group. For example:

hi CursorLine ctermbg=lightblue


HTH,
Dennis Benzinger

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

#105693 From: Sapfeer <sapfeer@...>
Date: Thu Jul 9, 2009 12:51 pm
Subject: How to change the color of cursor line in terminal session
sapfeer@...
Send Email Send Email
 
Is it possible?.. I've tried to use :hi CursorLine gui* commands, but
they don't work... As I suppose, this group is for use in GUI only

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

#105692 From: "A. S. Budden" <abudden@...>
Date: Thu Jul 9, 2009 12:48 pm
Subject: Re: exit
abudden@...
Send Email Send Email
 
2009/7/9 SamPeng <sampeng87@...>:
> how to exit this group?
>
>
Follow the link at the bottom of your email and read the instructions there.

Al

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

Messages 105692 - 105721 of 110441   Newest  |  < Newer  |  Older >  |  Oldest
Advanced
Add to My Yahoo!      XML What's This?

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help