Thursday, November 21, 2019

Re: Are the --enable-hangulinput and --enable-xim confilct?

Namsh wrote:

> >> 2019-08-25 오후 2:25에 Hongyi Zhao 이(가) 쓴 글:
> >>> Hi,
> >>>
> >>> I try to build vim with the --enable-hangulinput and --enable-xim
> >>> confilct at the same time, but failed with error:
> >>>
> >>> -------------------------
> >>> vim.h:1585:63: error: called object 'size_t' is not a function or
> >>> function pointer
> >>> #define STRNCMP(d, s, n) strncmp((char *)(d), (char *)(s), (size_t)(n))
> >>> ^
> >>> ex_docmd.c:8459:6: note: in expansion of macro 'STRNCMP'
> >>> if (STRNCMP(arg, "FALLBACK ", 9) == 0)
> >>> ^~~~~~~
> >>> In file included from /usr/include/wchar.h:887:0,
> >>> from spell.h:250,
> >>> from vim.h:2110,
> >>> from ex_docmd.c:14:
> >>> /usr/include/x86_64-linux-gnu/bits/wchar2.h:507:20: note: declared here
> >>> __fortify_function size_t
> >>> ^~~~~~
> >>> Makefile:3059: recipe for target 'objects/ex_docmd.o' failed
> >>> make[1]: *** [objects/ex_docmd.o] Error 1
> >>> make[1]: Leaving directory '/home/werner/software/editor/vim/vim.git/src'
> >>> Makefile:26: recipe for target 'first' failed
> >>> make: *** [first] Error 2
> >>> -----------------------------
> >>>
> >>> Are these two options conflict?
> >>
> >> Regardless of compilation error, the hangulin feature is for
> >> environments where XIM is not available.
> >>
> >> You can find next line with ':help hangul'.
> >> ./configure --with-x --enable-multibyte --enable-hangulinput \
> >> --disable-xim
> >
> > That's a bit of a disadvantage when someone tries to build a version
> > that works with multiple languages. Can we make this a runtime choice
> > instead of a compile time choice? No idea how much work that would be.
>
> Here is a minimal patch (no documentation, no indenting to minimize).
> If vim supports both xim and hangulinpt and user set 'imdisable',
> hangulinput feature is selected.
>
> I tested this patch by adding '--enable-xim --enable-hangulinput' to my
> default configure option.
> $ auto/configure --enable-perlinterp=no --disable-gpm
> --enable-python3interp=dynamic --enable-tclinterp=no --enable-cscope
> --with-features=huge --enable-terminal --enable-multibyte --enable-xim
> --enable-hangulinput --prefix=/opt/local --with-x --enable-gui=gtk3
>
> While testing this patch, I noticed one glitch.
> Though I set 'imdisable' in the vimrc and I confirmed the setting with
> ':set imdisable?', when I typed S-Space for the first time, vim connects
> to XIM. After that, go to english input mode and type S-Space again, vim
> enters to hangulinput mode. My system environement may cause this glitch??

Now that I try this patch I notice that hangulin.c doesn't build.
Since nobody complained and this input method is unmaintained, let's
just remove it.

I hope someone can re-implement this for utf-8 encoding.

--
hundred-and-one symptoms of being an internet addict:
98. The Alta Vista administrators ask you what sites are missing
in their index files.

/// 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/201911211546.xALFkrp9004253%40masaka.moolenaar.net.

Re: vim Startup Problem: autoreplace

On Mi, 20 Nov 2019, Heinz Meier wrote:

> Hi,
>
> every time I start vim it replaces the end of the recent line with the letter
> "g" and end-of-line. This is very annoying. It does not happen if I edit the
> files as root.
>
> My ~/.vimrc is empty.
>
> Any idea what is wrong with my setup?

This is most likely terminal related. However those issues should be
fixed with the latest version. But you mnetioned neither vim nor
terminal version. Make sure your $TERM variable is configured correctly.
Also please show the output of v:termresponse.


Best,
Christian
--
Vor allem der Seele wegen ist es nötig, den Körper zu üben.
-- Jean Jacques Rousseau

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20191121083910.GD498%40256bit.org.

Wednesday, November 20, 2019

vim Startup Problem: autoreplace

Hi,

every time I start vim it replaces the end of the recent line with the letter "g" and end-of-line. This is very annoying. It does not happen if I edit the files as root.

My ~/.vimrc is empty.

Any idea what is wrong with my setup?

