Questions tagged [vimscript-lua]

Lua programming interface to Vim. DO NOT use for questions with Lua examples or about syntax highlighting in Lua.

Filter by
Sorted by
Tagged with
0
votes
0answers
41 views

Cursorline became black when cursor is moving

If I change the colorscheme by <option>+12345 :colorscheme newsprint Then when I will firstly got the expected result: But then if I move my cursor by j/k, the clean cursorline gone: I can ...
0
votes
1answer
173 views

How to use packer.use inside neovim?

I was switching vimscript to lua in neovim, and I saw packer.nvim is a famous plugin manager for lua. In this README.md file I saw I can use startup function, but it's not required and I can also use ...
0
votes
1answer
86 views

How to transform this Vimscript into Lua?

Can anyone help me transform this into nvim.lua? inoremap <silent><expr> <TAB> \ pumvisible() ? "<C-n>" : \ <SID>check_back_space() ? "<TAB&...
0
votes
0answers
41 views

How to require `luafile` not in a subdirectory

in my config of init.lua ,I want to load a luafile from anywhere or any directory so : can I source it without function vim.cmd() vim.cmd('luafile /full/path/to/file.lua')
0
votes
1answer
35 views

How to colorize words in a buffer, using type data and position data?

I am writing a plugin for Neovim using Lua. If I have a text and some predefined arbitrary types, for example: chita wolf grizzly types: dog(green), cat(blue), bear(yellow) And I know positions/...
0
votes
0answers
16 views

Is there a simple way to pull in type specs from a language server?

This is a neovim + erlang_ls language server specific problem of mine. How can I inserting a type specification right above an Erlang function, that coming from the erlang_ls language server? (If it ...
0
votes
1answer
127 views

How to use vim.loop interactively in Neovim?

I want to read texts with Neovim scrolling them down automatically. The following code provides such functionality: local M = {} function M.down() local timer = vim.loop.new_timer() local ...
1
vote
1answer
47 views

How to provide modifier keys in lua?

If I want to move a cursor one line down with Lua in Neovim I can use :lua vim.cmd('normal j') How do I move the screen down one line? For example, this does not work: :lua vim.cmd('normal \<C-E&...
0
votes
0answers
33 views

How to get strings between `[ and `] in lua?

I'm trying to play around with text objects in lua, here's what I got: https://learnvimscriptthehardway.stevelosh.com/chapters/33.html On that webpage, I found that I can operate on the text send to ...
0
votes
1answer
63 views

How to call function with lisp style via mappings from lua in neovim?

I'm trying to use v:lua to call functions written in lua (actually it's fennel, which compiles to lua). Now I have a function named lisp-style , then I can't directly use v:lua.lisp-style() because it'...
1
vote
1answer
43 views

how to tabdo all the visible buffers without changing the current tab?

My init.vim code: cd ~/Documents/cp nnoremap <leader>lcd :tabdo lcd %:p:h<cr> suppose, i have 4 tabs opened in nvim via using nvim -p A.cpp B.cpp C.cpp D.cpp A.cpp B.cpp C.cpp D.cpp ...
-1
votes
2answers
2k views

short key mapping by lua for neovim

the simple why to remap key in lua is: vim.api.nvim_set_keymap('n', 'foo', 'bar', { noremap = true, silent = true }) but i want a simple syntax like vimScript: nnoremap foo bar n_keymap('foo','bar') ...
1
vote
2answers
697 views

Neovim lua config: how to append to listchars?

In a neovim init.lua config, I know that I can append to a string like so: vim.opt.wildignore:append("*/node_modules/*,*/vendor/*,*/venv/*,*/.venv/*,*/target/*") However, I'm getting errors ...
0
votes
2answers
41 views

Cycle through a list of letters in multiple groups

So I have a case where I have some unicode letters say [B, Ḅ, Ḃ] and when I have my mouse selected over the B, (in normal mode) I want some way of cycling through the list. Like pressing some command ...
1
vote
1answer
293 views

Get value of $MYVIMRC from Lua

I am trying to retrieve the value of $MYVIMRC in my init.lua but I am coming up short because I don't understand what $MYVIMRC actually is. It is not a global variable, is it? None of these work: vim....
0
votes
0answers
262 views

Autoloaded vs lua functions: which is faster/more efficient?

I'm creating a neovim plugin written in Lua, and I have to react to the BufAdd and BufUnload events with a function call. I have 3 options: write the function in Lua (like the rest of the plugin) and ...
0
votes
0answers
27 views

Cannot search for pairs with searchpairpos()

I am trying to search for the location of the start and the end of a pair with searchpairpos(). Given an example like this: *hel[]lo* And my code like this: local start_match = vim.api....
1
vote
2answers
1k views

How to modify only the background colour of a colourscheme in neovim using lua

I am slowly switching my neovim configurations to Lua. I am currently using the colour scheme https://github.com/nightsense/snow. It sets the background colour to a light-grey, while I want it to be a ...
1
vote
1answer
2k views

How to get the filetype in lua in nvim

How to get the current file type in lua with neovim? I tried following but all of them returns nil. print(vim.g.filetype) print(vim.b.filetype) print(vim.w.filetype) print(vim.t.filetype) print(vim.v....
3
votes
1answer
2k views

Most efficient way to call a Vim script function with lua (Neovim)

What is the most efficient way to call a Neovim function using Lua. I am able to call the sign_define Vim script function using the nvim_command procedure. I struggle with calling it with the ...
2
votes
1answer
1k views

Neovim Lua integration

I'm trying to understand how can I use Lua to extend Neovim, following a baby steps approach. Something like: -- ~/.config/nvim/lua/test.lua local api = vim.api local firstmodule = {} function ...
0
votes
0answers
547 views

Adding directories to Lua’s search path

I’m trying to run Fennel scripts in Vim 8.1 using the fennel-nvim plugin. (Fennel is a language that basically lets you write Lua with LISP syntax; you can use it from any Lua-supporting application ...
3
votes
2answers
3k views

How to use Lua in Vim?

I'm using MacVim snapshot 134 (on Mac OS X 10.9.5), which has support for Lua: $ vim --version | grep lua +dialog_con_gui +lua/dyn +rightleft +writebackup I've got Lua installed and ...
5
votes
1answer
2k views

Is it possible to write .nvimrc for NeoVim in Lua?

Is it possible to write .nvimrc for NeoVim in Lua? Is it planned for the future?