Skip to content

Instantly share code, notes, and snippets.

@mengwangk
mengwangk / options.lua
Last active November 3, 2023 06:06
Neovim Plugins and Configuration Recipes | 5
local function update_lead()
local lcs = vim.opt_local.listchars:get()
local tab = vim.fn.str2list(lcs.tab)
local space = vim.fn.str2list(lcs.multispace or lcs.space)
local lead = { tab[1] }
for i = 1, vim.bo.tabstop - 1 do
lead[#lead + 1] = space[i % #space + 1]
end
vim.opt_local.listchars:append { leadmultispace = vim.fn.list2str(lead) }
@mengwangk
mengwangk / pickers.lua
Last active September 30, 2023 14:00
Neovim Plugins and Configuration Recipes | 3
M.actions = transform_mod {
set_extension = function(prompt_bufnr)
local current_input = action_state.get_current_line()
vim.ui.input({ prompt = "*." }, function(input)
if input == nil then
return
end
live_grep_filters.extension = input
actions.close(prompt_bufnr)
@mengwangk
mengwangk / utils.lua
Last active September 23, 2023 13:47
Neovim Plugins and Configuration Recipes | 3
local M = {}
local function default_on_open(term)
vim.cmd "startinsert"
vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", { noremap = true, silent = true })
end
function M.open_term(cmd, opts)
opts = opts or {}
opts.size = opts.size or vim.o.columns * 0.5
@mengwangk
mengwangk / init.lua
Last active August 10, 2023 12:57
Modern Neovim - User Interface
local opts = {
defaults = {
mappings = mappings,
vimgrep_arguments = {
"rg",
"-L",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
{
"echasnovski/mini.clue",
cond = function()
return require("config").keymenu.mini_clue
end,
event = "VeryLazy",
opts = function()
local map_leader = function(suffix, rhs, desc)
vim.keymap.set({ "n", "x" }, "<Leader>" .. suffix, rhs, { desc = desc })
end
@mengwangk
mengwangk / languages.toml
Last active August 5, 2023 12:45
Helix - Languages
[language-server.pyright]
command = "pyright-langserver"
args = ["--stdio"]
config = { settings = { python = { analysis = { autoImportCompletions = true, typeCheckingMode = "off", autoSearchPaths = true, useLibraryCodeForTypes = true, diagnosticMode = "openFilesOnly" } } } }
[language-server.ruff-lsp]
command = "ruff-lsp"
[[language]]
name = "python"
@mengwangk
mengwangk / config.toml
Last active July 29, 2023 08:30
Helix - config.toml
theme = "everforest_dark"
[editor]
# Show currently open buffers, only when more than one exists.
bufferline = "multiple"
# Highlight all lines with a cursor
cursorline = true
# Use relative line numbers
line-number = "relative"
# Show a ruler at column 80 and 120
@mengwangk
mengwangk / typescript.lua
Created July 22, 2023 06:39
Neovim PDE - Plugins and Configuration Recipes
{
"mfussenegger/nvim-dap",
opts = {
setup = {
vscode_js_debug = function()
local function get_js_debug()
local install_path = require("mason-registry").get_package("js-debug-adapter"):get_install_path()
return install_path .. "/js-debug/src/dapDebugServer.js"
end
@mengwangk
mengwangk / terraform.lua
Last active July 15, 2023 04:36
Neovim PDE -Flutter, Kotlin, Ruby, and Other Languages
if not require("config").pde.terraform then
return {}
end
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"terraform",
@mengwangk
mengwangk / elixir.lua
Created July 15, 2023 04:22
Neovim PDE -Flutter, Kotlin, Ruby, and Other Languages
if not require("config").pde.elixir then
return {}
end
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"elixir",