Wednesday, October 31, 2012

how use surround.vim

Hi,everyone

         I use surround.vim.

         I want it can do like this:

        

         Old:

         GT_SI                 <=#`DELAY 0 ;

        

         New:

         begin

                   GT_SI                 <=#`DELAY 0 ;

         End

 

         How can I do?

         Thank you !

 

Re: :source command

On 10/30/2012 09:26 AM, Marcin Szamotulski wrote:
> On 12:42 Tue 30 Oct , Adolfo Olivera wrote:
>> Hi,
>> Would somebody explain me essentially what is the :source command used
>> for and how.
>>
>> --
>> You received this message from the "vim_use" maillist.
>> Do not top-post! Type your reply below the text you are replying to.
>> For more information, visit http://www.vim.org/maillist.php
>
> Hi,
>
> There is :source command and :runtime command, which are similar.
> :source {file}
> executes commands written in a {file} The {file} is usually a VimL
> script (plugin, filetype plugin, color scheme, indent file, etc). It
> may contain any ex-commands, and VimL declarations.
> :runtime {file}
> does the same but the {file} is search in 'runtimepath'.
>

Probably inspired by the source or dot command found in most Unix shells.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

GUI Tab Tooltip: list buffers

I pilfered the following code that is supposed to show a buffer list
as the tooltip on the tabs, but it is not working. Any ideas?

I can see the buffers with :buffers and with ctrlP buffer list, so I
know they are there, but they are not showing as the tooltip. Am I not
understanding what this code *should* do?

***


"make those tooltips cool by showing buffer names within them
function! GuiTabToolTip()
let tip = ''
let bufnrlist = tabpagebuflist(v:lnum)
for bufnr in bufnrlist
" separate buffer entries
if tip!=''
let tip .= " \n "
endif
" Add name of buffer
let name=bufname(bufnr)
if name == ''
" give a name to no name documents
if getbufvar(bufnr,'&buftype')=='quickfix'
let name = '[Quickfix List]'
else
let name = '[No Name]'
endif
endif
let tip.=name
" add modified/modifiable flags
if getbufvar(bufnr, "&modified")
let tip .= ' [+]'
endif
if getbufvar(bufnr, "&modifiable")==0
let tip .= ' [-]'
endif
endfor
return tip
endfunction

"show tooltips on tabs
set guitabtooltip=%{GuiTabToolTip()}

***

c
--
Chris Lott <chris@chrislott.org>

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Spellcheck on Tex-Files

xxx wrote:
> I would really appreciate a specific example on how to acomplish this.
> My last try is syn region texComment matchgroup=texStatement
> start='{tabular}{' end='}' \ contains=@NoSpell but it doesn't work...
You almost had it earlier; you need to have your new region contained in
texDocZone:

syn region texTabularPos matchgroup=texStatement
start='\\begin\s*{\s*tabular\s*}{' end='}' fold
contains=@texFoldGroup,@texDocGroup,@NoSpell containedin=texDocZone

That may not be the only region that it needs to be contained in, however.

I use my :HLT! command available with my plugin hilinks.vim:
http://www.drchip.org/astronaut/vim/index.html#HILINKS

Then you can move your cursor around and determine which syntax region
is currently active under the cursor.

Regards,
C Campbell

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Wildcards in Spell-check?

I am trying to find a way to use pattern recognition in spell-check. At the moment, I am not even sure if that is possible, but it seems like it should be. If I want to have a url in a file with ":set spell" I have to either mark the link as correct or deal with the red hilighting. Is there any way to white-list everything that starts with "http://"? Thanks in advance.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: What do I need to read to understand g: and s: VIM variable prefixes?

On Wed, Oct 31, 2012 at 9:52 PM, donothing successfully
<donothingsuccessfully@gmail.com> wrote:
> On 31 October 2012 19:15, Dotan Cohen <dotancohen@gmail.com> wrote:
>>[…]
>> #include <stdio.h>
>> int foo();
>>
>> int main() {
>> int x = 42;
>> printf("%d", x);
>> foo();
>> return 0;
>> }
>>
>> int foo() {
>> printf("%d", x);
>> }
>>[…]
> Here x is a local variable of the function *main*.
> I think the "global" keyword is more of a weirdism of PHP than
> standard practise.
> http://en.wikipedia.org/wiki/Global_variable#C_and_C.2B.2B
>

Exactly. However, there is no flow control outside of main(), so I
don't account for variables declared outside of main(). If someone is
declaring a variable in an area of the program with no flow control,
then they are explicitly declaring their intentions that the variable
will be global. In other words, it is not a surprise or a gotcha when
the variable is available in a different scope.


--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: What do I need to read to understand g: and s: VIM variable prefixes?

On 31 October 2012 19:15, Dotan Cohen <dotancohen@gmail.com> wrote:
>[…]
> #include <stdio.h>
> int foo();
>
> int main() {
> int x = 42;
> printf("%d", x);
> foo();
> return 0;
> }
>
> int foo() {
> printf("%d", x);
> }
>[…]
Here x is a local variable of the function *main*.
I think the "global" keyword is more of a weirdism of PHP than
standard practise.
http://en.wikipedia.org/wiki/Global_variable#C_and_C.2B.2B

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: What do I need to read to understand g: and s: VIM variable prefixes?

On Wed, Oct 31, 2012 at 8:33 PM, Tim Chase <vim@tim.thechases.com> wrote:
> On 10/31/12 06:05, Dotan Cohen wrote:
>> On Wed, Oct 31, 2012 at 12:55 PM, Tony Mechelynck wrote:
>>> Yes, and in addition, if you don't use a scope prefix Vim
>>> implies l: if you're inside a function and g: otherwise.
>>>
>>> See :help internal-variables
>>
>> Thank you, that is not consistent with other programming
>> environments that I am familiar with. Very good to know!
>
> Python happens to work this way:
>
> x = 42
> def foo():
> x = 32
> return x
> print foo()
> print x
>
> prints 32 followed by 42 (the x remains local to the function).

Right, this is how most C-based languages work. I don't know if Python
is C-based (I think so), but this is what I expect. What I don't
expect is that x would be recognized inside the foo() declaration if
it was only defined outside, as Tony mentions is the case with VIM.
Let's try:

>>> x = 42
>>> print x
42
>>> def foo():
... print x
...
>>> print x
42
>>> foo()
42

Wow! This would be at minimum a compiler warning at at worse a huge
security flaw in other languages. I happen to have PHP handy:

