Skip to content

Instantly share code, notes, and snippets.

Avatar

Andy Shevchenko ur4ltz

  • Kharkiv - Ukraine, Glory to Ukraine
View GitHub Profile
@MunifTanjim
MunifTanjim / .config--hammerspoon--.nvimrc.lua
Last active Aug 24, 2022
Neovim - Project Local Config with exrc.nvim
View .config--hammerspoon--.nvimrc.lua
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
@kylechui
kylechui / dot-repeating.md
Last active Sep 19, 2022
A basic overview of how to manage dot-repeating in your Neovim plugin, as well as manipulate it to "force" what action is repeated.
View dot-repeating.md

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".

Using operatorfunc

@NNBnh
NNBnh / wm.md
Created May 3, 2022
My old windows manager ranking
View wm.md
@VonHeikemen
VonHeikemen / map_utils.lua
Last active Mar 27, 2022
Allows you to use lua functions with `vim.api.nvim_set_keymap` (for neovim 0.6.1 or lower)
View map_utils.lua
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)
@VonHeikemen
VonHeikemen / prompt-backspace.lua
Last active Jan 10, 2022
Neovim: Use backspace when `buftype=prompt`
View prompt-backspace.lua
-- 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
@VonHeikemen
VonHeikemen / completion.lua
Created Nov 16, 2021
Sublime-like autocompletion for neovim, using nvim-cmp and luasnip
View completion.lua
--[[
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:
@numToStr
numToStr / au.lua
Last active Oct 1, 2022
Neovim autocmd in lua
View au.lua
--
-- 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
@folke
folke / lua-lsp.lua
Last active Sep 9, 2022
Correct sumneko lua lsp setup for init.lua and plugin development
View lua-lsp.lua
-- put this file somewhere in your nvim config, like: ~/.config/nvim/lua/config/lua-lsp.lua
-- usage: require'lspconfig'.sumneko_lua.setup(require("config.lua-lsp"))
local library = {}
local path = vim.split(package.path, ";")
-- this is the ONLY correct way to setup your path
table.insert(path, "lua/?.lua")
table.insert(path, "lua/?/init.lua")
@pianocomposer321
pianocomposer321 / colors.lua
Last active Jun 8, 2022
Feline.nvim config
View colors.lua
-- ~/.config/nvim/lua/plugins/feline/colors.lua
-- One-dark colors
local _M = {
bg = '#2c323c',
fg = none,
yellow = '#e5c07b',
cyan = '#8abeb7',
darkblue = '#528bff',
green = '#98c379',
@windwp
windwp / livereload.lua
Created Apr 18, 2021
livereload for plugin development on lua
View livereload.lua
#Neovim Trick
Live Reload on plugin development and init.lua
# Demo
# How
* [ ] code