New answers tagged

0

My mistake at line # 148 -- Setup lspconfig. 148 require('lspconfig')[tsserver].setup { 149 capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) 150 } This should be: require('lspconfig')['tsserver'].setup { I didn't know the string tsserver was supposed to be a string litteral.


1

disable_commands = true was disabling PackerInstall, PackerSync, etc., but not the plugin, so I switched to using packer.sync() inside plugins.lua, and it worked fine.


0

Yes: run vim --startuptime profile and work for a bit. (To purely measure time from "enter" to "open and ready", use vim --startuptime profile +q.) I used this and a single command quite successfully to cut my startup time by 1/3rd. First, I collected the profile, as shown above. Then I "analyzed" it by putting the slowest bits ...


0

One plugin that notably improved my neovim startup time is filetype.nvim the speed test measured 175x faster filetype detection for neovim. This plugin is a replacement for the included filetype.vim that is sourced on startup. The purpose of that file is to create a series of autocommands that set the filetype variable depending on the filename. The issue is ...


0

I encountered this same error and found that my copy of the netrw plugin .vim/plugin/netrwPlugin.vim was extremely out of date. I've been carrying around a copy of my .vim directory for years. The latest installed versions of vim have been advancing but my old copy of the plugin wasn't. Updating the plugin file fixed my issue. https://github.com/eiginn/...


2

:h nvim_win_get_cursor() will return a tuple containing the current cursor position, which you'll have to unpack to use. It takes an argument {window}, and you can use 0 to specify the current window. :h nvim_get_current_line() is the Neovim Lua analog to getline('.'). Here is an example: function check_back_space() -- get row and column local row, ...


3

An alternative solution that works if you're running the commands inside a Vim instance (you're not, but the existing answer is already the best solution for your exact circumstances) is to use :execute to more specifically delimit the arguments to the LspInstall command. Instead of: :LspInstall tsserver | qall You can use: :execute "LspInstall ...


0

This is (roughly) how I would write this with your skeleton: we add an autocommand to do the initial mapping on any buffer enter. If you want it for particular files, change the autocommmand's pattern. If you want it for particular filetypes, you're better off putting the call MapRunCmd() in ~/.vim/after/ftplugin/{filetype}.vim. function! MapRunCmd() abort ...


3

I guess the LspInstall user command is configured to take multiple parameters. No matter, you can use multiple -c flags, each with their own command(s). Specifically... You can use up to 10 "+" or "-c" arguments in a Vim command. They are executed in the order given. A "-S" argument counts as a "-c" argument as well. ...


2

There's no default init file in neovim. There's no requirement to create one. If you have such file then it should consist of the same commands you (can) input at (neo)vim command prompt. If you still don't know what you can do with Vim you should learn this, not "how do I setup the tool I can't make use of". The recommended reading for beginners ...


1

As of nvim 0.5.1, on MacOS and Linux, it appears that the vim.opt.listchars:append in my original question now works, and for some reason setting the map values as in vim.opt.listchars.extends = "e" or vim.opt.listchars.tab = "t" no longer works. vim.opt.listchars:append({ extends = "#" }) print(vim.inspect(vim.opt.listchars:get(...


1

Removing the following lines from my init.lua vim.cmd [[set runtimepath=$VIMRUNTIME]] vim.cmd [[set packpath=~/.local/share/nvim/site]] and placing all my .lua modules (except init.lua) into ~/.config/nvim/lua fixed the issue.


1

Ok, I assume the following according to your post + image: You're using neovim >= 0.5.0 You've already set up the server with (assuming that the following code is in a lua file like ~/.config/nvim/lua/rofl.lua and you're loading it in your ~/.config/nvim/init.vim with lua require('rofl')): local nvim_lsp = require('lspconfig') nvim_lsp.tsserver.setup({})...


0

i solved mine by doing this python -m pip --user --upgrade pynvim. PyNvim is a provider for python in NVIM and later in the config file at ~/.config/nvim/init.vim add this line saying which python to use let g:python3_host_prog = '/usr/bin/python'


0

This and more (saving of watch window variables) should now be possible with a recent commit on github. Essentially, prior to exit, you can have something so: nnoremap <leader>d1 :call vimspector#WriteSessionFile(".vim/debuggingsession.txt")<CR> Then, the next time you are in, you call: nnoremap <leader>d2 :call vimspector#...


1

I kind of solved the problem.(There might be a better way.) Here is what I did as a Rust programmer. I installed rust.vim plugin. I found a pending pull request for the plugin. I added the code manually from that pull request to see how it works. It gave me the indentation.


0

Plugin suggestions from the comments: easymotion vim-sneak


1

A far simpler version of what you're trying to accomplish: inoreabrrev <buffer> \cup ∪ To read/write a buffer, you probably want the API at :help text-functions. If you meant register, you can access it directly @a to read/write it. If you need to do "smarter" things, I would look for a snippets plugin.


0

A rough sketch with lots of bugs, probably. The function names could use some work, too. function Templates(ext) abort return glob(printf('~/Documents/Library/**/*.%s', a:ext), v:false, v:true) endfunction function ChooseTemplateAll() abort const ext = fnamemodify(@%, ':e') call popup_menu(Templates(ext), #{callback: 'SelectedTemplate', title: '...


0

In regular vim, the API would be term_start() with the exit_cb option set: function Exit(job, exit_status) abort echom 'goodbye world' endfunction call term_start('echo hello world', #{exit_cb: 'Exit'})


1

After a bit of research, I found that there are two autocommands I can use that suit my needs au TermClose * lua require('my-plugin').someFunction() or au TermLeave * lua require('my-plugin').someFunction() The first one works better for me because I only want to run my function once the terminal is killed/closed. The second one is for if you want to run ...


Top 50 recent answers are included