When using Lua-based plugins for Neovim, you may need to install some packages
with luarocks. To use these packages, the environment variables LUA_PATH
and
LUA_CPATH
needs to contain the luarocks directories. Problem is, Neovim uses
LuaJIT which is a Lua 5.1 implementation; however, you may already have your
environment setup for a different Lua version, for example the current last
version 5.4. To resolve this problem, this gist patches the Lua paths in the
startup configuration instead of relying on the environment variables as is
default in Neovim.
View README.md
View feline.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local feline = require('feline') | |
local vi_mode = require('feline.providers.vi_mode') | |
-- | |
-- 1. define some constants | |
-- | |
-- left and right constants (first and second items of the components array) | |
local LEFT = 1 | |
local RIGHT = 2 |
View .config--hammerspoon--.nvimrc.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("config.lsp.custom").patch_lsp_settings("sumneko_lua", function(settings) | |
settings.Lua.diagnostics.globals = { "hs", "spoon" } | |
settings.Lua.workspace.library = {} | |
local hammerspoon_emmpylua_annotations = vim.fn.expand("~/.config/hammerspoon/Spoons/EmmyLua.spoon/annotations") | |
if vim.fn.isdirectory(hammerspoon_emmpylua_annotations) == 1 then | |
table.insert(settings.Lua.workspace.library, hammerspoon_emmpylua_annotations) | |
end |
View dot-repeating.md
Using
Adding dot-repeat to your Neovim plugin
In Neovim, the .
character repeats "the most recent action"; however, this is not always respected by plugin actions. Here we will explore how to build dot-repeat support directly into your plugin, bypassing the requirement of dependencies like repeat.vim.
The Basics
When some buffer-modifying action is performed, Neovim implicitly remembers the operator (e.g. d
), motion (e.g. iw
), and some other miscellaneous information. When the dot-repeat command is called, Neovim repeats that operator-motion combination. For example, if we type ci"text<Esc>
, then we replace the inner contents of some double quotes with text
, i.e. "hello world"
→ "text"
. Dot-repeating from here will do the same, i.e. "more samples"
→ "text"
.
operatorfunc
Using
View wm.md
Name | Structure | Bar | Menu | Window decoration | Difficulty | Config method | Description |
---|---|---|---|---|---|---|---|
Tree | Yes | No | Border | Easy | Python | With Plasma it can be use tree-base tiling system like I3 and Sway but because Qtile is Python-base, it's way more hackable | |
Tree | Yes | No | Tabsbar | Easy | [Plain text](https://wikiped |
View map_utils.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local M = {} | |
local module_name = 'map_utils' | |
local fn_store = {} | |
local function register_fn(fn) | |
table.insert(fn_store, fn) | |
return #fn_store | |
end | |
function M.apply_function(id) |
View prompt-backspace.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Taken from here: | |
-- https://github.com/neovim/neovim/issues/14116#issuecomment-977555102 | |
function PromptBackspace() | |
-- Have to know the length of the prompt | |
local prompt = 2 | |
local cursor = vim.api.nvim_win_get_cursor(0) | |
local line = cursor[1] | |
local col = cursor[2] | |
if col ~= prompt then |
View completion.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
Dependencies: | |
Completion: | |
https://github.com/hrsh7th/nvim-cmp | |
https://github.com/hrsh7th/cmp-buffer | |
https://github.com/hrsh7th/cmp-path | |
https://github.com/saadparwaiz1/cmp_luasnip | |
Snippets: |
View au.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Move this file to your neovim lua runtime path ie. ~/.config/nvim/lua/au.lua | |
-- | |
local cmd = vim.api.nvim_command | |
local function autocmd(this, event, spec) | |
local is_table = type(spec) == 'table' | |
local pattern = is_table and spec[1] or '*' | |
local action = is_table and spec[2] or spec | |
if type(action) == 'function' then |
View rust_tools_lsp_config.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function setup_rust_tools() | |
local tools = { | |
autoSetHints = true, | |
runnables = {use_telescope = true}, | |
inlay_hints = {show_parameter_hints = true}, | |
hover_actions = {auto_focus = true} | |
} | |
require('rust-tools').setup({ | |
tools = tools, | |
server = { |
NewerOlder