r_vim | Unsorted

Telegram-канал r_vim - r_vim

-

@r_channels

Subscribe to a channel

r_vim

Good light themes as complete as dracula?

I've been using dracula as my theme for everything in the terminal: the terminal itself, tmux, and vim.

I've lately been interested in trying to find a light theme and wanted to know if there was any good "suite" of themes like dracula, but light. Thanks!

https://redd.it/183l416
@r_vim

Читать полностью…

r_vim

Vim's useful lists
https://codeinthehole.com/tips/vim-lists/

https://redd.it/183gjjq
@r_vim

Читать полностью…

r_vim

Looking for a type of plugin

Are there any plugins that allow you to move selected text around the screen other than this one I found:

https://github.com/jondkinney/dragvisuals.vim

I was going to write a better version, with a greater range of motions and stuff, but if it already exists I guess there's no need.

https://redd.it/1834mgq
@r_vim

Читать полностью…

r_vim

hide or change highlighting of linefeed characters in :registers

my :registers output includes many characters like ^I or ^J i don't really care what they mean all i want is at least allow me to change the highlighting as they are highlighted in a bright blue color which i don't like. searching in help pages didn't find anything

https://redd.it/182t1ll
@r_vim

Читать полностью…

r_vim

Best way to select code snippet? [Help]

Hello, I would like some help on what would be the best way / fastest way to select the following in the picture and copy the contents? I tried using <C-V>5jt=y but that gives me a whole block. Is there any way of doing it? maybe a macro?

the code:

self.notes: List[Note] = notes
self.notes_to_add: List[Note] = list()
self.notes_to_edit: List[Note] = list()
self.notes_to_delete: List[Note] = list()
self.new_pictures: List[Picture] = list()
self.pictures: List[Picture] = [picture for note in notes for picture in note.pictures]

https://preview.redd.it/plxcfnyfo42c1.png?width=713&amp;format=png&amp;auto=webp&amp;s=368e0c363a45de49ecef103dbd30881222b53fe1

https://redd.it/1825jij
@r_vim

Читать полностью…

r_vim

How to conceal?

I would like to add a conceal feature for:

`<u>lorem ipsum</u>`
<span class="underline">lorem ipsum</span>

Ive tried a couple of things and have failed.

I'm trying this for markdown.

https://redd.it/181ujpq
@r_vim

Читать полностью…

r_vim

Flashbang effect upon opening vim.

Window screen becomes white before setting theme in vim, please see the attached video.How can I fix it?

I have used the everforest.vim colorscheme and the issue is only with that colorscheme.

Thanks!

https://reddit.com/link/181h6d1/video/iisa46zq8y1c1/player

https://redd.it/181h6d1
@r_vim

Читать полностью…

r_vim

How to turn markdown links into title only

Hi, I've been struggling with this for about an hour because I just suck at using RegEx so I'm asking for help !

Basically, I have a huge list of markdown links, and I'd like to convert all of them into their text only (removing the square brackets, url and parentheses)
I've tried creating a RegEx that matches that in order to delete it to no avail, and even chat GPT isn't helping here, always giving me invalid commands.

So yeah, please can someone help me with this ? :)


https://redd.it/181e6kf
@r_vim

Читать полностью…

r_vim

Mappings only in "diff" mode.

For years I've used some nmaps that only apply when I start Vim as vimdiff (EDIT: or gvimdiff) on my Windows machines (which I would typically do by selecting multiple files in the Windows File Explorer, then right mouse clicking).

I made these mappings mode-specific by putting them inside the MyDiff() function in _vimrc, as this function gets called when entering "diff mode".

This stopped working when one of my Vims was updated to 8.2, presumably because this version uses an internal diff and MyDiff() isn't called.

&#x200B;

Question: how do I make some nmaps that only apply in "diff mode", that will work in 8.2?

https://redd.it/1812ab3
@r_vim

Читать полностью…

r_vim

Help with syntax file

I'm writing a super simple syntax file for a small plugin that handles a special type of read-only buffer that shows some information.

The syntax file is just:

  syntax match ECS "\^ECS.\*"
syntax match HPC "\^HPC.\*"
syntax match TOTAL "\^Summary.\*"
syntax match MARK "\^>.\*"
highlight link ECS Comment
highlight link HPC Constant
highlight link TOTAL Function
highlight link MARK IncSearch


When I type syntax in the buffer I get (among many other lines) what you could expect:

ECS            xxx match /^ECS.*/
links to Comment
HPC xxx match /^HPC.*/
links to Constant
TOTAL xxx match /^Summary.*/
links to Function
MARK xxx match /^>.*/
links to IncSearch


