Neovim Snippets
# Open filenvim myfile.txt
# Launch neovim with a specific configuration folder# e.g. ~/.config/astronvimNVIM_APPNAME=astronvim nvim
# or in shell set environment variables## powershell$env:NVIM_APPNAME = "astronvim"## bashexport NVIM_APPNAME="astronvim"## nu$env.NVIM_APPNAME = 'astronvim'## Run nvimnvim
# Edit a file with a specific configurationNVIM_APPNAME=nvimexample nvim init.lua
Lua Snippets related to Neovim
Section titled “Lua Snippets related to Neovim”-- Set key mappings-- Source current file, normal mode SPC SPC Xvim.keymap.set("n", "<space><space>x", "<cmd>source %<CR>")-- Run lua in current linevim.keymap.set("n", "<space>x", ":.lua<CR>")-- Run lua in visual selectionvim.keymap.set("v", "<space>x", ":lua<CR>")
-- Highlight when yanking (copying) text-- Try it with `yap` in normal mode-- See `:help vim.highlight.on_yank()`vim.api.nvim_create_autocmd('TextYankPost', { desc = 'Highlight when yanking (copying) text', group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), callback = function() vim.highlight.on_yank() end,})