php > $x = 42;
php > echo $x . PHP_EOL;
42
php > function foo() {
php { echo $x . PHP_EOL;
php { return true;
php { }
php > echo $x . PHP_EOL;
42
php > foo();
PHP Notice: Undefined variable: x in php shell code on line 2

The variable $x was not declared in foo(), and is not valid there.
Now, to check my suspicions:

- neptune:c$ cat scopeTest.c
#include <stdio.h>
int foo();

int main() {
int x = 42;
printf("%d", x);
foo();
return 0;
}

int foo() {
printf("%d", x);
}
- neptune:c$ gcc scopeTest.c
scopeTest.c: In function 'foo':
scopeTest.c:15:15: error: 'x' undeclared (first use in this function)
scopeTest.c:15:15: note: each undeclared identifier is reported only
once for each function it appears in
- neptune:c$

Nope, C won't allow it either.

In both PHP and C there are ways to explicitly make x global, but it
is not implicit.


> I've noticed little bits of Python show up in VimScript--such as
> array slicing, negative-indexing, and first-class(ish) functions.
> Not that I mind, as Python is my preferred language. :-)
>
> There may be others where this scope is the same (pascal comes to mind)
>

I've actually never touched Pascal, nor Cobol or Fortran for that matter.

Thank you for the information regarding Python. I do dabble in Python
occasionally, and things like this I should know. I love Python, but
VIM is ill-equipped to handle bracketless languages out of the box!

--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: What do I need to read to understand g: and s: VIM variable prefixes?

On 10/31/12 06:05, Dotan Cohen wrote:
> On Wed, Oct 31, 2012 at 12:55 PM, Tony Mechelynck wrote:
>> Yes, and in addition, if you don't use a scope prefix Vim
>> implies l: if you're inside a function and g: otherwise.
>>
>> See :help internal-variables
>
> Thank you, that is not consistent with other programming
> environments that I am familiar with. Very good to know!

Python happens to work this way:

x = 42
def foo():
x = 32
return x
print foo()
print x

prints 32 followed by 42 (the x remains local to the function).
I've noticed little bits of Python show up in VimScript--such as
array slicing, negative-indexing, and first-class(ish) functions.
Not that I mind, as Python is my preferred language. :-)

There may be others where this scope is the same (pascal comes to mind)

-tim


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Strange issue with Pathogen

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: §auto-key-locate cert pka ldap hkp://keys.gnupg.net
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJQkWoRAAoJEKuJdOaOnmMJLGIH/j/745xoZSz034MWteaNm9Ts
aKXBtgFNYD/i3vpNaoNcgPnJiDEQ8qrzt4S0T9PPcQLM1ONJxyHa0/Iu8KxhGZCM
0WyzROvgfiyN0PRSRSGLu65o59ZEONhoDcSa59HX3qh5B0NaZGG3I9+QAFTmd0MA
XN1e9Xfr45ZPXRn2EP5LYh4vlDFuRBbPxJt4jw0PFozSdXXjqrd1+SPvrnov5343
zxHbmaV5MD/VY1mxFireL0YG922e/Gu4qKbamsc9WA7FajnADTelzLxE3klr9AGb
/MN0J6F5mzgW01ivFbxwzZEEXPA2S5nb2IGge8LhZpz67LYwAXYHnKceDCG1riY=
=Vv5t
-----END PGP SIGNATURE-----
Rostislav Svoboda wrote:

>> I'm having a strange issue with Pathogen. I'm trying to keep my Vim
>> configuration and plugins organised on several computers
>> so I decided to create a git repo for it.
>
> I had the same problem and realized Vundle works for me better than pathogen

I second the suggestion to use Vundle.

I keep my vimrc in Github & then clone it to any machine I'm going to
use (after cloning Vundle, of course) & then run `:BundleInstall` &
there's my plugins.

I also keep my colors & syntax directories in Github & a couple of
plugins that don't really work via Vundle (i.e. toggle_width.vim for
NERDTree) & a very basic bashrc which adds full color to the terminal
for Powerline, etc.

I've used it on CentOS, Debian, Fedora, OS X & Ubuntu & they all work
but not Windows 'cause I don't use it so have never tried it, so I can't
comment.

If you want to see it, it's at
<http://github.com/horse-latitudes/horse-vimfiles>.

Cheers,

Phil...

--
But masters, remember that I am an ass.
Though it be not written down,
yet forget not that I am an ass.

Wm. Shakespeare - Much Ado About Nothing

Re: Map Command key to Control on OS X

On 31/10/12 16:48, Heldraug wrote:
> On Tuesday, October 30, 2012 11:29:24 AM UTC-6, Tim Gray wrote:
>> On Oct 30, 2012 at 08:10 AM -0700, Heldraug wrote:
>>
>>> Here's the deal: I use a lot a Macbook to code, problem is, it only has
>>
>>> a small Control key on the left side, so it's kind of uncomfortable to
>>
>>> use, particularly when using keys that have to be typed with the left
>>
>>> hand. There are two Command keys, though. I looked around but I
>>
>>> couldn't find an answer to this. Is there a way to map the Command key
>>
>>> to Control, so I can use it as a Control key? Has anyone done this?
>>
>>
>>
>> No I haven't done that. However, what I have done is to swap the caps
>>
>> lock key and the left control key. You can probably the command key as
>>
>> well, but I'm not sure if OS X lets you change just one of the command
>>
>> keys and not the other. I use the built in capability on 10.7. It's
>>
>> probably available in other versions of OS X, but I can't verify that at
>>
>> the moment. Go to System Preferences -> Keyboard, select the Keyboard
>>
>> tab and then hit the Modifier Keys... button. There are other apps out
>>
>> there that let you remap things in fancier ways, but for simple modifier
>>
>> key remapping, this works for me.
>
> That works, problem is, it remaps completely the Command key system wide. What I'm looking for is to map the Cmd key only within Vim.
>

The problem with that is that Cmd and Ctrl are modifier keys, Vim
doesn't see them separately but only together to whatever letter or
function key you pressed together with them.

A possible but ugly solution would be

noremap <C-A> <D-A>
noremap! <C-A> <D-A>
noremap <D-A> <C-A>
noremap! <D-A> <C-A>
noremap <C-B> <D-B>
noremap! <C-B> <D-B>
noremap <D-B> <C-B>
noremap! <D-B> <C-B>
etc.

There are, however, IIRC, a hundred or so keys on the keyboard. Let's
see… four statements as above for each of them, plus four other ones to
swap Ctrl-Alt-<key> with Cmd-Alt-<key>, that's eight, plus eight more to
swap Ctrl-Shift- and Ctrl-Alt-Shift- with Cmd-Shift- and Cmd-Alt-Shift-…
That's something like sixteen hundred mappings just for swapping those
two keys… You could of course define a keymap: see
http://vim.wikia.com/wiki/How_to_make_a_keymap but keymaps work only in
Insert and Command-line mones, and is the game worth the candle?

If someone knows an easier way to do it "just for Vim"… or is it
possible to change the system keyboard preferences just for one application?


Best regards,
Tony.
--
"It's Fabulous! We haven't seen anything like it in the last half an
hour!"
-- Macy's

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Map Command key to Control on OS X

On Tuesday, October 30, 2012 11:29:24 AM UTC-6, Tim Gray wrote:
> On Oct 30, 2012 at 08:10 AM -0700, Heldraug wrote:
>
> >Here's the deal: I use a lot a Macbook to code, problem is, it only has
>
> >a small Control key on the left side, so it's kind of uncomfortable to
>
> >use, particularly when using keys that have to be typed with the left
>
> >hand. There are two Command keys, though. I looked around but I
>
> >couldn't find an answer to this. Is there a way to map the Command key
>
> >to Control, so I can use it as a Control key? Has anyone done this?
>
>
>
> No I haven't done that. However, what I have done is to swap the caps
>
> lock key and the left control key. You can probably the command key as
>
> well, but I'm not sure if OS X lets you change just one of the command
>
> keys and not the other. I use the built in capability on 10.7. It's
>
> probably available in other versions of OS X, but I can't verify that at
>
> the moment. Go to System Preferences -> Keyboard, select the Keyboard
>
> tab and then hit the Modifier Keys... button. There are other apps out
>
> there that let you remap things in fancier ways, but for simple modifier
>
> key remapping, this works for me.

That works, problem is, it remaps completely the Command key system wide. What I'm looking for is to map the Cmd key only within Vim.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Strange issue with Pathogen

On 31/10/12 14:47, Some Developer wrote:
> I'm having a strange issue with Pathogen. I'm trying to keep my Vim
> configuration and plugins organised as I need to use it on several
> computers so I decided to create a git repo for it.
>
> The following is my .vim folder structure:
>
> autoload
> bundle
> vimrc_config
>
> When I symlink ~/.vimrc to ~/.vim/vimrc_config Pathogen does not load
> any plugins at all. When I copy ~/.vim/vimrc_config to ~/.vimrc on the
> other hand it works perfectly.
>
> It would be nice if I could fix this issue as that would make it nice
> and easy to distribute the full config in the Git repo and I would only
> need to maintain one copy of the file. Since I need to copy the file to
> make it work if I want to make a change to the file I need to change
> both which is highly annoying and is error prone.
>
> Does anyone have any ideas at all?
>

