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
g; doesn't work with wrap
i wonder if there's any way to solve the problem that g; doesn't work when you wrap text (it goes to the end of the paragraph instead of the character)
my format settings are:
textwidth=100
fo+=atw
fo-=crol
i've asked ai bots (perplexity and grok) but they aren't helpful. i have used vim without the wrapping and it's great when writing code, but for anything else i prefer to wrap the text for multiple reasons
conclude: i think lococoyote is right, in this case i don't see that there's any solution.
https://redd.it/1r8eeav
@r_vim
i wonder if there's any way to solve the problem that g; doesn't work when you wrap text (it goes to the end of the paragraph instead of the character)
my format settings are:
textwidth=100
fo+=atw
fo-=crol
i've asked ai bots (perplexity and grok) but they aren't helpful. i have used vim without the wrapping and it's great when writing code, but for anything else i prefer to wrap the text for multiple reasons
conclude: i think lococoyote is right, in this case i don't see that there's any solution.
https://redd.it/1r8eeav
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Undo in Vi and its successors, and my views on the mess
https://utcc.utoronto.ca/~cks/space/blog/unix/ViUndoMyViews
https://redd.it/1r76lr4
@r_vim
https://utcc.utoronto.ca/~cks/space/blog/unix/ViUndoMyViews
https://redd.it/1r76lr4
@r_vim
Language server for Bruno
Bruno is an API client similar to Postman and Insomnia, but it also works via CLI and is great for E2E testing.
I found a plugin that integrates with Bruno, but I only needed basic language server support, so I decided to create my own. It’s still a bit buggy, but it works well for the most common use cases.
It may also work with VS Code, although I haven’t tested it yet.
If you’re interested, feel free to check it out:
https://github.com/DaviTostes/bruno-language-server
https://redd.it/1rbhn95
@r_vim
Bruno is an API client similar to Postman and Insomnia, but it also works via CLI and is great for E2E testing.
I found a plugin that integrates with Bruno, but I only needed basic language server support, so I decided to create my own. It’s still a bit buggy, but it works well for the most common use cases.
It may also work with VS Code, although I haven’t tested it yet.
If you’re interested, feel free to check it out:
https://github.com/DaviTostes/bruno-language-server
https://redd.it/1rbhn95
@r_vim
GitHub
GitHub - DaviTostes/bruno-language-server: Language Server Protocol implementation for Bruno API client
Language Server Protocol implementation for Bruno API client - DaviTostes/bruno-language-server
Is it possible to have Emacs eshell behavior but with Vim?
Hello Vimers,
Succinctly - I am looking for a workflow which allows to write commands in default "insert" mode, in a terminal emulator, but when needed can go into "visual" mode and navigate freely terminal content with Vim keybinds.
I've tried zsh-vi-mode and tmux copy-mode but that's not exactly it.
Yesterday I've stumbled onto github.com/mikesmithgh/kitty-scrollback.nvim plugin, which seems to be closest to what I'm looking for - albeit not tested yet. But maybe there is some better solution possible?
https://redd.it/1rgvwc7
@r_vim
Hello Vimers,
Succinctly - I am looking for a workflow which allows to write commands in default "insert" mode, in a terminal emulator, but when needed can go into "visual" mode and navigate freely terminal content with Vim keybinds.
I've tried zsh-vi-mode and tmux copy-mode but that's not exactly it.
Yesterday I've stumbled onto github.com/mikesmithgh/kitty-scrollback.nvim plugin, which seems to be closest to what I'm looking for - albeit not tested yet. But maybe there is some better solution possible?
https://redd.it/1rgvwc7
@r_vim
GitHub
GitHub - mikesmithgh/kitty-scrollback.nvim: 😽 Open your Kitty scrollback buffer with Neovim. Ameowzing!
😽 Open your Kitty scrollback buffer with Neovim. Ameowzing! - mikesmithgh/kitty-scrollback.nvim
Auto-Formatting Problem
I have been getting a small annoyance when using auto formatting and I was wondering if anyone knows if there is a way to resolve it.
I have the following options set.
Sometimes when changing text, when the new word is shorter and will fit on the previous line, auto formatting brings the cursor back to the previous line as it should, but when I type space to enter the next word the cursor does not advance because of auto formatting, and I have to type space a second time to actually get the space, which is is quite annoying because it hits only once in a while and causes run-together words when I'm retyping from something else and not looking at the editor window. So far I have not been able to find anyone with a fix for this.
https://redd.it/1rgq3av
@r_vim
I have been getting a small annoyance when using auto formatting and I was wondering if anyone knows if there is a way to resolve it.
I have the following options set.
formatoptions+=t
formatoptions+=a
wrap
textwidth=72
linebreak
Sometimes when changing text, when the new word is shorter and will fit on the previous line, auto formatting brings the cursor back to the previous line as it should, but when I type space to enter the next word the cursor does not advance because of auto formatting, and I have to type space a second time to actually get the space, which is is quite annoying because it hits only once in a while and causes run-together words when I'm retyping from something else and not looking at the editor window. So far I have not been able to find anyone with a fix for this.
https://redd.it/1rgq3av
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Magical number increments
We have [`g ctrl-a`](https://vimhelp.org/change.txt.html#v_g_CTRL-A) to increment numbers linearly:
```diff
-Potato 0
-Potato 0
-Potato 0
-Potato 0
+Potato 1
+Potato 2
+Potato 3
+Potato 4
```
[vim cast] (https://github.com/kaddkaka/vim_examples?tab=readme-ov-file#increment-numbers-incremental-sequence)
But [this stackoverflow answer] (https://stackoverflow.com/a/6554728/393010) about ` :g/banana/exec "m ".i | let i+= 1 ` made me curious.
When inserting multiple lines with numbers or running macros or `:global` command. Is there any available builtin counter variable that I can hook into and use? Sometimes it would be nice to type a number sequence directly instead of having to first insert with 0 just make another pass and edit the numbers.
https://redd.it/1rfyxk4
@r_vim
We have [`g ctrl-a`](https://vimhelp.org/change.txt.html#v_g_CTRL-A) to increment numbers linearly:
```diff
-Potato 0
-Potato 0
-Potato 0
-Potato 0
+Potato 1
+Potato 2
+Potato 3
+Potato 4
```
[vim cast] (https://github.com/kaddkaka/vim_examples?tab=readme-ov-file#increment-numbers-incremental-sequence)
But [this stackoverflow answer] (https://stackoverflow.com/a/6554728/393010) about ` :g/banana/exec "m ".i | let i+= 1 ` made me curious.
When inserting multiple lines with numbers or running macros or `:global` command. Is there any available builtin counter variable that I can hook into and use? Sometimes it would be nice to type a number sequence directly instead of having to first insert with 0 just make another pass and edit the numbers.
https://redd.it/1rfyxk4
@r_vim
vimhelp.org
Vim: change.txt
Vim help pages, always up-to-date
Why do :marks suck so much?
I rarely use marks, but the few times I do, I get frustrated because they don't work well when you delete lines. I know that's how they work, but it's always the same issue. In conclusion, they suck.
https://redd.it/1rgrk10
@r_vim
I rarely use marks, but the few times I do, I get frustrated because they don't work well when you delete lines. I know that's how they work, but it's always the same issue. In conclusion, they suck.
https://redd.it/1rgrk10
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Disabling annoying highlight of "note" in scm files?
Hi Vimers, I recently upgraded my computer (MacOS) and suddenly vim syntax highlighting for scheme source files is highliting the word "note" in bright yellow. On my previous install this was not the case and I have not done anything custom with regard to .scm syntax highlighting.
It's making me crazy because I'm writing music software, so "note" appears a LOT.
If anyone can help, that would be lovely as so far my google searching has not helped!
thanks
https://redd.it/1rfdw13
@r_vim
Hi Vimers, I recently upgraded my computer (MacOS) and suddenly vim syntax highlighting for scheme source files is highliting the word "note" in bright yellow. On my previous install this was not the case and I have not done anything custom with regard to .scm syntax highlighting.
It's making me crazy because I'm writing music software, so "note" appears a LOT.
If anyone can help, that would be lovely as so far my google searching has not helped!
thanks
https://redd.it/1rfdw13
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
:sleep VS termwait()
Can someone explain me, possibly with a couple of examples that I can reproduce, the difference between :sleep and term\wait()?
https://redd.it/1re5fto
@r_vim
Can someone explain me, possibly with a couple of examples that I can reproduce, the difference between :sleep and term\wait()?
https://redd.it/1re5fto
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
This media is not supported in your browser
VIEW IN TELEGRAM
I built a Vim plugin to run Claude CLI directly via :Claude — would love feedback
https://redd.it/1rdqg7o
@r_vim
https://redd.it/1rdqg7o
@r_vim
Get netrw to group/sort by extension first, then filename second?
Is there any way to get the netrw plugin to sort/group by filename extension, then by filename within each group of extensions?
Setting
https://redd.it/1rcryth
@r_vim
Is there any way to get the netrw plugin to sort/group by filename extension, then by filename within each group of extensions?
Setting
g:netrw_sort_by='exten' sorts files by extension, but within each group of extensions, it doesn't necessarily sort by filename.https://redd.it/1rcryth
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Newbie .vimrc question
I'm using fedora linux less than a month and I have a modest .vimrc file. When I am in my Konsole Terminal and use vim to open a file I have no problem. But, when i want to say edit a etc or boot file and i use sudo vim the .vimrc file is not loaded or read. What should I be doing?
https://redd.it/1rh1ysn
@r_vim
I'm using fedora linux less than a month and I have a modest .vimrc file. When I am in my Konsole Terminal and use vim to open a file I have no problem. But, when i want to say edit a etc or boot file and i use sudo vim the .vimrc file is not loaded or read. What should I be doing?
https://redd.it/1rh1ysn
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Some question about colorscheme.
syntax on
colorscheme ...
highlight Comment ...
highlight LineNr ...
If I don’t use
How can I use
https://redd.it/1rhl2sk
@r_vim
syntax on
colorscheme ...
highlight Comment ...
highlight LineNr ...
If I don’t use
colorscheme, the Comment color won’t apply. but the LineNr color works fine. I don't know what's different. How can I use
highlight without colorscheme?https://redd.it/1rhl2sk
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community