r_vim – Telegram
r_vim
71 subscribers
1.24K photos
60 videos
1 file
19.5K links
Download Telegram
: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 :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
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
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
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
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.

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
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
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
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
: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
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
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 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
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
Some question about colorscheme.

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