Monday, April 30, 2018

how to use v:termrbgresp & friends

I've been trying to use v:termrbgresp to determine what color scheme to
use, but I can't figure out how to use it successfully.

I tried simply testing against it in my .vimrc, but that doesn't work,
probably because it hasn't been set yet. Sort of like v:termresponse,
which requires that you use the TermResponse event.

But when TermResponse fires, v:termrbgresp isn't set yet, either, and I
can't find an event that seems like it should be the right thing to use.
By the time I can type in ":echo v:termrbgresp", though, it's set. I just
need a mechanism to tell me when it's okay to use its value.

Should there be separate events for each of the terminal response codes?
Maybe one that fires when all the ones that will have responses have them?
Or a generic event that fires when a variable is set?

Or am I missing something? I looked for examples, but couldn't find any.

Thanks,
Danek

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Question about the use of "g:term_ansi_colors"

Christian wrote:

> On Mo, 30 Apr 2018, Bram Moolenaar wrote:
>
> > Masaaki Nakamura wrote
> >
> > > Thanks to the patch 8.0.1685, the output in terminal buffers got easy
> > > to see in any colorscheme. I'm really happy with it.
> > >
> > > Now, I would like to set "g:term_ansi_colors" in my colorscheme file,
> > > but then I'm wondering it could be harmful for other colorschemes. For
> > > example, first I set my colorscheme A and then change to another
> > > colorscheme B, the "g:term_ansi_colors" set by A may not match with B.
> > >
> > > At first, I can use "ColorScheme" autocmd event to restore the default
> > > colors. However, it is triggered after the colorscheme B sorced. If B
> > > also wants to set its "g:term_ansi_colors", it might be overwritten
> > > unintentionally.
> > >
> > > Anyone has ideas to restore the default colors? Or it is not expected
> > > to be set in a colorscheme file?
> >
> > I don't think there is an easy way. I can add the ColorSchemePre
> > autocommand event.
>
> Shouldn't syncolor and nosyntax reset g:term_ansi_colors?

g:term_ansi_colors is about the colors, not the syntax. Thus it's
related to highlighting.

syncolor.vim is a bit of a corner case, since it can set and reset the
colors used for syntax highlighting. But I don't see how this matters
for the colors to be used in a terminal (which may have nothing to do
with syntax highlighting).


--
Luxury. We used to have to get out of the lake at three o'clock in the
morning, clean the lake, eat a handful of hot gravel, go to work at the
mill every day for tuppence a month, come home, and Dad would beat us
around the head and neck with a broken bottle, if we were LUCKY!

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Question about the use of "g:term_ansi_colors"

2018年4月30日月曜日 21時55分39秒 UTC+8 Christian Brabandt:
> On Mo, 30 Apr 2018, Bram Moolenaar wrote:
>
> >
> > Masaaki Nakamura wrote
> >
> > > Thanks to the patch 8.0.1685, the output in terminal buffers got easy
> > > to see in any colorscheme. I'm really happy with it.
> > >
> > > Now, I would like to set "g:term_ansi_colors" in my colorscheme file,
> > > but then I'm wondering it could be harmful for other colorschemes. For
> > > example, first I set my colorscheme A and then change to another
> > > colorscheme B, the "g:term_ansi_colors" set by A may not match with B.
> > >
> > > At first, I can use "ColorScheme" autocmd event to restore the default
> > > colors. However, it is triggered after the colorscheme B sorced. If B
> > > also wants to set its "g:term_ansi_colors", it might be overwritten
> > > unintentionally.
> > >
> > > Anyone has ideas to restore the default colors? Or it is not expected
> > > to be set in a colorscheme file?
> >
> > I don't think there is an easy way. I can add the ColorSchemePre
> > autocommand event.
>
> Shouldn't syncolor and nosyntax reset g:term_ansi_colors?
>
> diff --git a/runtime/syntax/nosyntax.vim b/runtime/syntax/nosyntax.vim
> index 0ab341237..ace75b5fb 100644
> --- a/runtime/syntax/nosyntax.vim
> +++ b/runtime/syntax/nosyntax.vim
> @@ -28,3 +28,4 @@ endif
> if exists("syntax_manual")
> unlet syntax_manual
> endif
> +unlet! g:term_ansi_colors
> diff --git a/runtime/syntax/syncolor.vim b/runtime/syntax/syncolor.vim
> index 8d0064db1..ed0ede4c1 100644
> --- a/runtime/syntax/syncolor.vim
> +++ b/runtime/syntax/syncolor.vim
> @@ -83,3 +83,4 @@ SynLink Debug Special
>
> delcommand SynColor
> delcommand SynLink
> +unlet! g:term_ansi_colors
>
>
> Best,
> Christian
> --
> Herz, mein Herz, sei nicht beklommen und ertrage dein Geschick! Neuer
> Frühling gibt zurück, was der Winter dir genommen.
> -- Heinrich Heine

Although "ColorSchemePre" event looks useful, I think reasonable to reset it by syntax/nosyntax.vim, just like highlight groups. I like the idea.

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Question about the use of "g:term_ansi_colors"

On Mo, 30 Apr 2018, Bram Moolenaar wrote:

>
> Masaaki Nakamura wrote
>
> > Thanks to the patch 8.0.1685, the output in terminal buffers got easy
> > to see in any colorscheme. I'm really happy with it.
> >
> > Now, I would like to set "g:term_ansi_colors" in my colorscheme file,
> > but then I'm wondering it could be harmful for other colorschemes. For
> > example, first I set my colorscheme A and then change to another
> > colorscheme B, the "g:term_ansi_colors" set by A may not match with B.
> >
> > At first, I can use "ColorScheme" autocmd event to restore the default
> > colors. However, it is triggered after the colorscheme B sorced. If B
> > also wants to set its "g:term_ansi_colors", it might be overwritten
> > unintentionally.
> >
> > Anyone has ideas to restore the default colors? Or it is not expected
> > to be set in a colorscheme file?
>
> I don't think there is an easy way. I can add the ColorSchemePre
> autocommand event.

Shouldn't syncolor and nosyntax reset g:term_ansi_colors?

diff --git a/runtime/syntax/nosyntax.vim b/runtime/syntax/nosyntax.vim
index 0ab341237..ace75b5fb 100644
--- a/runtime/syntax/nosyntax.vim
+++ b/runtime/syntax/nosyntax.vim
@@ -28,3 +28,4 @@ endif
if exists("syntax_manual")
unlet syntax_manual
endif
+unlet! g:term_ansi_colors
diff --git a/runtime/syntax/syncolor.vim b/runtime/syntax/syncolor.vim
index 8d0064db1..ed0ede4c1 100644
--- a/runtime/syntax/syncolor.vim
+++ b/runtime/syntax/syncolor.vim
@@ -83,3 +83,4 @@ SynLink Debug Special

delcommand SynColor
delcommand SynLink
+unlet! g:term_ansi_colors


