Skip to main content

Questions tagged [vimscript]

A scripting language embedded into Vim. It can be used to customize Vim to suit your needs and to create plugins. Also called VimL.

Filter by
Sorted by
Tagged with
1 vote
0 answers
21 views

Is there a way to get a list of channels (channel/handle)? For jobs one can use job_info() without argument to list all, but can not find a way to get a lost handle for channels.
user3342816's user avatar
1 vote
2 answers
65 views

I created a new custom file type called foo: $ cat ~/.vim/ftdetect/foo.vim au BufRead,BufNewFile *.foo set filetype=foo I created a new syntax group: $ cat ~/.vim/after/syntax/foo.vim syntax keyword ...
bofo's user avatar
  • 33
1 vote
1 answer
105 views

I have a function that changes settings for diff mode (usually activated by using vimdiff). Manually calling this function works as expected. However, I would like this function to be called ...
MERM's user avatar
  • 113
2 votes
2 answers
115 views

Suppose, we have the text inside the default register: ": new_name And we have the following Perl code in the buffer: $hash{old_name} = "value"; ▲ cursor position I ...
user4035's user avatar
  • 221
0 votes
2 answers
74 views

This code is intended to be portable between Vim and Neovim. In cases where I don't have a LSP configured, I like to use the following to grep for a word. This thing is also a working vimrc or init....
Greg Nisbet's user avatar
  • 1,951
1 vote
1 answer
160 views

I have a file that is in mail.vim and has the following executable commands: augroup autocom autocmd! "executes the command on quit "autocmd VimLeave /tmp/mutt-* !/usr/bin/email-...
user3236841's user avatar
0 votes
1 answer
55 views

I'm running Neovim on Windows, and I'm trying to use what I call "autoload variables" to implement a plugin-scoped constant for my plugin. Having read :help autoload, I think I've found the ...
Phil R's user avatar
  • 744
0 votes
3 answers
61 views

So a new Vim syntax file was created and placed into ~/.vim/syntax directory. An accompanied Vim colors file was created and placed into ~/.vim/colors directory. What's the best way for the syntax ...
John Greene's user avatar
2 votes
1 answer
228 views

I can use the foreach() function with a string, like so: :call foreach([37,73], 'echo v:val') 37 73 or with a Funcref: function Foobar(key,val) echo a:val endfunction :call foreach([37,73], ...
Phil R's user avatar
  • 744
0 votes
2 answers
114 views

I have a script.vim file in which I'm trying to replace certain string matches. E.g. I have in .html file a number of lines like: <a href="foundry-illustration/foundry-illustration.html"&...
Tom's user avatar
  • 181
0 votes
1 answer
79 views

I'd like to write a file-tree/file-browsing plugin that uses popup windows. In popup_create I can set a filter to capture keys. For instance, popup_create('hello world', {filter: 'popup_filter_menu'}) ...
user54579's user avatar
0 votes
1 answer
80 views

How to convert this vimscript code into Lazyvim Lua code? function! BreakHere() s/^\(\s*\)\(.\{-}\)\(\s*\)\(\%#\)\(\s*\)\(.*\)/\1\2\r\1\4\6 call histdel("/", -1) ...
jayachandran's user avatar
1 vote
1 answer
74 views

I am trying to achieve a function that can auto-complete the command with options in dict. For example: there's two commands create_clock and set_voltage, two options -wave and -period with ...
M_Sea's user avatar
  • 177
1 vote
2 answers
96 views

I have a function that renames a file by saving it to the new location then deleting the old: execute "saveas" fnameescape(l:new_path) call delete(l:old_path) I ran into a problem with this ...
Big McLargeHuge's user avatar
0 votes
2 answers
129 views

I am trying to write a function for putting copied text from Windows to WSL, but in-spite of my attempts, I cannot get rid of the ^M. Here is my attempt: vim9script def WslPut(above: bool = false)...
Barzi2001's user avatar
  • 1,133
1 vote
2 answers
139 views

So far, I know that you can pass only two arguments to popup callback functions. I am wondering if there is any way to pass a third argument? Shall I rely on some sort of closure or use some "...
Barzi2001's user avatar
  • 1,133
0 votes
3 answers
143 views

I've got a EBNF that needs to be Vim-syntaxed: header :== 'header' ( '{' 'header1' ( '{ 'header2' nest_3? 'trailer2' '}' )? 'trailer1' '}' )? 'trailer' Railroad diagram gets me: And I'm struggling ...
John Greene's user avatar
0 votes
1 answer
52 views

Say that I type :cd <tab>. I get displayed a menu with all the directories in pwd. I am wondering if I can store the content of such a menu into a variable. For example, if :cd <tab> ...
Barzi2001's user avatar
  • 1,133
0 votes
0 answers
54 views

I've tried a lot of things, but basically event.regname is `` for "*y autocmd textyankpost * if v:event.regname =~ '[8+*]' call system('win32yank.exe -i --crlf', @") endif In ...
Orwellophile's user avatar
-1 votes
2 answers
94 views

From https://vi.stackexchange.com/a/28026/47188 I know that by defining in vimrc: " Insert text at the current cursor position. function! InsertText(text) let cur_line_num = line('.') let ...
athos's user avatar
  • 359
1 vote
3 answers
81 views

As per text. I have a terminal buffer running ipython and I want capture the last non-blank line. I tried the following: var bufnr = bufnr('IPYTHON') term_getline(bufnr, line('$')) term_getline(bufnr, ...
Barzi2001's user avatar
  • 1,133
0 votes
3 answers
399 views

While scripting I could achieve the same result both through Ex commands and vimscript functions, for example: var filename = "foo.txt" exe "new" filename # Ex ...
Barzi2001's user avatar
  • 1,133
2 votes
0 answers
69 views

I am using neovim with ALE and I want to change the coloring of style errors in general for any language and particularly in python using flake8, in the following code of my configuration file I try ...
Jorge L. de Oz's user avatar
0 votes
0 answers
41 views

I am aware that system() capture the output of shell commands. I am wondering if there is a similar command for capturing the output of commands sent to other type of interpreters running in terminal ...
Barzi2001's user avatar
  • 1,133
1 vote
1 answer
108 views

I've been trying to make a dot-repeatable (.) command that should work in both visual and normal mode. The command in question searches for a [] on a line and turns it into a [x], and vise versa. It ...
melvio's user avatar
  • 617

1
2 3 4 5
33