Michael Schwartzkopff

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/340ed314-88e7-41ab-bc1d-f4be2a786d9a%40googlegroups.com.

Tuesday, November 19, 2019

Re: Trailing ^M on Windows

Hi Tony,

I was actually writing a plugin for this, and since I could change its implementation I ended up with something like (note the call to substitute() right after system()):

function! s:paste(...) " {{{
  let l:after = get(a:, 1, 1)
  let reg_save = @@

  let @@ = system(g:cb_paste_prg)
  " XXX pastin on Windows somehow leaves trailing ^M
  " gotta figure out a better way to fix this, but
  " for now, this will do!
  let @@ = substitute(@@, "\r\n", "\n", "g")
  setlocal paste
  if l:after
    exe 'normal p'
  else
    exe 'normal P'
  endif
  setlocal nopaste

  let @@ = reg_save
endfunction " }}}

I will leave this here for a little while, and then I will probably cross-post it on vim_dev.

Thanks again for the help.

On Mon, Nov 18, 2019 at 10:43 PM Tony Mechelynck <antoine.mechelynck@gmail.com> wrote:
On Mon, Nov 18, 2019 at 4:11 PM Matteo Landi <matteo@matteolandi.net> wrote:
>
> Hi Tony,
>
> The thing is, :read! appears to be stripping ^M already, irrespective of the use of ++opts:
>
>   :read !powershell.exe Get-Clipboard
>   :read ++ff=unix !powershell.exe Get-Clipboard
>   :read ++ff=dos !powershell.exe Get-Clipboard
>
> To be honest, I'd expect the second one, where we specify ++ff=unix, to leave trailing ^M, but somehow that's not happening, and for your reference (after I vim -u NONE):
>
>   :verbose set ff
>
> Returns 'fileformat=unix'
>
>   :verbose set ffs
>
> Returns 'fileformats=unix,dos'
>
> So am I correct if I say that there is something "weird" going on with system()?  I also found the following at the end of system()'s help page, but somehow the experienced behavior is not the documented one:
>
>   To make the result more system-independent, the shell output
>   is filtered to replace <CR> with <NL> for Macintosh, and
>   <CR><NL> with <NL> for DOS-like systems.
>
> I even tried to give systemlist() a go, but each entry of the array still has that trailing ^M, so it really seems like Vim cannot properly guess the fileformat from the command output.
>
> I am really in the dark here.

So am I.

As a last resort, the following Normal-mode mapping will remove (after
the fact) all ^M characters found at he end of a line:

:map <F5> :%s/<Ctrl-M>$//<CR>

Of course, you can replace <F5> by something else (if for instance
your Normal-mode F5 key is already mapped).

Meaning of the {rhs}:
        :       start an ex-command
        %       or 1,$ : from top to bottom of the file
        s       :s[ubstitute] (search and replace)
        /       replace what
        <Ctrl-M>  (typed as such: less-than, C, etc.) : ^M (carriage return)
        $       at end-of-line
        /       replace by what
        (nothing)   replace by nothing
        /       end of replace-what text
        (nothing)   no flags: replace once (at most) per line (N.B.
there can be only one end-of-line per line)
        <CR>    end of ex-command

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXsaTWz2Mw-8nKe5H05_2WFG_iPNnEtMa1bCQ3aN0Ja-7g%40mail.gmail.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

---
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAKpQHWbLxLLvgQhRBX1b5Lg8xZZYWKAM-rJa4aw3Ofvyhkaqug%40mail.gmail.com.

Monday, November 18, 2019

Re: Trailing ^M on Windows

On Mon, Nov 18, 2019 at 4:11 PM Matteo Landi <matteo@matteolandi.net> wrote:
>
> Hi Tony,
>
> The thing is, :read! appears to be stripping ^M already, irrespective of the use of ++opts:
>
> :read !powershell.exe Get-Clipboard
> :read ++ff=unix !powershell.exe Get-Clipboard
> :read ++ff=dos !powershell.exe Get-Clipboard
>
> To be honest, I'd expect the second one, where we specify ++ff=unix, to leave trailing ^M, but somehow that's not happening, and for your reference (after I vim -u NONE):
>
> :verbose set ff
>
> Returns 'fileformat=unix'
>
> :verbose set ffs
>
> Returns 'fileformats=unix,dos'
>
> So am I correct if I say that there is something "weird" going on with system()? I also found the following at the end of system()'s help page, but somehow the experienced behavior is not the documented one:
>
> To make the result more system-independent, the shell output
> is filtered to replace <CR> with <NL> for Macintosh, and
> <CR><NL> with <NL> for DOS-like systems.
>
> I even tried to give systemlist() a go, but each entry of the array still has that trailing ^M, so it really seems like Vim cannot properly guess the fileformat from the command output.
>
> I am really in the dark here.

