Skip to content

Instantly share code, notes, and snippets.

View ur4ltz's full-sized avatar

Andy Shevchenko ur4ltz

  • Kharkiv - Ukraine, Glory to Ukraine
View GitHub Profile
@mischw
mischw / convert_unicode_nerdfont3.py
Last active September 28, 2023 07:35
Converts the unicode characters to the new range introduced in nerdfont 3. Conversion based on this table: https://github.com/ryanoasis/nerd-fonts/issues/1059#issuecomment-1404891287
View convert_unicode_nerdfont3.py
#!/usr/bin/env python3
trans_dict = {
'\U0000f500': '\U000f0001', # vector_square
'\U0000f501': '\U000f0003', # access_point
'\U0000f502': '\U000f0002', # access_point_network
'\U0000f503': '\U000f0004', # account
'\U0000f504': '\U000f0005', # account_alert
'\U0000f505': '\U000f0006', # account_box
'\U0000f506': '\U000f0007', # account_box_outline
@Lattay
Lattay / README.md
Last active January 6, 2023 20:32
Configure luarocks for Neovim at startup (Linux)
View README.md

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 feline.lua
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
@MunifTanjim
MunifTanjim / .config--hammerspoon--.nvimrc.lua
Last active August 24, 2022 16:23
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 November 30, 2023 20:12
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

@VonHeikemen
VonHeikemen / init.lua
Last active November 1, 2023 18:24
nvim-lspconfig + nvim-cmp setup
View init.lua
--[[
blogpost:
https://vonheikemen.github.io/devlog/tools/setup-nvim-lspconfig-plus-nvim-cmp/
Dependencies:
LSP:
https://github.com/neovim/nvim-lspconfig
https://github.com/williamboman/mason.nvim (optional)
https://github.com/williamboman/mason-lspconfig.nvim (optional)
@NNBnh
NNBnh / wm.md
Created May 3, 2022 08:02
My old windows manager ranking
View wm.md
@VonHeikemen
VonHeikemen / map_utils.lua
Last active March 27, 2022 16:15
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 January 10, 2022 01:57
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