r_vim | Unsorted

Telegram-канал r_vim - r_vim

-

@r_channels

Subscribe to a channel

r_vim

Amber monochrome inspired color scheme with syntax highlighting, for Vim
https://redd.it/15f1p4e
@r_vim

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

r_vim

Shift + n not working for previous occurrence of word, but Caps + n does
https://redd.it/15ektiu
@r_vim

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

r_vim

Different ways to exit Vim

I published one article talking about exiting Vim:

https://wenijinew.medium.com/vim-do-you-know-how-to-exit-vim-you-probably-know-and-probably-dont-know-all-4a6a7fb5afa4

Welcome to comment.

https://redd.it/15e7xu6
@r_vim

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

r_vim

When your favorite editor is not available
https://redd.it/15cu4h8
@r_vim

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

r_vim

how to do a regex pattern matching on bufname()

i have a file lets say name scripts.lua

i want to match with bufname() == 'scr.*' or bufname() == '*.lua'

none of these options are working. i have tried way too many patterns, nothing works.

please help. thank you in advance

https://redd.it/15cjl52
@r_vim

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

r_vim

If I set ft=vim in an _alternative_rc, will it change the filetype of docs open with this rc?

Hi, if I set ft=vim in an alternative_rc, the filetype of a doc open with this rc change to doc.vim? or ft change only in the rc?

I use vim -N -u _alternative_rc anydoc

thank you and regards

https://redd.it/15ccmxy
@r_vim

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

r_vim

[new plugin] vim-navigator: navigate your commands easily
https://github.com/skywind3000/vim-navigator

https://redd.it/15c2goj
@r_vim

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

r_vim

Persistent Custom Syntax Hilighting

Is there a way (which does not involve any command like bufdo, source...) to make a custom filetype syntax highlighting persistent:

If I open file.custom of filetype custom, syntax/custom.vim will be loaded and custom highlighting will be applied, now if I split the screen and open options.vim, if I :source $MYVIMRC, the cursor split will keep its colors but the file.custom split will lost all its colors and requires to move the cursor to it and reiterate the :so $MYVIMRC for it to retrieve its colors.

Meanwhile, options.vim never lost its colors. I understand that :source command does not affect options.vim cause its colors are defined in the global config not mine.

When I run :scriptnames I can see "/squashfs-root/usr/share/nvim/runtime/syntax/nosyntax.vim" in the last line, I wonder what calls it and if it is connected with my problem.

I want my custom syntax to be more persistent, without overloading my vimrc with autocommands etc. does anyone got & solved this issue?

Best,

https://redd.it/15bvseg
@r_vim

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

r_vim

Customising a gvim toolbar

For the relatively small percentage[?\] of Windows gvim users out there, if you don't do it already, you may be interested in customising your toolbar. I did that with mine recently. I rarely used the default toolbar, except a few buttons. That's because most of the buttons were related to things I think are better with the keyboard. Others though, like spell checking, I prefer to use a mouse (no flames, please).

This image shows my "before" and "after":

https://preview.redd.it/fvhlf1rm5keb1.jpg?width=600&format=pjpg&auto=webp&s=3b65fb51a3f7f3363ca17af7a6df43c51789b442

The link to my Gist for how this was done, including the vimscript and zipped bitmaps.

​

​

https://redd.it/15bqhnt
@r_vim

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

r_vim

How do you edit a readonly vim config file?

I would like to edit vim/vim82/ftplugins/vim.vim which is a default vim config file.

There are some mappings in this file that seem to be causing strange problems with my own mappings (particularly the mappings which use and )

I have tried:

:w!
:update!

But none of these let me change the file as it keeps giving me a readonly error.

Is there an alternate thing I could try?

My goal is to get rid of a command inside the file:

nnoremap <buffer> ]" :call(code)

Thank you for the help!

https://redd.it/15bd4q1
@r_vim

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

r_vim

What is causing these mappings to be present?