Symlinks are a relatively new feature on Windows (compared to Unix-like
OSes where it existed since antiquity) so maybe Vim for Windows doesn't
know how to follow symlinks, or to make sure that they are followed.

Ben's "source" approach is the most portable, and for Vim, that's a
great plus.

Hardlinks (which are totally transparent to the application) would work
too, but unlike symlinks (and the :source statement) they can't cross
filesystem (i.e. disk partition) boundaries.


Best regards,
Tony.
--
ARTHUR: Ni!
BEDEVERE: Nu!
ARTHUR: No. Ni! More like this. "Ni"!
BEDEVERE: Ni, ni, ni!
"Monty Python and the Holy Grail" PYTHON (MONTY)
PICTURES LTD

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Strange issue with Pathogen

On Wednesday, October 31, 2012 8:50:28 AM UTC-5, Some Developer wrote:
> I'm having a strange issue with Pathogen. I'm trying to keep my Vim
>
> configuration and plugins organised as I need to use it on several
>
> computers so I decided to create a git repo for it.
>
>
>
> The following is my .vim folder structure:
>
>
>
> autoload
>
> bundle
>
> vimrc_config
>
>
>
> When I symlink ~/.vimrc to ~/.vim/vimrc_config Pathogen does not load
>
> any plugins at all. When I copy ~/.vim/vimrc_config to ~/.vimrc on the
>
> other hand it works perfectly.
>
>
>
> It would be nice if I could fix this issue as that would make it nice
>
> and easy to distribute the full config in the Git repo and I would only
>
> need to maintain one copy of the file. Since I need to copy the file to
>
> make it work if I want to make a change to the file I need to change
>
> both which is highly annoying and is error prone.
>
>
>
> Does anyone have any ideas at all?

I don't have any idea why this would fail. Your method should probably work.

A workaround (which I use, because I use Vim on Windows XP without an easy way to make sym links) is to instead create a VERY simple .vimrc that looks something like this:

source ~/.vim/vimrc_config

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Avoid typing, completion listing

On Wednesday, October 31, 2012 8:36:48 AM UTC-5, niva wrote:
>
>
> I have tried this to make autocompletion in insert mode:
>
> set dictionary=keys(myDict)
> set completeopt=menu
>

See :help 'dictionary'. You're using this option wrong. It takes file names, not a word list.

>
> But, not only keys of mydict appears when I type CTRL+N CTRL+P.
>

Dictionary completion is started with CTRL-X followed by CTRL-K.

>
> The menu appears and contains all lines of all opened buffers.
>

Probably because CTRL-N and CTRL-P by themselves will start generic completion, controlled by the 'complete' option. By default all words from all loaded buffers, windows, unloaded buffers in the buffer list, tags, and included files are included in the completion list.

>
>
> How can I do to restrain on keys of my Dict ?
>

Put your words in a file or set of files and use CTRL-X CTRL-K to start your completion.

Incidentally, I just discovered from the help that if 'dictionary' is empty or contains the word "spell", dictionary completion USES THE SPELLING DICTIONARY. I have a new Vim feature to play with! My day just got way better.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Strange issue with Pathogen

> I'm having a strange issue with Pathogen. I'm trying to keep my Vim
> configuration and plugins organised on several computers
> so I decided to create a git repo for it.

I had the same problem and realized Vundle works for me better than pathogen

Bost

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: saving code browsing history

On Wednesday, October 31, 2012 2:32:49 AM UTC-5, Asis Hallab wrote:
> 2012/10/31 happyFace <happyface...@gmail.com>
>
> > I have been using vim for sometime now but I am completely new to writing
> > vim plugins. I would like to write a plugin that record all the file
> > locations we jump to (with tags or cscope symbols) and save them in a file.
> > So that we can later review the "code browsing session" and be able to
> > conveniently revisit the same tags we browsed.
>
>
> Vim already has that feature. It's called the jumplist.
> Couldn't be better explained than by Drew Neil:
> http://vimcasts.org/episodes/using-the-changelist-and-jumplist/
>
>
>
> There is also a switch to make Vim save its history. 
> So after restarting it, you still have your old jumplist.
> You can set it in your vimrc, unfortunately I can't remember it right now..
>

Vim saves the jumplist in the .viminfo file, if the "'" included by default in
the 'viminfo' option is still present.

However, the .viminfo file may not be as persistent a storage location as you
might like. Additionally, according to the help only 100 jumps are stored in the
list, and each window has its own jump list. The :jumps command will list out
the current jump list (presumably for the current window). Potentially you could
use :redir to capture and parse the output of this command and store it to a
file of your choosing. I don't see any functions to get the jumplist in a
script, but perhaps I just missed them.

Actually, rather than parsing the output of :jumps, it is probably better to set
'viminfo' to the desired setting, use the :wviminfo command with a file
argument, then restore 'viminfo'.

I don't know of a better way to accomplish your task than using the jump list,
even with the caveats I mention above. Hopefully 100 jumps will be sufficient
for you.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Strange issue with Pathogen

I'm having a strange issue with Pathogen. I'm trying to keep my Vim
configuration and plugins organised as I need to use it on several
computers so I decided to create a git repo for it.

The following is my .vim folder structure:

autoload
bundle
vimrc_config

When I symlink ~/.vimrc to ~/.vim/vimrc_config Pathogen does not load
any plugins at all. When I copy ~/.vim/vimrc_config to ~/.vimrc on the
other hand it works perfectly.

It would be nice if I could fix this issue as that would make it nice
and easy to distribute the full config in the Git repo and I would only
need to maintain one copy of the file. Since I need to copy the file to
make it work if I want to make a change to the file I need to change
both which is highly annoying and is error prone.

Does anyone have any ideas at all?

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Avoid typing, completion listing

Le mardi 30 octobre 2012 22:24:19 UTC+1, niva a écrit :
> Hi,I present this kind of file to the user and want to avoid him to type some text that I have in a list. D_foo=D_bar=D_foobar=I have a list in memory that contains some words: let mylist=["word1","word2","word3","word4"].I would like to avoid user to type words that I ever had into mylist I think to use completion list and let it appears on insert mode after each equal sign. How can I do that ?Thank you

I have tried this to make autocompletion in insert mode:
set dictionary=keys(myDict)
set completeopt=menu

But, not only keys of mydict appears when I type CTRL+N CTRL+P.

The menu appears and contains all lines of all opened buffers.

How can I do to restrain on keys of my Dict ?
Thank you


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Re[2]: auto ctrl-P in Vim

...
> On Tuesday, October 30, 2012 2:47:47 AM UTC-6, Alexander Mak wrote:
>> Hi,
>>
>> My desire is to make vim automatically open complection menu ( like when I
>> hit ctrl-P ) after I've inserted 3d symbol in the word. I've tried to search
>> plugins or scripts, but didn't find anything simple/convinient yet.
>>
>> I'm not familiar with writing vim plugins or scripts, so I can't imagine
>> how to do it by myself. Can you help me and point out if there is anything
>> already developed? Or what should I add to my vim settings?

You might also want to look at this one then:

" autocomplpop.vim : Automatically open the popup menu for completion
" http://www.vim.org/scripts/script.php?script_id=1879
" Author: Takeshi NISHIDA

