Thursday, September 3, 2009

using Unix 'whoami' to build a temp file location

Is there a way to set a temp and backup location for users using a
global vimrc like:

my name is "rlhicks"

when loading vim it checks to see if the following are there:

/tmp/rlhicks/backup
/tmp/rlhicks/temp

If they are it uses them...if they aren't it creates them an uses
them.

If doing something in home would work:

/home/rhicks/.vim/backup
/home/rhicks/.vim/tmp

I am sure I can use a shell script to check and create the directories
but wondering if I can do it all from the vimrc.

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

RE: how to re-use the pattern matched in parenthes

>Here \1 is used in substitute command. Is there a way I use \1 other
>than in substitute command?

Like what?

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

Re: how to re-use the pattern matched in parenthes

> Use (untested, but should work)
>
>         :g/\(abc(\)\(\d*\)\().*\)/s//\1\2\3\r\2
>
> and salt/pepper to taste.
>
> Ie, split the "abc" line into 3 parts:  prefix, number, and suffix.  Put
> back the original 3 parts, add a return, and add the number.

Impressive solution

Here \1 is used in substitute command. Is there a way I use \1 other
than in substitute command?

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

RE: how to re-use the pattern matched in parenthes

>abc(123);
>xyz

[to]

>abc(123);
>123
>xyz

Use (untested, but should work)

:g/\(abc(\)\(\d*\)\().*\)/s//\1\2\3\r\2

and salt/pepper to taste.

Ie, split the "abc" line into 3 parts: prefix, number, and suffix. Put
back the original 3 parts, add a return, and add the number.

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

Re: au_exists bug, was Re: Test Existence of Autocommand?

On Thu, Sep 3, 2009 at 6:13 AM, Bram Moolenaar<Bram@moolenaar.net> wrote:

>> Here's a probably better patch, and a test case to show the behavior I
>> expect from exists() with respect to autocommands:
>
> Thanks for the patch and testcase script.  Would you be able to turn the
> script into a test for src/testdir?  That will greatly help avoid
> regressions.

Sure, something like the following?

diff --git a/src/testdir/Makefile b/src/testdir/Makefile
index 50386ec..8f9fd13 100644
--- a/src/testdir/Makefile
+++ b/src/testdir/Makefile
@@ -22,7 +22,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out
test5.out test6.out \
test48.out test49.out test51.out test52.out test53.out \
test54.out test55.out test56.out test57.out test58.out \
test59.out test60.out test61.out test62.out test63.out \
- test64.out test65.out test66.out
+ test64.out test65.out test66.out test67.out

SCRIPTS_GUI = test16.out

diff --git a/src/testdir/test67.in b/src/testdir/test67.in
new file mode 100644
index 0000000..46221ea
--- /dev/null
+++ b/src/testdir/test67.in
@@ -0,0 +1,32 @@
+Test that groups and patterns are tested correctly when calling
exists() for autocommands.
+
+STARTTEST
+:so small.vim
+:let results=[]
+:augroup auexists
+:augroup END
+:call add(results, exists('##BufEnter'))
+:call add(results, exists("#BufEnter"))
+:au BufEnter * let g:entered=1
+:call add(results, exists("#BufEnter"))
+:call add(results, exists("#auexists#BufEnter"))
+:augroup auexists
+:au BufEnter * let g:entered=1
+:augroup END
+:call add(results, exists("#auexists#BufEnter"))
+:call add(results, exists("#BufEnter#*.test"))
+:au BufEnter *.test let g:entered=1
+:call add(results, exists("#BufEnter#*.test"))
+:edit testfile.test
+:call add(results, exists("#BufEnter#<buffer>"))
+:au BufEnter <buffer> let g:entered=1
+:call add(results, exists("#BufEnter#<buffer>"))
+:edit testfile2.test
+:call add(results, exists("#BufEnter#<buffer>"))
+:e test.out
+:call append(0, results)
+:$d
+:w
+:qa!
+ENDTEST
+
diff --git a/src/testdir/test67.ok b/src/testdir/test67.ok
new file mode 100644
index 0000000..61e9344
--- /dev/null
+++ b/src/testdir/test67.ok
@@ -0,0 +1,10 @@
+1
+0
+1
+0
+1
+0
+1
+0
+1
+0

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

Re: Function name in status bar

On 2009-09-03, Salvatore Benedetto wrote:
> Any other way beside taglist plugin?
>
> Because I don't use it, I just use ctags and cscope, which
> should be the equivalent to taglist if I understood correctly
> the plugin after a quick read.

There is this one, which I use.

ctags.vim : Display function name in the title bar and/or the status line
http://vim.sourceforge.net/scripts/script.php?script_id=610

Regards,
Gary

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

Re: T{char}

Hi, Ben.

>
> Hmm, very strange.
>
> What version of Vim are your running? What OS?

The output of ':version'.

VIM 7.2 (2008 Aug 9 compiled Jul 15 2009 10:23:03)
MS-Windows 32-bit GUI version with OLE support
Included patches: 1-234

> Does T work when your launch vim as
>
> vim -N -u NONE
>
> ?

Nope. But it does a bell.

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

Re: problem mapping

On Thu, Sep 03, 2009 at 04:28:54AM +0200, Tony Mechelynck wrote:
>
> On 25/08/09 19:40, CHEN Cheng wrote:
> >
> > Hi folks,
> >
> > When I map<M-b>, a character "â" shows up, instead of the expected rhs.
> > But, if I map ^]b directly, everything works, which is very interesting.
> >
> > What I did:
> > 1. vim
> > 2. :set<M-b>=^[b
> > 3. :imap<M-b> YYYY
> > 4. i, goto insert mode
> > 5. press<M-b>, nothing happened on the screen
> > 6. press<M-b>, still nothing
> > 7. press<M-b>, character "â" was inserted
> >
> > What I expected:
> > A sequence of YYYY was inserted
> >
> > Workaround:
> > 1. vim
> > 2. :imap ^[b YYYY
> > 3. i, goto insert mode
> > 4. press<M-b>, a sequence of YYYY was inserted
> >
> > Reproduce: everytime
> > 1. Vim 7.1.242
> > 1.1 set esckeys
> > 2. Linux, Fedora Core 7
> > 2.1 Virtual Terminal, TERM=linux
> > 2.2 setmetamode esc
> >
> > It seems vim treats assigned<M-b> and ^]b differently, but actually
> > <M-b> has the value of ^]b. Is it a contradiction?
> >
> > Note: ^]b is a sequence of escape and letter "b".
> >
> >
> > Thanks in advance,
> > Cheng
>

Hi Tony, thanks for your response.

> - See ":help :map-alt-keys"
>
> - Since, to Vim, [key + 0x80] is equivalent to [Meta+key], Alt-b (where
> b is 0x62) will be stored in mappings as 0xE2, i.e., â (small Latin a
> with circumflex).
>
> - I don't think 'esckeys' applies to <M-...> (but I could be wrong).
>
> - IIUC, your "setmetamode esc" is the culprit. Try
>
> setmetamode bit
>

I tried 'bit' but failed. Please see the test record I made below:

|-------------------+------------+-----+-----+-----------+-----+-----|
| terminal / config | SendEscape | | | 8bit_meta | | |
|-------------------+------------+-----+-----+-----------+-----+-----|
| vim mapping | <M-b> | ^]b | cat | <M-b> | ^]b | cat |
| and cat test | | | | | | |
|===================+============+=====+=====+===========+=====+=====|
| xterm $TERM=xterm | â | ok | ^]b | ok | â | â |
|-------------------+------------+-----+-----+-----------+-----+-----|
| gnome-terminal | | | | no 8bit |
| $TERM=xterm | â | ok | ^]b | mode |
|-------------------+------------+-----+-----+-----------+-----+-----|
| Linux virtual | | | | | | |
| terminal (VT) | â | ok | ^]b | â | â | â |
|-------------------+------------+-----+-----+-----------+-----+-----|
| putty | | | | |
| $TERM=xterm | â | ok | ^]b | no test |
|-------------------+------------+-----+-----+-----------+-----+-----|
Note: the listed terminals are configured into two modes, escape meta
mode and 8bit meta mode, respectively. For each mode, the output
after pressing Alt-b is shown in three settings:
<M-b> :set <M-b>=^]b before :imap <M-b> ok
^]b :imap ^]b YYYY directly
cat not in vim, but in stdin, which is provided by
executing 'cat' in the shell
Note: the tests are done in `LANG=en_US.UTF-8 vim`.

As you see, in 8bit mode (linux console), "â" is what I always get.