In my vimrc file, I have a noremap for "]"
When I press "]" in normal mode, I expect the action to trigger right away.

Except it doesnt. It pauses for a little bit, and then runs.
Which leads me to think perhaps I have other commands also tied to "]".

I used redir to get a text copy of all of my mappings

Here is some of what I see:

n ] *@m':call search('^\\s*end\\(f\\vim.temp.txt[unction
n ]" @:call search('^\(\s".\n\)\@<!\(\s"\)', "W")<CR>

... and lots more
]m, ]g, et cetera

These are mappings that I wrote long ago, but I'm sure I deleted them. (hence why I can't find them in any of my config files), but yet, they still seem to be present.

Do you guys have any suggestions on how I could remove them?

Thank you

https://redd.it/15b97c6
@r_vim

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

r_vim

Vim Send To Terminal
https://balki.me/posts/vim-stt/

https://redd.it/15ag7e5
@r_vim

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

r_vim

Coc disable suggestions

How disable variable suggestions in Coc? This is bothering me a lot, I have no idea how to remove it.

https://preview.redd.it/exhrh0owwaeb1.png?width=1366&amp;format=png&amp;auto=webp&amp;s=57ec77a704af85e08e44ee9635afc4c25a3ef0c8

https://redd.it/15a4946
@r_vim

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

r_vim

How to adapt vim regex in context.vim for sql

Plugin in question: context.vim

I am trying to figure out how to incorporate the following plain text table structures (table version A and table version B) into context.vim so that it looks like adopted context sketch

table version A

```

ColumnA ColumnB ColumnC

\--------------------------------------- --------------------------------------- ---------------------------------------

John Doe Male

Jane Doe Female

```

&#x200B;

table version B

```

ColumnA ColumnB ColumnC

\--------------------------------------- --------------------------------------- ---------------------------------------

48170 Doe Male

10384 Doe Female

```

adopted context sketch

```

ColumnA ColumnB ColumnC

–––––––––––(this is now the context.vim line)––––––––––––––––––––––––––––––––<context.vim>---------

10384 Doe Female

```

If I understand correctly, context.vim reads lines and either skips them if they match the context_skip_regex or adds them to the context if line is matching the context_extend_regex.

Depending on whether context.vim reads from top to bottom or from line up, what will be encountered first, will lead to different changes to context_extend_regex. I think the magic of the plugin and hence the answer to the question happens/is here, though I don't fully get it: link

Can someone help me?

&#x200B;

https://redd.it/15a53ut
@r_vim

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

r_vim

Any vim git plugin that groaks logs and diff?

I can't find a plugin that helps with something so simple and yet so useful as these use cases:


use case #1

\- show me a log of a commits of my branch or other branches

\- log can contain

\- patches

\- only commit text, which means a patch or a file list needs to be open from it

\- only file names

\- open a vertical diff for the file under cursor


Please don't answer Fugitive, it indeed does the first two but stops there.


use case #2

\- given a patch open in a buffer

\- if possible, IE commits present locally, open the diffs of the file under the cursor in a vertical diff


this use case is close to the one above but it's not sure the patch is something applicable locally


&#x200B;

https://redd.it/159ha9v
@r_vim

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

r_vim

Config and plugins not working with sudo

Noob here, could use some help. I managed to make a nice setup for myself on my local machine (Fedora). I copied the config file and re-installed the plugins on a vps running Ubuntu, and to my surprise it worked.

The problem is the setup works only on regular privileges. When I sudo vim anything, vim just reverts to the original state.

Can anyone tell me what am I missing here?

https://redd.it/15el1gz
@r_vim

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

r_vim

Configure autocompletion refresh in CoC nvim

Hello,

I am currently trying to setup Conqueror of Completion plugin.

Everything works great except that refresh of diagnostic messages does not work in real time.

More specifically, i use coc-diagnostic extension , with the default configuration for python linting as advised in coc-jedi-lint repo .