Best,
Christian
--
Herz, mein Herz, sei nicht beklommen und ertrage dein Geschick! Neuer
Frühling gibt zurück, was der Winter dir genommen.
-- Heinrich Heine

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Question about the use of "g:term_ansi_colors"

Masaaki Nakamura wrote

> Thanks to the patch 8.0.1685, the output in terminal buffers got easy
> to see in any colorscheme. I'm really happy with it.
>
> Now, I would like to set "g:term_ansi_colors" in my colorscheme file,
> but then I'm wondering it could be harmful for other colorschemes. For
> example, first I set my colorscheme A and then change to another
> colorscheme B, the "g:term_ansi_colors" set by A may not match with B.
>
> At first, I can use "ColorScheme" autocmd event to restore the default
> colors. However, it is triggered after the colorscheme B sorced. If B
> also wants to set its "g:term_ansi_colors", it might be overwritten
> unintentionally.
>
> Anyone has ideas to restore the default colors? Or it is not expected
> to be set in a colorscheme file?

I don't think there is an easy way. I can add the ColorSchemePre
autocommand event.

--
CONCORDE: Message for you, sir.
He falls forward revealing the arrow with the note.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Question about the use of "g:term_ansi_colors"

Hi all,

Thanks to the patch 8.0.1685, the output in terminal buffers got easy to see in any colorscheme. I'm really happy with it.

Now, I would like to set "g:term_ansi_colors" in my colorscheme file, but then I'm wondering it could be harmful for other colorschemes. For example, first I set my colorscheme A and then change to another colorscheme B, the "g:term_ansi_colors" set by A may not match with B.

At first, I can use "ColorScheme" autocmd event to restore the default colors. However, it is triggered after the colorscheme B sorced. If B also wants to set its "g:term_ansi_colors", it might be overwritten unintentionally.

Anyone has ideas to restore the default colors? Or it is not expected to be set in a colorscheme file?

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Typing Persian (Farsi) in Vim

Felipe Vieira wrote:

> I have tried the above solution and the following:
>
> http://vim.1045645.n5.nabble.com/arabic-font-td1161759.html
>
> Still can't get Farsi to work. I get those "<200d>" characters.
>
> I have tried gvim with
>
> :set guifont=Courier\ New\ 10
>
> For instance.
>
> Website for example:
>
> http://www.unics.uni-hannover.de/nhtcapri/persian-alphabet.html
>
> It displays nicely on my firefox.

The Farsi support in Vim is outdated. It doesn't work with Unicode.
We are waiting for someone to re-implement it, or merge it with the
Arabic support.

--
Eight Megabytes And Continually Swapping.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sunday, April 29, 2018

Re: Typing Persian (Farsi) in Vim

Hey guys,

I have tried the above solution and the following:

http://vim.1045645.n5.nabble.com/arabic-font-td1161759.html

Still can't get Farsi to work. I get those "<200d>" characters.

I have tried gvim with

:set guifont=Courier\ New\ 10

For instance.

Website for example:

http://www.unics.uni-hannover.de/nhtcapri/persian-alphabet.html

It displays nicely on my firefox.

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Friday, April 27, 2018

Re: Vim syntax plugin loading issue

Ben Fritz wrote:

> On Wednesday, April 25, 2018 at 1:51:09 PM UTC-5, Bram Moolenaar wrote:
> > Sam Burk wrote:
> >
> > > I am trying to use a plugin called vim-coldfusion (https://github.com/ernstvanderlinden/vim-coldfusion <https://github.com/ernstvanderlinden/vim-coldfusion>), which provides an alternative syntax file to the vim default.
> > >
> > > I am using Vim 8's builtin packages to load it.
> > >
> > > Whenever I load it via Vim's package system, it is read after the default cf syntax file (I got this information by looking at :scriptnames), but if I copy the syntax file to ~/.vim/syntax, it is read before the default syntax file. The plugin aborts if b:current_syntax is set, and it is set by the default cf syntax file. Thus, the plugin syntax file is never applied.
> > >
> > > How can I resolve this? Are syntax files under pack/ always read after the default syntax files?
> > >
> > > Ideally, I'd like to keep this plugin in pack/*/opt/ and load it only for cf files.
> >
> > The 'runtimepath' is updated with the directory of the package. It is
> > added after the directory that matches, otherwise at the end.
> >
> > Is your package also under ~/.vim/syntax ? If not, then put it there.
> >
>
> Huh? Why would we put packages in ~/.vim/syntax? The whole point of
> packages is to avoid scattering and intermingling plugin files all
> over the ~/.vim tree.

Sorry, I meant ~/vim/pack. Definitely not $VIMRUNTIME/pack


--
Facepalm statement #1: "I'm going to New York tomorrow, hopefully I have time
to visit the White House"

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: I'd emulate Ctrl-Space keypress and CLI with Esc using map

Sorry, I may confuse you.
Fedora 28 vim is 8.0.1704 which is built by distribution not mine.
vim-minimal does not send Ctrl-\ and Ctrl-G but vim-enhanced can send them.
I didn't notice vim-minimal does not support .vimrc fully.
Now I use vim-enhanced and that problem is fixed.

vim-minimal is built with:
%configure --prefix=%{_prefix} --with-features=small --with-x=no \
--enable-multibyte \
--disable-netbeans \
%if %{WITH_SELINUX}
--enable-selinux \
%else
--disable-selinux \
%endif
--disable-pythoninterp --disable-perlinterp --disable-tclinterp \
--with-tlib=ncurses --enable-gui=no --disable-gpm --exec-prefix=/ \
--with-compiledby="<bugzilla@redhat.com>" \
--with-modified-by="<bugzilla@redhat.com>"

vim-enhanced is built with:
configure --with-features=huge \
--enable-pythoninterp=dynamic \
--enable-python3interp=dynamic \
--enable-perlinterp=dynamic \
--disable-tclinterp --with-x=yes \
--enable-xim --enable-multibyte \
--with-tlib=ncurses \
--disable-gtk3-check \
--enable-gtk3-check --enable-gui=gtk3 \
--with-compiledby="<bugzilla@redhat.com>" --enable-cscope \
--with-modified-by="<bugzilla@redhat.com>" \
%if "%{withnetbeans}" == "1"
--enable-netbeans \
%else
--disable-netbeans \
%endif
%if %{WITH_SELINUX}
--enable-selinux \
%else
--disable-selinux \
%endif
%if "%{withruby}" == "1"
--enable-rubyinterp=dynamic \
%else
--disable-rubyinterp \
%endif
%if "%{withlua}" == "1"
--enable-luainterp=dynamic \
%else
--disable-luainterp \
%endif
--enable-termtruecolor

Now my another problem is that I cannot send Ctrl-Space key to xterm or gnome-terminal but not vim.
I tried:

nmap <F4> <C-Space>

and

nmap <F4> :call feedkeys("\<C-Space>")<CR>

but gnome-terminal receives F4 key only with either nmap when I debugged gnome-terminal.

I tried 8.0.1704 of Fedora 28 and 8.0.1766 of Fedora 29 but vim, vimx, gvim failed to receive the key events.
I thought I might mistake the syntax.
Or do you mean the syntax is correct and you can send Ctrl-Space key with the above nmap?

Thanks

On 04/26/18 22:48, Tony Mechelynck-san wrote:
> It surprises me that your Vim apparently doesn't know about Ctrl-\
> Ctrl-G. Which Vim version is that? (Vim 8.0 was released 12-Sep-2016,
> and the latest patchlevel is 8.0.1765 as of this writing.) To compile
> your own Vim on Unix/Linux, see
> http://users.skynet.be/antoine.mechelynck/vim/compunix.htm and some of
> the pages linked from there. If you install your own-compiled Vim
> under its default /usr/local/ directory, it will normally live happily
> together in the Vim version(s) from your distro, and it will be
> earlier in the $PATH.
>
> To change from Insert mode to Normal mode for just one command (which
> may be several keys e.g. 3j to go 3 lines down, or even a whole
> ex-command from : to <CR>) there is also CTRL-O, see :help i_CTRL-O
> (IIRC that one existed already in Vim 6 and probably before, if the
> latest Vim on RedHat/Fedora doesn't know about it it might be time to
> switch to another distro.)
>
> vim-minimal is (as its name says) a minimal Vim, usually a Tiny build;
> it may be packaged under the executable name "vi" and it hasn't got
> all the bells and whistles in even a "normal" Vim. vim-enhanced or
> even vim-gui (or all three, IIRC they can be installed together) are
> usually better choices for the "serious" Vim user.
>
> Best regards,
> Tony.
>

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thursday, April 26, 2018

