You are not logged in.

#1 2009-07-28 18:30:45

agro
Member
Registered: 2009-07-28
Posts: 4

[SOLVED] Problems with gVim

I have a really annoying problem with copy & paste between gVim windows. When I type "+gP (or use menu/toolbar command), pasting works as expected, but when I map this command to Shift+Insert (in ~/.vimrc):

nnoremap <S-Insert> "+gP

copied text isn't inserted before cursor, but at the top of the window (or sometimes somewhere else, but not before cursor, as it should).

There is also a second problem (bug?) - I can't disable highlighting searched text in Arch's Vim - set nohlsearch in ~/.vimrc just doesn't work for me. I have to type :nohls each time I search to remove the highlighting.

Any ideas?

Last edited by agro (2009-07-29 12:26:55)

Offline

#2 2009-07-28 20:53:39

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: [SOLVED] Problems with gVim

Concerning your second problem, you cannot globally turn off "hlsearch". As the Vim help states:

:noh[lsearch]        Stop the highlighting for the 'hlsearch' option.  It
            is automatically turned back on when using a search
            command, or setting the 'hlsearch' option.
            This command doesn't work in an autocommand, because
            the highlighting state is saved and restored when
            executing autocommands |autocmd-searchpat|.
            Same thing for when invoking a user function.

I have to :nohl over and over again as well. sad


To know or not to know ...
... the questions remain forever.

Offline

#3 2009-07-28 21:59:52

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Re: [SOLVED] Problems with gVim

Post your .vimrc? Works fine for me.

(The highlighting issue, that is.)

Last edited by Peasantoid (2009-07-28 22:00:13)

Offline

#4 2009-07-28 22:10:10

agro
Member
Registered: 2009-07-28
Posts: 4

Re: [SOLVED] Problems with gVim

bernarcher wrote:

you cannot globally turn off "hlsearch"

This is true about "nohlsearch" command (:nohlsearch, note the colon), but you should be able to permanently turn off highlighting with "nohlsearch" option (that's something quite different, although has the same name). It works this way in Vim on Windows, it worked in Vim on my previous Linux distribution, but it doesn't work on Arch.

Peasantoid wrote:

Post your .vimrc? Works fine for me.

Now i'm testing it on .vimrc that contains only one line:

set nohlsearch

and it still doesn't work. I'm using standard (g)Vim from Arch repository; current version is 7.2.65, but it didn't work with earlier versions too.

PS the problem with highlighting affects only gVim; it works fine in console Vim.

Last edited by agro (2009-07-28 22:19:18)

Offline

#5 2009-07-28 22:32:54

alterecco
Member
Registered: 2009-07-13
Posts: 152

Re: [SOLVED] Problems with gVim

agro wrote:

I have a really annoying problem with copy & paste between gVim windows.

I have no direct solution for the "+gP problem, but have a look at the `clipboard` option. Personally I have it set to `unnamed`, which has solved all my problems with copy/paste between vim and X. I can now do a regular yank into the X clipboard buffer, and a regular paste inside vim from the X primary clipboard buffer. Very pleasant.

.]

Offline

#6 2009-07-28 22:43:44

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Re: [SOLVED] Problems with gVim

agro wrote:

PS the problem with highlighting affects only gVim; it works fine in console Vim.

That explains the difference, then.

Offline

#7 2009-07-29 09:21:38

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: [SOLVED] Problems with gVim

agro wrote:

This is true about "nohlsearch" command (:nohlsearch, note the colon), but you should be able to permanently turn off highlighting with "nohlsearch" option (that's something quite different, although has the same name).

Of course! I messed these up. sad

But I think I found a possible cause. In /etc/virc and /etc/vimrc there are explicit set hlsearch lines which are used in colored terminals and GUIs.

I have no time to really check this. But it may be worth a look.


To know or not to know ...
... the questions remain forever.

Offline

#8 2009-07-29 11:52:03

agro
Member
Registered: 2009-07-28
Posts: 4

Re: [SOLVED] Problems with gVim

alterecco wrote:

I have no direct solution for the "+gP problem, but have a look at the `clipboard` option.

Thanks, may be useful, but doesn't solve the problem. I'm currently testing gVim with the following .vimrc:

set nohlsearch
set clipboard=unnamed
vnoremap <C-y> "*y
nnoremap <C-e> "*gP

In this configuration copy & paste works as expected, but with Ctrl+y and Ctrl+e keys. However, if I map these copy & paste commands to Ctrl+Insert and Shift+Insert, it doesn't work correctly. I guess there is something wrong with these key combinations in Arch. It worked on my previous Linux distribution, so why doesn't work here?

bernarcher wrote:

But I think I found a possible cause. In /etc/virc and /etc/vimrc there are explicit set hlsearch lines which are used in colored terminals and GUIs.

I commented out these lines, but it didn't help sad
Can someone confirm that it isn't possible to disable highlighting searched text in gVim? Or is it only my problem?

Offline

#9 2009-07-29 11:58:28

arkham
Member
From: Stockholm
Registered: 2008-10-26
Posts: 516
Website

Re: [SOLVED] Problems with gVim

Have you tried creating a ~/.gvimrc with

set nohlsearch

?


"I'm Winston Wolfe. I solve problems."

~ Need moar games? [arch-games] ~ [aurcheck] AUR haz updates? ~

Offline

#10 2009-07-29 12:24:10

agro
Member
Registered: 2009-07-28
Posts: 4

Re: [SOLVED] Problems with gVim

arkham wrote:

Have you tried creating a ~/.gvimrc with

set nohlsearch

?

Thanks!!! smile:):) It works! If I put config commands in ~/.gvimrc, both problems are solved! big_smile

Offline

#11 2009-07-29 14:23:40

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: [SOLVED] Problems with gVim

GRRR! I always forget that Arch uses a separate .gvimrc. sad
Glad you found a solution. smile


To know or not to know ...
... the questions remain forever.

Offline

Board footer

Powered by FluxBB