> instead. Vim "ought" to recognise this with no problem; however, when I
> do that on a Linux terminal here, Vim requires pressing the key between
> three and five times (i.e., press Alt, hit aaa, release Alt; or press
> Alt, hit zzzzz, release Alt) before it notices that I've done anything.
>
> With "setmetamode esc", Vim sees the Esc+something immediately, but as
> Esc followed by something else, not as an Alt-key combo. In Insert mode
> I get nothing, or maybe a beep, etc., depending on which key was used
> with Alt; and if prefixed by Ctrl-V I see ^[a ^[b ^[c etc. instead of á
> â ã (a-acute a-circumflex a-tilde) which are correct for Alt-a Alt-b
> Alt-c respectively.
>
> I don't know why you saw â and not YYYY when hitting Alt-b repeatedly
> after doing
>
> :set <M-b>=^[b
> :imap <M-b> YYYY
>
> where ^[ is entered by hitting Ctrl-V followed by Esc, or (alternately)
> ^[b by hitting Ctrl-V followed by Alt-b. When I do it (in that order,
> and when Vim was started in a linux console on /dev/tty3 just after
> using "setmetamode esc"), I see YYYY. (I'm using a "Huge" Vim 7.2.245 on
> openSUSE Linux 11.1.) For me (where it works) it wouldn't be practical
> since it would mean using twice as many "set" statements as there are
> "printable" keys on my keyboard -- one for each unshifted meta+key and
> one for each shifted meta+key.
>

Aha, your experiment made me blame the difference between your box
and mine. Suddenly, an idea came out, which asked me to check $LANG.

I did:
$ LANG=C vim
Guess what? I reproduced your experiment. I also see YYYY!!!

But, when I:
$ echo $LANG
en_US.UTF-8
$ vim
Oops, "â" came out as before.

So, for vim, the problem might be utf8 support conflicting with
meta key handling.

Since I use the Chinese language, I can't set encoding to latin1, which
turns Chinese characters into a mess.

I think I'd better live with escape meta key mode, because gnome-terminal
supports Chinese well, but it doesn't support 8bit meta key mode.


Best regards,
Cheng


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

Re: vimdiff export to html

> I couldn't determine if this was discussed before by searching. I want
> to export the current vimdiff to html, but 2html.vim only exports on
> window at a time. Is there a plugin or a trick to come up with both
> the windows participating in the diff?

I also expecting this function.
Then I can export html and share to other one see the different without vim.


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

au_exists bug, was Re: Test Existence of Autocommand?

Bob Hiestand wrote:

> On Tue, Aug 25, 2009 at 11:38 AM, Ben Fritz<fritzophrenic@gmail.com> wrote:
> >> On Fri, Aug 14, 2009 at 6:38 PM, Edward Beach<beach9...@hotmail.com> wrote:
> >> > I'm trying to write a script that will toggle an autocommand on/off
> >> > and I'm looking for a function to return it's existence. I've found
> >> > the built-in exists function and from the help it gives me this:
> >> > #group#event autocommand defined for this group and event.
> >> > So from my command line I enter in the following
> >> > :aug TestGroup | aug END | echo exists("#TestGroup#BufWritePost")
> >> > and it comes back 1 -- but shouldn't it be 0 since I haven't created a
> >> > BufWritePost event and since
> >> > :au TestGroup
> >> > returns nothing?
> >>
> >> It looks like the #group#event code doesn't check for an autocommand
> >> for that event being defined *within* the group, just whether both the
> >> group and the autocommand exist. The #group#event#pattern does check
> >> for an autocommand defined within the specified group, though, so that
> >> may be helpful to you.
>
> > Since this is a patch for some VERY unexpected behavior, I'm cc'ing
> > vim_dev where such things are normally discussed.
> >
> > My opinion is that this is a bug, if it can be reliably reproduced. I
> > can't imagine any situation where the described behavior would be
> > helpful.
>
> Here's a probably better patch, and a test case to show the behavior I
> expect from exists() with respect to autocommands:

Thanks for the patch and testcase script. Would you be able to turn the
script into a test for src/testdir? That will greatly help avoid
regressions.

--
hundred-and-one symptoms of being an internet addict:
178. You look for an icon to double-click to open your bedroom window.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

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

encoding autodetection in MS Windows

Hello.
Is it possible to configure encoding autodetection for vim in MS
Windows? I can't find enca win32 binaries to configure it in usual way.

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

Function name in status bar

Any other way beside taglist plugin?

Because I don't use it, I just use ctags and cscope, which
should be the equivalent to taglist if I understood correctly
the plugin after a quick read.

Thannks to all for the replies.

Regards,
S.

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

Wednesday, September 2, 2009

Re: problem mapping

On 25/08/09 19:40, CHEN Cheng wrote:
>
> Hi folks,
>
> When I map<M-b>, a character "â" shows up, instead of the expected rhs.
> But, if I map ^]b directly, everything works, which is very interesting.
>
> What I did:
> 1. vim
> 2. :set<M-b>=^[b
> 3. :imap<M-b> YYYY
> 4. i, goto insert mode
> 5. press<M-b>, nothing happened on the screen
> 6. press<M-b>, still nothing
> 7. press<M-b>, character "â" was inserted
>
> What I expected:
> A sequence of YYYY was inserted
>
> Workaround:
> 1. vim
> 2. :imap ^[b YYYY
> 3. i, goto insert mode
> 4. press<M-b>, a sequence of YYYY was inserted
>
> Reproduce: everytime
> 1. Vim 7.1.242
> 1.1 set esckeys
> 2. Linux, Fedora Core 7
> 2.1 Virtual Terminal, TERM=linux
> 2.2 setmetamode esc
>
> It seems vim treats assigned<M-b> and ^]b differently, but actually
> <M-b> has the value of ^]b. Is it a contradiction?
>
> Note: ^]b is a sequence of escape and letter "b".
>
>
> Thanks in advance,
> Cheng

- See ":help :map-alt-keys"

- Since, to Vim, [key + 0x80] is equivalent to [Meta+key], Alt-b (where
b is 0x62) will be stored in mappings as 0xE2, i.e., â (small Latin a
with circumflex).

- I don't think 'esckeys' applies to <M-...> (but I could be wrong).

- IIUC, your "setmetamode esc" is the culprit. Try

setmetamode bit

instead. Vim "ought" to recognise this with no problem; however, when I
do that on a Linux terminal here, Vim requires pressing the key between
three and five times (i.e., press Alt, hit aaa, release Alt; or press
Alt, hit zzzzz, release Alt) before it notices that I've done anything.

With "setmetamode esc", Vim sees the Esc+something immediately, but as
Esc followed by something else, not as an Alt-key combo. In Insert mode
I get nothing, or maybe a beep, etc., depending on which key was used
with Alt; and if prefixed by Ctrl-V I see ^[a ^[b ^[c etc. instead of á
â ã (a-acute a-circumflex a-tilde) which are correct for Alt-a Alt-b
Alt-c respectively.

I don't know why you saw â and not YYYY when hitting Alt-b repeatedly
after doing

:set <M-b>=^[b
:imap <M-b> YYYY

where ^[ is entered by hitting Ctrl-V followed by Esc, or (alternately)
^[b by hitting Ctrl-V followed by Alt-b. When I do it (in that order,
and when Vim was started in a linux console on /dev/tty3 just after
using "setmetamode esc"), I see YYYY. (I'm using a "Huge" Vim 7.2.245 on
openSUSE Linux 11.1.) For me (where it works) it wouldn't be practical
since it would mean using twice as many "set" statements as there are
"printable" keys on my keyboard -- one for each unshifted meta+key and
one for each shifted meta+key.


Best regards,
Tony.
--
A hypothetical paradox:
What would happen in a battle between an Enterprise security
team, who always get killed soon after appearing, and a squad of
Imperial Stormtroopers, who can't hit the broad side of a planet?
-- Tom Galloway

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

vimdiff export to html

I couldn't determine if this was discussed before by searching. I want
to export the current vimdiff to html, but 2html.vim only exports on
window at a time. Is there a plugin or a trick to come up with both
the windows participating in the diff?

I was able to get a reasonable result by manually merging the body of
the two html files generated into an outer table, but I had an issue
the table wrapping some lines due to lack of width and take the files
out of sync. To workaround, I had to fix the table width's to be large
enough and avoid the wrap. I couldn't find a way to disable wrapping
all together or set automatically based on the longest lines, may be
this is one of those wacky javascript problems to solve. Here is the
template that I came up with (the background color here reflects my
current colorscheme).

<!--HTML template for side by side diff:-->

<html>
<head>
<title>diff</title>
<meta name="Generator" content="Vim/7.2">
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#333333" text="#ffffff"><font face="monospace">
<table border="1" width="1600">
<tr>
<td width="700" valign="top">
<!-- First file goes here -->
</td>
<td valign="top">
<!-- Second file goes here -->
</td>
</tr>
</table>
</font>
</body>
</html>

<!--
vim: ft=html
-->

It would be nice to automate this merge. If I end up doing this over
and over, I might cook up a macro/plugin but would love to get ideas
from here.

PS: Make sure you set g:html_whole_filler before running 2html.vim,
otherwise the columns won't sync up.

--
HTH,
Hari

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

Re: T{char}

>> In my VIM installation the f, F and t works fine. But the T motion doesn't.
>> I already searched for some plugin or ftplugin that possibly changed this
>> mapping. The ':map T' command shows nothing (more precisely "No mapping
>> found"). My question is, what is happening that this motion command is not
>> working? I normally use f, F and t a lot. T would be a blessing.
>>
>
> Hmm, very strange.
>
> What version of Vim are your running? What OS?
>
> Does T work when your launch vim as
>
> vim -N -u NONE

I suspect it will work fine with "-N -u NONE". I know that
":map" shows some mappings while ":map!" shows other mappings.
Perhaps check the output of ":map!" too to see if there's
something eating your T behavior.

Once you find which mapping is eating your T, you can use
something like

:verbose map! T
or
:verbose map T

to see where the weirdness originated.

Yes, I use f/F/t/T more times than I can count, almost never
using h/l to move left/right because I either use w/b/e to move
words at a time, or I use f/F/t/T to jump to the target character
I want.

-tim


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

Re: how to re-use the pattern matched in parenthes

On Sep 2, 1:31 pm, KKde <khekadestro...@gmail.com> wrote:
> Hi,
>
> How do I re-use the pattern matched in parentheses? Let say there are
> two lines as below.
>

:help /\1

(that's a "one" at the end if your font is crappy)
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Re: T{char}

On Sep 2, 1:36 pm, Alessandro Antonello <antonello....@gmail.com>
wrote:
> Hi, all.
>
> In my VIM installation the f,  F and  t works fine.  But the T motion doesn't.
> I already  searched for  some plugin  or ftplugin  that possibly  changed this
> mapping.  The  ':map T'  command shows  nothing  (more  precisely  "No mapping
> found").  My question is,  what  is happening that this motion  command is not
> working?  I normally use f, F and t a lot.  T would be a blessing.
>

Hmm, very strange.

What version of Vim are your running? What OS?

Does T work when your launch vim as

vim -N -u NONE

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

Re: :close question

Hi, Marc.

> I wonder how you manage to remember all those numbers..
> I usually don't close that many windows.

I had a complete environment set to do my work. I use 'Project' plugin and
'MiniBufExplorer'. So, I don't have to remember all that numbers. I simply
look above and see the numbers.

> If you want to maximize a window don't close the others, use c-w t (open
> the current in a new tab)..

As I said, I use MiniBufExplorer plugin, so I don't use the Vim or GVim tabs.

> And then I've remapped all those c-w h,j,k,l mappings to
> <m-s-k> <m-s-j> etc so that it's one hit to jump to another window.
> (use :windcmd to create this mapping)..

This is a good idea. I didn't think of that. I will see if is possible to do
something with ':wincmd' command.

Thanks a lot,
Alessandro

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

Re: :close question

Hei Alessandro,

I wonder how you manage to remember all those numbers..
I usually don't close that many windows.
If you want to maximize a window don't close the others, use c-w t (open
the current in a new tab)..

And then I've remapped all those c-w h,j,k,l mappings to
<m-s-k> <m-s-j> etc so that it's one hit to jump to another window.
(use :windcmd to create this mapping)..

So maybe don't even try to close windows but create the new working
space in a new tab ?

That's how I do work. Probably you can also write some vim scripts to
accomplish your task.

Marc W.

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

Re: When I enter !ls the vimrun.exe does not find /bin/tcsh

Thank you that solved everything.

Andy

On Aug 30, 4:12 am, Gary Johnson <garyj...@spocom.com> wrote:
> On 2009-08-29, chiefenne wrote:
> > When I enter !ls the vimrun.exe does not find /bin/tcsh
>
> > I use the Windows GUI version of vim (7.2).
> > I also run cygwin, I start the Windows vim version via cygwin with an
> > alias.
>
> > I cannot escape to the shell using e.g.:
>
> > :!ls
>
> > I always get something like:
>
> > /bin/tcsh -c "ls"
>
> > The system cannot find the specified path.
>
> > Seems that something in my environment, either Windows or cygwin is
> > wrong.
>
> Since you're running Cygwin, and since your shell is /bin/tcsh, your
> environment probably contains
>
>     SHELL=/bin/tcsh
>
> Per
>
>     :help startup
>
> Windows vim sees that value of SHELL and sets 'shell' accordingly,
> which it then uses whenever you execute a command that requires a
> shell, such as ":!ls".  However, non-Cygwin programs including
> Windows vim don't understand full Cygwin paths and don't see the /bin
> directory.
>
> There are probably several ways to solve this problem, but what I've
> done is to put these lines early in my .vimrc:
>
>     if has("win32") && $SHELL == "/bin/bash" && executable("C:/cygwin/bin/bash")
>         " Running in Cygwin.
>
>         if executable("C:/WINDOWS/system32/cmd.exe")
>             let $SHELL=''
>             set shell=C:\\WINDOWS\\system32\\cmd.exe
>                                         " Unlike other places in
>                                         " Vim, the 'shell' path must
>                                         " use backslashes.  I don't
>                                         " know why.
>         endif
>     endif
>
> You'll want to change my /bin/bash to /bin/tcsh.
>
> HTH,
> Gary
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

T{char}

Hi, all.

In my VIM installation the f, F and t works fine. But the T motion doesn't.
I already searched for some plugin or ftplugin that possibly changed this
mapping. The ':map T' command shows nothing (more precisely "No mapping
found"). My question is, what is happening that this motion command is not
working? I normally use f, F and t a lot. T would be a blessing.

Alessandro Antonello

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

how to re-use the pattern matched in parenthes

Hi,

How do I re-use the pattern matched in parentheses? Let say there are
two lines as below.

abc(123);
xyz
.
.
.
abc(245);
well;


I have to match lines with the pattern abc(.*) and also need to
capture the string in parentheses and then
create a new line below the matched line, the new line contains the
string matched in parentheses.

like below

abc(123);
123
xyz
.
.
abc(245)
245
well

How do I achieve this?

I have the below in this mind..but how do I go further?

:g/abc(\(.\+\))/normal o


I hope my question is clear.

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

:close question

Hi, all.

This is a simple question. Maybe I did not searched in the right place.
Well, if you use the following command:

:bd 5

You will 'delete a buffer' that it's number is 5.
The following command:

:bd 3 5 7 9

Will do the same for the buffers 3, 5, 7 and 9.
And more:

:1,4bd

Will delete from buffer 1 to 4.
Why the ':close' command does not have a similar functionality? See, I
use GVim usually with two or more buffers in "splitted" windows. I don't
want to change to another window just to close it. I want to close it from
else where. But the ':close' command does not accept a buffer number or
name. What can I do?

Regards,
Alessandro

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

Re: Remove everything up to and including a certain word

On 25/08/09 12:57, Bastiaan Wakkie wrote:
> If I am standing (not in insert mode) with my cursor on the beginning .
> i would just type:ct1Hello World

E492: Not an editor command: ct1Hello

IOW, :ct1Hello is not a valid ex-command

Without the colon, it would mean: remove everything on the same line
until but not including the first digit-one on the right of the cursor,
then replace what was removed with "Hello World" (with capitals, and
without quotes). Not at all what the OP wanted, namely, delete from the
top of the file up to and including the first occurrence of "hello
world" (in lowercase, or in any case if 'ignorecase' is set; and still
without quotes) anywhere in the file, not necessarily on the same line.


Also, please bottom-post next time.

Regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
119. You are reading a book and look for the scroll bar to get to
the next page.


>
> drlatex wrote:
>> Hello there vimmers,
>>
>> I was wondering if I could remove everything in a file up to AND including a
>> certain word within the file.
>>
>> Let's say I have something like ""
>>
>> And I want only 123 to remain.
>>
>> Is there a way to delete everything up to and including the string "hello
>> word" ??
>>
>> I know that this particular string only comes up once in the file.
>>
>> Thanks in advance!
>>
>
> >


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

Re: How to use vim tabs like other editors' tabs

On Sep 2, 5:53 am, Bu Rak <loku...@gmail.com> wrote:
> I want to use vim tabs like the ones in MiniBufferExplorer or other editor
> tabs (when a file opens, it will open in a new tab, when closes close the
> tab).
>

Why do you want this? Vim's tab pages are more like workspaces. They
can be much more powerful than the usual one-file-per-tab setup used
in other editors. There is nothing wrong with using tabs *mostly* in a
one-file-per-tab fashion (I do this myself), but trying to force Vim
to *always* work this way is bound to cause frustration and will only
serve to impose artificial limits anyway.

If you want to LAUNCH files in a new tab always, that isn't too hard
using the --remote-tab-silent or -p command-line switches, or using
the :tab drop command from within Vim. --remote-tab-silent and :tab
drop will even jump to the file without opening a new tab for it if it
is already open. But don't try to lock each tab so that they can only
ever have a single file in them, or lock Vim so that a given file can
only ever be open in a single tab page. You would lose out on tons of
useful things you can do with Vim if you ever succeed.

As for closing tabs, whenever you close the last window in a tab, the
tab already closes. If you have several windows open, there is
the :tabclose command to close the entire tab if desired.

> I try to use autocmds but no success at all (it will open tabs for files but
> there are some problems).
>
> My .vimrc related to these:
>
> autocmd BufNew * :tablast
> autocmd BufAdd * :tabnew <sfile>
>

I'm not even sure how these are SUPPOSED to work, and I'm not going to
try them out to guess at what is going wrong.

I'd suggest looking at vim.wikia.com/wiki/Category:Tabs for a tip or
two about one-tab-per-file ideas, as well as tips about how to use Vim
tab pages the right way.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Re: Language dependent mapping

Derek Wyatt wrote:
> On Wed, Sep 2, 2009 at 6:26 AM, Dmitry V. Krivenok
> <krivenok@orangesystem.ru <mailto:krivenok@orangesystem.ru>> wrote:
>
> I want to map insertion of such strings to some key (e.g. F8).
> However, I want this mapping to be language dependent.
> It should recognize type of file in the current buffer and insert
> appropriate string.
>
> Is it possible to implement such mapping in VIM?
> Are there ready-to-use solutions?
> What should I learn to implement such mapping from scratch?
>
>
> One way to do this is by using the filetype.
>
> Create two files, $VIM/ftplugin/cpp.vim and $VIM/ftplugin/perl.vim and
> put your mappings in there:
>
> in $VIM/ftplugin/cpp.vim
> nmap <buffer> <F8> 80i/<esc>
> imap <buffer> <F8> <esc>80i/<esc>
>
>
> $VIM/ftplugin/perl.vim
> nmap <buffer> <F8> 80i#<esc>
> imap <buffer> <F8> <esc>80i#<esc>

Thank you very much!
This solution works fine!

>
>
>
> >


--
Sincerely yours, Dmitry V. Krivenok
Orange System Co., Ltd.
Saint-Petersburg, Russia
work phone: +7 812 332-32-40
cellular phone: +7 921 576-70-91
e-mail: krivenok@orangesystem.ru
web: http://www.orangesystem.ru
skype: krivenok_dmitry
jabber: krivenok_dmitry@jabber.ru
icq: 242-526-443


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

How to use vim tabs like other editors' tabs

I want to use vim tabs like the ones in MiniBufferExplorer or other editor tabs (when a file opens, it will open in a new tab, when closes close the tab).

I try to use autocmds but no success at all (it will open tabs for files but there are some problems).

My .vimrc related to these:

autocmd BufNew * :tablast
autocmd BufAdd * :tabnew <sfile>

Any commets?

Burak


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

Re: Language dependent mapping

On Wed, Sep 2, 2009 at 6:26 AM, Dmitry V. Krivenok <krivenok@orangesystem.ru> wrote:
I want to map insertion of such strings to some key (e.g. F8).
However, I want this mapping to be language dependent.
It should recognize type of file in the current buffer and insert
appropriate string.

Is it possible to implement such mapping in VIM?
Are there ready-to-use solutions?
What should I learn to implement such mapping from scratch?

One way to do this is by using the filetype.

Create two files, $VIM/ftplugin/cpp.vim and $VIM/ftplugin/perl.vim and put your mappings in there:

in $VIM/ftplugin/cpp.vim
nmap <buffer> <F8> 80i/<esc>
imap <buffer> <F8> <esc>80i/<esc>


$VIM/ftplugin/perl.vim
nmap <buffer> <F8> 80i#<esc>
imap <buffer> <F8> <esc>80i#<esc>



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

Language dependent mapping

Hello!

To separate functions in C/C++ I use strings containing 80 "/" characters.
In perl scripts I use strings containing "#" to separate subroutines.

I want to map insertion of such strings to some key (e.g. F8).
However, I want this mapping to be language dependent.
It should recognize type of file in the current buffer and insert
appropriate string.

Is it possible to implement such mapping in VIM?
Are there ready-to-use solutions?
What should I learn to implement such mapping from scratch?

--
Sincerely yours, Dmitry V. Krivenok
Orange System Co., Ltd.
Saint-Petersburg, Russia
work phone: +7 812 332-32-40
cellular phone: +7 921 576-70-91
e-mail: krivenok@orangesystem.ru
web: http://www.orangesystem.ru
skype: krivenok_dmitry
jabber: krivenok_dmitry@jabber.ru
icq: 242-526-443


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

Re: goto line depending on exit code of filter

On Wed, 02 Sep 2009, Tony Mechelynck wrote:
> what about (untested)
>
> %!filter
> if v:shell_error
> undo
> endif
>
> ?
>
> If it doesn't work you can always do

Thanks Tony, it works.

--
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
-~----------~----~----~----~------~----~------~--~---

Re: Save through to remote server

2009/8/31 Ernest Obusek <ernest@willowfalls.net>:
> I'm trying to switch back to vim after years with jEdit, but I need to get a
> set of things working before I can use vim productively.  One thing I need
> is to make it so that when I save a file, it scp's it to a remote server.  I
> imagine a script could do this, but I have no idea how to hook that in to
> the save command.  How can this be done?

If you do not need a Windows solution, mount the remote filesystem
with sshfs or curlftpfs. You can then edit the files in whichever
editor you like and all changes will be propagated back to the remote
server.

--
Tomas

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

Tuesday, September 1, 2009

Re: Use terminal colors in GUI Vim?

Matt Wozniski wrote:

> Well, you can probably tell that I was bored today... but here's a
> port of the 16-color-terminal default colorscheme to gvim. Just
> change the block of colors (the "let" lines..) to match your
> terminal's colors (they're colors 0 through 15, in order, fwiw).
> Hopefully gmail doesn't wrap this on me... In fact, just in case it
> does, I've attached it as well - so there will be a plain text,
> archivable copy in the list archives and a not-horribly-wrapped copy
> in subscriber's inboxes. Sorry I can't disable wrapping ATM. :)

[..]

Thanks for the feedback.

Do not deride such efforts - and yours in particular. Stuff like that is
quite valuable in terms of introducing low-level vim users like myself
to vim scripting / customization.

An obvious limitation is that nobody is going to want to type in their
rrggbb's - even 16 of them.. And some folks have 256 colors terminals.

I plan to take a closer look at your port, tomorrow I hope.

:-)

Gen-Paul.


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

NERDTree question

Is there a way to have the NERDTree always show up by default for every tab?

Thanks,

Ernest


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

Re: changing what counts as a paragraph

Hi Tony,
( I don't know where to write "hi Tony" when bottom-post, jsut do it as before)
On Sun, Aug 30, 2009 at 5:16 PM, Tony Mechelynck <antoine.mechelynck@gmail.com> wrote:
("sic" because
I would have asked "why people hate bottom posting" or maybe "why people
hate to bottom-post": "people" is a plural except when "a people" is
used as an approximate synonym of "a nation".)
 
Sorry for my english, -_-!. And I like your bottom-post indeed.
I posted the "Why" mail for I saw too much top-post mailling lists, almost all except this one.
The "people" I meant are not all newbies, but they may be not old Usenet hands.
 
The reason most newbies use top-posting is, I believe, that the
braindead software they use makes top-posting easier. I'm not saying
that it _enforces_ top-posting, and, indeed, in most cases, when
composing a reply you can move your edit cursor to below the part to
which you want to reply, after removing irrelevant quoted text.
Many mailing-lists attach a long content of some info, usually the first one
of the subject. And some mail service providers also attach ads at the end the mail.
So others need to search for where is my post in the middle the mail, if I bottom post my reply.
Certainly, I should edit quoted part rather than directly bottom-post, but I don't want to edit
other's post.
 
When I received a mail with 10 top posted replies, I think, I should do as what they do.
IMHO, top or bottom, are just a convention, of someone or a list, and there are not two much
loftiness and sin. But I'll bottom-post here, and need to learn some confusing things about bottom posting.
 
 
One possible exception has been said to be some "Internet phone" servers
where the quoted text is added in front of the message by the server
_after_ you send the reply, where the quoted text is not included. If
such servers exist, IMO they are worse than braindead.
Yeah, when I wrote previous reply on my phone, I could seen none of original post. Any this one was written on desktop computer.
 
B.R.
Wayne

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

Re: ":setlocal spell" shows "SpellLocal" errors

On Aug 30, 1:38 pm, Matt Wozniski <m...@drexel.edu> wrote:
> On Sat, Aug 29, 2009 at 10:01 AM, AndyHancock wrote:
>
> > I'm using vim 7.1 from the cygwin 1.5.25 installation. I did:
>
> >   :set spelllang=en_us,us_ca
>
> > I got:
>
> >   Warning: Cannot find word list "us.latin1.spl" or "us.ascii.spl"
>
> Well, two points here - one, you should probably be using vim in UTF-8
> mode unless you have a really good reason not to, and b) in vim 7.1
> this would fail unless ~/.vim/spell/ already existed, so an mkdir
> might help.
>
> > Before getting the above error, Vim asked for permission to download
> > those files, but couldn't find them.  After the above error, local
> > spellings such as "neighbourhood" and "colour" are highlighted as
> > SpellLocal, meaning that it is the /wrong/ spelling for the selected
> > region.  I thought I was selecting the region with above command?
>
> If I set spelllang to "en_us", "colour" is highlighted with
> SpellLocal.  If I set it to "en_ca", "color" is highlighted with
> SpellLocal.  If I set it to "en_us,en_ca", neither "color" nor
> "colour" is highlighted as SpellLocal.

Hmm, I'll have to read up a bit more on UTF-8 mode and see if anything
I did in the past might have torpedoed that. I already have ~/.vim/
spell.

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

Re: goto line depending on exit code of filter

On 01/09/09 12:18, bill lam wrote:
>
> On Tue, 01 Sep 2009, Tony Mechelynck wrote:
>> external program generate the required number as a return code: IIRC,
>> return codes are limited to one byte, and those above 127 may have a
>> special meaning (generated by the OS maybe).
>
> Tony, you are correct. I don't why it seemed to work last time I
> tested.
>
> How can I store content of the current buffer and restore it in case
> of error? like the following pseudo code
>
> let tmp=%
> %!filter
> if v:xhell_error | set %=tmp | endif
>

what about (untested)

%!filter
if v:shell_error
undo
endif

?

If it doesn't work you can always do

w! /temp/file
%!filter
if v:shell_error
e! /temp/file
saveas #
endif

but it isn't very elegant.


Best regards,
Tony.
--
President Reagan has noted that there are too many economic pundits and
forecasters and has decided on an excess prophets tax.

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

Re: Suggest a vim task for a college workshop

On Tue, Aug 25, 2009 at 10:08 AM, Erik Falor<ewfalor@gmail.com> wrote:
> On Tue, Aug 25, 2009 at 09:25:51AM -0700, Ben Fritz wrote:
>> 1. Vim is a very powerful tool with plenty of advantages over other
>> tools.
>> 2. Vim is complex, but there are ways to learn how to use it
>> effectively.
>
> Most of my colleagues who use Vim at work do not use it to its full
> potential.  For instance, I haven't encountered a single one who was
> aware of text objects.  Most folks are content to learn only 10% of
> Vim's unique functionality.  I suspect that's true for most people who
> use any software.  But it's especially sad in the case of Vim since
> they really are missing out on a lot.

I have the same observation. Even those who say they are die-hard fans
don't really know much of Vim, but I guess they are really die-hard Vi
fans, not Vim, they simply switched over to Vim, but don't really want
to learn more. What is funny however is there are people who worked
for years on Vi on console and still don't know much of Vi. I guess
these are the folks who would have been satisfied working in windows
notepad like program, but just happened to begin their work in Vi.

My recommendation for beginners it to use plain Vi in console (or at
least Vim in 'compatible' mode on console) and concentrate on the core
Vi features before trying out the newer Vim features. This was my
learning path, though mine was natural shift with quite a few years of
time to play with Vi before I came across Vim.

--
HTH,
Hari

>
> I believe that any approach that emphasizes using Vim's help system
> will do them the greatest service in the long-term.  And if you teach
> them to effectively search and navigate the help system, it should
> also have the effect of getting them hooked.  You'll be showing them
> that:
>    1) Vim isn't really *that* hard because it comes with so much good
>       documentation.
>    2) Vim has an overwhelming number of features, but I can learn
>       about them at my own pace because I know where to look for
>       help.
>    3) Vim's normal-mode and ex-mode commands all adhere to
>       well-defined conventions with respect to addresses and motions.
>       Once I master that, it's just a matter of remembering the names
>       of some commands.  Oh, there is tab completion for the ex-mode
>       commands!  That means I really only need to memorize a few
>       normal mode commands!
>
>> Start them out with a pre-configured Vim with a lot of "bells and
>> whistles" such as syntax highlighting already enabled for them. Maybe
>> even install a snippet or skeleton plugin that pre-populates most of a
>> C program for them. TagList would not be out of the question.
>
> I would also show off Vim's insert-mode completion capabilities.  That
> is something that programmers coming from an IDE very much rely on.
>
>> 3. Vim's help tells you basically EVERYTHING you need to know about
>> the editor.
>>
>> This step is VERY important. Without knowledge of :help, Vim is
>> basically useless, and a new user will never get beyond basic editing.
>> If time permits, I would even demonstrate CTRL-D with a :help topic,
>> and :helpgrep.
>
> Please make time to show this aspect of the help system off.  I also
> encourage you to point out that they can use Ctrl-] and Ctrl-T to
> navigate via helptags.
>
> The :options command along with :mkvimrc would be a good thing to
> throw into a hand-out.  Vim is very, very configurable.  These
> commands are a good way to explore all of those settings.
>
> In addition to the great resources Ben Fritz pointed to, you can also
> direct new users to #vim on irc.freenode.net.
>
> --
> Erik Falor
> Registered Linux User #445632 http://counter.li.org
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkqUGpoACgkQpMTu6iYtwselPwCffq28KFLp1vQQLiXmi9du00S4
> xp4An2yfOofSYFo7cMwrVHkBLZPXFDVp
> =ri5h
> -----END PGP SIGNATURE-----
>
>

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

Re: goto line depending on exit code of filter

On Tue, Sep 1, 2009 at 2:55 AM, Tony Mechelynck wrote:
>
> Vim can jump to any line that it can count, the problem is having your
> external program generate the required number as a return code: IIRC,
> return codes are limited to one byte, and those above 127 may have a
> special meaning (generated by the OS maybe).

Depends on the OS, but on Unix...

Return codes are limited to one byte

Applications are free to return any number in that range, none of them
are "special", but...

The operating system often uses return codes between 128 and 255 to
indicate death by signal. The solaris machine I'm sitting in front of
uses 128 + (signal number) when an app dies of a signal, and Linux
uses the same. I could swear that an older version of solaris used
256 - (signal number), but I can't confirm that at the moment, so
don't quote me on that.

The 127 return code from bash isn't OS-level special, it's just a
convenience thing that bash does to make it easier to guess when a
script failed because it couldn't find a command.

~Matt

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

Re: Use terminal colors in GUI Vim?

On Tue, Sep 1, 2009 at 10:31 AM, Nathan Neff wrote:
>
> On Mon, Aug 31, 2009 at 8:19 PM, Patrick Gen-Paul wrote:
>> I used ":hi + copy/paste" to create a color scheme that reflects my
>> xterm's default colors.
>>
>> Pleas find attached the color scheme file I created manually via
>> copy/paste and a few substitutions + the relevant stanza of my
>> .Xdefaults file so all you need to do is replace my terminal color
>> definitions by yours.
>
> Thanks Glen -- I tried your colorscheme, and it looks a lot like mine.
>
> I'll go through the colors 1 by 1 when I have time -- in the meantime, I'll
> use your colorscheme :-)

Well, you can probably tell that I was bored today... but here's a
port of the 16-color-terminal default colorscheme to gvim. Just
change the block of colors (the "let" lines..) to match your
terminal's colors (they're colors 0 through 15, in order, fwiw).
Hopefully gmail doesn't wrap this on me... In fact, just in case it
does, I've attached it as well - so there will be a plain text,
archivable copy in the list archives and a not-horribly-wrapped copy
in subscriber's inboxes. Sorry I can't disable wrapping ATM. :)

~Matt

hi clear
if exists("syntax_on")
syntax reset
endif

let g:colors_name = 'sixteen'

" Change these to match your terminal!

let s:Black = '#000000'
let s:DarkBlue = '#AF0000'
let s:DarkGreen = '#00AF00'
let s:DarkCyan = '#AFAF00'
let s:DarkRed = '#00FF00'
let s:DarkMagenta = '#AF00AF'
let s:Brown = '#00AFAF'
let s:Grey = '#9A9A9A'
let s:DarkGrey = '#5F5F5F'
let s:Blue = '#D70000'
let s:Green = '#00D700'
let s:Cyan = '#D7D700'
let s:Red = '#00FF00'
let s:Magenta = '#D700D7'
let s:Yellow = '#00D7D7'
let s:White = '#D7D7D7'

" Both

exe 'hi ErrorMsg term=standout ctermbg=DarkRed guibg=' . s:DarkRed . '
ctermfg=White guifg=' . s:White
exe 'hi IncSearch term=reverse cterm=reverse gui=reverse'
exe 'hi ModeMsg term=bold cterm=bold gui=bold'
exe 'hi NonText term=bold ctermfg=Blue guifg=' . s:Blue
exe 'hi StatusLine term=reverse,bold cterm=reverse,bold gui=reverse,bold'
exe 'hi StatusLineNC term=reverse cterm=reverse gui=reverse'
exe 'hi VertSplit term=reverse cterm=reverse gui=reverse'
exe 'hi VisualNOS term=underline,bold cterm=underline,bold gui=underline,bold'
exe 'hi DiffText term=reverse cterm=bold gui=bold ctermbg=Red guibg=' . s:Red
exe 'hi PmenuThumb cterm=reverse gui=reverse'
exe 'hi PmenuSbar ctermbg=Grey guibg=' . s:Grey
exe 'hi TabLineSel term=bold cterm=bold gui=bold'
exe 'hi TabLineFill term=reverse cterm=reverse gui=reverse'
exe 'hi Cursor guibg=fg guifg=bg'
exe 'hi lCursor guibg=fg guifg=bg'

if &bg == 'light'
exe 'hi Directory term=bold ctermfg=DarkBlue guifg=' . s:DarkBlue
exe 'hi LineNr term=underline ctermfg=Brown guifg=' . s:Brown
exe 'hi MoreMsg term=bold ctermfg=DarkGreen guifg=' . s:DarkGreen
exe 'hi Question term=standout ctermfg=DarkGreen guifg=' . s:DarkGreen
exe 'hi Search term=reverse ctermbg=Yellow guibg=' . s:Yellow . '
ctermfg=NONE guifg=NONE'
exe 'hi SpellBad term=reverse ctermbg=Red guibg=' . s:Red
exe 'hi SpellCap term=reverse ctermbg=Blue guibg=' . s:Blue
exe 'hi SpellRare term=reverse ctermbg=Magenta guibg=' . s:Magenta
exe 'hi SpellLocal term=underline ctermbg=Cyan guibg=' . s:Cyan
exe 'hi Pmenu ctermbg=Magenta guibg=' . s:Magenta
exe 'hi PmenuSel ctermbg=Grey guibg=' . s:Grey
exe 'hi SpecialKey term=bold ctermfg=DarkBlue guifg=' . s:DarkBlue
exe 'hi Title term=bold ctermfg=DarkMagenta guifg=' . s:DarkMagenta
exe 'hi WarningMsg term=standout ctermfg=DarkRed guifg=' . s:DarkRed
exe 'hi WildMenu term=standout ctermbg=Yellow guibg=' . s:Yellow .
' ctermfg=Black guifg=' . s:Black
exe 'hi Folded term=standout ctermbg=Grey guibg=' . s:Grey . '
ctermfg=DarkBlue guifg=' . s:DarkBlue
exe 'hi FoldColumn term=standout ctermbg=Grey guibg=' . s:Grey . '
ctermfg=DarkBlue guifg=' . s:DarkBlue
exe 'hi SignColumn term=standout ctermbg=Grey guibg=' . s:Grey . '
ctermfg=DarkBlue guifg=' . s:DarkBlue
exe 'hi Visual term=reverse'
exe 'hi DiffAdd term=bold ctermbg=Blue guibg=' . s:Blue
exe 'hi DiffChange term=bold ctermbg=Magenta guibg=' . s:Magenta
exe 'hi DiffDelete term=bold ctermfg=Blue guifg=' . s:Blue . '
ctermbg=Cyan guibg=' . s:Cyan
exe 'hi TabLine term=underline cterm=underline gui=underline
ctermfg=Black guifg=' . s:Black . ' ctermbg=Grey guibg=' . s:Grey
exe 'hi CursorColumn term=reverse ctermbg=Grey guibg=' . s:Grey
exe 'hi CursorLine term=underline cterm=underline gui=underline'
exe 'hi MatchParen term=reverse ctermbg=Cyan guibg=' . s:Cyan
exe 'hi Normal gui=NONE'
else
exe 'hi Directory term=bold ctermfg=Cyan guifg=' . s:Cyan
exe 'hi LineNr term=underline ctermfg=Yellow guifg=' . s:Yellow
exe 'hi MoreMsg term=bold ctermfg=Green guifg=' . s:Green
exe 'hi Question term=standout ctermfg=Green guifg=' . s:Green
exe 'hi Search term=reverse ctermbg=Yellow guibg=' . s:Yellow . '
ctermfg=Black guifg=' . s:Black
exe 'hi SpecialKey term=bold ctermfg=Blue guifg=' . s:Blue
exe 'hi SpellBad term=reverse ctermbg=Red guibg=' . s:Red
exe 'hi SpellCap term=reverse ctermbg=Blue guibg=' . s:Blue
exe 'hi SpellRare term=reverse ctermbg=Magenta guibg=' . s:Magenta
exe 'hi SpellLocal term=underline ctermbg=Cyan guibg=' . s:Cyan
exe 'hi Pmenu ctermbg=Magenta guibg=' . s:Magenta
exe 'hi PmenuSel ctermbg=DarkGrey guibg=' . s:DarkGrey
exe 'hi Title term=bold ctermfg=Magenta guifg=' . s:Magenta
exe 'hi WarningMsg term=standout ctermfg=Red guifg=' . s:Red
exe 'hi WildMenu term=standout ctermbg=Yellow guibg=' . s:Yellow .
' ctermfg=Black guifg=' . s:Black
exe 'hi Folded term=standout ctermbg=DarkGrey guibg=' . s:DarkGrey
. ' ctermfg=Cyan guifg=' . s:Cyan
exe 'hi FoldColumn term=standout ctermbg=DarkGrey guibg=' .
s:DarkGrey . ' ctermfg=Cyan guifg=' . s:Cyan
exe 'hi SignColumn term=standout ctermbg=DarkGrey guibg=' .
s:DarkGrey . ' ctermfg=Cyan guifg=' . s:Cyan
exe 'hi Visual term=reverse'
exe 'hi DiffAdd term=bold ctermbg=DarkBlue guibg=' . s:DarkBlue
exe 'hi DiffChange term=bold ctermbg=DarkMagenta guibg=' . s:DarkMagenta
exe 'hi DiffDelete term=bold ctermfg=Blue guifg=' . s:Blue . '
ctermbg=DarkCyan guibg=' . s:DarkCyan
exe 'hi TabLine term=underline cterm=underline gui=underline
ctermfg=White guifg=' . s:White . ' ctermbg=DarkGrey guibg=' .
s:DarkGrey
exe 'hi CursorColumn term=reverse ctermbg=DarkGrey guibg=' . s:DarkGrey
exe 'hi CursorLine term=underline cterm=underline gui=underline'
exe 'hi MatchParen term=reverse ctermbg=DarkCyan guibg=' . s:DarkCyan
exe 'hi Normal gui=NONE'
endif

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

Re: improving the :join command

Hi Gene!

On Di, 01 Sep 2009, Gene Kwiecinski wrote:

> To reiterate, I *don't* want to appear to be argumentative, but I'm just
> saying that handing Uberlines is something that's *possible* in
> 'vim'/'gvim', but don't expect it to be handled "efficiently", not if
> it's well outside the usual performance envelope of file-editing.

Well, then don't use it. Nobody forces you to use the plugin. But
someone might think it's useful.

regards,
Christian

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

RE: improving the :join command

>>No disrespect intended, but *why* in B'Harni's Dark Name would you
>>want to join >10000 lines into 1?!?

>There might be usecases. Data is growing rapidly today, and I myself
>had to manage automatically generated text-files of several hundred MB
>of size. Plus there have occasionally been questions on this list
>regarding joining lines.

Even so, something which I can understand, eg, a logfile, should be
delineated by linebreaks. Raw xml/sgml/etc., should be edited as a
sequence of modestly-sized lines, then if necessary, joined to a single
line after saving (or before saving, if you have the time :D ).


>Well just one simple test:

>#v+
>~$ for i in 1 2 4 8 16 32 64 128; do
> seq 1 $(($i*1000)) >tempfile
> echo "joining $i kilo lines"
> time vim -u NONE -N -c ':%join|:q!' tempfile;
>done
>#v-

>and compare the timings yourself. Doesn't this look like a bug to you?

I have no idea, as I didn't run it yet. Offhand, an exponential
increase wouldn't be out of the question, ie, e^n.

Don't forget *physical* limits such as available memory. Once you bang
your head on that memory-ceiling and start having to swap to disk, all
bets are off, and processing time can increase by order*s* of magnitude,
depending how bad it is. Hell, I run into that in *perl*, let alone
'gvim', when intentionally joining huge files to a single line to c&p
whole sections of the file! And I'm not even dealing with syntax
highlighting, colorschemes, and the like.


>>Any 'vi' variant is a *line*-based editor, which presumed a modest
>>line-size for each. Juggling lines back and forth is easy, but
heaving
>>huge MB-sized chunks o' text is just obscene. Add to that
syntax-based
>>highlighting, multiple colors, etc., and all the processing required
for
>>just *1* line adds exponentially to the amount of work involved, let
>>alone cursor motions, etc.

>Well Vim is an editor. Shouldn't it be able to join properly millions
>of lines, even if that sounds strange? The power of vim comes from

Sure, it should be able to be pushed to its limits and do so, but not
necessarily *efficiently*. Ie, it may hit that aforementioned ceiling
and then start hitting the disk to do so, and pretty much require you to
leave it running overnight to go and join a brazillion lines into 1
Uberline. That's not necessarily a "bug", just an unexpected excursion
of its performance envelope. The fact that it can create a huge
Uberline without *crashing* is a testament to the robustness of the
code. An old version of 'vi' I had would vomit on lines >300chars or
so.

Point being, *line*-editors are meant to be used with *lines*, and lines
of a modest size. The fact that it *can* handle Uberlines is great, but
you can't expect it to be handled "efficiently". The kind of advice I
might give would be along the lines of the guy who sees his doctor:

guy: "Doc, it hurts when I do this."
doc: "So don't do that."


>the fact, that you can do many different manipulations very
>efficiently and does not limit you.

Absolutely, but again, recall that it's intended to be a *line*-editor.
Not to appear facetious in repeating that again, but that's what
'vim'/'gvim' happens to be, a *line*-editor. You yank and put *lines*.
You add *lines*. You delete *lines*. Hell, syntax highlighting becomes
downright painful for overly-long lines that people wrote add-ons to
stop highlighting after N columns! That should be Clue #1 that
overly-long lines are not "natural" to a *line*-editor.


>Plus :h limits does not talk about joining only a couple of lines ;)