The problem is that the MARK group does not work (see attached image). Even more strange is that if I manually type :syntax match MARK "^>.* then it does work, and the output of syntax is now (note the doubled and redundant match):

MARK           xxx match /^>.*/
match /^>.*/


Why it does not work in first instance? Why it does need to have match doubled for it to work?

https://redd.it/180cqyl
@r_vim

Читать полностью…

r_vim

Vim and latex

Could anyone share their latex workflow not using the vimtex plugin. Currently im using a continuous compile command from another tmux session but i would love to hear different setups.

Also, I've noticed that soft wraping usually is the way to go since it keeps the viewing experience consistent no matter the resizing or viewing of other collaborators. Having to go with gj gk to move by screen lines does get annoying though and it's the one thing that keeps me from using vim as a latex editor. How do you chose to navigate a soft wrapped document?

Thanks for your time!

https://redd.it/1804qgr
@r_vim

Читать полностью…

r_vim

how to make cursor position where we want it to position?

i was wondering while writing c programs

{} and positioning cursor at center and pressing enter does

&#x200B;

{

(cursor is here)}

&#x200B;

moves our cursor to end of brackets

however when we use IDE's

&#x200B;

pressing enter does

{

(cursor is here)

}

&#x200B;

is there a way to make vim do this

i've been using it for 2 years and this is the only thing i'm sad about else everything about vim is amazing never expected i would be just using terminal for this long without getting irritated thanks to this community

https://redd.it/17zwodn
@r_vim

Читать полностью…

r_vim

aVimUserWalkedIntoABarImproved

&#x200B;

:h |

Meme improvements inspired by reddit comments.


