UltiSnips giving weird <++> when expanding () on gvim
Hi everyone, dual boot user here, I use arch btw and windows. I recently encountered this problem that when I do () on windows, it'll expand it to ()<++> even without any snippets defined (see video).
​
Would anyone know why it does this?
https://redd.it/1599lu9
@r_vim
Does anyone want to make the VIM logo here ?
https://redd.it/158yw9p
@r_vim
Just ordered a final batch of these before I start working on 2nd edition
https://redd.it/158nhy2
@r_vim
detect +MANPAGER mode in vimrc
is it possible to detect +MANPAGER mode in my vimrc?
My vimrc usually has *set number relativenumber*.
I like to remove that while looking at a manpage; adding *-c 'nonum ....'* to my definition of MAPAGER works.
The problem is that if I use a plugin, fzf-vim in this case, to search in the manpage, when vim get back to displaying the manpage, it has *set number relativenumber* set again.
before using the plugin
https://preview.redd.it/5c0zoiel7wdb1.png?width=876&format=png&auto=webp&s=38255001fe068e0b990083f239c3a7ee0e6fc4ab
after using the plugin, line numbers are back and wrapping is wrong
https://preview.redd.it/btym2x5q7wdb1.png?width=853&format=png&auto=webp&s=b73956d484f03dfa078a2de09392ffc7f9dbbaad
related issue I reported
https://github.com/vim/vim/issues/12703
​
https://redd.it/15876nj
@r_vim
patched guifont for powerline of airline set the font for vim!
Hi, I set a patched guifont in vimrc for see powerline but the patched charset has not include all characters needed for me. patched ubuntu mono derivative ... has not have the character super index = (similar to ₌ but upper not botton like this).
could I use 2 guifont? 1 for text and another for powerline of airline?
Thank you and Regards
https://redd.it/157qnx9
@r_vim
VimTeX vim on mac lags when trying to use includegraphics{} for attaching image to a .tex file
I am new to Vim and LaTeX, but I'm trying to learn both at the same time so I started using VimTeX to edit .tex files on MacVim. I got almost everything working now (vimtex itself, zathura, autocomplete, etc.), but one thing. And that is Vim won't respond for a while whenever I try to include an image using \\includegraphics[\]{} from \\usepackage{graphicx}. By typing so, MacVim will request permission to access several folders but then hangs from there for like at least 10 minutes while my computer gets super hot and fans kick on loudly like it's doing something heavy in the background.
Could Vim be doing some file sorting/indexing thing? But after the lag is gone, Vim lags once more when I try to change the image file in \\includegraphics. At first I thought it was a MacVim thing but the same thing also happens on terminal vim.
https://redd.it/11d231g
@r_vim
Dumb new vim user question
I was screwing around with vim airline and I was trying to get the cool block color arrow look
I think it looks really cool
Does it have to do with the font that you use in your terminal emulator, a setting in your vimrc, a visual element that only is usable in the app version of vim, or something else entirely?
I have not had much luck with google so I thought I would post here just in case someone can point me the right direction. If it is not that simple, then just let me know. I am new to vim
https://redd.it/11ct9pl
@r_vim
How to close open dropdown in vimium?
Is there any way I can close an open dropdown without having to click to a random link to lose focus? Esc doesn't seem to work. Here is an image of what I'm talking about.
https://redd.it/11covzr
@r_vim
Shortening vim learning feedback loop
I’ve been using vim for a few years now and I’m pretty pleased with my skills. However, I know that there is always something to be learned or improved. Especially when it comes to vim. It’s just too easy to get used to some inefficient flows (like over-using j/k for vertical navigation etc) and stop seeking better habits. That’s why from time to time I do a bit of research and try to find ways in which I can improve my editing skills. The problem with that is that it takes a bit of time to do research and more importantly I often lack the discipline to enforce them in my workflow.
I wonder if there is some online app that could help me with that. I would really like to have a website with a never-ending stream of short vim challenges, that would first give you a task to edit the code and afterward show you the faster/better solution and make you redo it. I could spend 10 minutes a day on it, not stressing too much about remembering all the new tricks but hoping that they will eventually transfer from the synthetic online environment into my daily flow. (Exactly the same as I did with touch-typing back in the days).
Do you know if such app already exists? If not, I might try creating one
https://redd.it/11cggy3
@r_vim
silent grep! <args>
nnoremap gw <cmd>Grep -w <cword><cr>
nnoremap gW <cmd>execute 'Grep -wF -- "' .
\ expand('<cWORD>')
\ ->escape('`%#\"\|')
\ ->substitute('\C<cword>', '\\<cword>', 'g')
\ ->substitute('\C<cWORD>', '\\<cWORD>', 'g')
\ ->substitute('\C<cexpr>', '\\<cexpr>', 'g')
\ ->substitute('\C<cfile>', '\\<cfile>', 'g')
\ ->substitute('\C<afile>', '\\<afile>', 'g')
\ ->substitute('\C<abuf>', '\\<abuf>', 'g')
\ ->substitute('\C<amatch>', '\\<amatch>', 'g')
\ ->substitute('\C<sfile>', '\\<sfile>', 'g')
\ ->substitute('\C<stack>', '\\<stack>', 'g')
\ ->substitute('\C<script>', '\\<script>', 'g')
\ ->substitute('\C<slnum>', '\\<slnum>', 'g')
\ ->substitute('\C<sflnum>', '\\<sflnum>', 'g')
\ . '"'<cr>
I find it rather ugly, inefficient and long. I also have to keep track of all the special characters and keywords. It would be much nicer if I just could tell vim not to expand them.
https://redd.it/11byhfd
@r_vim
How do I embed Vim into Geany?
I use the simple GTK IDE Geany. I would like a Vim-like text editor in there, so to get started, how do I embed Vim into Geany? Make Geany's editor Vim!
https://redd.it/11bxpj7
@r_vim
How to change default keys while on the file explorer in VS Code?
So I have been using the vim extension in VS Code for some time now and I have swapped `j` with `k` , It just seems way more natural to me that way. However, when I want to navigate to the file explorer, this change I have done in the settings doest persist and its back to using `j` to go down and `k` to go up. Is there any way to change that? I found this in a github issue but I am not sure what to make of it. Thanks a lot in advance!
https://redd.it/11blyrt
@r_vim
Other keyboard layouts
Is it considered bad practice to remap the default cursor keys to work better with my keyboard layout? I use a german (QWERTZ) keyboard, and hjkl are inconvenient for touch typing, so I'm considering to remap them to jklö(the default touch typing position). However I saw some posts mentioning that you generally shouldn't remap this. Are there any issues with doing this?/What else do I need to consider if I remap them?
https://redd.it/11blrw0
@r_vim
plugins for explorable interface and identifier highlighting
Are there two different plugins that:
1. One plugin creates popup windows listing all the normal-mode commands that start with the pressed key
2. One plugin that highlights all the occurrence of the identifier under the cursor in the shown buffer?
https://redd.it/11alwee
@r_vim
Compete on code refactoring speed by using vim
http://vimracing.io
Hi everybody!
Sharing with you one of my recent pet projects. Project is not fully completed yet, lots of things & thoughts to improve. Would love to get any feedback & support from you, thanks in advance!
https://redd.it/1592eld
@r_vim
Vim tiny IDE: edit-compile-edit cycle for fast error browsing
https://hereket.github.io/posts/vim_ide_compile_cycle/
https://redd.it/158kfho
@r_vim
How do I enter text in vim?
Vim opened when I wanted to amend a commit and I can move cursor around text but I can't type. Each time I press a key, a letter is displayed in the bottom right corner, but not where my cursor is.
Taking into consideration that vim is supposed to be a text editor, entering text is probably one of its core features, but how do I do it? :)
https://redd.it/1583n66
@r_vim
Vim-compatible keybinds for twm + tmux?
Does anyone use a twm and tmux with keybinds that don't conflict with vim keybinds? I use vim keybinds for everything - vim, emacs, ide's, browsers, etc. I'm converting my system over to a twm, and intend to use that with tmux as primary interface and dev IDE. But I need a set of non-conflicting keybind schemes for both the twm and tmux. Anyone have such a setup they can share their keybinds for?
https://redd.it/157nhkl
@r_vim
How to edit files in encrypted zip archive?
I have a question. I know vim can handle unencrypted zip archives. But I use AES encrypted password-protected zip archive files. How do I use vim for my purpose?
https://redd.it/11d13zr
@r_vim
Help me find this Ozzy who gives Vim seminars
There's a bald, middle aged Australian guy who gives really amazing, advanced Vim seminars. I was watching them 5-6 years ago and they were probably out for a few years already by then. At the time I wasn't ready to dive into them, but would like to revisit them. Does this (admittedly pretty bad) description call to mind anyone? TIA
https://redd.it/11cqcyh
@r_vim
Widely supported themes (other than gruvbox)
I've used gruvbox dark for YEARS. I absolutely love it. The main reason I've always stuck with gruvbox is because literally everything seems to support it. My kitty terminal, tmux, vim, lualine, all support it.
What are some other widely supported themes out there other than gruvbox?
https://redd.it/11clflw
@r_vim
(To move text-Lines between files) ______ :ab wt w! ~/temp.vi ______ :ab rt r ~/temp.vi
i have these in my `.vimrc` file.
_______________
_______________
:ab qq q!
:ab wt w! ~/temp.vi
:ab rt r ~/temp.vi
_______________
_______________
So i can ..
- [1] from one file, do
_______________
_______________
:.wt -- write 1 line to temp file
:.,.+5 wt -- write 6 lines to temp file
:.,'a wt -- write up to (and including) mark A to temp file
- [2] optionally edit the temp file
- [3] from another file, do the following to read (in) the temp file
_______________
:rt
https://redd.it/11cbos4
@r_vim
How to tell grep not to expand keywords like <cword> and special characters like %? (And my journey to how to grep <cWORD>)
I summon the wizards of vim. I am trying to create a simple mapping which greps `<cWORD>` (the WORD under the cursor `:help <cWORD>`) which turned out to be more difficult than I thought.
**TLDR:** How to tell vim not to expand keywords like `<cword>` and special characters like `%` when they are in included in the search-pattern for grep without manually escaping them? For example I want that the command `:grep %` greps for the symbol `%` instead of vim expanding `%` to the current file-name and grepping for the file-name without me having to manually escape it to `:grep \%`. I played around with `magic` and `\V` but it doesn't seem to help.
## Problem
It begins with the simple and naive mapping which expands `<cWORD>` and passes it to grep as a search-pattern:
set grepprg=rg\ --vimgrep
set grepformat=%f:%l:%c:%m
nnoremap gW <cmd>grep! -wF -- "<cWORD>"<cr>
We are using in this example ripgrep as our grepprg.
* `-w` only shows matches surrounded by word boundaries.
* `-F` treats the pattern as a literal string instead of a regular expression. When this flag is used, special regular expression meta characters such as `.(){}\*` do not need to be escaped.
* `--` indicate that no more flags will be provided. Prevents grep interpreting `<cWORD>` as a flag if `<cWORD>` starts with a `-`.
Also, because `<cWORD>` can contain special characters which can be interpreted by the shell in funny ways we have to double-quote `<cWORD>`. But wait. `<cWORD>` itself can contain double-quotes, so now we have to escape the double-quotes inside `<cWORD>` with a backslash before passing it to grep. Also, there can be backslashes in `<cWORD>` which also have to be escaped by backslashes because they also can cause the shell to do funny things (like unquoting our double-quote around `<cWORD>`). We come up with something more sophisticated:
nnoremap gW <cmd>execute 'grep! -wF -- "' . escape(expand('<cWORD>'), '"\') . '"'<cr>
Now you may be thinking we can just pass our quoted and escaped `<cWORD>` to grep. What could go wrong? No! If `<cWORD>` contains any special characters like `\%#|`or keywords like... you guessed it...`<cWORD>` (`:help E499`) then vim will expand them before passing them to grep. For example if `<cWORD>` contains a `%` vim will expand it to the current file-name and pass the file-name to grep as a search-pattern instead of just `%`. Or if `<cWORD>` contains `<cWORD>` than `<cWORD>` inside `<cWORD>` will be expanded again to the contents of `<cWORD>`. Just like in the movie Inception. This means we also have to escape all the keywords and special characters inside `<cWORD>`. Escaping the special characters is easy. We just need to add them to the already existing escape-function. Escaping the keywords is a little bit more cumbersome and requires calling the substitute-function for every single keyword. Now it's getting long and ugly:
nnoremap gW <cmd>execute 'grep! -wF -- "' .
\ expand('<cWORD>')
\ ->escape('`%#"\|')
\ ->substitute('\C<cword>', '\\<cword>', 'g')
\ ->substitute('\C<cWORD>', '\\<cWORD>', 'g')
\ ->substitute('\C<cexpr>', '\\<cexpr>', 'g')
\ ->substitute('\C<cfile>', '\\<cfile>', 'g')
\ ->substitute('\C<afile>', '\\<afile>', 'g')
\ ->substitute('\C<abuf>', '\\<abuf>', 'g')
\ ->substitute('\C<amatch>', '\\<amatch>', 'g')
\ ->substitute('\C<sfile>', '\\<sfile>', 'g')
\ ->substitute('\C<stack>', '\\<stack>', 'g')
\ ->substitute('\C<script>', '\\<script>', 'g')
\ ->substitute('\C<slnum>', '\\<slnum>', 'g')
\ ->substitute('\C<sflnum>', '\\<sflnum>', 'g')
\ . '"'<cr>
`\C` makes the substitution case-sensitiv and isn't considered by vim as part of the pattern. For some reason the flags `gI` don't seem to work. My current solution looks as following:
set grepprg=rg\ --vimgrep
set grepformat=%f:%l:%c:%m
command! -nargs=+ -complete=file_in_path Grep
VIM Dashboard!
I have used glepnir-dashboard in neovim. Is there any available Dashboard for vim?
https://redd.it/11bssyt
@r_vim
Favourite Vim Easter Eggs?
I happened across the help system entry for :smile
this morning and it did, indeed, make me smile. :) What's your favourite Vim Easter Egg?
(I also have one in my .vimrc but that doesn't really count. But if you have a particularly good one you've implemented, instead of one Bram left for us, by all means, share it too!)
https://redd.it/11bml97
@r_vim
Vim: The whole Process to Solve coc.nvim: RangeError: WebAssembly.instantiate(): Out of memory: wasm memory
Tricky problems occurred quite often. This article is about one of them. It’s WebAssembly Memory issue when I use Vim plugin coc.nvim.
https://medium.com/code-art/vim-the-whole-process-to-solve-coc-nvim-b6f3b3f68ebe
https://redd.it/11bldwh
@r_vim
How to handle fold file after the main file is deleted?
I have this habit of making a test file, eg. test.py for whatever code I intend to try out, then usually, delete it right after. Ever since I discover that I can use fold in vim and store them, this question come up naturally. The fold setting file is not deleted, and I wonder if this will affect future file, as well as how to handle?
https://redd.it/11alz43
@r_vim
<M-;> acts as <Esc> without config
I started learning vim a week ago and was wondering is it worth remapping <Esc>
Long story short, I discovered that on Windows <M-;> somehow acts exactly as <Esc> without any remaps!
I checked it with powershell, wsl and windows terminal with vim, lazy.nvim and plain clean neovim. Works like a charm in any mode.
And it is crazy convenient because my fingers do not leave home row at all. Left thumb on Alt and right pinky on semicolon. Looks like compared to jk/kj/jj there is no downsides regarding probability, slowdowns and behaviour on the top and bottom of the page.
It is not working on macos iTerm2 and vscode vim/neovim extensions out of the box, but sure can be mapped.
The point is, I searched :help, this subreddit and google in general and was unable to find any single mention of this combination with closest been this.
This puzzling me quite a bit. Why huge article dedicated to <Esc> alternatives missed this simple and convenient combination? Is it somehow worse than Ctrl+[ or some other mapping?
Did you know about it? Is it working on your system?
I hope this community will help me shed some light on this mystery
https://redd.it/11aa28t
@r_vim