Of course not. I can 'ls' a list of filenames into a file, do a ':%j'
to get them into a single line, then prepend a command to run (with the
filelist as the list of files to operate on) and make an instant
batchfile. Works great. But there's a huge difference between a
batch-/shell-command that's 1000chars long, and a 1-line file with a
100Mchar Uberline.


>>Dunno, but to me, that seems like using a text editor to edit a .jpg
or
>>.gif or something, ie, not the right tool for the job, even if,
through
>>herculean contortions and torturing the editor's functionality, it
*can*
>>be done.

>Exactly. It can. And it might be done by someone.

And if he has the luxury of letting it run overnight, great. :D


>>I'd, if anything, edit the file as needed, save it, then use 'sed',
>>'tr', etc., to post-process it accordingly. No overhead for syntax,
>>colorschemes, etc. Ie, use the right tool for the job.

>Yeah, but sed, tr, awk, perl, $language is not always available. And
>Vim should be able to do it right.

>What was the reason again to add :vimgrep to vim when grep is
>available?

I have no idea, as I don't recall ever using it. <shrug/>


To reiterate, I *don't* want to appear to be argumentative, but I'm just
saying that handing Uberlines is something that's *possible* in
'vim'/'gvim', but don't expect it to be handled "efficiently", not if
it's well outside the usual performance envelope of file-editing.

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