My vim version 9.0.749.

"diagnostic-languageserver.filetypes": {
"python": "pylint"
},
"diagnostic-languageserver.linters": {
"pylint": {
"sourceName": "pylint",
"command": "pylint",
"debounce": 100,
"args": [
"--output-format",
"text",
"--score",
"no",
"--msg-template",
"'{line}:{column}:{category}:{msg} ({msg_id}:{symbol})'",
"%file"
],
"formatPattern": [
"^(\\d+?):(\\d+?):([a-z]+?):(.*)$",
{
"line": 1,
"column": 2,
"endColumn": 2,
"security": 3,
"message": 4
}
],
"rootPatterns": ["pyproject.toml", "`setup.py`", ".git"],
"securities": {
"informational": "hint",
"refactor": "info",
"convention": "info",
"warning": "warning",
"error": "error",
"fatal": "error"
},
"offsetColumn": 1,
"offsetColumnEnd": 1,
"formatLines": 1
}
}

The current behavior is as follow:
1 - i write gibberish in a python file
2 - quit insert mode
3 - save changes
4 - an error message show up at my gibberish line (1)

However i would like it to behave as follow:
1 - i write gibberish in a python file
2 - quit insert mode
3 - without having to save, an error message show up immediately at my gibberish line (1)

I first tried to add '"diagnostic.refreshOnInsertMode": true' in coc-settings.json, but nothing has changed.

Another test i did was to set "diagnostic.autoRefresh" to false, and then call CocAction('diagnosticRefresh') after doing changes in my file, but it seems that i have to save my file first before calling CocAction (which was not the behavior i espected either).

Is what i want even possible?

Thank you very much for your help!

https://redd.it/15edkse
@r_vim

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

r_vim

Wrong language

I just installed gvim 9.0 on Windows. In the installer I left everything as it was (default).

Now I'm opening gvim and see some strange language. "Fitxer", "Edita", "Eines".

How do I get English? And why does it happen in the first place, my Windows language settings are correct, no other program has ever done something like this.

https://redd.it/15czfui
@r_vim

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

r_vim

What are your current thoughts of NeoVim from Vim users

I’ve been using Vim compiled from source for around 20 something years now. I cannot function on a computer without it. It has stayed loyal to my needs since the first time I opened it. In fact the old trope of unable to quit was reversed for me. The first time I used a Unix system was on a shared server. I searched (then Alta Vista) how to edit files in Unix and got two answers Emacs and Vim. I opened Emacs and was unable to quit. I eventually panicked and pressed the big red reset button only to hear shouting down the hall (I was young and stupid). After that I vowed to learn how to exit. Back to searching I saw it was a strange alien key cord that I would have to print on a dot matrix manner and hang on the wall to remember. I then thought how do you do that in Vim? «:quit» oh snap I can remember that! And my love and affection for Vim started and never left that day.

Fast forward to today after decades of fending off the IDE zealots and scoffing and down right contempt (looking at you Apple XCode developers) I'm again finding myself being challenged. Only this time by my own echo chamber with NeoVim. When nvim first hit the popularity buzz I avoided it knowing that Vim has remained loyal and will remain so. But it has been more difficult this time. I can't help but feel like I'm somehow missing something. How can this fork undo all the wonderful features and compatibility that Vim has out of the box? Is it really true that Vim is unable to scale with modern software? Is my predilection to want «:make» over a Language Server make me obsolete?

When VimScript9 dropped I was pleased because it meant that the core of my customizations can begin to have more modern features. Unfortunately it came after the Lua craze creating an atmosphere of ridicule for embracing it over NeoVim's solution. It was staggering to see how fast the Vim community dropped Vim at the first sight of a new girl in a red dress. Which has very much gobsmacked me knowing the difficulties and frustrations we all felt during the Vim/Emacs wars so many years ago and more so during the first of the IDE wars.

