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
@VonHeikemen
VonHeikemen / prompt-backspace.lua
Last active January 10, 2022 01:57
Neovim: Use backspace when `buftype=prompt`
-- 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 November 16, 2021 17:20
Sublime-like autocompletion for neovim, using nvim-cmp and luasnip
--[[
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 August 20, 2023 05:15
Neovim autocmd in 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
@mengwangk
mengwangk / rust_tools_lsp_config.lua
Created August 2, 2021 13:44
rust-tools LSP config
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 = {
@mengwangk
mengwangk / lsp_config.lua
Created August 1, 2021 15:20
LSP Config for Code Lens
local alt_key_mappings = {
{"code_lens", "n", "<leader>lcld","<Cmd>lua vim.lsp.codelens.refresh()<CR>"},
{"code_lens", "n", "<leader>lclr", "<Cmd>lua vim.lsp.codelens.run()<CR>"}
}
local function set_lsp_config(client, bufnr)
require"lsp_signature".on_attach({
bind = true,
handler_opts = {border = "single"}
})
@folke
folke / lua-lsp.lua
Last active March 7, 2023 19:17
Correct sumneko lua lsp setup for init.lua and plugin development
-- 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 October 10, 2022 22:26
Feline.nvim config
-- ~/.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 April 18, 2021 06:34
livereload for plugin development on lua
#Neovim Trick
Live Reload on plugin development and init.lua
# Demo
# How
* [ ] code
@pkkm
pkkm / git-ml.el
Created February 26, 2021 16:51
Asynchronous git modeline (rough prototype)
;;; Asynchronous detailed git modeline.
;; git-ml is free software: you can redistribute it and/or modify it under the
;; terms of the GNU General Public License as published by the Free Software
;; Foundation, either version 3 of the License, or (at your option) any later
;; version.
;; This is a rough sketch. Things to do before publishing it as a package:
;;
;; * Consider doing the checks per git directory instead of per buffer, then
font = "Bmono 12"
geometry = "0x0-62-62"
separator_height = 2
padding = 2
horizontal_padding = 2
frame_width = 2
markup = full
format = "<b>%s</b>\n%b"
icon_path = ""