Re: improving the :join command

Hi Gene!

On Di, 01 Sep 2009, Gene Kwiecinski wrote:

> No disrespect intended, but *why* in B'Harni's Dark Name would you
> want to join >10000 lines into 1?!?

There might be usecases. Data is growing rapidly today, and I myself
had to manage automatically generated text-files of several hundred MB
of size. Plus there have occasionally been questions on this list
regarding joining lines.

Well just one simple test:

#v+
~$ for i in 1 2 4 8 16 32 64 128; do
seq 1 $(($i*1000)) > tempfile
echo "joining $i kilo lines"
time vim -u NONE -N -c ':%join|:q!' tempfile;
done
#v-

and compare the timings yourself. Doesn't this look like a bug to you?

> Any 'vi' variant is a *line*-based editor, which presumed a modest
> line-size for each. Juggling lines back and forth is easy, but heaving
> huge MB-sized chunks o' text is just obscene. Add to that syntax-based
> highlighting, multiple colors, etc., and all the processing required for
> just *1* line adds exponentially to the amount of work involved, let
> alone cursor motions, etc.

Well Vim is an editor. Shouldn't it be able to join properly millions
of lines, even if that sounds strange? The power of vim comes from
the fact, that you can do many different manipulations very
efficiently and does not limit you.

