This file contains hidden or 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 function pack_len(...) | |
| return {n = select('#', ...), ...} | |
| end | |
| function M.run(f) | |
| local t = coroutine.create(f) | |
| local context = {} |
This file contains hidden or 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
| --- | |
| -- Recreating Neovim's v0.12 intro message in Snacks.nvim's dashboard. | |
| -- Based on echasnovski's fancy intro: | |
| -- https://github.com/neovim/neovim/pull/38378 | |
| --- | |
| local Snacks = require('snacks') | |
| local version = vim.version() | |
| local fmt = function(str) |
This file contains hidden or 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
| " NOTE: Neovim v0.11 or greater is needed | |
| " ============================================================================ " | |
| " === EDITOR SETTINGS === " | |
| " ============================================================================ " | |
| set number | |
| set ignorecase | |
| set smartcase | |
| set hlsearch |
This file contains hidden or 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
| -- NOTE: This configuration is meant for Neovim v0.11 or greater | |
| -- Learn about Neovim: | |
| -- https://vonheikemen.github.io/devlog/tools/simple-neovim-config/ | |
| -- https://neovim.io/doc/user/lua-guide.html | |
| vim.o.number = true | |
| vim.o.tabstop = 2 | |
| vim.o.shiftwidth = 2 | |
| vim.o.smartcase = true |
This file contains hidden or 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
| " vimscript version of the config in this blog post: | |
| " https://vonheikemen.github.io/devlog/tools/simple-neovim-config/ | |
| set number | |
| set tabstop=2 | |
| set shiftwidth=2 | |
| set smartcase | |
| set ignorecase | |
| set nowrap | |
| set nohlsearch |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
NewerOlder