On 2024-06-27, ζεδΉ <ogouo168@gmail.com> wrote:
> Why does an error occur when changing the comment of the vim9.1
> configuration file to #? 9.1 does not support #
Not sure I understand your question, but before `vim9script` you should
use the legacy comment symbol " (double quote). For example:
" vim: set sw=2 ts=2 sts=0 et fdm=marker :nospell:
" Here, legacy comments must be used
" In general, before `vim9script`, legacy syntax is assumed
if !has('vim9script')
" Still legacy Vim script syntax
echomsg 'Vim 9 script is not available')
finish
endif
vim9script
# Now, Vim 9 script syntax is assumed
# The comment delimiter must be #
Hope this helps,
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/v5kj3s%24vbo%241%40ciao.gmane.io.
Thursday, June 27, 2024
Configuration file does not support #
Why does an error occur when changing the comment of the vim9.1 configuration file to #? 9.1 does not support #
--
--
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/5706f749-f601-467c-86dd-b800f6f54efan%40googlegroups.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/5706f749-f601-467c-86dd-b800f6f54efan%40googlegroups.com.
Sunday, June 23, 2024
Re: ":b {bufname}" tab-completion uses whole filepath
On 2024-06-14, Enan Ajmain <3nan.ajmain@gmail.com> wrote:
> I use ':b' quite often. And I use a substring of the bufname to jump to
> that buffer. Works quite well.
>
> But a problem is that the substring I provide isn't only matched with
> the buffer names but also the filenames. See these examples:
>
> :ls
> 1 #h "example\predict.py" line 25
> 2 a "deeplog\deeplog.py" line 0
> 4 %a "example\train.py" line 37
> :b deep<tab>
>
> Then when I type ":b deep<tab>", the matches shown are:
>
> E:\projects\log-parsing\deeplog\example\predict.py
> deeplog\deeplog.py
> E:\projects\log-parsing\deeplog\example\train.py
>
> We can see that vim is matching the filepaths instead of only the buffer
> names. Can I change this behavior? Preferably with vimscripting, --
If you don't mind using a (lightweight) plugin, you can do it with my
Zeef¹ plugin. Zeef has a buffer switcher, which may or may not work for
you, but simplifying the creation of one tailored to your own specific
needs is the very purpose of the plugin. This is an example:
vim9script
import autoload 'zeef.vim'
def SwitchToBuffer(items: list<string>)
execute 'buffer' matchstr(items[0], '^\s*\zs\d\+')
enddef
zeef.Open(
execute('ls')->split("\n"),
SwitchToBuffer,
'Choose buffer',
{multi: false},
)
Hope this helps,
Life.
¹ https://github.com/lifepillar/vim-zeef
--
--
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/v599m0%248b7%241%40ciao.gmane.io.
> I use ':b' quite often. And I use a substring of the bufname to jump to
> that buffer. Works quite well.
>
> But a problem is that the substring I provide isn't only matched with
> the buffer names but also the filenames. See these examples:
>
> :ls
> 1 #h "example\predict.py" line 25
> 2 a "deeplog\deeplog.py" line 0
> 4 %a "example\train.py" line 37
> :b deep<tab>
>
> Then when I type ":b deep<tab>", the matches shown are:
>
> E:\projects\log-parsing\deeplog\example\predict.py
> deeplog\deeplog.py
> E:\projects\log-parsing\deeplog\example\train.py
>
> We can see that vim is matching the filepaths instead of only the buffer
> names. Can I change this behavior? Preferably with vimscripting, --
If you don't mind using a (lightweight) plugin, you can do it with my
Zeef¹ plugin. Zeef has a buffer switcher, which may or may not work for
you, but simplifying the creation of one tailored to your own specific
needs is the very purpose of the plugin. This is an example:
vim9script
import autoload 'zeef.vim'
def SwitchToBuffer(items: list<string>)
execute 'buffer' matchstr(items[0], '^\s*\zs\d\+')
enddef
zeef.Open(
execute('ls')->split("\n"),
SwitchToBuffer,
'Choose buffer',
{multi: false},
)
Hope this helps,
Life.
¹ https://github.com/lifepillar/vim-zeef
--
--
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/v599m0%248b7%241%40ciao.gmane.io.
Re: partial syntax in vim
On 2024-06-17, Andreas Otto <aotto1968zwei@gmail.com> wrote:
> Hi is it possible to change the syntax for a limit part of a file?
Yes. See :help syn-include and :help mysyntaxfile-add.
> example: tcl file with bash syntax used with "pseudo code" vim: push … vim:
I do not recommend using comments with `vim:` because they are
interpreted specially by Vim. Just use (for instance):
if {checkNotIgnore("DIFF")} {
File_Exec_BASH {
# syntax=bash
[...]
# pop syntax
} <@stdin >@stdout 2>@stderr
}
Create ~/.vim/after/syntax/tcl.vim with this content:
unlet b:current_syntax
syn include @Bash syntax/bash.vim
syn region tclBash matchgroup=Comment start=/^\s*# syntax=bash/ end=/^\s*# pop syntax/ contains=@Bash
let b:current_syntax = "tcl"
Hope this helps,
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/v598nh%2433u%241%40ciao.gmane.io.
> Hi is it possible to change the syntax for a limit part of a file?
Yes. See :help syn-include and :help mysyntaxfile-add.
> example: tcl file with bash syntax used with "pseudo code" vim: push … vim:
I do not recommend using comments with `vim:` because they are
interpreted specially by Vim. Just use (for instance):
if {checkNotIgnore("DIFF")} {
File_Exec_BASH {
# syntax=bash
[...]
# pop syntax
} <@stdin >@stdout 2>@stderr
}
Create ~/.vim/after/syntax/tcl.vim with this content:
unlet b:current_syntax
syn include @Bash syntax/bash.vim
syn region tclBash matchgroup=Comment start=/^\s*# syntax=bash/ end=/^\s*# pop syntax/ contains=@Bash
let b:current_syntax = "tcl"
Hope this helps,
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/v598nh%2433u%241%40ciao.gmane.io.
Sunday, June 16, 2024
partial syntax in vim
Hi is it possible to change the syntax for a limit part of a file?
example: tcl file with bash syntax used with "pseudo code" vim: push … vim: pop
if {checkNotIgnore("DIFF")} {
File_Exec_BASH {
# vim: push syntax=bash
set -ue
[[ "$(yes_or_no.bash 'want to exit?')" == "y" ]] && exit
declare -a files=($(find . -name .vimrc 2>/dev/null))
git diff "${files[@]}"
if [[ $(git status --porcelain "${files[@]}") ]] ; then
if [[ "$(yes_or_no.bash 'commit changes?')" = "y" ]] ; then
git commit -m lng_Shortcut.tcl "${files[@]}"
fi
:
fi
exit 0
# vim: pop syntax
} <@stdin >@stdout 2>@stderr
}
-- File_Exec_BASH {
# vim: push syntax=bash
set -ue
[[ "$(yes_or_no.bash 'want to exit?')" == "y" ]] && exit
declare -a files=($(find . -name .vimrc 2>/dev/null))
git diff "${files[@]}"
if [[ $(git status --porcelain "${files[@]}") ]] ; then
if [[ "$(yes_or_no.bash 'commit changes?')" = "y" ]] ; then
git commit -m lng_Shortcut.tcl "${files[@]}"
fi
:
fi
exit 0
# vim: pop syntax
} <@stdin >@stdout 2>@stderr
}
--
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/abc1d980-74a7-4192-a288-6ad802758888n%40googlegroups.com.
Saturday, June 15, 2024
Re: ":b {bufname}" tab-completion uses whole filepath
On Fr, 14 Jun 2024, Enan Ajmain wrote:
> On Fri, 14 Jun 2024 22:52:10 +0200
> Christian Brabandt <cblists@256bit.org> wrote:
> >
> > You could try the following mapping:
> >
> > :cnoremap <expr> B getcmdtype()==#':'&&getcmdpos()==1?'b */':'B'
> >
> > And then type :B which would expand to :b */ on the commandline and then
> > whatever you type would be anchored to the directory separator.
>
> I think the cnoremap only maps 'B' to expand to "b */" if it's at the
> start of the commandline. But what's "b */" supposed to do? I added
> this mapping and then typed "deep" (so the whole commandline became "b
> */deep" and then pressed tab. It didn't do anything. No completion.
Ah Windows, I didn't think about it. So unless you use shellslash,
you'll need to change the mapping to use a backslash instead:
:cnoremap <expr> B getcmdtype()==#':'&&getcmdpos()==1?'b *\':'B'
> Could you explain the logic behind "anchored to the directory
> separator"?
The idea is, that you want everything that you typed to be matched after
a directory separator. So instead of :b deeplog<tab> which presents you
with 3 different files, anchor the pattern to the directory separator:
\deeplog.py which Vim shall then only complete if it matches the
directory separator followed by whatever you enter.
> Note that I also tried "b *\" and "b *\\" since I'm in Windows.
Try if :b *\<pattern><tab> works for you.
Thanks,
Christian
--
Unfair animal names:
-- tsetse fly -- bullhead
-- booby -- duck-billed platypus
-- sapsucker -- Clarence
-- Gary Larson
--
--
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/Zm2eN1txfljI05dC%40256bit.org.
> On Fri, 14 Jun 2024 22:52:10 +0200
> Christian Brabandt <cblists@256bit.org> wrote:
> >
> > You could try the following mapping:
> >
> > :cnoremap <expr> B getcmdtype()==#':'&&getcmdpos()==1?'b */':'B'
> >
> > And then type :B which would expand to :b */ on the commandline and then
> > whatever you type would be anchored to the directory separator.
>
> I think the cnoremap only maps 'B' to expand to "b */" if it's at the
> start of the commandline. But what's "b */" supposed to do? I added
> this mapping and then typed "deep" (so the whole commandline became "b
> */deep" and then pressed tab. It didn't do anything. No completion.
Ah Windows, I didn't think about it. So unless you use shellslash,
you'll need to change the mapping to use a backslash instead:
:cnoremap <expr> B getcmdtype()==#':'&&getcmdpos()==1?'b *\':'B'
> Could you explain the logic behind "anchored to the directory
> separator"?
The idea is, that you want everything that you typed to be matched after
a directory separator. So instead of :b deeplog<tab> which presents you
with 3 different files, anchor the pattern to the directory separator:
\deeplog.py which Vim shall then only complete if it matches the
directory separator followed by whatever you enter.
> Note that I also tried "b *\" and "b *\\" since I'm in Windows.
Try if :b *\<pattern><tab> works for you.
Thanks,
Christian
--
Unfair animal names:
-- tsetse fly -- bullhead
-- booby -- duck-billed platypus
-- sapsucker -- Clarence
-- Gary Larson
--
--
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/Zm2eN1txfljI05dC%40256bit.org.
Friday, June 14, 2024
Re: ":b {bufname}" tab-completion uses whole filepath
junegunn/fzf.vim solves this nicely. It builds on junegunn/fzf to fuzzy search on buffer names. Look into its :Buffers alongside other handy helper methods.
On Fri, 14 Jun 2024, 20:52 Christian Brabandt, <cblists@256bit.org> wrote:
On Fr, 14 Jun 2024, Enan Ajmain wrote:
> I use ':b' quite often. And I use a substring of the bufname to jump to
> that buffer. Works quite well.
>
> But a problem is that the substring I provide isn't only matched with
> the buffer names but also the filenames. See these examples:
>
> :ls
> 1 #h "example\predict.py" line 25
> 2 a "deeplog\deeplog.py" line 0
> 4 %a "example\train.py" line 37
> :b deep<tab>
>
> Then when I type ":b deep<tab>", the matches shown are:
>
> E:\projects\log-parsing\deeplog\example\predict.py
> deeplog\deeplog.py
> E:\projects\log-parsing\deeplog\example\train.py
>
> We can see that vim is matching the filepaths instead of only the buffer
> names. Can I change this behavior? Preferably with vimscripting, but
> I'm willing to change source code too since I use this too often.
>
> To be clear: I want only this match to be shown:
>
> deeplog\deeplog.py
You could try the following mapping:
:cnoremap <expr> B getcmdtype()==#':'&&getcmdpos()==1?'b */':'B'
And then type :B which would expand to :b */ on the commandline and then
whatever you type would be anchored to the directory separator.
Thanks,
Christian
--
TAILFINS!! ... click ...
--
--
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/Zmytev/J%2BUjT7XXH%40256bit.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/CAOmRJrdSq0_psQiU40%2BUTAjJCy-unbBJ__vStbK4CpMP%2B74JOQ%40mail.gmail.com.
Subscribe to:
Posts (Atom)