So am I.

As a last resort, the following Normal-mode mapping will remove (after
the fact) all ^M characters found at he end of a line:

:map <F5> :%s/<Ctrl-M>$//<CR>

Of course, you can replace <F5> by something else (if for instance
your Normal-mode F5 key is already mapped).

Meaning of the {rhs}:
: start an ex-command
% or 1,$ : from top to bottom of the file
s :s[ubstitute] (search and replace)
/ replace what
<Ctrl-M> (typed as such: less-than, C, etc.) : ^M (carriage return)
$ at end-of-line
/ replace by what
(nothing) replace by nothing
/ end of replace-what text
(nothing) no flags: replace once (at most) per line (N.B.
there can be only one end-of-line per line)
<CR> end of ex-command

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXsaTWz2Mw-8nKe5H05_2WFG_iPNnEtMa1bCQ3aN0Ja-7g%40mail.gmail.com.

Re: Trailing ^M on Windows

Hi Tony,

The thing is, :read! appears to be stripping ^M already, irrespective of the use of ++opts:

  :read !powershell.exe Get-Clipboard
  :read ++ff=unix !powershell.exe Get-Clipboard
  :read ++ff=dos !powershell.exe Get-Clipboard

To be honest, I'd expect the second one, where we specify ++ff=unix, to leave trailing ^M, but somehow that's not happening, and for your reference (after I vim -u NONE):

  :verbose set ff

Returns 'fileformat=unix'

  :verbose set ffs

Returns 'fileformats=unix,dos'

So am I correct if I say that there is something "weird" going on with system()?  I also found the following at the end of system()'s help page, but somehow the experienced behavior is not the documented one:

  To make the result more system-independent, the shell output
  is filtered to replace <CR> with <NL> for Macintosh, and
  <CR><NL> with <NL> for DOS-like systems.

I even tried to give systemlist() a go, but each entry of the array still has that trailing ^M, so it really seems like Vim cannot properly guess the fileformat from the command output.

I am really in the dark here.

Thanks,