Re: Multiple Splits from CLI: vim -O .asoundrc*

On Fr, 27 Apr 2018, Philip Rhoades wrote:

> People,
>
> I regularly use a command like in the subject and flick between the splits
> using "CTRL-w CTRL-w" - however the last few times I have realised there are
> issues:
>
> - the CLI command does not open / display ALL of the files - there seems to
> a maximum of six files opened
>
> - moving between the splits and sometimes using ":q" to repeatedly exit a
> buffer and then having finished the comparison and any editing and
> repeatedly using ":q" on each remaining split - after what I thought was the
> last buffer, I am getting prompted that I still have files to look at and
> have to use ":n" - which reopens files that I have previously closed - weird
> stuff . .
>
> Any ideas about getting "vim -O" to open ALL the files with the appropriate
> number of splits?

It all depends on the size of your Vim window/terminal and Vim will then
try to open as many windows as possible so that
'winminheight'/'winminwidth' option for each window is fulfilled. If the
space is not enough, it won't create more windows. So try to reduce the
'winminwidth'/'winminheight' option

Best,
Christian
--
Unter die größten Entdeckungen, auf die der menschliche Verstand in
den neuesten Zeiten gefallen ist, gehört meiner Meinung nach wohl die
Kunst, Bücher zu beurteilen, ohne sie gelesen zu haben.
-- Georg Christoph Lichtenberg

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Multiple Splits from CLI: vim -O .asoundrc*

People,

I regularly use a command like in the subject and flick between the
splits using "CTRL-w CTRL-w" - however the last few times I have
realised there are issues:

- the CLI command does not open / display ALL of the files - there seems
to a maximum of six files opened

- moving between the splits and sometimes using ":q" to repeatedly exit
a buffer and then having finished the comparison and any editing and
repeatedly using ":q" on each remaining split - after what I thought was
the last buffer, I am getting prompted that I still have files to look
at and have to use ":n" - which reopens files that I have previously
closed - weird stuff . .

Any ideas about getting "vim -O" to open ALL the files with the
appropriate number of splits?

Thanks,

Phil.
--
Philip Rhoades

PO Box 896
Cowra NSW 2794
Australia
E-mail: phil@pricom.com.au

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Vim syntax plugin loading issue

On Wednesday, April 25, 2018 at 1:51:09 PM UTC-5, Bram Moolenaar wrote:
> Sam Burk wrote:
>
> > I am trying to use a plugin called vim-coldfusion (https://github.com/ernstvanderlinden/vim-coldfusion <https://github.com/ernstvanderlinden/vim-coldfusion>), which provides an alternative syntax file to the vim default.
> >
> > I am using Vim 8's builtin packages to load it.
> >
> > Whenever I load it via Vim's package system, it is read after the default cf syntax file (I got this information by looking at :scriptnames), but if I copy the syntax file to ~/.vim/syntax, it is read before the default syntax file. The plugin aborts if b:current_syntax is set, and it is set by the default cf syntax file. Thus, the plugin syntax file is never applied.
> >
> > How can I resolve this? Are syntax files under pack/ always read after the default syntax files?
> >
> > Ideally, I'd like to keep this plugin in pack/*/opt/ and load it only for cf files.
>
> The 'runtimepath' is updated with the directory of the package. It is
> added after the directory that matches, otherwise at the end.
>
> Is your package also under ~/.vim/syntax ? If not, then put it there.
>

Huh? Why would we put packages in ~/.vim/syntax? The whole point of packages is to avoid scattering and intermingling plugin files all over the ~/.vim tree.

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: I'd emulate Ctrl-Space keypress and CLI with Esc using map

It surprises me that your Vim apparently doesn't know about Ctrl-\
Ctrl-G. Which Vim version is that? (Vim 8.0 was released 12-Sep-2016,
and the latest patchlevel is 8.0.1765 as of this writing.) To compile
your own Vim on Unix/Linux, see
http://users.skynet.be/antoine.mechelynck/vim/compunix.htm and some of
the pages linked from there. If you install your own-compiled Vim
under its default /usr/local/ directory, it will normally live happily
together in the Vim version(s) from your distro, and it will be
earlier in the $PATH.

To change from Insert mode to Normal mode for just one command (which
may be several keys e.g. 3j to go 3 lines down, or even a whole
ex-command from : to <CR>) there is also CTRL-O, see :help i_CTRL-O
(IIRC that one existed already in Vim 6 and probably before, if the
latest Vim on RedHat/Fedora doesn't know about it it might be time to
switch to another distro.)

vim-minimal is (as its name says) a minimal Vim, usually a Tiny build;
it may be packaged under the executable name "vi" and it hasn't got
all the bells and whistles in even a "normal" Vim. vim-enhanced or
even vim-gui (or all three, IIRC they can be installed together) are
usually better choices for the "serious" Vim user.

Best regards,
Tony.

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: help for Vim binding development (Freeplane) wanted

Dear vim community,

please excuse me repeating this question (see below).

If it is a misplaced question, then please tell me where to post it, alternatively. I just need a good start, I think, in order to get going on the mentioned subject. Can anybody give a small hint?

Thanks again.


2018-04-15 21:16 GMT+02:00 Nnako <nnamdi.kohn@gmail.com>:
Hi,

my name is Nnako and I am natively a C and Python programmer. I use Vim every day and have learned to just smile when yet another new graphical code development environment appears (e.g. VS Code and JupyterLab)...

