Skip to main content
Share Your Experience: Take the 2024 Developer Survey
10 votes
Accepted

Vim plugin where the first lines in the editor show the first line(s) with less indendation that are not visible

There's plug-in wellle/context.vim which seems to implement what you requested. (Perhaps it's the one D. Ben Knoble was trying to recall?) It will try to show context (if, for or while block, function/...
filbranden's user avatar
  • 28.9k
7 votes

How do I use github copilot in NvChad?

You'll have to add copilot.lua in custom/plugins.lua using something like this: local overrides = require("custom.configs.overrides") local plugins = { ... { "zbirenbaum/...
ritiek's user avatar
  • 171
7 votes

nvim (plugged with coc, coc-clangd) is showing parameters for every function. How do disable it?

I propose you set: { "inlayHint.enable": false } in your coc-settings.json. You can get to this config by running the command :CocConfig in a vim/neovim buffer. See doc.
Johan Chane's user avatar
4 votes
Accepted

Advice on the use of :exe "norm!" vs. built in functions when writing vimscipt and plugins

In no particular order. Readability Any sequence of normals, except a very short one, is nearly impossible to read and understand. Vimgolf can't lie. Clobbering registers etc. Quite often there is ...
Matt's user avatar
  • 20.8k
4 votes
Accepted

Is it possible to execute Ex Commands (colon commands) in VimScript (vimrc/init.vim)?

I believe @VivianDeSmedt's comment refers to :help startup (notice that the vimrc is executed after files like plugin/*.vim and others have loaded). In general you cannot use a command until it has ...
D. Ben Knoble's user avatar
  • 26.4k
4 votes
Accepted

How can we know if we can install a plugin on both Vim and Neovim?

Most plugins are compatible for both Vim and Neovim. I'm not aware of any popular plugins that is Vim compatible and not Neovim compatible. Neovim has a more rich Lua binding and some plugins make use ...
Vivian De Smedt's user avatar
4 votes
Accepted

Is there a Vim plugin for testing VimScript patterns?

There is a very simple way, for which you do not need any plugin. Open a file with some content, turn on :set incsearch and/or :set hlsearch and try it out interactively with Vim. That's how you learn ...
Christian Brabandt's user avatar
4 votes

How do you pass options to a lua plugin?

require'nvim-gpt'.setup { no_default_keymaps = true, } is the correct way. It is not dependent on the plugin manager. (my mistake was elsewhere, calling this setup function accidentally from two ...
TamaMcGlinn's user avatar
3 votes

Add a Semicolon Automatically in C With a Vim Plugin

Languages with automatic semicolon insertion such as JavaScript and Go have as bunch of edge-cases where they do unexpected things, and any C solution will probably be no different. In C macros in ...
Martin Tournoij's user avatar
3 votes
Accepted

Data storage for a plugin

There is no vim convention for this per se, but there are various operating system conventions. On neovim, your best bet is probably stdpath('cache'). On linux, this usually resolves to ~/.cache/nvim....
Mass's user avatar
  • 14.1k
3 votes
Accepted

Is there a plugin that comments by putting the comment symbol at the line beginning?

Use vim-commentary plugin, it has buffer-local variable b:commentary_startofline you can setup per filetype: let b:commentary_startofline = 1 See patch https://github.com/tpope/vim-commentary/commit/...
Maxim Kim's user avatar
  • 13.5k
3 votes

Follow mode in ViM?

One way to do that would be with the following commands: ctrl+w v To create a new split with the same buffer ctrl-w w To go to the new split (or any other command you see fit like ctrl+w l) L To move ...
statox's user avatar
  • 50k
3 votes
Accepted

Minimap config in lua

The error you are receiving is caused by you attempting to call the setup function of a Vimscript plugin. Remember that Vimscript plugins do not need a setup() function and not all Lua plugins need ...
unrealapex's user avatar
3 votes
Accepted

Using marks in custom functions/plugins without changing user's marks

To get a list of all marks, you can use the getmarklist() Vimscript function. It allows to either return global marks (when no buffer argument is given) or return buffer specific marks when a bufnr ...
Christian Brabandt's user avatar
2 votes

Vim plugin where the first lines in the editor show the first line(s) with less indendation that are not visible

I would recommend writing a plugin that adds some text to your statusline. You can create a function that returns the text of the previous line that has one less unit of indentation (use indent()) ...
Chris Heithoff's user avatar
2 votes

Vim plugin where the first lines in the editor show the first line(s) with less indendation that are not visible

I think I've heard of a plugin that does this, but I cannot recall it's name. When I need this I do one of two things: Create a split. I lean towards vertical splits, since my monitor is wider than ...
D. Ben Knoble's user avatar
  • 26.4k
2 votes

Syntax highlighting with bogado/file-line and slim-template/vim-slim (e.g. when doing `vim app/views/sessions/new.html.slim:20`)

I needed to put syntax on after the imports of the plugins: call vundle#end() filetype plugin indent on syntax on
Dorian's user avatar
  • 123
2 votes
Accepted

Run a command that is from a plugin in a function

If you're running that code block from inside a vimrc file (or init.vim for NeoVim), that will explain why the :Fern command will not be available yet, since the code in a vimrc will run before plug-...
filbranden's user avatar
  • 28.9k
2 votes
Accepted

pylint default filepath in ALE

Knowing from :help ale-python-pylint that we want to adjust g:ale_python_pylint_options to include --rcfile, I would drop let g:ale_python_pylint_options = '--rcfile '.<filename> in wherever ...
D. Ben Knoble's user avatar
  • 26.4k
2 votes

how to navigate to a file or a function using neovim or vim?

i [sic] am not able to navigate to a file or function Vim comes with many ways to do this. So many, I nearly closed this as too broad. (Plugin requests are also off-topic…) A quick smattering of ...
D. Ben Knoble's user avatar
  • 26.4k
2 votes
Accepted

how to navigate to a file or a function using neovim or vim?

Language support in modern Vim/NeoVim typically involves using an LSP server that is able to parse/interpret/compile your code base and provide your editor with access to semantic elements such as ...
filbranden's user avatar
  • 28.9k
2 votes

Remove/hide control characters in the vim-fireplace preview window

Thanks to @D. Ben Knoble for helping me to understand what was going on. It was the timbre logging library that was adding the color characters. To turn them off, I added the following to my ...
apostl3pol's user avatar
2 votes
Accepted

Is there a way to restore a previous version of file in vim

The mbbill/undotree plugin provides you similar feature provided that you have enabled the support for undofiles see screenshot: Here is what I have in my .vimrc files to control the support " ...
Vivian De Smedt's user avatar
2 votes

Separate virtualenv for vim plugins and application code

Adding the following snippet at the start of .vimrc restores the default python environment. if has_key(environ(),"VIRTUAL_ENV") let $PATH=substitute($PATH,join([$VIRTUAL_ENV,"...
vijayvithal's user avatar
2 votes

Why is Vim telling me that 'no plugin to install' when I have installed a plugin manager (vim-plug)?

[![Updated][1]][1] The command to register a plugin in vim-plug is :Plug, not :plug; command names are case-sensitive in Vim. For the correct way, check the screenshot of my .vimrc here [1]: https://i....
Artisan's user avatar
  • 31
1 vote
Accepted

How can I install fzf in vim without using a plugin manager?

I use Vundle, and here are the relevant lines in my .vimrc to install fzf.vim: " If installed using git set runtimepath+=~/.fzf " set the runtime path to include Vundle and initialize set ...
mattb's user avatar
  • 1,141
1 vote
Accepted

Gvim Python loading issue (despite being correctly installed)

Vim needs to find the python310.dll. Like all executable it will search in a number of folders (the list and the order depends on the version of Windows). But the list always includes: The directory ...
Vivian De Smedt's user avatar
1 vote
Accepted

bind/map a call to win_gotoid with script level argument

The righthand side of a mapping is a series of key presses. That is, it works almost as if you pressed sequentially key "colon", then "c", then "a", then "l", ...
Matt's user avatar
  • 20.8k
1 vote

Is there a plugin for saving/loading registers' contents to/from files in a convenient way?

Register contents already saved into viminfo file. But you can create some sort of "extra spare file" if you wish. Here is (almost) one-liner: call split('abcdefghijklmnopqrstuvwxyz', '\zs') ...
Matt's user avatar
  • 20.8k
1 vote

Is there a plugin for saving/loading registers' contents to/from files in a convenient way?

Here's a simple function that achieves your goal, but it assumes that the text to the right of : is properly formatted for Vim (so your examples all need quotes to make strings). It does incidentally ...
D. Ben Knoble's user avatar
  • 26.4k

Only top scored, non community-wiki answers of a minimum length are eligible