Plus :h limits does not talk about joining only a couple of lines ;)

> Dunno, but to me, that seems like using a text editor to edit a .jpg or
> .gif or something, ie, not the right tool for the job, even if, through
> herculean contortions and torturing the editor's functionality, it *can*
> be done.

Exactly. It can. And it might be done by someone.

> I'd, if anything, edit the file as needed, save it, then use 'sed',
> 'tr', etc., to post-process it accordingly. No overhead for syntax,
> colorschemes, etc. Ie, use the right tool for the job.

Yeah, but sed, tr, awk, perl, $language is not always available. And
Vim should be able to do it right.

What was the reason again to add :vimgrep to vim when grep is
available?

regards,
Christian

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

RE: improving the :join command

>as you may know, :join suffers from a serious performance issue, when
>joining many lines ( in the order of 10 thousands or more lines).

No disrespect intended, but *why* in B'Harni's Dark Name would you want
to join >10000 lines into 1?!?

Any 'vi' variant is a *line*-based editor, which presumed a modest
line-size for each. Juggling lines back and forth is easy, but heaving
huge MB-sized chunks o' text is just obscene. Add to that syntax-based
highlighting, multiple colors, etc., and all the processing required for
just *1* line adds exponentially to the amount of work involved, let
alone cursor motions, etc.