On Sun, Nov 17, 2019 at 5:57 AM Tony Mechelynck <antoine.mechelynck@gmail.com> wrote:
On Sat, Nov 16, 2019 at 7:06 PM Matteo Landi <matteo@matteolandi.net> wrote:
>
> On 11/16, Tony Mechelynck wrote:
> >On Windows, when you read a file in Vim and every (or almost every)
> >line ends with ^M, it usually means that the last line lacks an
> >end-of-line, which made Vim read the whole file as if it were a Unix
> >file. This is how I would fix such a file:
> >
> >    :new ++ff=dos filename.ext
> >    :wq
> >
> >(this has the side-effect of opening then closing a new window for
> >that file) — see ":help ++opt".
> >Reading the file with 'fileformat' explicitly set to dos forces both
> >CR+LF or LF alone (or nothing at end of file) to be recognised as
> >ends-of-lines. Writing the file (which still has 'fileformat' set to
> >dos) writes a proper CR+LF Dos/Windows end-of-line at the end of every
> >line including the last one, so the next time you read it it will be
> >recognised as a Windows file and you won't see those pesky ^M (i.e.
> >carriage-return) characters (they are still there but they are part of
> >the normal Dos/Window end-of-line).
> >
> >Or if you want to transmit the file to be read on a Unix system, you
> >can replace :wq by :wq ++ff=unix — in that case all lines will get a
> >proper LF-only Unix end-of-line, which both Vim (on any platform) and
> >any Unix program will be able to recognise properly. In this case the
> >^M characters are not even there so no one will see them.
> >
>
> Thanks Tony for your reply, but I am afraid I did not properly explain
> myself earlier, apologies.
>
> The actual problem I dealing with is trailing ^M when reading from the
> OS clipboard; I started with dumping trailing \r\n data on a file only
> to make it easier for people to reproduce my problem, but ultimately I
> need to figure out how to read from the clipboard without having ^M
> added at the end of each line.
>
> So, going back to my experiments, can anyone suggest why, the following
> strips trailing ^M:
>
>   :read! powershell.exe Get-Clipboard
>
> While this one instead, doesn't?
>
>   :let @@ = system('powershell.exe Get-Clipboard') | exe 'normal p'
>
> Also, for those who might wonder: reading from the */+ registers
> unfortunately is not an option, as I am trying build a mini-plugin
> around "cb" (https://github.com/iamFIREcracker/cb) which is a script
> that can work via ssh too where you don't have access to the OS
> clipboard; anyway, this is the reason why I am trying to read the
> content of the OS clipboard by using a command, `powershell.exe
> Get-Clipboard`, instead of using the */+ register.
>
> Let me know if this makes things a little more clear.
>
> Thanks.
>
> --
> Matteo Landi
> https://matteolandi.net

My previous answer still applies to this usecase.

As the documentation for :read says, this command accepts a ++opt
modifier, even when used with an !external command.

I expect that

        :read ++ff=dos !powershell.exe Get-Clipboard

(with the ++ff= modifier before the exclamation mark) will give you
the result you want, without the ^M characters. Try it, then tell us
if it works.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXvV7bzJfAGK%2BhnMmwqutb-Pee3gs1yv%3DKepK7929AL%3DDg%40mail.gmail.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

---
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAKpQHWZWnAZg86ey-1xcBhenW4tTCe8Y-vvR3DXkxS_5LYnr3A%40mail.gmail.com.

Saturday, November 16, 2019

Re: Trailing ^M on Windows

On Sat, Nov 16, 2019 at 7:06 PM Matteo Landi <matteo@matteolandi.net> wrote:
>
> On 11/16, Tony Mechelynck wrote:
> >On Windows, when you read a file in Vim and every (or almost every)
> >line ends with ^M, it usually means that the last line lacks an
> >end-of-line, which made Vim read the whole file as if it were a Unix
> >file. This is how I would fix such a file:
> >
> > :new ++ff=dos filename.ext
> > :wq
> >
> >(this has the side-effect of opening then closing a new window for
> >that file) — see ":help ++opt".
> >Reading the file with 'fileformat' explicitly set to dos forces both
> >CR+LF or LF alone (or nothing at end of file) to be recognised as
> >ends-of-lines. Writing the file (which still has 'fileformat' set to
> >dos) writes a proper CR+LF Dos/Windows end-of-line at the end of every
> >line including the last one, so the next time you read it it will be
> >recognised as a Windows file and you won't see those pesky ^M (i.e.
> >carriage-return) characters (they are still there but they are part of
> >the normal Dos/Window end-of-line).
> >
> >Or if you want to transmit the file to be read on a Unix system, you
> >can replace :wq by :wq ++ff=unix — in that case all lines will get a
> >proper LF-only Unix end-of-line, which both Vim (on any platform) and
> >any Unix program will be able to recognise properly. In this case the
> >^M characters are not even there so no one will see them.
> >
>
> Thanks Tony for your reply, but I am afraid I did not properly explain
> myself earlier, apologies.
>
> The actual problem I dealing with is trailing ^M when reading from the
> OS clipboard; I started with dumping trailing \r\n data on a file only
> to make it easier for people to reproduce my problem, but ultimately I
> need to figure out how to read from the clipboard without having ^M
> added at the end of each line.
>
> So, going back to my experiments, can anyone suggest why, the following
> strips trailing ^M:
>
> :read! powershell.exe Get-Clipboard
>
> While this one instead, doesn't?
>
> :let @@ = system('powershell.exe Get-Clipboard') | exe 'normal p'
>
> Also, for those who might wonder: reading from the */+ registers
> unfortunately is not an option, as I am trying build a mini-plugin
> around "cb" (https://github.com/iamFIREcracker/cb) which is a script
> that can work via ssh too where you don't have access to the OS
> clipboard; anyway, this is the reason why I am trying to read the
> content of the OS clipboard by using a command, `powershell.exe
> Get-Clipboard`, instead of using the */+ register.
>
> Let me know if this makes things a little more clear.
>
> Thanks.
>
> --
> Matteo Landi
> https://matteolandi.net

My previous answer still applies to this usecase.

As the documentation for :read says, this command accepts a ++opt
modifier, even when used with an !external command.

I expect that

:read ++ff=dos !powershell.exe Get-Clipboard

(with the ++ff= modifier before the exclamation mark) will give you
the result you want, without the ^M characters. Try it, then tell us
if it works.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXvV7bzJfAGK%2BhnMmwqutb-Pee3gs1yv%3DKepK7929AL%3DDg%40mail.gmail.com.