David

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: readfile( return on column instead of lines of file

Le mercredi 31 octobre 2012 09:55:35 UTC+1, niva a écrit :
> Hi, I would like to store lines of file into a List then I have used readfile(. When I open this file by :read command, the file appears correctly with many lines. When I use readfile(, the list return is composed of each character of each line of the file. I don't understand why? thank you for help

Thank you christian I am trying

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re[2]: auto ctrl-P in Vim


Yeah, that's I wanted. A little bit heavy, but cool anyway.

Thanks.


Tue, 30 Oct 2012 08:05:29 -0700 (PDT) от Heldraug <gerardo.galindez@gmail.com>:.

On Tuesday, October 30, 2012 2:47:47 AM UTC-6, Alexander Mak wrote:
> Hi,
>
> My desire is to make vim automatically open complection menu ( like when I hit ctrl-P ) after I've inserted 3d symbol in the word. I've tried to search plugins or scripts, but didn't find anything simple/convinient yet. 
>
> I'm not familiar with writing vim plugins or scripts, so I can't imagine how to do it by myself. Can you help me and point out if there is anything already developed? Or what should I add to my vim settings?
>
> Thanks in advance.
>
> Alex.

I'm not sure if that's what you're looking for, but I previously saw a thread were someone was asking the same thing and someone suggested NeoComplCache. I haven't tried it yet, but I think it solved the problem. Maybe you should check it out. The URL for the GitHub repo is: https://github.com/Shougo/neocomplcache

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: re-selecting block in different buffer

On 06:03 Wed 31 Oct , Tim Chase wrote:
> On 10/30/12 12:32, Ben Fritz wrote:
> > Vim remembers the previous mode though, and while it might not be
> > accessible, you can select the same area and mode in a different
> > place by using 1v. The help on this is a little hard to find, it
> > does not have its own topic, it is right above :help v_<Esc>.
>
> This must have been added more recently than the 7.2 that Debian
> Stable gives me by default. But it sounds like an interesting feature.
>
> -tim
>
>
>
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php

Indeed it is a nice feature. But it doesn't remember the are when
escaping the visual mode (with <esc> or <c-c>). I've asked about it on
vim_dev, and I got an answer that this rather will not be changed in vim
(since it may break some plugins) but there is a workaround:

vnoremap <Esc> g?gvg?

Best,
Marcin

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: What do I need to read to understand g: and s: VIM variable prefixes?

On Wed, Oct 31, 2012 at 12:55 PM, Tony Mechelynck
<antoine.mechelynck@gmail.com> wrote:

> Yes, and in addition, if you don't use a scope prefix Vim implies l: if
> you're inside a function and g: otherwise.
>
> See :help internal-variables
>

Thank you, that is not consistent with other programming environments
that I am familiar with. Very good to know!


> Question:
> Man Invented Alcohol,
> God Invented Grass.
> Who do you trust?
>

I'm pretty sure that God invented alcohol too, actually. I know that
I've had pomegranate juice ferment into a type of wine just sitting
there in the container. Divine fermentation?

--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: re-selecting block in different buffer

On 10/30/12 12:32, Ben Fritz wrote:
> Vim remembers the previous mode though, and while it might not be
> accessible, you can select the same area and mode in a different
> place by using 1v. The help on this is a little hard to find, it
> does not have its own topic, it is right above :help v_<Esc>.

This must have been added more recently than the 7.2 that Debian
Stable gives me by default. But it sounds like an interesting feature.

-tim



--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: What do I need to read to understand g: and s: VIM variable prefixes?

On 30/10/12 20:27, Ben Fritz wrote:
> On Tuesday, October 30, 2012 1:10:16 PM UTC-5, herm...@free.fr wrote:
>>
>>> What is the s: for that precedes the second function's name, and why
>>> does it change scope (s for scope, perhaps)? Thanks.
>>
>> s: stands for script. The scope of the variable is the script. As file static variables in C.
>>
>
> Any of the [gvslawtb]: prefixed variables define the scope of the variable, as follows:
>
> g: global variable, accessible anywhere
> v: special variable predefined by Vim only useful in certain contexts, see the help entry for that variable
> s: script-local variable, accessible anywhere within a given script file
> l: function-local variable, only accessible with the defining function
> a: function argument
> w: window-local variable, global variable but with a separate copy for every single window
> t: tab-local variable, global variable but with a separate copy for each tab page
> b: buffer-local variable, global variable but with a separate copy for each buffer
>
Yes, and in addition, if you don't use a scope prefix Vim implies l: if
you're inside a function and g: otherwise.

See :help internal-variables


Best regards,
Tony.
--
Question:
Man Invented Alcohol,
God Invented Grass.
Who do you trust?

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: readfile( return on column instead of lines of file

On Wed, October 31, 2012 10:34, niva wrote:
> Le mercredi 31 octobre 2012 09:55:35 UTC+1, niva a écrit :
>> Hi, I would like to store lines of file into a List then I have used
>> readfile(. When I open this file by :read command, the file appears
>> correctly with many lines. When I use readfile(, the list return is
>> composed of each character of each line of the file. I don't understand
>> why? thank you for help
>
> The file contains that:
> BEGIN OUT OF FILE
> Bit 1 : FOO
> END OUT OF FILE
>
> The readfile( in a loop show that:
>
> ÿþB
> i
> t
>
> 1
>
> :
>
> F
> O
> O
>

Readfile does not detect the encoding and convert your utf16le
encoded file into utf-8 butsimply reads byte by byte.

In your utf16le encoded file, it will replace the NULs by "\n".

I suggest to save/encode your tags file into utf8 format, before using
readfile()


regards,
Christian

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: readfile( return on column instead of lines of file

��B�i�t� �1� �:� �V�A�L�I�D�_�S�T�A�R�B�O�A�R�D� �
�Le mercredi 31 octobre 2012 09:55:35 UTC+1, niva a écrit :
> Hi, I would like to store lines of file into a List then I have used readfile(. When I open this file by :read command, the file appears correctly with many lines. When I use readfile(, the list return is composed of each character of each line of the file. I don't understand why? thank you for help

The file contains that:
BEGIN OUT OF FILE
Bit 1 : FOO
END OUT OF FILE

The readfile( in a loop show that:

ÿþB
i
t

1

:

F
O
O

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

readfile( return on column instead of lines of file

Hi,

I would like to store lines of file into a List then I have used readfile(.

When I open this file by :read command, the file appears correctly with many lines.


When I use readfile(, the list return is composed of each character of each line of the file.

I don't understand why?

thank you for help

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: saving code browsing history

2012/10/31 happyFace <happyface.tcsh2002@gmail.com>
Hi,

I have been using vim for sometime now but I am completely new to writing vim plugins. I would like to write a plugin that record all the file locations we jump to (with tags or cscope symbols) and save them in a file. So that we can later review the "code browsing session" and be able to conveniently revisit the same tags we browsed.

Hi!

Vim already has that feature. It's called the jumplist.
Couldn't be better explained than by Drew Neil:

There is also a switch to make Vim save its history. 
So after restarting it, you still have your old jumplist.
You can set it in your vimrc, unfortunately I can't remember it right now..

Cheers!
 

I know ":tags" can give us the tags stack but I want also to save cscope symbols accessed.

The only way I can think of for doing this is to remap ctrl+], tag <pattern>, cs find g <pattern>, etc to my own functions which will then do two things:
1- jump to the new tag, symbol.
2- record the location, tag, etc

Is there a better way to go about this? Better yet, is there an existing plugin for this? I could not find any. The closest I found are ":tags" for the tag stack, ":history" for the list of commands history, Taglist plugin but this displays all tags in a file, it doesn't record only those visited...

Thanks,
E.S.


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Tuesday, October 30, 2012

saving code browsing history

Hi,

I have been using vim for sometime now but I am completely new to writing vim plugins. I would like to write a plugin that record all the file locations we jump to (with tags or cscope symbols) and save them in a file. So that we can later review the "code browsing session" and be able to conveniently revisit the same tags we browsed.

I know ":tags" can give us the tags stack but I want also to save cscope symbols accessed.

The only way I can think of for doing this is to remap ctrl+], tag <pattern>, cs find g <pattern>, etc to my own functions which will then do two things:
1- jump to the new tag, symbol.
2- record the location, tag, etc

Is there a better way to go about this? Better yet, is there an existing plugin for this? I could not find any. The closest I found are ":tags" for the tag stack, ":history" for the list of commands history, Taglist plugin but this displays all tags in a file, it doesn't record only those visited...

Thanks,
E.S.


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Avoid typing, completion listing

On Tuesday, October 30, 2012 4:32:49 PM UTC-5, niva wrote:
> I think that I can use a code like that:
>
>
>
> while line(".") != line("$")
>
> norm A
>
> call complete(col('.'), mylist)
>
> endwhile
>
>
>
> But it does not work well
>
>

You can't trigger completion like this in a script. It has to be done in insert mode. "norm A" does NOT enter insert mode. See :help :normal, the stuff done as part of a :normal command needs to be a complete normal-mode operation. For example, ":norm! Ahello" will append the word "hello" to the current line *and return to normal mode*.

:help complete() says that you can trigger the popup in insert mode by using a <C-R>= in your mapping. Use the example there if you feel the need to continue using the complete() function for some reason.

But there are plenty other methods for completion. See :help ins-completion. You may instead be interesting in "dictionary" completion. See :help compl-dictionary.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Avoid typing, completion listing

I think that I can use a code like that:

while line(".") != line("$")
norm A
call complete(col('.'), mylist)
endwhile

But it does not work well

Le mardi 30 octobre 2012 22:24:19 UTC+1, niva a écrit :
> Hi,
>
>
> I present this kind of file to the user and want to avoid him to type some text that I have in a list.
>
> D_foo=
> D_bar=
> D_foobar=


> I have a list in memory that contains some words:
> let mylist=["word1","word2","word3","word4"].
>
> I would like to avoid user to type words that I ever had into mylist
>
> I think to use completion list and let it appears on insert mode after each equal sign.
>
> How can I do that ?
> Thank you

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Avoid typing, completion listing

Hi,


I present this kind of file to the user and want to avoid him to type some text that I have in a list.

D_foo=
D_bar=
D_foobar=

I have a list in memory that contains some words:
let mylist=["word1","word2","word3","word4"].

I would like to avoid user to type words that I ever had into mylist

I think to use completion list and let it appears on insert mode after each equal sign.

How can I do that ?
Thank you

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: backward reference

It works perfectly :)

2012/10/30 Ben Fritz <fritzophrenic@gmail.com>
On Tuesday, October 30, 2012 1:22:18 PM UTC-5, niva wrote:
> Hi,
>
> I am using this kind of code in order to modify line content :
>
> let patternOfxembh='^.*one="\(\d\+\)".*two="\(\d\+\)"'
> if line =~ patternOfxembh
>       echo line
> endif
>
> The recognition is working well and then I can echo my line but is it possible to do an echo of backward reference: value of \(\d\+\).
>
> I would like to avoid to use substitute and using again the same pattern on the line.
>

You cannot use the captured groups at a later time after doing a =~ or substitute().

However, you can use the matchlist() function to give you a list of all the matches which you can use later. This function returns an empty list if there are no matches, so to avoid doing regex matching twice you could do:

let lineMatches = matchlist(...)
if !empty(lineMatches)
  echo line
  ...
endif

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: What do I need to read to understand g: and s: VIM variable prefixes?

On Tue, Oct 30, 2012 at 9:27 PM, Ben Fritz <fritzophrenic@gmail.com> wrote:
> Any of the [gvslawtb]: prefixed variables define the scope of the variable, as follows:
>
> g: global variable, accessible anywhere
> v: special variable predefined by Vim only useful in certain contexts, see the help entry for that variable
> s: script-local variable, accessible anywhere within a given script file
> l: function-local variable, only accessible with the defining function
> a: function argument
> w: window-local variable, global variable but with a separate copy for every single window
> t: tab-local variable, global variable but with a separate copy for each tab page
> b: buffer-local variable, global variable but with a separate copy for each buffer
>

Great, thank you!

--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: What do I need to read to understand g: and s: VIM variable prefixes?

On Tue, Oct 30, 2012 at 8:09 PM, <hermitte@free.fr> wrote:
> Hello,
>
>> What do I need to read to understand g: and s: VIM variable prefixes?
>> This one is hard to guess for the built in help, and Google isn't
>> helping.
>
> Have you tried
> :h s:^D
> ?
> which will give you :h s:var
>

I had no idea that ^D would complete in :h! That's it, I'll never have
to post to the list again! :)


>> The root of the issue is trying to figure out why g:someVariable can
>> be seen in SomeFunction() but cannot be seen in s:AnotherFunction().
>
> someVariable in a function will be actually l:someVariable. When accessing global variables from functions, always prefix them with g:.
>
>
>> What is the s: for that precedes the second function's name, and why
>> does it change scope (s for scope, perhaps)? Thanks.
>
> s: stands for script. The scope of the variable is the script. As file static variables in C.
>

Thanks. Actually, since my first post I see that I did have a bug in
the function: reducing it to a most-simple case revealed the flaw. In
any case, what I have is a function in .vimrc that begins with s:,
something that was suggested to me on SuperUser, so I'd like to know
what it's doing, not just how to do it.

Thank you.


--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: What do I need to read to understand g: and s: VIM variable prefixes?

On Tuesday, October 30, 2012 1:10:16 PM UTC-5, herm...@free.fr wrote:
>
> > What is the s: for that precedes the second function's name, and why
> > does it change scope (s for scope, perhaps)? Thanks.
>
> s: stands for script. The scope of the variable is the script. As file static variables in C.
>

Any of the [gvslawtb]: prefixed variables define the scope of the variable, as follows:

g: global variable, accessible anywhere
v: special variable predefined by Vim only useful in certain contexts, see the help entry for that variable
s: script-local variable, accessible anywhere within a given script file
l: function-local variable, only accessible with the defining function
a: function argument
w: window-local variable, global variable but with a separate copy for every single window
t: tab-local variable, global variable but with a separate copy for each tab page
b: buffer-local variable, global variable but with a separate copy for each buffer

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: backward reference

On Tuesday, October 30, 2012 1:22:18 PM UTC-5, niva wrote:
> Hi,
>
> I am using this kind of code in order to modify line content :
>
> let patternOfxembh='^.*one="\(\d\+\)".*two="\(\d\+\)"'
> if line =~ patternOfxembh
> echo line
> endif
>
> The recognition is working well and then I can echo my line but is it possible to do an echo of backward reference: value of \(\d\+\).
>
> I would like to avoid to use substitute and using again the same pattern on the line.
>

You cannot use the captured groups at a later time after doing a =~ or substitute().

However, you can use the matchlist() function to give you a list of all the matches which you can use later. This function returns an empty list if there are no matches, so to avoid doing regex matching twice you could do:

let lineMatches = matchlist(...)
if !empty(lineMatches)
echo line
...
endif

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

backward reference

Hi,

I am using this kind of code in order to modify line content :

let patternOfxembh='^.*one="\(\d\+\)".*two="\(\d\+\)"'
if line =~ patternOfxembh
echo line
endif

The recognition is working well and then I can echo my line but is it possible to do an echo of backward reference: value of \(\d\+\).

I would like to avoid to use substitute and using again the same pattern on the line.

Thank you

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: What do I need to read to understand g: and s: VIM variable prefixes?

Hello,

> What do I need to read to understand g: and s: VIM variable prefixes?
> This one is hard to guess for the built in help, and Google isn't
> helping.

Have you tried
:h s:^D
?
which will give you :h s:var

> The root of the issue is trying to figure out why g:someVariable can
> be seen in SomeFunction() but cannot be seen in s:AnotherFunction().

someVariable in a function will be actually l:someVariable. When accessing global variables from functions, always prefix them with g:.


> What is the s: for that precedes the second function's name, and why
> does it change scope (s for scope, perhaps)? Thanks.

s: stands for script. The scope of the variable is the script. As file static variables in C.

HTH,
--
Luc Hermitte
http://lh-vim.googlecode.com/
http://hermitte.free.fr/vim/

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

What do I need to read to understand g: and s: VIM variable prefixes?

What do I need to read to understand g: and s: VIM variable prefixes?
This one is hard to guess for the built in help, and Google isn't
helping.

The root of the issue is trying to figure out why g:someVariable can
be seen in SomeFunction() but cannot be seen in s:AnotherFunction().
What is the s: for that precedes the second function's name, and why
does it change scope (s for scope, perhaps)? Thanks.

--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: re-selecting block in different buffer

On Tuesday, October 30, 2012 11:18:04 AM UTC-5, Tim Chase wrote:
> On 10/30/12 11:11, Chris Lott wrote:
> > The gv command is very useful. I'd like to be able to reselect a block
> > after I have selected, cut, and pasted it into a different buffer.
> >
> > Is this possible?
>
> It's a little tricky. Vim does track the `[ and `] marks for you
> which can be used to find the beginning/end of the block. However,
> since you're now in another window/buffer, I don't know of any way
> to get Vim to know whether the paste was from a
> linewise/characterwise/blockwise selection. There is a visualmode()
> function, but it only gives you the most recent visual mode for the
> *current* buffer.
>

Vim remembers the previous mode though, and while it might not be accessible,
you can select the same area and mode in a different place by using 1v. The help
on this is a little hard to find, it does not have its own topic, it is right
above :help v_<Esc>.

This works for me, to select the pasted text in the correct mode:

`[1v

(Note, it doesn't QUITE work with the 'selection' set to "exclusive", it selects
one character too few. This may be a bug.)

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Map Command key to Control on OS X

On Oct 30, 2012 at 08:10 AM -0700, Heldraug wrote:
>Here's the deal: I use a lot a Macbook to code, problem is, it only has
>a small Control key on the left side, so it's kind of uncomfortable to
>use, particularly when using keys that have to be typed with the left
>hand. There are two Command keys, though. I looked around but I
>couldn't find an answer to this. Is there a way to map the Command key
>to Control, so I can use it as a Control key? Has anyone done this?

No I haven't done that. However, what I have done is to swap the caps
lock key and the left control key. You can probably the command key as
well, but I'm not sure if OS X lets you change just one of the command
keys and not the other. I use the built in capability on 10.7. It's
probably available in other versions of OS X, but I can't verify that at
the moment. Go to System Preferences -> Keyboard, select the Keyboard
tab and then hit the Modifier Keys... button. There are other apps out
there that let you remap things in fancier ways, but for simple modifier
key remapping, this works for me.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: :source command

On 12:42 Tue 30 Oct , Adolfo Olivera wrote:
> Hi,
> Would somebody explain me essentially what is the :source command used
> for and how.
>
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php

Hi,

There is :source command and :runtime command, which are similar.
:source {file}
executes commands written in a {file} The {file} is usually a VimL
script (plugin, filetype plugin, color scheme, indent file, etc). It
may contain any ex-commands, and VimL declarations.
:runtime {file}
does the same but the {file} is search in 'runtimepath'.

Best regards,
Marcin

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: re-selecting block in different buffer

On 10/30/12 11:11, Chris Lott wrote:
> The gv command is very useful. I'd like to be able to reselect a block
> after I have selected, cut, and pasted it into a different buffer.
>
> Is this possible?

It's a little tricky. Vim does track the `[ and `] marks for you
which can be used to find the beginning/end of the block. However,
since you're now in another window/buffer, I don't know of any way
to get Vim to know whether the paste was from a
linewise/characterwise/blockwise selection. There is a visualmode()
function, but it only gives you the most recent visual mode for the
*current* buffer.

So you could do something like

:nnoremap <leader>v `[v`]
:nnoremap <leader>V `[V`]
:nnoremap <leader><c-v> `[<c-v>`]

to reselect the pasted contents in the given mode.

-tim



--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

re-selecting block in different buffer

The gv command is very useful. I'd like to be able to reselect a block
after I have selected, cut, and pasted it into a different buffer.

Is this possible?

c
--
Chris Lott <chris@chrislott.org>

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

:source command

Hi,
    Would somebody explain me essentially what is the :source command used for and how.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Map Command key to Control on OS X

Here's the deal: I use a lot a Macbook to code, problem is, it only has a small Control key on the left side, so it's kind of uncomfortable to use, particularly when using keys that have to be typed with the left hand. There are two Command keys, though. I looked around but I couldn't find an answer to this. Is there a way to map the Command key to Control, so I can use it as a Control key? Has anyone done this?

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: auto ctrl-P in Vim

On Tuesday, October 30, 2012 2:47:47 AM UTC-6, Alexander Mak wrote:
> Hi,
>
> My desire is to make vim automatically open complection menu ( like when I hit ctrl-P ) after I've inserted 3d symbol in the word. I've tried to search plugins or scripts, but didn't find anything simple/convinient yet. 
>
> I'm not familiar with writing vim plugins or scripts, so I can't imagine how to do it by myself. Can you help me and point out if there is anything already developed? Or what should I add to my vim settings?
>
> Thanks in advance.
>
> Alex.

I'm not sure if that's what you're looking for, but I previously saw a thread were someone was asking the same thing and someone suggested NeoComplCache. I haven't tried it yet, but I think it solved the problem. Maybe you should check it out. The URL for the GitHub repo is: https://github.com/Shougo/neocomplcache

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Strange behavior using caret or backtick

@Ben

Yes, that's the exact bahavior, and yes I used the switches you specified. Also, the described behavior is not appearing in 7.3.046.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: auto ctrl-P in Vim

On 10/30/12 03:47, Alexander Mak wrote:
> My desire is to make vim automatically open complection menu (
> like when I hit ctrl-P ) after I've inserted 3d symbol in the
> word.

To get a more helpful answer, you may have to clarify what you mean
by "inserted 3d symbol". Is this some special character that I
don't know about? Will it only appear at the point that you want it
to act like control+P, or can it appear earlier in the word (such as
"hi<3dsymbol>" vs. "he<3dsymbol>llo")?

-tim


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

auto ctrl-P in Vim

Hi,

My desire is to make vim automatically open complection menu ( like when I hit ctrl-P ) after I've inserted 3d symbol in the word. I've tried to search plugins or scripts, but didn't find anything simple/convinient yet. 

I'm not familiar with writing vim plugins or scripts, so I can't imagine how to do it by myself. Can you help me and point out if there is anything already developed? Or what should I add to my vim settings?

Thanks in advance.

Alex.

Monday, October 29, 2012

Re: Mapping keys Ctrl-K Ctrl-C

Apologies for not speciying WHERE i am using Vim. I am using it on windows. and my _vimrc has the following in the beginning.
set nocompatible        " be iMproved
source $VIMRUNTIME/mswin.vim
behave mswin            " required!

I assume this takes of the mswin behaviour.
Thanks for extensive support on my problem forum. I will try to see if anything else works around for me.


On Sun, Oct 28, 2012 at 11:55 PM, Henry Hertz Hobbit <hhhobbit@gmail.com> wrote:
On Saturday, October 27, 2012 4:44:17 PM UTC, ashwin sathya wrote:
> Hi,
>
> I am fairly new to Vim and a primary Visual Studio user. I have installed nerd commenter and would like to map Ctrl+k Ctrl+c for commenting(this is the same shortcut in visual studio), so i have these lines in my vimrc
>
> map <C-K><C-c> <leader>cc
> map <C-K><C-U> <leader>cu
>
>
> the <leader>cc and <leader>cu are mapped to NERD commands accordingly. I am having some trouble mapping C-c (BREAK ?? ) is there any workaround for this ?
>

I was waiting for somebody else to give an elightened comment.  Actually the one that was given was enlighteed, but it seemed to have a 'nix bias.  I think you need to say WHERE you are using vim.  I am sssuming Windows where <C-c> is usually mapped to COPY which is not hard wired into it.  It is put into it with what is in the _vimrc (you said neither ~/.vimrc nor _vimrc which causes me to guess).  Here is what I wrote for that it is worth:

http://www.securemecca.com/public/VimKeyMap.txt

I leave it to you to determine if you are on Windows and using vim with a mswin behavior (see previous file) whether giving up the default behavior of <C-c> being a copy and doing away with it altogether is worth it.  If you are on 'nix <C-c> usually either prints that message on how to exit or cancels a current operation in modes other than command mode.  It usually does not exit vim as you would suppose.  It is just that <C-c> is mapped to other behaviors and usually wiping out those mappings may not be what you want to do.  You may have problems seeing the previous file and the one it references.  The reason I say that is because a  school named BYU blocks (blocked?) access to securemecca.  That is not just for the campus.  BYU also offers an inexpensive broadband connection for their students and it will also block access to my web-site.  I assume they are not the lone strangers.  So I just mailed the files to you as well.

Please let us know WHERE you are using vim, and if on Windows whether or not you are using the mswin behavior and for me the mswin.vim file which is what I assume.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php



--
Thanks & Regards,
R Ashwin Sathya

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Strange behavior using caret or backtick

On Monday, October 29, 2012 10:58:34 AM UTC-5, Axel Bender wrote:
> I'm using the German keyboard using "^" as a combining key. The exact order of input is a given below ("..." denotes input, initially the cursor is on the second "a" in normal mode):
>
> gvim -N -u NONE -i NONE -U NONE
>
> a[a]aa -> "a"
> aa[]aa -> "<spc>^<spc>"
> aa []aa -> "<esc>"
> aa[ ]aa -> (ga shows 0x20), "s"
> []a aa -> (first a elimiated; an "$" is only shown with .vimrc), "123"
> 123[]a aa -> "<esc>"
> 12[3]a aa
>
> GVim behaves correctly in version 7.3.046 as downloadable from the homepage:
>
> a[a]aa -> "a"
> aa[]aa -> "<spc>^<spc>"
> aa ^[]aa -> "<esc>"
> aa [^]aa -> (ga shows 0x5E), "s"
> aa []aa -> "123"
> aa 123[]aa -> "<esc>"
> aa 12[3]aa
>
> Can provide binary and/or video.

OK, I think I understand now. Is the following correct?

You pressed a key which does nothing by itself, but rather combines with the next key to yield either an accented letter, or a literal '^' character depending on which key follows. You then pressed the "space" key, expecting Vim to enter a single '^' character. Instead, Vim inserted nothing at all.

Furthermore, when you typed 's' after this operation, with the cursor on a character in the middle of the line, you expected Vim to delete that character and enter insert mode. Vim instead jumped to the beginning of the line and deleted the character there, entering insert mode at that point.

If this is correct, I do not have a keyboard that can provide Vim the required input, nor am I familiar with a mapping that will provide this capability, so I'm afraid I cannot be of much further use besides:

Have you checked that a plugin or .vimrc setting is not causing this, by launching Vim from a command-line with "gvim -N -u NONE -U NONE -i NONE"?

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: surround a visual block with character(s)

On 2012-10-29, Tim Chase wrote:
> On 10/29/12 05:07, Marcin Szamotulski wrote:
> > On 23:20 Sun 28 Oct , Gary Johnson wrote:
> >> On 2012-10-28, Chris Lott wrote:
> >>> blah blah foo foo
> >>>
> >>> to
> >>>
> >>> "blah blah foo foo"
> >>
> >> s"<C-R>1"<Esc>
> >
> > I like that! With visual area less than one line one has to use the
> > - register.
>
> When the change is less than one line, I use this method, except I
> just use the scratch register:
>
> s"<c-r>""<esc>
>
> For more than one line, I have to think, because using this method
> does weird things depending on your indentation of the block, and
> your 'paste' settings. I.e., your contents can end up
> stair-stepping across the screen.

To avoid the stair-stepping, you can use <C-R><C-O> or <C-R><C-P>
instead of just <C-R>. That may not put the indentation where you
want it, but the text won't go meandering off to the right.

Regards,
Gary

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Strange behavior using caret or backtick

Sorry for opening another thread. After having been away for a week, I was not aware of having posted this before (also had not found it in a "quick" search). I think, the thread should continue here.

@Tony

yes, I'm using the German keyboard using "^" as a combining key. The exact order of input is a given below ("..." denotes input, initially the cursor is on the second "a" in normal mode):

gvim -N -u NONE -i NONE -U NONE

a[a]aa -> "a"
aa[]aa -> "<spc>^<spc>"
aa []aa -> "<esc>"
aa[ ]aa -> (ga shows 0x20), "s"
[]a aa -> (first a elimiated; an "$" is only shown with .vimrc), "123"
123[]a aa -> "<esc>"
12[3]a aa

GVim behaves correctly in version 7.3.046 as downloadable from the homepage:

a[a]aa -> "a"
aa[]aa -> "<spc>^<spc>"
aa ^[]aa -> "<esc>"
aa [^]aa -> (ga shows 0x5E), "s"
aa []aa -> "123"
aa 123[]aa -> "<esc>"
aa 12[3]aa

Can provide binary and/or video.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Tmux-style window resizing in vim?

On Sat, October 27, 2012 12:20, lith wrote:
>> Other niceties from tmux are that you can press <C-b>jjjjj to carry on
>> resizing, whereas in vim you'd have to use
>
> You can use plugins like tinymode or tinykeymap (and some others) to
> create such maps.
>

But tinykeymap doesn't work out of the box.
Just installed it from the vim.org site:

Error detected while processing
U:\DE914854\vim\vimfiles\autoload\tinykeymap\map\buffers.vim:
line 9:
E121: Undefined variable: g:tinykeymap#mapleader
Error detected while processing
U:\DE914854\vim\vimfiles\autoload\tinykeymap\map\buffers.vim:
line 9:
E15: Invalid expression: g:tinykeymap#mapleader ."b" "{{{2
Error detected while processing
U:\DE914854\vim\vimfiles\autoload\tinykeymap\map\buffers.vim:
line 9:
E121: Undefined variable: g:tinykeymap#mapleader
Error detected while processing
U:\DE914854\vim\vimfiles\autoload\tinykeymap\map\buffers.vim:
line 9:
E15: Invalid expression: g:tinykeymap#mapleader ."b" "{{{2
Error detected while processing
U:\DE914854\vim\vimfiles\autoload\tinykeymap\map\buffers.vim:
line 16:
E121: Undefined variable: g:tinykeymap#map#buffers#map
Error detected while processing
U:\DE914854\vim\vimfiles\autoload\tinykeymap\map\buffers.vim:
line 16:
E116: Invalid arguments for function tinykeymap#EnterMap
Error detected while processing function tinykeymap#Map..<SNR>68_GetDict:
line 8:
E605: Exception not caught: tinykeymaps: Unknown map: buffers
Error detected while processing
U:\DE914854\vim\vimfiles\autoload\tinykeymap\map\buffers.vim:
line 16:
E121: Undefined variable: g:tinykeymap#map#buffers#map
Error detected while processing function tinykeymap#Load:
line 12:
E170: Missing :endfor

regards,
Christian

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: surround a visual block with character(s)

On 10/29/12 05:07, Marcin Szamotulski wrote:
> On 23:20 Sun 28 Oct , Gary Johnson wrote:
>> On 2012-10-28, Chris Lott wrote:
>>> blah blah foo foo
>>>
>>> to
>>>
>>> "blah blah foo foo"
>>
>> s"<C-R>1"<Esc>
>
> I like that! With visual area less than one line one has to use the
> - register.

When the change is less than one line, I use this method, except I
just use the scratch register:

s"<c-r>""<esc>

For more than one line, I have to think, because using this method
does weird things depending on your indentation of the block, and
your 'paste' settings. I.e., your contents can end up
stair-stepping across the screen.

-tim


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: surround a visual block with character(s)

On 23:20 Sun 28 Oct , Gary Johnson wrote:
> On 2012-10-28, Chris Lott wrote:
> > What's the most efficient way to visually select a block of text and
> > append/prepend a character or more?
> >
> > In other words, I often want convert this:
> >
> > blah blah foo foo
> >
> > to
> >
> > "blah blah foo foo"
> >
> > I assume there are plugins that help with this kind of thing, for
> > which suggestions are welcome, but I'm curious how to do this most
> > efficiently without them.
>
> The way I would do that without using a plugin would be visually
> select the block, then type
>
> s"<C-R>1"<Esc>
>
> where <C-R> means Ctrl-R. That will substitute the current
> selection with a ", the original selected text from the 1 register,
> and another ".
>
> Regards,
> Gary
>
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php

I like that! With visual area less than one line one has to use the
- register.

Best,
Marcin

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Sunday, October 28, 2012

Re: surround a visual block with character(s)

On 2012-10-28, Chris Lott wrote:
> What's the most efficient way to visually select a block of text and
> append/prepend a character or more?
>
> In other words, I often want convert this:
>
> blah blah foo foo
>
> to
>
> "blah blah foo foo"
>
> I assume there are plugins that help with this kind of thing, for
> which suggestions are welcome, but I'm curious how to do this most
> efficiently without them.

The way I would do that without using a plugin would be visually
select the block, then type

s"<C-R>1"<Esc>

where <C-R> means Ctrl-R. That will substitute the current
selection with a ", the original selected text from the 1 register,
and another ".

Regards,
Gary

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

bash shell "here document" show wrong color

#!/bin/bash

# like this
cat << EOF|grep 123
aaaaa
bb123bbb
ccc123cc
ddd123ddd
aa111
EOF
# from now on, the color not changed to normal.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

答复: vim help

Thanks all!

-----邮件原件-----
发件人: Tim Chase [mailto:vim@tim.thechases.com]
发送时间: 2012年10月29日 9:49
收件人: vim_use@googlegroups.com
抄送: 王军
主题: Re: vim help

On 10/28/12 20:38, 王军 wrote:
> I want to press F1 ,and display help windows at right side which like
> used :vsp comand. Don't like use :sp command.

:nnoremap <f1> :vert :help<cr>

which you can read about at

:help :vert

-tim



--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: vim help

Thank You! I was thinking about that myself.

On Sun, Oct 28, 2012 at 9:48 PM, Tim Chase <vim@tim.thechases.com> wrote:
On 10/28/12 20:38, 王军 wrote:
> I want to press F1 ,and display help windows at right side which
> like used :vsp comand. Don't like use :sp command.

 :nnoremap <f1> :vert :help<cr>

which you can read about at

  :help :vert

-tim


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php



--
"When you see that trading is done, not by consent, but by compulsion - when you see that in order to produce, you need to obtain permission from men who produce nothing - when you see that money is flowing to those who deal, not in goods, but in favors - when you see that men get richer by graft and by pull than by work, and your laws don't protect you against them, but protect them against you - when you see corruption being rewarded and honesty becoming a self-sacrifice - you may know that your society is doomed."  Ayn Rand


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: vim help

On 10/28/12 20:38, 王军 wrote:
> I want to press F1 ,and display help windows at right side which
> like used :vsp comand. Don't like use :sp command.

:nnoremap <f1> :vert :help<cr>

which you can read about at

:help :vert

-tim


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: vim help

Excerpts from 王军's message of Mon Oct 29 02:38:29 +0100 2012:
> I want to press F1 ,and display help windows at right side which
> like used :vsp comand. Don't like use :sp command.

What about <c-w> v (split), then :h ?
This way works always for everything.

Marc Weber

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

vim help

Hi

         I want to press F1 ,and display help windows at right side which like used :vsp comand. Don't like use :sp command.

Re: surround a visual block with character(s)

On 10/28/12 12:47, Chris Lott wrote:
> In other words, I often want convert this:
>
> blah blah foo foo
>
> to
>
> "blah blah foo foo"
>
> I assume there are plugins that help with this kind of thing,

The most common is Tim Pope's surround.vim

http://www.vim.org/scripts/script.php?script_id=1697

> but I'm curious how to do this most efficiently without them.

There are a sufficient number of edge cases that I'd suggest using a
plugin to worry about them for you. In your particular use-case,
it's only one character, and it's the same character on both sides.
Things get a lot uglier when you have an opening that differs from
your closing (e.g. "smart quotes); if you plan to insert longer
text; if you want to reflow the contents if it causes a rewrapping;
or if your text-to-surround is indented (prevents some solutions,
unless you toggle 'paste' settings); etc.

-tim (not Pope)




--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: surround a visual block with character(s)

On 09:47 Sun 28 Oct , Chris Lott wrote:
> What's the most efficient way to visually select a block of text and
> append/prepend a character or more?
>
> In other words, I often want convert this:
>
> blah blah foo foo
>
> to
>
> "blah blah foo foo"
>
> I assume there are plugins that help with this kind of thing, for
> which suggestions are welcome, but I'm curious how to do this most
> efficiently without them.
>
> c
> --
> Chris Lott <chris@chrislott.org>
>
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php

Hi Chris,

I don't recall if there is a vim operator which does this but you can
make a vmap:

vmap <Leader>" <esc>`>a"<esc>`<i"<esc>

You could also make an operator with

fun! Wrapper(arg)
let pos_b = getpos("'[")
let pos_e = getpos("']")
call cursor(pos_e[1:2])
normal! a"
call cursor(pos_b[1:2])
normal! i"
endfun
nmap <silent> <Leader>" :set opfunc=Wrapper<cr>g@

And you can use \"{motion} in normal mode (assuming that the <Leader> is
equal to "). You can also tweak the function so that it will operate
line wise. See :help g@, :help 'operatorfunc'.

regards,
Marcin

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Mapping keys Ctrl-K Ctrl-C

On Saturday, October 27, 2012 4:44:17 PM UTC, ashwin sathya wrote:
> Hi,
>
> I am fairly new to Vim and a primary Visual Studio user. I have installed nerd commenter and would like to map Ctrl+k Ctrl+c for commenting(this is the same shortcut in visual studio), so i have these lines in my vimrc
>
> map <C-K><C-c> <leader>cc
> map <C-K><C-U> <leader>cu
>
>
> the <leader>cc and <leader>cu are mapped to NERD commands accordingly. I am having some trouble mapping C-c (BREAK ?? ) is there any workaround for this ?
>

I was waiting for somebody else to give an elightened comment. Actually the one that was given was enlighteed, but it seemed to have a 'nix bias. I think you need to say WHERE you are using vim. I am sssuming Windows where <C-c> is usually mapped to COPY which is not hard wired into it. It is put into it with what is in the _vimrc (you said neither ~/.vimrc nor _vimrc which causes me to guess). Here is what I wrote for that it is worth:

http://www.securemecca.com/public/VimKeyMap.txt

I leave it to you to determine if you are on Windows and using vim with a mswin behavior (see previous file) whether giving up the default behavior of <C-c> being a copy and doing away with it altogether is worth it. If you are on 'nix <C-c> usually either prints that message on how to exit or cancels a current operation in modes other than command mode. It usually does not exit vim as you would suppose. It is just that <C-c> is mapped to other behaviors and usually wiping out those mappings may not be what you want to do. You may have problems seeing the previous file and the one it references. The reason I say that is because a school named BYU blocks (blocked?) access to securemecca. That is not just for the campus. BYU also offers an inexpensive broadband connection for their students and it will also block access to my web-site. I assume they are not the lone strangers. So I just mailed the files to you as well.

Please let us know WHERE you are using vim, and if on Windows whether or not you are using the mswin behavior and for me the mswin.vim file which is what I assume.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php