Skip to main content

Questions tagged [vim9]

To flag questions about features introduced with vim9 that are not vim9script questions

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

input() function: is it possible to distinguish when user hit <esc> or <enter> keys?

As per question. If in my script I have input('Add your text here:') and run it, is there a way to distinguish if at some point user hit enter or esc?
0 votes
1 answer
71 views

Block comment syntax colouring being lost while moving, but redraw will fix

I frequently use block comments to disable sections of terraform code using /* to start disabling and */ to complete. As expected, the code will turn "grey" and lose syntax highlights. ...
2 votes
1 answer
601 views

Vim appimage can't run on Ubuntu 22.04

Vim has a official AppImage (cool). But I can't run it on Ubuntu 22.04. I suppose that some dependencies are lost. My problem is that I can't identify what exactly are. I see the terminal output when ...
0 votes
3 answers
178 views

Recommended way of scripting: Ex commands or vimscript functions?

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 ...
-1 votes
2 answers
40 views

What options shall be set for loading ftplugins? [duplicate]

Consider the following script: vim9script filetype plugin indent on import "./plugin/myplugin.vim" exe $"edit testfile.py" MyCommand In the specific case, ...
0 votes
2 answers
43 views

How to convert octal in ascii characters by using substitute() in Vim9?

My attempt: vim9script var text = 'Hello \\123world\\045!' echom text->substitute('\\\o\o\o', => printf("%c", str2nr(submatch(0), 8)), 'g') result in E15 and E116.
0 votes
2 answers
121 views

Vim9script commands from command line result in E1124. Is it normal?

If I run e.g. :var a = 1 from the command line I end up in E1124: "var" cannot be used in legacy vimscript. Running on MacVim 9.0.1276. Is it normal behavior?
1 vote
1 answer
80 views

csv column colors in Vim 9

I just upgraded Vim to version 9.1 (under Windows). Seems now it improved the display of csv files, commas are shown as vertical lines (|), and the columns are displayed alternatively as yellow and ...
0 votes
1 answer
31 views

Using the return of a user defined function in an :execute statement