For some years now, I have been structuring my work and private life using a tool called FREEPLANE [https://www.freeplane.org]. It is a very flexible mindmap editor. As I love both, Freeplane and Vim, I am looking for ways to combine these two exceptional technologies. At least a subset of Vim's functionalities could be used to facilitate NODE NAVIGATION and TEXT EDITING, and later maybe TEXT SEARCH, COMMANDS,...

There are already some bindings for Vim in applications out there, like for browsers (Chrome, Firefox, ... ), development environments (Eclipse, Netbeans, ...) and web applications (Jupyter Notebook, Code Mirror, ....). I was thinking to invest some time into the development of a Vim binding for Freeplane (developed in JAVA). But I don't know where to start.

Are there some people here, who have already developed Vim-Bindings for applications, using parts of the original vim source? Or people who know people who have already successfully done such a thing?

Thanks.
Nnako

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Variable tabstop size

On Mi, 25 Apr 2018, Gustavo Ribeiro Croscato wrote:

> I tested your patch and it worked perfectly for my use case, that is, to edit some assembly files.
>
> Would be great to see this patch go upstream.
>
> If you need any help in making that happen let me know.

Great. Please leave a comment at that PR so that we have the demand
documented :)

I see, there is already a merge conflict. Will try to find time to fix
this later.

Best,
Christian
--
Der eine: "Kalt heute, nicht?"
Der andere: "Willst Du mich aushorchen?"

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Wednesday, April 25, 2018

Re: I'd emulate Ctrl-Space keypress and CLI with Esc using map

On 04/25/18 16:46, Tony Mechelynck-san wrote:
> On Wed, Apr 25, 2018 at 6:15 AM, Takao Fujiwara <fujiwara@redhat.com> wrote:
>> I'd like to create a new shortcut key of `F4` to send Esc to vim but
>> Ctrl-space to xterm, gnome-terminal instead of vim.
>>
>> Seems the command `imap <F4> <Esc> :call feedkeys("\<C-Space>")<CR>` does
>> not send Ctrl-Space.
>>
>> Do you have any ideas?
>>
>> I also tried the two commands:
>>
>> nmap <silent> <F4> :!ibus engine anthy<CR>a
>> imap <silent> <F5> <Esc>:!ibus engine xkb:us::eng<CR><CR>
>>
>> They work if I run each command directly in vim buffer. But they do not work
>> if I save them in vimrc.
>>
>> Do you have any ideas?
>
> See :help CTRL-\_CTRL-G
>
> N.B.
> 1. You can use a single {lhs} for nmap and imap, Vim won't mix them up.
> 2. (about the RTFM above) 'insertmode' should only be set in the
> so-called "easy Vim" (actually a Notepad look-alike :-P )

Thank you. My {lhs} is <F4> or <F5> which are single keys.
From your reply, I guess I should not add space characters in the command line.

I noticed my vim does not provide `:help CTRL-\_CTRL-G` in Fedora.
And seems vim-minimal package does not provide the full supports of vimrc.

After I installed vim-enhanced package, my vim can work with $HOME/.vimrc of the following content:

nmap <silent> <F4> :!ibus engine anthy<CR>a
imap <silent> <F5> <Esc>:!ibus engine xkb:us::eng<CR><CR

However feedkeys() still does not work.

imap <F5> <C-\><C-G>:call feedkeys("\<C-Space>")<CR>

When I press F5 key in the insert mode, I'd change the mode to the normal mode and send Ctrl-space key to xterm or gnome-terminal but not vim.
But the actual result is, <C-/><C-G> or <Esc> works but feedkeys() does not forward Ctrl-space to my input method.

Do you have any ideas?


>
> Best regards,
> Tony.
>

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Variable tabstop size

Em quarta-feira, 25 de abril de 2018 03:59:18 UTC-3, Christian Brabandt escreveu:
> On Mi, 25 Apr 2018, Tony Mechelynck wrote:
>
> > On Wed, Apr 25, 2018 at 6:25 AM, Gustavo Ribeiro Croscato
> > <croscato@gmail.com> wrote:
> > > Hi everyone!
> > >
> > > Is there any option or plugin like "colorcolumn" but for set tabstop at variable positions?
> > >
> > > Or maybe something like emacs tab-stop-list?
> > >
> > > Thanks!
> >
> > There is but it is not yet part of Vim (it is being considered for
> > inclusion). You must recompile with a few changes, and I don't know
> > exactly where they are to be found, but I think Christian Brabandt
> > knows. If you are willing, you can help test this new option and maybe
> > help convince Bram that it is more useful than dangerous.
>
> The patch is here: https://github.com/vim/vim/pull/2711
>
> Best,
> Christian
> --
> Wir lernen aus Erfahrung, daß die Menschen nichts aus Erfahrung
> lernen.
> -- George Bernard Shaw

Hi Christian.

I tested your patch and it worked perfectly for my use case, that is, to edit some assembly files.

Would be great to see this patch go upstream.

If you need any help in making that happen let me know.

Best regards,
Gustavo

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Vim syntax plugin loading issue

Sam Burk wrote:

> I am trying to use a plugin called vim-coldfusion (https://github.com/ernstvanderlinden/vim-coldfusion <https://github.com/ernstvanderlinden/vim-coldfusion>), which provides an alternative syntax file to the vim default.
>
> I am using Vim 8's builtin packages to load it.
>
> Whenever I load it via Vim's package system, it is read after the default cf syntax file (I got this information by looking at :scriptnames), but if I copy the syntax file to ~/.vim/syntax, it is read before the default syntax file. The plugin aborts if b:current_syntax is set, and it is set by the default cf syntax file. Thus, the plugin syntax file is never applied.
>
> How can I resolve this? Are syntax files under pack/ always read after the default syntax files?
>
> Ideally, I'd like to keep this plugin in pack/*/opt/ and load it only for cf files.

The 'runtimepath' is updated with the directory of the package. It is
added after the directory that matches, otherwise at the end.

Is your package also under ~/.vim/syntax ? If not, then put it there.

--
Ten bugs in the hand is better than one as yet undetected.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: I'd emulate Ctrl-Space keypress and CLI with Esc using map

On Wed, Apr 25, 2018 at 6:15 AM, Takao Fujiwara <fujiwara@redhat.com> wrote:
> I'd like to create a new shortcut key of `F4` to send Esc to vim but
> Ctrl-space to xterm, gnome-terminal instead of vim.
>
> Seems the command `imap <F4> <Esc> :call feedkeys("\<C-Space>")<CR>` does
> not send Ctrl-Space.
>
> Do you have any ideas?
>
> I also tried the two commands:
>
> nmap <silent> <F4> :!ibus engine anthy<CR>a
> imap <silent> <F5> <Esc>:!ibus engine xkb:us::eng<CR><CR>
>
> They work if I run each command directly in vim buffer. But they do not work
> if I save them in vimrc.
>
> Do you have any ideas?

See :help CTRL-\_CTRL-G

N.B.
1. You can use a single {lhs} for nmap and imap, Vim won't mix them up.
2. (about the RTFM above) 'insertmode' should only be set in the
so-called "easy Vim" (actually a Notepad look-alike :-P )

Best regards,
Tony.

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tuesday, April 24, 2018

Re: Variable tabstop size

On Mi, 25 Apr 2018, Tony Mechelynck wrote:

> On Wed, Apr 25, 2018 at 6:25 AM, Gustavo Ribeiro Croscato
> <croscato@gmail.com> wrote:
> > Hi everyone!
> >
> > Is there any option or plugin like "colorcolumn" but for set tabstop at variable positions?
> >
> > Or maybe something like emacs tab-stop-list?
> >
> > Thanks!
>
> There is but it is not yet part of Vim (it is being considered for
> inclusion). You must recompile with a few changes, and I don't know
> exactly where they are to be found, but I think Christian Brabandt
> knows. If you are willing, you can help test this new option and maybe
> help convince Bram that it is more useful than dangerous.

The patch is here: https://github.com/vim/vim/pull/2711

Best,
Christian
--
Wir lernen aus Erfahrung, daß die Menschen nichts aus Erfahrung
lernen.
-- George Bernard Shaw

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Variable tabstop size

On Wed, Apr 25, 2018 at 6:25 AM, Gustavo Ribeiro Croscato
<croscato@gmail.com> wrote:
> Hi everyone!
>
> Is there any option or plugin like "colorcolumn" but for set tabstop at variable positions?
>
> Or maybe something like emacs tab-stop-list?
>
> Thanks!

There is but it is not yet part of Vim (it is being considered for
inclusion). You must recompile with a few changes, and I don't know
exactly where they are to be found, but I think Christian Brabandt
knows. If you are willing, you can help test this new option and maybe
help convince Bram that it is more useful than dangerous.

Best regards,
Tony.

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Variable tabstop size

Hi everyone!

Is there any option or plugin like "colorcolumn" but for set tabstop at variable positions?

Or maybe something like emacs tab-stop-list?

Thanks!

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I'd emulate Ctrl-Space keypress and CLI with Esc using map

I'd like to create a new shortcut key of `F4` to send Esc to vim but Ctrl-space to xterm, gnome-terminal instead of vim.

Seems the command `imap <F4> <Esc> :call feedkeys("\<C-Space>")<CR>` does not send Ctrl-Space.

Do you have any ideas?

I also tried the two commands:

nmap <silent> <F4> :!ibus engine anthy<CR>a
imap <silent> <F5> <Esc>:!ibus engine xkb:us::eng<CR><CR>

They work if I run each command directly in vim buffer. But they do not work if I save them in vimrc.

Do you have any ideas?

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vim syntax plugin loading issue

I am trying to use a plugin called vim-coldfusion (https://github.com/ernstvanderlinden/vim-coldfusion), which provides an alternative syntax file to the vim default.

I am using Vim 8's builtin packages to load it.

Whenever I load it via Vim's package system, it is read after the default cf syntax file (I got this information by looking at :scriptnames), but if I copy the syntax file to ~/.vim/syntax, it is read before the default syntax file. The plugin aborts if b:current_syntax is set, and it is set by the default cf syntax file. Thus, the plugin syntax file is never applied.

How can I resolve this? Are syntax files under pack/ always read after the default syntax files?

Ideally, I'd like to keep this plugin in pack/*/opt/ and load it only for cf files.

Vim website moving to OSDN - outage April 30

Hello Vimmers,

We have given it enough time, and the decision is to move to OSDN.
This will take place on April 30, during which time the website will be
read-only until the move is done.

Why OSDN? Well, SourceForge and OSDN are very similar. Both have given
us support recently. What matters is that SourceForge had a multi-days
outage and we have seen nothing like that on OSDN.

Of course it's still possible that problems are uncovered only after
moving. Thus we keep the option open to move back. The SourceForge Vim
project will stay, at least for a while. Only the website moves.

Thanks to Christian Brabandt for doing the work!

--
hundred-and-one symptoms of being an internet addict:
258. When you want to see your girlfriend, you surf to her homepage.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Monday, April 23, 2018

Re: Problem with Obsession leaking buffers from one session to another

On Tuesday 24 April 2018 02:41,
Dave Woodfall <dave@dawoodfall.net> put forth the proposition:
>I've reported this on the Obsession issues page, but I thought I'd
>ask here in case there is some generic setting or solution that may
>help fix this.
>
>The problem is that when I open a session file using -S it contains
>buffers that were opened in either a previous session, or no session
>at all.
>
>Test case:
>
>touch a b
>vim a
>:Obsession a-test
>:q
>
>vim b
>:Obsession b-test
>:q
>
>vim -S a-test
>
>It contains a buffer with 'b'.
>
>Is there a way of fixing this? I've tried adjusting sessionoptions to
>only contain 'folds,options,winsize,terminal' but it made no difference.
>This is obviously a problem with sessions containing many buffers that
>spill into each other.
>
>Any help is greatly appreciated.
>
>Dave

Well it seems my custom viminfo setting was the cause. I had %50 in
it, which was loading previous buffers.

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Problem with Obsession leaking buffers from one session to another

I've reported this on the Obsession issues page, but I thought I'd
ask here in case there is some generic setting or solution that may
help fix this.

The problem is that when I open a session file using -S it contains
buffers that were opened in either a previous session, or no session
at all.

Test case:

touch a b
vim a
:Obsession a-test
:q

vim b
:Obsession b-test
:q

vim -S a-test

It contains a buffer with 'b'.

Is there a way of fixing this? I've tried adjusting sessionoptions to
only contain 'folds,options,winsize,terminal' but it made no difference.
This is obviously a problem with sessions containing many buffers that
spill into each other.

Any help is greatly appreciated.

Dave

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Case-insensitive completefunc

On Monday 23 April 2018 13:53,
Tony Mechelynck <antoine.mechelynck@gmail.com> put forth the proposition:
>On Mon, Apr 23, 2018 at 1:34 PM, Tony Mechelynck
><antoine.mechelynck@gmail.com> wrote:
>> On Mon, Apr 23, 2018 at 1:18 PM, David Woodfall <dave@dawoodfall.net> wrote:
>>> Hi
>>>
>>> I've been reading the help to try to make the complete menu case
>>> insensitive and I see the 'icase' setting, but for the life of me I
>>> can't figure out how to use it.
>>>
>>> If I add it to the return value in my completefunc I just get errors.
>>>
>>> fun! UserComplete(findstart, base)
>>> let line = getline(line('.'))
>>> if line =~ '^\(To\|Cc\|Bcc\|From\|Reply-To\):'
>>> return CompleteEmails(a:findstart, a:base)
>>> endif
>>> endfun
>>>
>>> I've tried making the return value a list by encasing in {} and
>>> adding , 'icase': 1 (also '1').
>>>
>>> I've tried adding it to the end of the call to add an item to the
>>> list:
>>>
>>> for m in split(system('completeemails ' . shellescape(a:base)), '\n')
>>> call add(res, m)
>>> endfor
>>> add (res, 'icase': 1)
>>> return res
>>>
>>> etc.
>>>
>>> Any help is hugely appreciated.
>>
>> • What is CompleteEmails() ?
>> • Remember that a completefunc must return a Number when a:findstart
>> is 1, a List or a Dictionary when a:findstart is 0.
>> • Your system command executes a program named "completeemails" with
>> no command-line parameters and a one-line stdin. Is that what you
>
>Oops, my bad. It was a dot not a comma. With parameters and no stdin.
>Anyway on my openSUSE Linux system there is no "completeemails" in the
>$PATH. There is something named "complete" though. YMMV, though. Which
>OS are you on?
>
>> want? Then the output of that program is split at linefeed characters
>> — you might just as well use systemlist()
>>
>> Best regards,
>> Tony.

Hi

I detailed the function and script in my thread 'Problem with
completefunc and lists':

fun! CompleteEmails(findstart, base)
if a:findstart
let line = getline('.')
let start = col('.') - 1
while start > 0 && line[start - 1] =~ '[^:,]'
let start -= 1
endwhile
return start
else
let res = []
for m in split(system('completeemails ' . shellescape(a:base)), '\n')
call add(res, m)
endfor
return res
endif
endfun

fun! UserComplete(findstart, base)
let line = getline(line('.'))
if line =~ '^\(To\|Cc\|Bcc\|From\|Reply-To\):'
return CompleteEmails(a:findstart, a:base)
endif
endfun

And my completer script:

#################################
#!/bin/sh

afile="$HOME/.mutt/aliases"
base=$(echo "$@" | sed "s%^ %%g")

aliases=$(cut -d' ' -f2- $afile | grep -iE "^$base" | cut -d' ' -f2- \
| sed "s%^% %")
names=$(cut -d' ' -f3- $afile | grep -iE "^$base" \
| sed "s%^% %")
addresses=$(cut -d'<' -f2 $afile | cut -d'>' -f1 | grep -iE "^$base" \
| sed "s%^% %")

printf "%s\n%s\n%s" "$aliases" "$names" "$addresses" | sort -u
###############################

The script and function work fine.

When the menu is first activated it is case-insensitive because it uses 'grep
-i'. However, if I type more or backspace it becomes case-sensitive, which I
guess is the default for the completion menu. That's what I want to change.

Thanks

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Case-insensitive completefunc

On Mon, Apr 23, 2018 at 1:34 PM, Tony Mechelynck
<antoine.mechelynck@gmail.com> wrote:
> On Mon, Apr 23, 2018 at 1:18 PM, David Woodfall <dave@dawoodfall.net> wrote:
>> Hi
>>
>> I've been reading the help to try to make the complete menu case
>> insensitive and I see the 'icase' setting, but for the life of me I
>> can't figure out how to use it.
>>
>> If I add it to the return value in my completefunc I just get errors.
>>
>> fun! UserComplete(findstart, base)
>> let line = getline(line('.'))
>> if line =~ '^\(To\|Cc\|Bcc\|From\|Reply-To\):'
>> return CompleteEmails(a:findstart, a:base)
>> endif
>> endfun
>>
>> I've tried making the return value a list by encasing in {} and
>> adding , 'icase': 1 (also '1').
>>
>> I've tried adding it to the end of the call to add an item to the
>> list:
>>
>> for m in split(system('completeemails ' . shellescape(a:base)), '\n')
>> call add(res, m)
>> endfor
>> add (res, 'icase': 1)
>> return res
>>
>> etc.
>>
>> Any help is hugely appreciated.
>
> • What is CompleteEmails() ?
> • Remember that a completefunc must return a Number when a:findstart
> is 1, a List or a Dictionary when a:findstart is 0.
> • Your system command executes a program named "completeemails" with
> no command-line parameters and a one-line stdin. Is that what you

Oops, my bad. It was a dot not a comma. With parameters and no stdin.
Anyway on my openSUSE Linux system there is no "completeemails" in the
$PATH. There is something named "complete" though. YMMV, though. Which
OS are you on?

> want? Then the output of that program is split at linefeed characters
> — you might just as well use systemlist()
>
> Best regards,
> Tony.

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Case-insensitive completefunc

On Mon, Apr 23, 2018 at 1:18 PM, David Woodfall <dave@dawoodfall.net> wrote:
> Hi
>
> I've been reading the help to try to make the complete menu case
> insensitive and I see the 'icase' setting, but for the life of me I
> can't figure out how to use it.
>
> If I add it to the return value in my completefunc I just get errors.
>
> fun! UserComplete(findstart, base)
> let line = getline(line('.'))
> if line =~ '^\(To\|Cc\|Bcc\|From\|Reply-To\):'
> return CompleteEmails(a:findstart, a:base)
> endif
> endfun
>
> I've tried making the return value a list by encasing in {} and
> adding , 'icase': 1 (also '1').
>
> I've tried adding it to the end of the call to add an item to the
> list:
>
> for m in split(system('completeemails ' . shellescape(a:base)), '\n')
> call add(res, m)
> endfor
> add (res, 'icase': 1)
> return res
>
> etc.
>
> Any help is hugely appreciated.

• What is CompleteEmails() ?
• Remember that a completefunc must return a Number when a:findstart
is 1, a List or a Dictionary when a:findstart is 0.
• Your system command executes a program named "completeemails" with
no command-line parameters and a one-line stdin. Is that what you
want? Then the output of that program is split at linefeed characters
— you might just as well use systemlist()

Best regards,
Tony.

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Case-insensitive completefunc

Hi

I've been reading the help to try to make the complete menu case
insensitive and I see the 'icase' setting, but for the life of me I
can't figure out how to use it.

If I add it to the return value in my completefunc I just get errors.

fun! UserComplete(findstart, base)
let line = getline(line('.'))
if line =~ '^\(To\|Cc\|Bcc\|From\|Reply-To\):'
return CompleteEmails(a:findstart, a:base)
endif
endfun

I've tried making the return value a list by encasing in {} and
adding , 'icase': 1 (also '1').

I've tried adding it to the end of the call to add an item to the
list:

for m in split(system('completeemails ' . shellescape(a:base)), '\n')
call add(res, m)
endfor
add (res, 'icase': 1)
return res

etc.

Any help is hugely appreciated.

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: 'normal' doesn't trigger TextChangedI

On So, 22 Apr 2018, Lifepillar wrote:

> >Also try using:
> > call test_override("char_avail", 1)
> >
>
> Does that prevent feedkeys() to remap keys?

I don't think it does.

Best,
Christian
--
Über eine Spur von Geist in einer Frau freuen wir uns ebenso wie über
ein paar Worte, die ein Papagei richtig herausbringt.
-- Jonathan Swift

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Problem with completefunc and lists

On Monday 23 April 2018 10:52,
Dave Woodfall <dave@dawoodfall.net> put forth the proposition:
>On Monday 23 April 2018 10:06,
>Dave Woodfall <dave@dawoodfall.net> put forth the proposition:
>>I made a custom completefunc for email addresses from the tip here:
>>https://gitlab.com/muttmua/mutt/wikis/ConfigTricks
>>
>>fun! CompleteEmails(findstart, base)
>>if a:findstart
>> let line = getline('.')
>> let start = col('.') - 1
>> while start > 0 && line[start - 1] =~ '[^:,]'
>> let start -= 1
>> endwhile
>> return start
>>else
>> let res = []
>> for m in split(system('completeemails ' . shellescape(a:base)), '\n')
>> call add(res, m)
>> endfor
>> return res
>>endif
>>endfun
>>
>>fun! UserComplete(findstart, base)
>>let line = getline(line('.'))
>>if line =~ '^\(To\|Cc\|Bcc\|From\|Reply-To\):'
>> return CompleteEmails(a:findstart, a:base)
>>endif
>>endfun
>>
>>And my completer script:
>>
>>#################################
>>#!/bin/sh
>>
>>afile="$HOME/.mutt/aliases"
>>base=$(echo "$@" | sed "s%^ %%g")
>>
>>aliases=$(cut -d' ' -f2- $afile | grep -iE "^$base" | cut -d' ' -f2- \
>>| sed "s%^% %")
>>names=$(cut -d' ' -f3- $afile | grep -iE "^$base" \
>>| sed "s%^% %")
>>addresses=$(cut -d'<' -f2 $afile | cut -d'>' -f1 | grep -iE "^$base" \
>>| sed "s%^% %")
>>
>>printf "%s\n%s\n%s" "$aliases" "$names" "$addresses" | sort -u
>>################################
>>
>>When querying the script it works, but when I select an entry I get
>>": &" added to the end of the line.
>>
>>This even happens if I put this in the top of the script:
>>
>>echo " a"
>>echo " b"
>>echo " c"
>>exit
>>
>>It doesn't do this when using a string, like the CompleteMonths()
>>example in the docs.
>>
>>Why is it adding the ": &" to the end?
>
>Hmm I've just run :imap <CR> and this was the output:
>
>i <CR> *@pumvisible() ? "\<C-Y>: &<Tab>" : "\<C-G>u\<CR>"
>
>I've no idea where that is coming from.

Found it. It was from an old text.vim file I made years ago.

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Problem with completefunc and lists

On Monday 23 April 2018 10:06,
Dave Woodfall <dave@dawoodfall.net> put forth the proposition:
>I made a custom completefunc for email addresses from the tip here:
>https://gitlab.com/muttmua/mutt/wikis/ConfigTricks
>
>fun! CompleteEmails(findstart, base)
> if a:findstart
> let line = getline('.')
> let start = col('.') - 1
> while start > 0 && line[start - 1] =~ '[^:,]'
> let start -= 1
> endwhile
> return start
> else
> let res = []
> for m in split(system('completeemails ' . shellescape(a:base)), '\n')
> call add(res, m)
> endfor
> return res
> endif
>endfun
>
>fun! UserComplete(findstart, base)
> let line = getline(line('.'))
> if line =~ '^\(To\|Cc\|Bcc\|From\|Reply-To\):'
> return CompleteEmails(a:findstart, a:base)
> endif
>endfun
>
>And my completer script:
>
>#################################
>#!/bin/sh
>
>afile="$HOME/.mutt/aliases"
>base=$(echo "$@" | sed "s%^ %%g")
>
>aliases=$(cut -d' ' -f2- $afile | grep -iE "^$base" | cut -d' ' -f2- \
> | sed "s%^% %")
>names=$(cut -d' ' -f3- $afile | grep -iE "^$base" \
> | sed "s%^% %")
>addresses=$(cut -d'<' -f2 $afile | cut -d'>' -f1 | grep -iE "^$base" \
> | sed "s%^% %")
>
>printf "%s\n%s\n%s" "$aliases" "$names" "$addresses" | sort -u
>################################
>
>When querying the script it works, but when I select an entry I get
>": &" added to the end of the line.
>
>This even happens if I put this in the top of the script:
>
>echo " a"
>echo " b"
>echo " c"
>exit
>
>It doesn't do this when using a string, like the CompleteMonths()
>example in the docs.
>
>Why is it adding the ": &" to the end?

Hmm I've just run :imap <CR> and this was the output:

i <CR> *@pumvisible() ? "\<C-Y>: &<Tab>" : "\<C-G>u\<CR>"

I've no idea where that is coming from.

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Problem with completefunc and lists

I made a custom completefunc for email addresses from the tip here:
https://gitlab.com/muttmua/mutt/wikis/ConfigTricks

fun! CompleteEmails(findstart, base)
if a:findstart
let line = getline('.')
let start = col('.') - 1
while start > 0 && line[start - 1] =~ '[^:,]'
let start -= 1
endwhile
return start
else
let res = []
for m in split(system('completeemails ' . shellescape(a:base)), '\n')
call add(res, m)
endfor
return res
endif
endfun

fun! UserComplete(findstart, base)
let line = getline(line('.'))
if line =~ '^\(To\|Cc\|Bcc\|From\|Reply-To\):'
return CompleteEmails(a:findstart, a:base)
endif
endfun

And my completer script:

#################################
#!/bin/sh

afile="$HOME/.mutt/aliases"
base=$(echo "$@" | sed "s%^ %%g")

aliases=$(cut -d' ' -f2- $afile | grep -iE "^$base" | cut -d' ' -f2- \
| sed "s%^% %")
names=$(cut -d' ' -f3- $afile | grep -iE "^$base" \
| sed "s%^% %")
addresses=$(cut -d'<' -f2 $afile | cut -d'>' -f1 | grep -iE "^$base" \
| sed "s%^% %")

printf "%s\n%s\n%s" "$aliases" "$names" "$addresses" | sort -u
################################

When querying the script it works, but when I select an entry I get
": &" added to the end of the line.

This even happens if I put this in the top of the script:

echo " a"
echo " b"
echo " c"
exit

It doesn't do this when using a string, like the CompleteMonths()
example in the docs.

Why is it adding the ": &" to the end?

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sunday, April 22, 2018

Re: 'normal' doesn't trigger TextChangedI

On 23/03/2018 22:39, Bram Moolenaar wrote:
>
> Life wrote:
>
>> On 23/03/2018 15:41, Jason Felice wrote:
>>> I couldn't get feedkeys() to trigger TextChangedI either, so I've
>>> rewritten my tests to use a terminal with small delays between
>>> keystrokes, and this works.
>>
>> I have the same problem (writing tests for a plugin that uses
>> TextChangedI, but TextChangedI doesn't seem to be triggered when using
>> feedkeys()). Would you mind showing an example of how you write a test
>> to work around that?
>
> Also try using:
> call test_override("char_avail", 1)
>

Does that prevent feedkeys() to remap keys?

Life.

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Saturday, April 21, 2018

Re: Is this case fitting search/replace possible?

On Saturday 21 April 2018 19:04,
tuxic@posteo.de <tuxic@posteo.de> put forth the proposition:
>Hi,
>
>I want to search and replace in the following manner:
>
>Find the word. whjch should be replaced in a case insensitive manner.
>But:
>Replace the word by preserving the case.
>
>Example:
>Given world is "search" which shoyld be replaced by "replace"
>
>When finding replace it with
>"Search" "Replace"
>"SEARCH" "REPLACSE"
>"search" "replace"
>"SeArCh" "RePlAce"
>and so on...
>
>Is it possible without any further interaction?
>
>Thanks a lot in advance!
>Cheers!
>Meino

If I understand you correctly, this is already done by

:set ignorecase

The replace string will still be case sensitive, even though the
search string isn't.

-Dave

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Is this case fitting search/replace possible?

On Saturday, April 21, 2018 at 12:04:12 PM UTC-5, tuxic@posteo.de wrote:
> Hi,
>
> I want to search and replace in the following manner:
>
> Find the word. whjch should be replaced in a case insensitive manner.
> But:
> Replace the word by preserving the case.
>
> Example:
> Given world is "search" which shoyld be replaced by "replace"
>
> When finding replace it with
> "Search" "Replace"
> "SEARCH" "REPLACSE"
> "search" "replace"
> "SeArCh" "RePlAce"
> and so on...
>
> Is it possible without any further interaction?
>
> Thanks a lot in advance!
> Cheers!
> Meino

I think the "abolish" plugin *may* provide what you want. At least, for some of your cases.

https://github.com/tpope/vim-abolish

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Is this case fitting search/replace possible?

Hi,

I want to search and replace in the following manner:

Find the word. whjch should be replaced in a case insensitive manner.
But:
Replace the word by preserving the case.

Example:
Given world is "search" which shoyld be replaced by "replace"

When finding replace it with
"Search" "Replace"
"SEARCH" "REPLACSE"
"search" "replace"
"SeArCh" "RePlAce"
and so on...

Is it possible without any further interaction?

Thanks a lot in advance!
Cheers!
Meino

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thursday, April 19, 2018

Re: modeline: syntax or filetype?

On Wed, Apr 18, 2018 at 9:33 AM, Alexander Dahl <post@lespocky.de> wrote:
Hei hei,

in the ptxdist project [1] we have files of type kconfig and make,
where the filetype is not detected by default, so since the very first
commits in the project vim modelines were used. Over time the options
used there evolved and are not consistent anymore:

    % grep -h 'vim:' rules/*.make | sort | uniq
    # vim: ft=make noet
    # vim: ft=make noet ts=8 sw=8
    # vim: ft=make ts=8 noet tw=80
    # vim: ft=make ts=8 tw=80
    # vim: syntax=make
    # vim: syntax=make tabstop=8

    % grep -h 'vim:' rules/*.in | sort | uniq
    # vim: ft=kconfig noet tw=72
    # vim: ft=kconfig ts=8 noet tw=80
    # vim: set ft=kconfig:
    # vim: set ft=kconfig sw=8 ts=8 noet:
    # vim: set sw=8 ts=8 noet ft=kconfig:
    # vim: set ts=8 sw=8 noet ft=kconfig:
    # vim: syntax=kconfig

Before taking some effort to make this consistent again over existing
files and templates for new files, I wanted to ask about the
difference between 'syntax' and 'filetype'? From the documentation I
understood, filetype sets syntax and additional options. Also from
digging around I learned there is one set of definition files
distributed with Vim for filetype and another set for syntax, not
necessarily both for a given type of file? Can that cause problems,
e.g. if the modeline tries to set a filetype for which no definition
exists in the distributed Vim?

'syntax' defines how to do syntax highlighting. 'filetype' sets other things, for instance buffer-local options and/or mappings. 'filetype' also sets 'syntax', usually to the same name.

If there is no filetype-plugin for the relevant filetype in any directory in 'runtimepath', the result is the same as if there had been an empty one, except that depending on the 'verbose' setting you may get a warning message telling you that no ftplugin script was found. This is not an error, and (if there is a syntax script) the proper syntax highlighting will be set.

My problem with the current files: I have expandtab set in my personal
vimrc as a default. When I open a file called 'Makefile' Vim
recognizes it as filetype=make and automatically sets 'noexpandtab'
which you need in a makefile to not produce non working files.

Yes, in makefiles tabs and spaces don't have the same meaning so it's important not to replace tabs by spaces when editing them.

Now with makefiles not automatically recognized by Vim (different
name/extension) this happens:

* Without modeline: ft=conf, expandtab can be anything: bad
* With modeline 'syntax=make': syntax highlighting correct, but
expandtab set, while noexpandtab would be needed: bad
* With modeline 'syntax=make noet': fine
* With modeline 'ft=make': fine
 
This is the expected behaviour if Vim fails to recognize the filetype automatically. The ":setlocal noet" command is found in the ftplugin, not in the syntax script, which busies itself with highlighting and nothing else.

Now it seems to me, setting ft in the modeline would be better, but
can it have undesired side effects? Perhaps with options I did not
consider?

You can find that out by reading $VIMRUNTIME/ftplugin/make.vim plus (if there are any) ftplugin/make.vim files under any other directories in 'runtimepath'. Normally there won't be any, unless you or your systems administrator have put them there.

What would you recommend to set in the modeline in general? Does it
make sense to set 'syntax' instead of 'filetype'? Or should 'filetype'
be preferred, because the options would set things right, which are
maybe set unfavorable by e.g. vimrc?

Look what is done in the modelines at the bottom of help files, IMHO they are a good example.

Should 'noet' be set additionally to 'ft' or 'syntax' in case some
definition files for syntax and/or filetype are missing? Or rely on ft
only?

I wouldn't put in modelines settings redundant with what is already set in the relevant $VIMRUNTIME/ftplugin/*.vim script, and if there are settings I want to set for _all_ files of a given filetype, I would put them (on Unix) in the relevant ~/.vim/ftplugin/*.vim or (on Windows) in the relevant ~/vimfiles/ftplugin/*.vim (where I give the path in Vim language).

Thanks for reading and in the hope of some helpful reply
Alex

[1] https://www.ptxdist.org/

Best regards,
Tony.

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Wednesday, April 18, 2018

embedded syntax filetype detection for smart indent

Hi,

In vimscript, is it possible to change filetype detection into embed syntax betwween EOF like this code :


fun! helper#XpathList(A,L,P) "{{{

ruby << EOF

require 'ox'
require 'open-uri'

# 0.on one xml file
xmlpath = ENV['tmp']+"/localConf.xml"
doc = Ox.parse(open(xmlpath).read)

# 1.retrieve all sorted child possible elements'name
arr = doc.root.locate('*/' + Vim::evaluate('a:A') )

arr_out = {}
arr.each do |a|
a.each do |key, value|
arr_out[key.value]=""
end
end

# 2.Proposal Array/Vim List returned
Vim::command("return " + arr_out.keys().to_s )

EOF # Ruby end
endfunction "}}}
" }}} Vimscript end


Finally could we use smart gg=GG that will understand vim syntax and embed delimited syntax like ruby, python etc..

See :h ruby

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.