(I tried adding an image comment to the original https://www.reddit.com/r/vim/comments/17xfh6a/avimuserwalkedintoabar/ but no lock)

https://redd.it/17znub0
@r_vim

Читать полностью…

r_vim

Directory specific skeleton file rule?

I've figured out the basics of how to create a skeleton file, at least on a per file extension basis. But, I'd like to make a directory specific rule in Neovim's init.vim so that AsciiDoc files in that specific directory get a different template. I'm not sure how to pull that off. Can someone please point me in the right direction?

https://redd.it/17z4lvk
@r_vim

Читать полностью…

r_vim

nimda.vim: A dark Vim colorscheme

https://github.com/onur-ozkan/nimda.vim

https://redd.it/17yz8sd
@r_vim

Читать полностью…

r_vim

is there a way to write using subindexes?

HI!

I'd like to write 3 letter ¿3 chareteres? in subindexes togheters these 3 lettes:<eff>

letter subindex is like numbers subindex H₂O₂₂

using digraphs

Thank you and regards!

https://redd.it/183grnd
@r_vim

Читать полностью…

r_vim

Prevent Vim from writing to a read only file

Hi,

I noticed that it is possible to force writing to a read-only file with :w!, if the file is owned by root:root, writing to the file with w! will change the ownership to user:user.

Is it possible to prevent Vim from writing to a read-only file even with w! (i.e. disabling this functionality), as I don't want to do this even by accident.

Also, how is Vim able to do this at all? I thought programs couldn't change ownership of files, only root could?

Thanks.

https://redd.it/183cqah
@r_vim

Читать полностью…

r_vim

Bộ gõ tiếng việt telex với .vimrc

Source code: https://github.com/ylsama/vimrc-vietnamese-telex

&#x200B;

For non-vietnamese: This is a .vimrc file with 1000 inoremap that providing very basic vietnamese TELEX typing. It is irrelevant for almost everyone but for vietnamese people. The post is mainly for other Vietnamese people helping me check this out (thus, i writing only in vietnamese from now-on).

&#x200B;

For vietnamese:

Trong quá trình dùng VIM thì việc edit, việt tài liệu khá là bực mình với mấy ông bộ gõ, đặc biệt là dùng normal node. Nên t code vo cũng tiện học cách dùng VIM macro `q@.` các thứ. Dù sao ngồi học cách code bộ gõ cho chuẩn để code lại bằng Function VIM rồi debug chết mệt thì việc inoremap này tốn tầm \~2-3h là tạm được

&#x200B;

Định hình cái này khá tốt trong trường hợp:

\- VIM motion ở các app: Không muốn dùng bộ gõ tiếng việt khi dùng VIM motion vì bất tiện, kha khá app hỗ trợ VIM motion và chỉ hỗ trợ tối thiểu một số lệnh .vimrc (Obsidian là một ví dụ) thì cứ thế mà gõ tiếng việt thôi.

\- Đẩy lên Server và dùng luôn (SSH, Telnet, ...): chứ cài bộ gõ lên server chỉ để viết tài liệu hướng dẫn thì khá là buồn cười.

\- Một vài người muốn dùng thuần VIM để xử lý văn bản: Bộ gõ gần như không dùng được, bật tắt liên tục thì bất tiện

&#x200B;

Hiện không có bật tắt, chỉ dùng thằng vimrc luôn, vì mình chủ yếu dùng neovim, nên bật VIM xác định là chỉ phục vụ vài việc đặc thù (để config file là chính), không gõ tiếng việt thì bật neovim.

https://preview.redd.it/uvq883ly1c2c1.png?width=952&amp;format=png&amp;auto=webp&amp;s=57dd60f916c21b554206369c0e2e06f902cc3c4a

&#x200B;

https://redd.it/182xx8q
@r_vim

Читать полностью…

r_vim

Way to use / in motion without setting / register

As in the title is their a way to do, for example d/hello without setting the / register to hello. I know there is a :keeppattern command but I don't want to have to remap all commands with motion to use it.

https://redd.it/1825ps6
@r_vim

Читать полностью…

r_vim

Path for helper-script.sh included with plugin

With a given plugin-directory-structure like...

myplugin/
├── autoload
│   └── myplugin.vim
├── contrib
│   └── myplugin-helper.sh
├── doc
│   └── myplugin.txt
├── plugin
│   └── myplugin.vim
└── README.md

... I would like to run the script contrib/myplugin-helper.sh inside a function...

function! s:myfunction()
silent! execute "!<?????>/contrib/myplugin-helper.sh"
endfunction

How do I get the missing path-compnent (<????>)?

https://redd.it/18239k5
@r_vim

Читать полностью…

r_vim

ALE configuration help

I'm kind of new to using ALE, and I am trying to configure the error warnings. I tried let g:ale_virtualtext_cursor = 'disabled' but that didn't get rid of the large red text box. So maybe I'm looking at the wrong setting, but I can't seem to find the right one. Sorry for the noob question.

https://redd.it/181skpj
@r_vim

Читать полностью…

r_vim

coc-pylsp does not produce any static analysis

I'm using the coc-pylsp extension of of coc. Actually I have been using it for a while. Now, I have changed some small things in my virtual environments, and I have messed something. I'm trying to recover the way all this used to work but it doesn't any more. Can you help me to debug this? I'm stuck.

More details:

\- My .vimrc has this: Plug 'neoclide/coc.nvim', {'branch': 'release'}

\- I install coc-pylsp with :CocInstall u/yaegassy/coc-pylsp

\- I install all extras required by the latter by running :CocCommand pylsp.builtin.install

\- My \~/.config/coc/extensions/@yaegassy/coc-pylsp-data/pylsp/venv/bin directory has python, ruff, pylint the rest of necessary binaries

\- my .vim/coc-settings.json has this content:

{
"pylsp.plugins.pycodestyle.enabled": false,
"pylsp.plugins.flake8.enabled": false,
"pylsp.plugins.flake8.ignore": "E265", "E266",
"pylsp.plugins.pydocstyle.enabled": false,
"pylsp.plugins.mccabe.enabled": false,
"pylsp.plugins.pyflakes.enabled": false,
"pylsp.plugins.yapf.enabled": false,
"pylsp.plugins.ruff.enabled": true,
"pylsp.plugins.ruff.extendSelect": "E", "D", "C90",
"pylsp.plugins.ruff.lineLength": 79,
"pylsp.builtin.installExtrasArgs":
"flake8",
"yapf",
"mccabe",
"pycodestyle",
"pydocstyle",
"pyflakes",
"pylint",
"rope"
,
"pylsp.builtin.enableInstallPythonLspRuff": true,
"pylsp.builtin.enableInstallPylsIsort": true,
"diagnostic.messageTarget": "float",
"diagnostic.checkCurrentLine": true,
"suggest.enablePreselect": false,
"suggest.noselect": true
}

It should work! Any idea how to debug this?

&#x200B;

https://redd.it/181gfjy
@r_vim

Читать полностью…

r_vim

How do you get quickfix :chistory count?

:chistory shows that Vim keeps track of all (or at least a lot) of current and past quickfix searches

> error list 1 of 2; 1053 errors whatever
error list 2 of 2; 1038 errors :setqflist()

And according to :h getqflist-examples you can even query / title / etc these saved searches. But how can you query how many lists there are? I know from :chistory that the answer is 2 but what's the API call to get that same information?

https://redd.it/18158i3
@r_vim

Читать полностью…

r_vim

Which One Came Before Vim Or The Linux Kernel?

Which One Came Before Vim Or The Linux Kernel?

https://redd.it/180f9jr
@r_vim

Читать полностью…

r_vim

How to disable auto indent on a code block in vim ?

For example, in this code block:

template <typename T, typename E>
class expected<T, E, true> {};

If I press enter on the curly bracket, the whole class block will automatically indent, which became like this:
template <typename T, typename E>
class expected<T, E, true> {

};

What I really want is this:
template <typename T, typename E>
class expected<T, E, true> {

};

Could anyone tell me how to solve this?

https://redd.it/180c18m
@r_vim

Читать полностью…

r_vim

Newbie in need of some tips

Hi,

First of all, apologize for my grammatical errors and for the long paragraph.I think I need tips AND/OR motivation to keep using Vim because I feel that I'm almost to the point where everything feels so cool.

Some context about me

I work as a web developer, I'm 31yo, I live in France (yep, my keyboard is azerty). I work as web developer for more than 10 years now, and I really love my job and do my best to improve myself, knowing that I lack some algorithms knowledge.

About my editor experiences, I started with Sublime Text at the time it was used almost everywhere for software development, and then I switched to Intellij, and I felt in love with it.

I started using Vim only 1 week ago, exactly it was on November 11th during the evening, I remember it well because I discovered ThePrimeagen channel and wanted to give a try to Vim.

My config is really cool to me, I made it "by myself", meaning that I took my time and did not used any pre-configured distro, but just created my lua files 1 by 1. I have everything working perfectly on my repositories: LSP, a nice colorscheme, and some cool plugins (telescope, harpoon, vim-surround, and bunch of other utilities)

I'm also getting used to Vim motions and basic vim mappings, I think I have some of the basics:

\- Jump vertically with (number)j/k

\- Move horizontally with w, b, F, f, T, t

\- Quickly edit with c(i-a)(w or anyting), di(w-...)

\- Search with / or vim-flash

To be clear, I'm really not saying that I know most of the commands, but it seems to me as a good starting point.

&#x200B;

Friction point

Here is where I struggle the most: when I need to combine jumps and horizontal movements to edit some code that I visually see on my screen. Here is an example:

&#x200B;

https://preview.redd.it/ria9u7xnkk1c1.png?width=1794&amp;format=png&amp;auto=webp&amp;s=25a8e30ac002cb1fd01c71e866796eedb53a7619

&#x200B;

As you can see, my cursor is on the y of the first line, and, let's say that for some reason I need to edit the HapoonNavNext() because I misspelled it and want to instead write HarpoonNavFinal(). Here are the 2 combinations I see and usually use:

\- Jump down 2 lines with 2j, then either move with w, or fH, and then ciw. Also, the simple fact of thinking of the fastest keystroke when using f or t makes me feel like I lose time.

\- Search for my word: /HarpoonNavNext and perform replacement

This is really my biggest friction point, the thing is that I can't stop thinking that it would be so much faster with the mouse, but every time I'm tempted to use it I feel like I'm cheating.

Do you have some tips to ease this process of combining vertical and horizontal movements almost at the same time ? What's for you the most efficient way to perform this ? I am not necessarily in need of a magical command that I don't know, I just don't know what's the more efficient, so I can get used to a good practice to get faster.

&#x200B;

&#x200B;

https://redd.it/17zzcgc
@r_vim

Читать полностью…

r_vim

Considering switching to vim, but not sure if it's worth it when it only works for coding?

I've considered going to arch linux with vim (for as much as i can), but i've found 1 big problem. Vim is only available for coding. Normally i use arrow keys, home and end to navigate, but if i switch to vim i would get used to the (seemingly just objectively better) keybinds.

But then when i go to google something, i can't use those, or even just writing this post wouldn't be possible with vim keybinds. Then i would have to switch back to using arrow keys, if i don't want to use the mouse. Isn't this a problem? if so, is there a way around?

https://redd.it/17zq69g
@r_vim

Читать полностью…

r_vim

swap two characters, don't pollute the unnamed register, undoable in one step

I'm learning Vim and I set myself a challenge: to create a command to swap two characters, without polluting the unnamed register, undoable in one step only.

I came up with a working solution which looks ugly to my non-coder eyes. Still, I'm proud of myself though, I'm just a writer who loves writing in Vim, after all.

We yank the leftmost character to register b, yank the next character to register a, merge the two registers into register c in reverse order (a + b), delete the two characters to the black hole register, and paste from c.

Any thoughts on how to make this look prettier?

" swap two characters via registers merge
command! -bar SwapCharsYank execute 'normal "byll"ayl'
command! -bar SwapCharsMerge execute 'let @c = @a . @b'
command! SwapCharsReplace execute 'normal vh"_d"cPh'
command! SwapChars execute 'SwapCharsYank|SwapCharsMerge|SwapCharsReplace'

&#x200B;

&#x200B;

&#x200B;

&#x200B;

&#x200B;

&#x200B;

&#x200B;

https://redd.it/17z9nki
@r_vim

Читать полностью…

r_vim

Made a new plugin to switch between wordCase -> WORD_CASE - ...

Hi there! Just finished a new plugin [vim-chase](https://github.com/axlebedev/vim-chase), that helps to change words case:

`helloWorld` \- `hello-world` \- `HELLO_WORLD` \- `Hello world` \- ...

(name "chase" is for "***ch***ange c***ase***")

Originally it was forked from 'vim-case-change', but has been completely rewritten.

Why made another plugin for this?
The main purpose is to see a popup list of words and see how many times should change case
Another is to have customizable list of variants, and make it work differently with single letter, word or complete sentence (or someComplexNameOfVariable).

How does it work?
First, place cursor at <cword> (or visual select) and press `~` one or several times.
Plugin will change word, showing upcoming variants.
Also it will highlight changes.
Undo should work as it was single action

Plugin is written in vim9script.

https://reddit.com/link/17z0mwu/video/6hanut03wb1c1/player

&#x200B;

https://redd.it/17z0mwu
@r_vim

Читать полностью…

r_vim

A Humble Request for Assistance Maintaining ALE

Hello Everyone! w0rp here. I thought I'd ask on Reddit if there's anyone out there would like to help maintain ALE. It would be nice to have another willing volunteer who is up for providing relevant feedback on PRs, answering common questions, merging good PRs, and managing GitHub issues. I'll mention to anyone interested that I have a general policy of never closing issues, no matter how old, unless they are actually either solved or invalid. I bear no compulsions to ensure an that a number of issues, which is arbitrary, remains low. I have a relatively simple vetting process, which mostly just requires building trust over time.

I'd like to add a little more context about Dense Analysis in the form of a bit of history. Originally I created ALE in a week or two, just in time for the release of Vim 8.0, knowing it wouldn't be too difficult to make an async Syntastic with the newly available APIs. Years later I realised in order to manage issues properly I'd need a GitHub organisation, which anyone can create easily on GitHub. Last year, 2022, I thought it would be a good idea to turn that org, Dense Analysis, into an actual charity and move the 2-clause BSD copyright to that charity instead of my online moniker. That charity is now a 501(c)(3) nonprofit, which I'm going to leverage to build a lot of interesting stuff in future.

Dense Analysis now has GitHub, Jira, Google Workspace, Windows licences, a Slack, Notion, a Discord, probably just a couple of LastPass licences soon, and probably other great stuff I'm forgetting about, most of which are provided to us for free. Theres $0 of revenue at the moment, but I'm aiming to open a corporate bank account in the name of the nonprofit, and by the Conflict of Interest policy and standard US laws, I will be barred from using that money for anything but the nonprofit's purposes. I've gone out of my way to set it up that way. This is all to say: I'll open up GitHub Sponsors, Patreon, PayPal, etc. in the coming months, and I and others can donate money to the charity. I intend on spending the money on various expenses including building bare-metal network infrastructure for running FOSS LLM tools. (like GPT) I've personally invested at least $1,500 myself already. I'll repeat that I don't need any further income than what my day job provides.

I'll be spending a lot of time building up the corporate structure for the charity and working on AI projects, when I'm not working on my somewhat demanding day job, or the roughly two bands I'm recording music for and performing in. (Which is fun!) I don't have a whole lot of time for merging ALE code and so on, but I will be working on it until I'm physically unable. I did a massive push a couple of months ago or so all at once to make a large series of improvements. I hope to do a lot more over the Christmas period, including supporting more of the nvim-lspconfig supported tools, and for Neovim integrating more closely with Neovim standard APIs now, while still supporting Vim 8+. (I will at some point in future require a newer Vim 8.x version.)

I'll forever be grateful to the probably hundreds of people across the world who have contributed to ALE. It's not my plugin, it's everyone's plugin. I hope it remains to be useful for many years to come.

https://redd.it/17ytm04
@r_vim

Читать полностью…
Subscribe to a channel