Dunno, but to me, that seems like using a text editor to edit a .jpg or
.gif or something, ie, not the right tool for the job, even if, through
herculean contortions and torturing the editor's functionality, it *can*
be done.

I'd, if anything, edit the file as needed, save it, then use 'sed',
'tr', etc., to post-process it accordingly. No overhead for syntax,
colorschemes, etc. Ie, use the right tool for the job.

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

Re: Suggest a vim task for a college workshop

On 26/08/09 17:48, Vlad Dogaru wrote:
>
> Ben Fritz wrote:
>>
>>
>>
>> On Aug 25, 8:14 pm, Ken Bloom<kbl...@gmail.com> wrote:
>>>
>>> When I first got interested in vim, it was because I watched people do
>>> vi's relatively simple navigation things -- being able to move a word at
>>> a time, delete a word, replace a word with simple keystrokes.
>>>
>>> But I don't think these make for a good tutorial.
>>>
>>
>> Agreed. This is why I suggest having them do it with some rudimentary
>> knowledge, then doing it in front of them on a projector or something.
>> They will see all the fancy stuff and a few of them might become
>> interested.
>
> Thanks to everyone for your input. We will probably give them a program
> and a makefile, so they can use make, copen and friends along with
> editing. As it is, many of them come from a background of Borland's C++
> environment, not latest-and-greatest Eclipse and the like, so hopefully
> we'll get a positive response.
>
> Cheers,
> Vlad