Am I really at the end of an era with Vim. It is wrong to still like its codebase? Should I feel guilty for not jumping over to NeoVim considering that the community is more interested in supporting its plugings more then Vim's? Or is this all just a contrived form of self punishment as the two coexist in the same community in harmony?

I am able to get a good bead on the perspectives of NeoVim users but I’m genuinely curious what the NeoVim versus Vim perspective is from Vim users.

Disclaimer: I am a Front End (JavaScript) developer who came from the ashes of Java and Ruby on Rails.

https://redd.it/15cqofo
@r_vim

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

r_vim

Do you folks have any unpopular vim script customizations you are proud of?

I've gotta admit, as much as I love vim, some of its default keyboard mappings are kinda anachronistic and annoying. As a way of making the program less frustrating inside of a GUI dominant OS, I had to find code for toggling the mouse button, even though I have gotten better at using vim and I don't need to use that feature nearly as much anymore.

However, recently I figured out ways to save some typing, i'm not expecting anyone to approve of it, but I would like to know your thoughts and/or some quirky modifications you've made to vim:

nnoremap <Space> <Backspace>
vnoremap <Space> <Backspace>
xnoremap <Space> <Backspace>

inoremap <Esc>:w<Enter>
xnoremap
<Esc>:w<Enter>
vnoremap <Esc>:w<Enter>
nnoremap
:w<Enter>

The first three lines make it so i can use jkl for navigation, but the spacebar as a replacement for h...which is just awkward, because i trained myself to type with the asdf jkl; typing method that is really common for people who get sick of hunt-and-peck. Having to use h kinda throws things off for a while until you get used to it...the spacebar just feels smoother and more natural than stretching my index finger, or keeping my middle finger on j.

The last four lines make switching to normal mode more natural and faster, also for a while i have been mapping switching to normal mode to save automatically because that's typically how i save in other word processors, text editors, IDEs: CONSTANTLY. It seems rather OCD but i prefer it that way.

&#x200B;

https://redd.it/15ce11i
@r_vim

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

r_vim

Unable to use undo under certain conditions using ALE linting/fixing of a C file

I have this c code:

#include <ctype.h>

/ atof: convert string s to double /
double atof(char s) {

<snip>

return sign val / power;
}

I have this in my vim file:

let g:ale_linters = {
\ 'python': ['pylint'],
\ 'vim': ['vint'],
\ 'cpp': ['clang'],
"\ 'c': ['clang'],
\ 'markdown': ['languagetool']
\}

let g:ale_fixers = {
\ 'c': ['clang-format'],
\}
let g:ale_fix_on_save = 1

" To prevent buffer from resizing when loclist is updated
let g:ale_set_loclist = 0

" To prevent the cursor from moving when errors are found
let g:ale_cursor_detail = 0
set signcolumn=yes

If I remove the "r" in return at the bottom of the function, I get an error as expected. But when I try to undo to fix the problem, the line temporarily changes and then reverts back to what it was with the same error.

If I change the return line to simply \`return 0\` and delete the "r" and do undo, the "r" is reverted back and the error disappears. So there's something about \`return sign \
val / power;`
that confuses ALE with fix on save turned on. Any fix aside from turning off fix on save?

I have a weird workaround for now:

nnoremap <leader>ul :let g:aleenabled = 0<CR> :undo<CR> :undo<CR> :let g:aleenabled = 1<CR>

I have to do "undo" twice for some reason.

If anyone has a better suggestions or a proper fix, please let me know.

https://redd.it/15cbjdk
@r_vim

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

r_vim

The teachings of Baphomet (vi)
https://redd.it/15bztm2
@r_vim

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

r_vim

Multiple filetype does not load multiple syntax

In vim syntax file start with:

if exists("b:current_syntax")
finish
endif
and terminate with:
let b:current_syntax = 'foo'