I am trying to get the output of the following function to an :execute statement such as I have this in my .vimrc def GetBufAbsPath(): string return substitute(expand("%:p"), '[^\/]\+$', ...
1 vote
1 answer
89 views

Start Vim window at a certain size?

Is there anything I can put in my _vimrc for gVim to make the window open a certain width/height?
10 votes
3 answers
2k views

Syntax highlighting for shell scripts broken

Since recently my syntax highlighting for ft=sh (also syn=sh is set) is broken: Why is that? How can I fix it? Edit: I'm using Vim 9.0 with patches 1-1302. I add here the code from the screenshot. ...
1 vote
2 answers
110 views

How to noremap plugin functions that take arguments?

I am aware that it is good practice to map some plugin function, like for example the piece of code that follows (Vim9): import autoload "../lib/my_script.vim" noremap <unique> <...
4 votes
1 answer
118 views

Why doesn't Vim recognize a pair of <\> as a single unit?

I'm kind of confused about why doesn't Vim accept di> operation on this piece of text: <This is a random text but has a backslash at the end\> but rather does on this: <This is a text with ...
2 votes
3 answers
535 views

How can I avoid built-in filetype detection?

I have a plugin for detecting and syntax highlighting *.k - source files in a given programming language. My ~/.vimrc contains only: se nocp rtp+=~/k/vim-k " the language plugin sy on And ...
2 votes
2 answers
2k views

How to get vertical wild menu using wildoptions=pum on Vim 9?

I would like to test the new vertical wildmenu of Vim 9. I read that set wildoptions=pum should provide it. But I'm not successful. Is there another setting to set to get it?
1 vote
2 answers
180 views

Gvim Python loading issue (despite being correctly installed)

I found a lot of questions about it, some problem was about 32 or 64 bit, other was about python support compiled in vim, etc. None was my case. Preamble: Software installed I installed Python on ...
-1 votes
2 answers
88 views

Prevent <c-w>q to quit Vim when there is only one window left

I wish to close windows and wipe out the associated buffers with <c-w>q but at the same time I want to prevent to quit Vim when there is only one window left. My attempt is as follows: ...
1 vote
1 answer
52 views

Is there any way to automatically adjust OS specific environment variables, path, etc. format?

Often in my scripts I have some ugly snippets like the following: vim9script var bin = "" if has("win32") bin = "\\bin" else bin = "/bin" endif g:...
2 votes
1 answer
53 views

How to change the internal vim python sys.path?

I have learned that py3eval('print(sys.path)') return the sys.path used internally by Vim. Say that i want add a new_path to the current sys.path. How shall I do? I would appreciate solutions that ...
0 votes
3 answers
411 views

Switch focus to :terminal buffer

I am trying to recreate the functionality of the very old conque plugin via terminal in modern vim. So far I have found a few plugins that send code to a terminal buffer. However, these do not update ...
0 votes
0 answers
63 views

Vim 9.0.1420 update: opening the same file twice without warning message is unfortunately now possible?

I observed that in the recent update for Vim, specifically vim 9.0.1420, it is now possible to create a text file, open it, and then open the same file through another terminal window without ...
0 votes
1 answer
50 views

Vim doesn't display my echo if it's 2 characters

On Vim 9 linux running this code: inoremap <C-n> <C-o>:echo "aa"<CR> doesn't display anything whereas: inoremap <C-n> <C-o>:echo "aaaa"<CR> ...
0 votes
0 answers
51 views

How to highlight all the columns of a window?

Consider the following snippet: vim9script var winid = win_getid() var winwidth = winwidth(winid) var range = [] for lnum in range(10, 20) add(range, [lnum, 0, winwidth(winid)]) endfor var m = ...
0 votes
0 answers
98 views

Different behaviour after upgrade Vim from v7.4.326 to 9.0.813

I have 2 Linux servers (SLES 12.5): On the first server I have vim version 7.4.326, On the other vim version 9.0.813. If I open the same file on both servers, Vim behaves differently. On server with ...
1 vote
1 answer
167 views

How can I control the color of my Vim terminal?

I'm using the nord theme on gVim 9.0. My Vim terminal appear with Black color: Here in console mode: Here in normal mode: How could I control it? Remark: I had a different behavior using Vim 8.2
0 votes
1 answer
65 views

Some Normal mode mappings not working in vim9 anymore

I have the following in my configuration: nnoremap µ iii nnoremap ° ioo I'm using gvim, on Windows 10, using an azerty keyboard (so µ is <S-*> and ° is <S-)). The mappings work in vim8, but ...
0 votes
1 answer
112 views

How can I make 'quickfixtextfunc' work with cfilter using a vim9's "def" function?

On Windows 10, using gvim, when editing a file like the following example: foo foobar baz As long as I use a function and not a def, I can do the following and Cfilter will work as expected: :...
2 votes
1 answer
2k views

Using Github Copilot with Regular Vim [closed]

I'm not finding much out there in terms of docs about using copilot with regular vim (everything I've come across is about using it with nvim / neovim) The copilot.vim docs mention it should support ...
5 votes
1 answer
452 views

How can I convert vim8 function mapping to vim9?

I have a function in vim8 as: function! BSkipQuickFix(command) let start_buffer = bufnr('%') execute a:command while &buftype ==# 'quickfix' && bufnr('%') != start_buffer execute ...
2 votes
1 answer
785 views

How do I :let a global variable in my vimrc in vim9script?

I am trying to change my vimrc to vim9script. For inbuilt fortran help, (:h fortran) we have: :let fortran_free_source=1 This is giving an error: E1126: Cannot use :let in Vim9 script If I remove ...
1 vote
1 answer
608 views

How to unlet a variable in Vim 9 script?

In Vim9 script :let cannot be used. An existing variable is assigned to without any command. The same for global, window, tab, buffer and Vim variables, because they are not really declared. Those ...
1 vote
1 answer
669 views

'Undefined variable' error: why?

vim9script set laststatus=2 set statusline= var separator = ' ' set statusline+=%{expand('%:p')} set statusline+=%{separator} set statusline+=%l:%v Error: Undefined variable: separator Why is ...
2 votes
1 answer
584 views

How can I enable .xml syntax highlighting for .xaml files?

I am trying to enable .xml syntax highlighting in Vim for .xaml files since .xaml files don't have syntax highlighting of its own. I came across a post on Stack Overflow which recommended to use au ...
5 votes
1 answer
540 views

Vim9: How will '#' characters be handled in colors/* files now?

Vim9 now interprets '#' as the start of comment, but I use this character in color setting files. For instance: hi Todo guifg=#d14a14 guibg=#1248d1 ctermfg=red ctermbg=darkblue