Don't deride Turbo C, I used it on Dos and it already had a decent
keyboard-driven editor, plus excellent syntax help on the C language,
and it came with an outstanding debugger.


Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
118. You are on a first-name basis with your ISP's staff.

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

Re: Suggest a vim task for a college workshop

On 25/08/09 19:08, Erik Falor wrote:
> On Tue, Aug 25, 2009 at 09:25:51AM -0700, Ben Fritz wrote:
>> 1. Vim is a very powerful tool with plenty of advantages over other
>> tools.
>> 2. Vim is complex, but there are ways to learn how to use it
>> effectively.
>
> Most of my colleagues who use Vim at work do not use it to its full
> potential. For instance, I haven't encountered a single one who was
> aware of text objects. Most folks are content to learn only 10% of
> Vim's unique functionality. I suspect that's true for most people who
> use any software. But it's especially sad in the case of Vim since
> they really are missing out on a lot.
>
> I believe that any approach that emphasizes using Vim's help system
> will do them the greatest service in the long-term. And if you teach
> them to effectively search and navigate the help system, it should
> also have the effect of getting them hooked. You'll be showing them
> that:
> 1) Vim isn't really *that* hard because it comes with so much good
> documentation.
> 2) Vim has an overwhelming number of features, but I can learn
> about them at my own pace because I know where to look for
> help.
> 3) Vim's normal-mode and ex-mode commands all adhere to
> well-defined conventions with respect to addresses and motions.
> Once I master that, it's just a matter of remembering the names
> of some commands. Oh, there is tab completion for the ex-mode
> commands! That means I really only need to memorize a few
> normal mode commands!
>
>> Start them out with a pre-configured Vim with a lot of "bells and
>> whistles" such as syntax highlighting already enabled for them. Maybe
>> even install a snippet or skeleton plugin that pre-populates most of a
>> C program for them. TagList would not be out of the question.
>
> I would also show off Vim's insert-mode completion capabilities. That
> is something that programmers coming from an IDE very much rely on.
>
>> 3. Vim's help tells you basically EVERYTHING you need to know about
>> the editor.
>>
>> This step is VERY important. Without knowledge of :help, Vim is
>> basically useless, and a new user will never get beyond basic editing.
>> If time permits, I would even demonstrate CTRL-D with a :help topic,
>> and :helpgrep.
>
> Please make time to show this aspect of the help system off. I also
> encourage you to point out that they can use Ctrl-] and Ctrl-T to
> navigate via helptags.