My problem is that if my file uses two filetype, it will have two syntax at once, my file use 'foo' syntax alongside with 'bar' syntax, the filetype of my file is then 'foo.bar', my issue is that if foo syntax is loaded, bar one is not ( i suspect current_syntax security to be the cause) what is the good practice in this case ? I tried to give bar a different security name like current_syntax_addon security but it did not help.

https://redd.it/15brv5k
@r_vim

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

r_vim

You can use Leaderf rg --live to perform live grep now.

&#x200B;

live grep

https://github.com/Yggdroot/LeaderF/wiki/Leaderf-rg

https://redd.it/15bolwu
@r_vim

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

r_vim

disable python type hints

Whenever I write python code, some plugin will give me a hint about the types

I'll see something like a = True : bool or lines = file.readlines() : List[str]. The : Type is inserted by I think either Pyright or coc.nvim. Anyone know what this is and how to disable it?

https://redd.it/15bd72u
@r_vim

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

r_vim

<ESC> substitution

Hello!

I recently moved to i3wm (BTW i use Arch) and so far i like it a lot.

And i started to use Vim much often, obviously, to edit config files etc.

Problems is: while i first configured key bindings with i3, i tried to use CAPS as ESC and as CTRL, and I find pretty awesome to use it as additional CTRL.

But in Vim i want to use it as ESC. Is there a solution for this? I saw the example with remapping CAPS when starting Vim and switch back on leaving Vim, but it's not convenient, because i would like to switch between Vim and other applications.

Or may be you can advice me other combination to replace ESC which you find convinient.

https://redd.it/15atypg
@r_vim

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

r_vim

general query, mouse functionality

this is an old hat type've issue, but one that im re-visiting after having returned to the computer since recent medical procedure...
... and most of yous are familiar with universal clipboard, vim settings, etc.
One of my main issues is still the 'off-screen mouse selection, selecting w/right click(shift+click, whatever) in the universal mode.. when you go offscreen it clears the selected text randomly (when your trying to grab a large portion of text that continues offscreen).. very finicky, hard to get it right however... thats the functionality id still like to advance/improve; the mouse selection/functionality... for Vim specifically (i dont do gvim or any of those extra vims)
... its not a major question i have atm. its somethin that just crossed my mind today while readin other queries.

https://redd.it/15agwug
@r_vim

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

r_vim

Are there any videos of good vim users working with the keystrokes shown?

I know many of the motions but I feel like watching how someone uses them in an effective workflow would be a really effective and fast way of learning. But I haven't been able to find any substantial videos where someone is working and shows what keys they're pressing. Theprimeagen has some tutorial videos where he shows his keys, but they're short and are just teaching the keys, not showing an actual workflow.

https://redd.it/15a4zwj
@r_vim

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

r_vim

I regret not knowing this terminal shortcut! Export and edit your currently typed terminal command query into a vim buffer by pressing " Ctrl + x + e ".

Honestly, this is much better than the "set -o vi" command. Because exporting your command into a vim buffer allows you to use commands like change, delete, visual select, or yank [cdvy] inside or around the words/sentences/paragraphs. Everyone knows Vim has far more functionality than the Vi editor.

This helped me loads in editing lengthy terminal chain commands. To paste the edited command back into terminal, just use your preferred Vim save command (I prefer Shift + zz).

To know more, watch this video:

https://www.youtube.com/watch?v=f9eVam6d_No

https://redd.it/159kef3
@r_vim

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

r_vim

Vim config end-to-end automated tests?

I have a very complex VIM9 setup with a lot of plugins.

Sometimes what happens is that one of the plugin authors updates their plugin and breaks things.

I always want to be running the latest version of the plugins, but I want to run a few end-to-end smoke tests to test that things are working on a basic level.

If not I know to go in and fix.

I have a long reproduceable build script, just need some way of doing end-to-end tests using VIM9.

One thought I had was rolling my own with the sendkeys() function.

But I would vastly prefer an already formed and featureful test framework if one already exists that you know of?

https://redd.it/159e7gz
@r_vim

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