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
#! /usr/bin/env lua | |
local function main(argv) | |
local name = argv[1] or 'World' | |
sh.spawn('echo "Hello, %s!"', name) | |
end | |
--- | |
-- I/O helper functions |
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 lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' | |
-- Auto-install lazy.nvim if not present | |
if not vim.loop.fs_stat(lazypath) then | |
print('Installing lazy.nvim....') | |
vim.fn.system({ | |
'git', | |
'clone', | |
'--filter=blob:none', | |
'https://github.com/folke/lazy.nvim.git', |
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
#! /usr/bin/lua | |
--[[* | |
* test case: cmus-notify status playing file path title hola artist qace album ok | |
* | |
* installation: | |
* - Set the status_display_program variable in cmus | |
* :set status_display_program=/path-to/cmus-notify.lua | |
* | |
* - Save the changes using |
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
vim.opt.signcolumn = 'yes' | |
vim.diagnostic.config({ | |
virtual_text = true, | |
}) | |
vim.api.nvim_create_autocmd('LspAttach', { | |
desc = 'LSP keybindings', | |
callback = function(event) | |
local opts = {buffer = event.buf} |
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
-- based on u/YungDaVinci work: | |
-- https://www.reddit.com/r/neovim/comments/ydlgzi/expand_lsp_snippets_with_luasnip_while_using/ | |
vim.api.nvim_create_augroup('user-snippet-expand', {}) | |
vim.api.nvim_create_autocmd('CompleteDone', { | |
group = 'user-snippet-expand', | |
desc = 'Expand LSP snippet', | |
pattern = '*', | |
callback = function(opts) | |
local comp = vim.v.completed_item |
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 path_sep = vim.loop.os_uname().version:match('Windows') and '\\' or '/' | |
local join = function(...) return table.concat({...}, path_sep) end | |
local getpath = function(arg) | |
local path = vim.fn.stdpath(arg) | |
return vim.fn.substitute(path, [[\(.*\)\zsnvim]], 'nvchad', '') | |
end | |
local user_path = getpath('config') | |
local data_path = getpath('data') | |
local chad_core = join(data_path, 'core', 'nvim') |
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
--- For details of usage and explanation see: | |
--- https://dev.to/vonheikemen/how-to-install-astronvim-without-overriding-your-existing-neovim-configuration-1nke | |
local path_sep = vim.loop.os_uname().version:match('Windows') and '\\' or '/' | |
local join = function(...) return table.concat({...}, path_sep) end | |
local getpath = function(arg) | |
local path = vim.fn.stdpath(arg) | |
return vim.fn.substitute(path, [[\(.*\)\zsnvim]], 'astronvim', '') | |
end |
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
--[[ | |
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) |
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
let s:packpath = expand('~/.local/share/nvim/site/pack/minpac') | |
let s:hash_dir = expand('~/.local/share/nvim/site/pack/minpac/hashes') | |
let s:pattern = '/{opt,start}' | |
function! s:save_hashes() abort | |
let plugin_dirs = glob(s:packpath .. s:pattern, 1, 1) | |
if empty(plugin_dirs) | |
return | |
endif |
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) |
NewerOlder