Rather than Ctrl-D, I would demonstrate 'wildmenu' (Tab) with a help
topic. ":helpgrep" is essential indeed.

>
> The :options command along with :mkvimrc would be a good thing to
> throw into a hand-out. Vim is very, very configurable. These
> commands are a good way to explore all of those settings.

hm. Never used :mkvimrc myself. My vimrc is something I built little by
little, starting with

runtime vimrc_example.vim

then adding one command (if block, rather) above it when I got messages
in the "wrong" language

if has('unix')
language messages C
else
language messages en
endif

(I already had a double-boot system by that time, and Windows and Unix
versions didn't accept the same arguments here)

the rest came after the call to vimrc_exmple.vim, starting with

filetype indent off

after a lot of searching why Vim was high-handedly changing my
indentation and how to prevent it

...etc... (YMMV).

I did (rather early) check every possible option, but I didn't use
:mkvimrc, I added the changes, with the appropriate "if has(" or "if
exists(" wrappers to avoid errors in different versions (such as
vim-minimal vs. vim-enhanced vs. vim-x11 on Linux, vs. vim.exe vs.
gvim.exe on Windows.

>
> In addition to the great resources Ben Fritz pointed to, you can also
> direct new users to #vim on irc.freenode.net.
>

not to forget the vim_use (and possibly vim_multibyte etc.) Google
Group, which I don't think Ben mentioned.


Best regards,
Tony.
--
"Nuclear war can ruin your whole compile."
-- Karl Lehenbauer

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

Re: Use terminal colors in GUI Vim?

Patrick Gen-Paul wrote:
> I used ":hi + copy/paste" to create a color scheme that reflects my
> xterm's default colors.
>
> Pleas find attached the color scheme file I created manually via
> copy/paste and a few substitutions + the relevant stanza of my
> .Xdefaults file so all you need to do is replace my terminal color
> definitions by yours.
>
> :%s/#iiiiii/#jjjjjj/g (e.g.)
>
> Would be nice if someone could suggest an automated solution, though.
>
The hicolors plugin can help with this:

http://mysite.verizon.net/astronaut/vim/index.html#HICOLORS
(cutting edge)
http://vim.sourceforge.net/scripts/script.php?script_id=1081 (stable)

I used simple.vimrc:
set nocp
syn on
filetype plugin on

and the following:

vim -u simple.vimrc
:he hicolors
(place cursor atop a color) <cr>
(place cursor atop "WriteColorscheme") <cr>
(pick a name for the colorscheme)

Regards,
Chip Campbell

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

Re: Use terminal colors in GUI Vim?

On Tue, Sep 1, 2009 at 9:31 AM, Nathan Neff<nathan.neff@gmail.com> wrote:
> On Mon, Aug 31, 2009 at 8:19 PM, Patrick Gen-Paul<pgenpaul@gmail.com> wrote:
>> I used ":hi + copy/paste" to create a color scheme that reflects my
>> xterm's default colors.
>>
>> Pleas find attached the color scheme file I created manually via
>> copy/paste and a few substitutions + the relevant stanza of my
>> .Xdefaults file so all you need to do is replace my terminal color
>> definitions by yours.
>
> Thanks Glen -- I tried your colorscheme, and it looks a lot like mine.
>
> I'll go through the colors 1 by 1 when I have time -- in the meantime, I'll
> use your colorscheme :-)
>
> --Nate
>

Sorry, I meant Patrick-Gen Paul.

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

Re: Use terminal colors in GUI Vim?

On Mon, Aug 31, 2009 at 8:19 PM, Patrick Gen-Paul<pgenpaul@gmail.com> wrote:
> I used ":hi + copy/paste" to create a color scheme that reflects my
> xterm's default colors.
>
> Pleas find attached the color scheme file I created manually via
> copy/paste and a few substitutions + the relevant stanza of my
> .Xdefaults file so all you need to do is replace my terminal color
> definitions by yours.

Thanks Glen -- I tried your colorscheme, and it looks a lot like mine.

I'll go through the colors 1 by 1 when I have time -- in the meantime, I'll
use your colorscheme :-)

--Nate

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

Re: expand variable to command line

Sorry, maybe I should open a new topic, but it's relevant to this one also.

How to do the same but without mapping to keyboard key. For instance I call my custom function EditVim() and it would drop me to command which already contains ":e /usr/share/vim".

In other word I can simulate pressing ":".

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

Re: My function needs to be sourced twice. Why?

Christophe-Marie Duquesne wrote:
> Hi,
>
> I'm trying to write a function in vimscript that would toggle a value
> either to its default value, or to an other value. Here is what I wrote.
>
> " Toggles value to default or other
> function! ToggleValue(value, default, other)
> exec 'let evalvalue = '.a:value
> if evalvalue == a:default
> exec 'let '.a:value.' = '.a:other
> else
> exec 'let '.a:value.' = '.a:default
> endif
> exec 'let '.a:value
> endfunction
>
> This seems to work, e.g.
> :let g:foo = 0
> :call ToggleValue("g:foo", 0, 1) "prints g:foo #0
> :call ToggleValue("g:foo", 0, 1) "prints g:foo #1
> :call ToggleValue("g:foo", 0, 1) "prints g:foo #0
>
> However, I don't understand why, to get it working, I need to source
> my vimrc twice.
>
> Can someone give me a hint?
Hmm -- it seemed to work fine for me with but a single sourcing.
However, the results I got were

g:foo #1
g:foo #0
g:foo #1

which seems correct to me (a quiet initialize g:foo to zero, toggle to
1, toggle to 0, toggle to 1).

Regards,
Chip Campbell


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

Re: My function needs to be sourced twice. Why?

Yes,

I'm answering my own mail : the function was already defined elsewhere (I had written a file in .vim/plugin/ where I wanted to define this function, and I had forgotten to remove it. I just lost 2 hours :$


On Tue, Sep 1, 2009 at 3:31 PM, Charles Campbell <Charles.E.Campbell@nasa.gov> wrote:

Christophe-Marie Duquesne wrote:
> Hi,
>
> I'm trying to write a function in vimscript that would toggle a value
> either to its default value, or to an other value. Here is what I wrote.
>
> " Toggles value to default or other
> function! ToggleValue(value, default, other)
>     exec 'let evalvalue = '.a:value
>     if evalvalue == a:default
>         exec 'let '.a:value.' = '.a:other
>     else
>         exec 'let '.a:value.' = '.a:default
>     endif
>     exec 'let '.a:value
> endfunction
>
> This seems to work, e.g.
> :let g:foo = 0
> :call ToggleValue("g:foo", 0, 1) "prints g:foo #0
> :call ToggleValue("g:foo", 0, 1) "prints g:foo #1
> :call ToggleValue("g:foo", 0, 1) "prints g:foo #0
>
> However, I don't understand why, to get it working, I need to source
> my vimrc twice.
>
> Can someone give me a hint?
Hmm -- it seemed to work fine for me with but a single sourcing.
However, the results I got were

g:foo                 #1
g:foo                 #0
g:foo                 #1

which seems correct to me (a quiet initialize g:foo to zero, toggle to
1, toggle to 0, toggle to 1).

Regards,
Chip Campbell






--
Christophe-Marie Duquesne

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

My function needs to be sourced twice. Why?

Hi,

I'm trying to write a function in vimscript that would toggle a value either to its default value, or to an other value. Here is what I wrote.

" Toggles value to default or other
function! ToggleValue(value, default, other)
    exec 'let evalvalue = '.a:value
    if evalvalue == a:default
        exec 'let '.a:value.' = '.a:other
    else
        exec 'let '.a:value.' = '.a:default
    endif
    exec 'let '.a:value
endfunction

This seems to work, e.g.
:let g:foo = 0
:call ToggleValue("g:foo", 0, 1) "prints g:foo #0
:call ToggleValue("g:foo", 0, 1) "prints g:foo #1
:call ToggleValue("g:foo", 0, 1) "prints g:foo #0

However, I don't understand why, to get it working, I need to source my vimrc twice.

Can someone give me a hint?

Thank you!
--
Christophe-Marie Duquesne

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

Re: How to display edited lines of the file

> Is there a way to highlight modified lines while editing a file?

I don't think there's any stand-alone way to do this, but you can
use DiffOrig

:help DiffOrig

which allows you do diff the current buffer with the original
file contents. If the diff ever gets out of sync, you can force
a resync with ":diffupdate"

-tim

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

Re: How to display edited lines of the file



On Tue, Sep 1, 2009 at 3:29 PM, Xian Chen <hoganxian@gmail.com> wrote:
set cursorline
set cursorcolumn


This only shows where the cursor is now, not the modified lines.

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