How to horizontally scroll large popups?
Say that I have a huge table displayed in a popup.
Although I can add some keys in the popup filter function to scroll up and down, with entries like:
I tried with:
but it does not work.
Does anyone knows if it is possible? Because if not, then I could open an feature request on the issue tracker of vim.
https://redd.it/1qxlibf
@r_vim
Say that I have a huge table displayed in a popup.
Although I can add some keys in the popup filter function to scroll up and down, with entries like:
\# Move up
if \["\\<C-n>", "\\<Down>", "j", "\\<ScrollWheelDown>"\]
win\_execute(id, "normal! \\<c-e>")
\# Move up
elseif \["\\<C-p>", "\\<Up>", "k", "\\<ScrollWheelUp>"\]
win\_execute(id, "normal! \\<c-y>")
I tried with:
elseif key == "l"
win_execute(id, "normal! zl")
elseif key == "h"
win_execute(id, "normal! zh")
but it does not work.
Does anyone knows if it is possible? Because if not, then I could open an feature request on the issue tracker of vim.
https://redd.it/1qxlibf
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Do you actually need a whole plugin just for surrounding?
lately i've been learning about vimnoscript after ignoring it for a long time, and i thought about doing some stuff in order to.. you know, learn by doing.
i got the basic surrounding working with 7 lines, and the 8th one for the mapping.
I think it's obviously not the best surrounding snippet out there but am i missing something? this feels more than enough for basic quotes and brackets. what do you think?
Edit: code format
https://redd.it/1qzl7g0
@r_vim
lately i've been learning about vimnoscript after ignoring it for a long time, and i thought about doing some stuff in order to.. you know, learn by doing.
i got the basic surrounding working with 7 lines, and the 8th one for the mapping.
def Surround(): void
echo "Enter surround char..."
var pairs = {'(': ')', '{': '}', '[': ']', '<': '>'}
var lhc = nr2char(getchar())
var rhc = pairs->get(lhc, lhc)
execute "normal! `>" .. (visualmode() ==# "V" ? "g_" : "") .. "a" .. rhc .. "\<Esc>`<" .. (visualmode() ==# "V" ? "g^" : "") .. "i" .. lhc .. "\<Esc>"
enddef
I think it's obviously not the best surrounding snippet out there but am i missing something? this feels more than enough for basic quotes and brackets. what do you think?
Edit: code format
https://redd.it/1qzl7g0
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Manual creating CNC code, is Vim a good fit?
Hey y'all. I need help learning if I can use Vim to make large swaths of code quickly or if something else is a better fit. Example here:
I was once a manual code editor a decade ago and used Vim with snippets to create lots of NC code at an old job, rather simple snippets back then. I moved jobs and have only programmed with MasterCAM the past decade but a recent feature would have been faster to write the code by hand. How can I learn? I remember some but it has been so long I barely remember
Edit: I'm on windows at work, WSL is disabled. Anything not native would need IT approval which might take a while.
https://redd.it/1qzrynd
@r_vim
Hey y'all. I need help learning if I can use Vim to make large swaths of code quickly or if something else is a better fit. Example here:
G13D0R0.4217Z-0.0900
G13D0R0.4218Z-0.0901
G13D0R0.4219Z-0.0902
…
G13D0R0.4336Z-0.1019
G13D0R0.4337Z-0.1020
G13D0R0.4338Z-0.1021
I was once a manual code editor a decade ago and used Vim with snippets to create lots of NC code at an old job, rather simple snippets back then. I moved jobs and have only programmed with MasterCAM the past decade but a recent feature would have been faster to write the code by hand. How can I learn? I remember some but it has been so long I barely remember
:wq but I did find an example of :put =range(4217,4338) to get part of what I needed but can't figure out if I can get everything at once. The example on Vim tips wiki :for i in range(1,10) | put ='192.168.0.'.i | endfor makes me think I should be able too do that, can such a function handle multiple variables? Like i j k? I will need to wait for IT to install Vim so it may take a while. Is there better ways to get what I want? Thanks.Edit: I'm on windows at work, WSL is disabled. Anything not native would need IT approval which might take a while.
https://redd.it/1qzrynd
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
hatsune miku color scheme
https://preview.redd.it/4oump8ckydig1.png?width=1900&format=png&auto=webp&s=0dc2f6622b2a0fc6a80d1b96204d008f0eda7664
I've been using this minimal colorscheme I hacked together for half a year now. Draws inspiration from Atom editor's default font, as well as elflord.
I would love to get some feedback on this! I mostly code in C so I'm sure there's a lot of different cases in different languages that I didn't catch. I would also love any suggestions that would help readability etc.
https://github.com/cccfire/vim-miku-colors/tree/main
https://redd.it/1qzt76z
@r_vim
https://preview.redd.it/4oump8ckydig1.png?width=1900&format=png&auto=webp&s=0dc2f6622b2a0fc6a80d1b96204d008f0eda7664
I've been using this minimal colorscheme I hacked together for half a year now. Draws inspiration from Atom editor's default font, as well as elflord.
I would love to get some feedback on this! I mostly code in C so I'm sure there's a lot of different cases in different languages that I didn't catch. I would also love any suggestions that would help readability etc.
https://github.com/cccfire/vim-miku-colors/tree/main
https://redd.it/1qzt76z
@r_vim
Flash/Jump/Hop to fold headers?
So I love my easy motion style navigation, but I cant seem to find a way to use it to navigate to UFO folded headers because I guess the header is virtual text or not part of the searchable buffer.
Has anyone found a solution to this?
https://redd.it/1r086ku
@r_vim
So I love my easy motion style navigation, but I cant seem to find a way to use it to navigate to UFO folded headers because I guess the header is virtual text or not part of the searchable buffer.
Has anyone found a solution to this?
https://redd.it/1r086ku
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Is there a way to include it in :messages but prevent to show it on-screen?
As per noscript.
I want to place a message in
To me the obvious would be
https://redd.it/1r07ir9
@r_vim
As per noscript.
I want to place a message in
:message but I don't want it to appear on screen.To me the obvious would be
:silent echom "foo" but foo is not placed in :messages, nor it is shown on screen. https://redd.it/1r07ir9
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Vim 9.2 has been released: Vim 9.2 brings significant enhancements to the Vim9 noscripting language, improved diff mode, comprehensive completion features, and platform-specific improvements including experimental Wayland support.
https://www.vim.org/vim-9.2-released.php
https://redd.it/1r4ymj3
@r_vim
https://www.vim.org/vim-9.2-released.php
https://redd.it/1r4ymj3
@r_vim
Reddit
From the vim community on Reddit: Vim 9.2 has been released: Vim 9.2 brings significant enhancements to the Vim9 noscripting language…
Posted by anaxarchos - 14 votes and 2 comments
Why is this so fast in vim?
So if you have this C program :
#include <stdio.h>
#include <stdint.h>
int main(void)
{
for(uint64_t i = 0; i < 1000000; i++)
{
printf("iteration %lu\n", i);
}
return 0;
}
When i run this really simple program in my terminal(foot), it takes around 0.6 seconds, when i run this in emacs(compilation mode) it takes around 40 seconds, but in vim if i do this in command mode : `:r !time ./print` it only takes 0.1 seconds and the file has 1 million lines of the same output. What is the difference maker?
https://redd.it/1r1xz29
@r_vim
So if you have this C program :
#include <stdio.h>
#include <stdint.h>
int main(void)
{
for(uint64_t i = 0; i < 1000000; i++)
{
printf("iteration %lu\n", i);
}
return 0;
}
When i run this really simple program in my terminal(foot), it takes around 0.6 seconds, when i run this in emacs(compilation mode) it takes around 40 seconds, but in vim if i do this in command mode : `:r !time ./print` it only takes 0.1 seconds and the file has 1 million lines of the same output. What is the difference maker?
https://redd.it/1r1xz29
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Vim noscripting with AI
I've been using Claude code to generate vim noscripts and key mappings. As well as using vim-ai /ChatGPT Plugin inside Vim. I'm finding it very useful in creating complex tasks that I have always put off as not worth the effort to reward.
Does anyone else have any good tips or tricks using AI within Vim ?
https://redd.it/1r2pag3
@r_vim
I've been using Claude code to generate vim noscripts and key mappings. As well as using vim-ai /ChatGPT Plugin inside Vim. I'm finding it very useful in creating complex tasks that I have always put off as not worth the effort to reward.
Does anyone else have any good tips or tricks using AI within Vim ?
https://redd.it/1r2pag3
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
integration of opencode
Other than using
I know
https://redd.it/1r21mur
@r_vim
Other than using
opencode on a separate terminal and let vim "reload" automatically the modified file whenever the focus comes back to vim, is there any other use mode where I can harness the power of opencode directly from my vim instance?I know
neovim does have a plugin for opencode but I don't want to switch to it for a number of reasons.https://redd.it/1r21mur
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Fold all sibling and child blocks?
So is there a way to fold all child nodes or all sibling and child nodes? eg
foo {
test
bar { ... }
bar2 { .... }
}
so lets say the cursor is on "test" and i should be able to hit a key that will fold bar and bar2
https://redd.it/1r18kit
@r_vim
So is there a way to fold all child nodes or all sibling and child nodes? eg
foo {
test
bar { ... }
bar2 { .... }
}
so lets say the cursor is on "test" and i should be able to hit a key that will fold bar and bar2
https://redd.it/1r18kit
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
How can I bind a plugin command to a key? Example, F2 instantly calls vim-plug PlugUpdate
I'm rarely at a loss because I can't figure out what to exactly google. I've gotten F2 to insert the command into the command line but I'm looking to bypass having to press enter and just run the command with one single press
Thanks in advance
https://redd.it/1r0s2m9
@r_vim
I'm rarely at a loss because I can't figure out what to exactly google. I've gotten F2 to insert the command into the command line but I'm looking to bypass having to press enter and just run the command with one single press
Thanks in advance
https://redd.it/1r0s2m9
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Should I really switch my habit?
I've been facing problems moving my cursor tens of lines up and down using Arrow keys or the Mouse (for which I need to take my hands off the keyboard) I learnt a few Vim key binds such as HJKL and Modes but I just can't be that productive right now.
To move n lines up and down I need to look at the line number and then type N(j/k) which feels about the same as using mouse, should I move ahead and practice more or just roll back?
https://redd.it/1r5cwzi
@r_vim
I've been facing problems moving my cursor tens of lines up and down using Arrow keys or the Mouse (for which I need to take my hands off the keyboard) I learnt a few Vim key binds such as HJKL and Modes but I just can't be that productive right now.
To move n lines up and down I need to look at the line number and then type N(j/k) which feels about the same as using mouse, should I move ahead and practice more or just roll back?
https://redd.it/1r5cwzi
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Help Really annoying setting!
Hey!
I'm trying to do the below:
[https://codeyarns.com/tech/2010-11-24-vim-show-filetypes-in-menu.html](https://codeyarns.com/tech/2010-11-24-vim-show-filetypes-in-menu.html)
But it's not working for me, and I'm going crazy as to why its not!
It allows this menu to be on by default without having to click to enable it everytime...
https://preview.redd.it/e75qczt5tojg1.png?width=684&format=png&auto=webp&s=e85e7f2c56dc653c227fe9ce18063c6f6cf86a99
Could someone point me in the right direction? I'm total beginner
let do_syntax_menu = 1
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set nu
colorscheme desert
set background=dark
filetype plugin indent on
" Add GameBoy to the Syntax menu manually
amenu Syntax.GameBoy :set syntax=rgbasm<CR>
" --- Diff Logic (Keep this at the bottom or middle, it's fine) ---
if &diffopt !~# 'internal'
set diffexpr=MyDiff()
endif
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg1 = substitute(arg1, '!', '\!', 'g')
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg2 = substitute(arg2, '!', '\!', 'g')
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let arg3 = substitute(arg3, '!', '\!', 'g')
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
if empty(&shellxquote)
let l:shxq_sav = ''
set shellxquote&
endif
let cmd = '"' . $VIMRUNTIME . '\diff"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
let cmd = substitute(cmd, '!', '\!', 'g')
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
if exists('l:shxq_sav')
let &shellxquote=l:shxq_sav
endif
endfunction
https://redd.it/1r5jayz
@r_vim
Hey!
I'm trying to do the below:
[https://codeyarns.com/tech/2010-11-24-vim-show-filetypes-in-menu.html](https://codeyarns.com/tech/2010-11-24-vim-show-filetypes-in-menu.html)
But it's not working for me, and I'm going crazy as to why its not!
It allows this menu to be on by default without having to click to enable it everytime...
https://preview.redd.it/e75qczt5tojg1.png?width=684&format=png&auto=webp&s=e85e7f2c56dc653c227fe9ce18063c6f6cf86a99
Could someone point me in the right direction? I'm total beginner
let do_syntax_menu = 1
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set nu
colorscheme desert
set background=dark
filetype plugin indent on
" Add GameBoy to the Syntax menu manually
amenu Syntax.GameBoy :set syntax=rgbasm<CR>
" --- Diff Logic (Keep this at the bottom or middle, it's fine) ---
if &diffopt !~# 'internal'
set diffexpr=MyDiff()
endif
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg1 = substitute(arg1, '!', '\!', 'g')
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg2 = substitute(arg2, '!', '\!', 'g')
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let arg3 = substitute(arg3, '!', '\!', 'g')
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
if empty(&shellxquote)
let l:shxq_sav = ''
set shellxquote&
endif
let cmd = '"' . $VIMRUNTIME . '\diff"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
let cmd = substitute(cmd, '!', '\!', 'g')
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
if exists('l:shxq_sav')
let &shellxquote=l:shxq_sav
endif
endfunction
https://redd.it/1r5jayz
@r_vim
Codeyarns
Code Yarns – ViM: Show Filetypes in Menu
:hardcopy with syntax highlighting does not preserve color consistently
I created a custom vim syntax file for deposition trannoscripts, such that questions and answers appear in different colors. This works fine in vim, but when I use
Is this a bug or limitation with hardcopy? Or a bug in my syntax rules that doesn't show up on the screen but does when printed? Any suggestions for how to troubleshoot?
My rules are below.
https://redd.it/1r6czk2
@r_vim
I created a custom vim syntax file for deposition trannoscripts, such that questions and answers appear in different colors. This works fine in vim, but when I use
:hardcopy to print to PostScript or PDF, the syntax coloring is inconsistent. More often than not, only the first line of a region has the right color, while the rest is default/black. So for some reason the hardcopy is not preserving the syntax highlighting I see on the screen.Is this a bug or limitation with hardcopy? Or a bug in my syntax rules that doesn't show up on the screen but does when printed? Any suggestions for how to troubleshoot?
My rules are below.
if exists("b:current_syntax")
finish
endif
syntax region Answer start=/\sA[\. ]/ end=/\sQ[\. ]\|\(BY\)\?\s*M[RS]\./me=s-1
syntax region Question start=/\sQ[\. ]/ end=/\sA[\. ]\|\(BY\)\?\s*M[RS]\./me=s-1
syntax region Counsel start=/\(BY\)\?\s*M[RS]\.\s\+[A-Z]\+:/ end=/\s[QA][\. ]/me=s-1
highlight Counsel ctermfg=darkred guifg=darkred
highlight Question ctermfg=darkgreen guifg=darkgreen
highlight Answer ctermfg=blue guifg=blue
highlight LineNo guifg=gray ctermfg=gray
2match LineNo /^\s\+[0-9]\+\s\+/
highlight PageNo guifg=black ctermfg=black guibg=gray ctermbg=gray
match PageNo /^\s\{30\}\s*[0-9]\+$/
let b:current_syntax = "trannoscript"
https://redd.it/1r6czk2
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community