Update Neovim and Emacs configurations
This commit is contained in:
@@ -1,33 +1,33 @@
|
||||
-- Autocmds are automatically loaded on the VeryLazy event
|
||||
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
||||
-- Add any additional autocmds here
|
||||
|
||||
local augroup = vim.api.nvim_create_augroup
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
local view_group = augroup("auto_view", { clear = true })
|
||||
|
||||
autocmd({ "BufWinLeave", "BufWritePost", "WinLeave" }, {
|
||||
desc = "Save view with mkview for real files",
|
||||
group = view_group,
|
||||
callback = function(args)
|
||||
if vim.b[args.buf].view_activated then
|
||||
vim.cmd.mkview({ mods = { emsg_silent = true } })
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
autocmd("BufWinEnter", {
|
||||
desc = "Try to load file view if available and enable view saving for real files",
|
||||
group = view_group,
|
||||
callback = function(args)
|
||||
if not vim.b[args.buf].view_activated then
|
||||
local filetype = vim.api.nvim_get_option_value("filetype", { buf = args.buf })
|
||||
local buftype = vim.api.nvim_get_option_value("buftype", { buf = args.buf })
|
||||
local ignore_filetypes = { "gitcommit", "gitrebase", "svg", "hgcommit" }
|
||||
if buftype == "" and filetype and filetype ~= "" and not vim.tbl_contains(ignore_filetypes, filetype) then
|
||||
vim.b[args.buf].view_activated = true
|
||||
vim.cmd.loadview({ mods = { emsg_silent = true } })
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
-- Autocmds are automatically loaded on the VeryLazy event
|
||||
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
||||
-- Add any additional autocmds here
|
||||
|
||||
local augroup = vim.api.nvim_create_augroup
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
local view_group = augroup("auto_view", { clear = true })
|
||||
|
||||
autocmd({ "BufWinLeave", "BufWritePost", "WinLeave" }, {
|
||||
desc = "Save view with mkview for real files",
|
||||
group = view_group,
|
||||
callback = function(args)
|
||||
if vim.b[args.buf].view_activated then
|
||||
vim.cmd.mkview({ mods = { emsg_silent = true } })
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
autocmd("BufWinEnter", {
|
||||
desc = "Try to load file view if available and enable view saving for real files",
|
||||
group = view_group,
|
||||
callback = function(args)
|
||||
if not vim.b[args.buf].view_activated then
|
||||
local filetype = vim.api.nvim_get_option_value("filetype", { buf = args.buf })
|
||||
local buftype = vim.api.nvim_get_option_value("buftype", { buf = args.buf })
|
||||
local ignore_filetypes = { "gitcommit", "gitrebase", "svg", "hgcommit" }
|
||||
if buftype == "" and filetype and filetype ~= "" and not vim.tbl_contains(ignore_filetypes, filetype) then
|
||||
vim.b[args.buf].view_activated = true
|
||||
vim.cmd.loadview({ mods = { emsg_silent = true } })
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -1,45 +1,42 @@
|
||||
-- Keymaps are automatically loaded on the VeryLazy event
|
||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||
-- Add any additional keymaps here
|
||||
|
||||
local map = vim.keymap.set
|
||||
|
||||
-- Buffer management
|
||||
map("n", "<leader>bn", ":bnext<CR>", { noremap = true, silent = true, desc = "Next buffer" })
|
||||
map("n", "<leader>bp", ":bprevious<CR>", { noremap = true, silent = true, desc = "Previous buffer" })
|
||||
map("n", "<leader>bd", ":bdelete<CR>", { noremap = true, silent = true, desc = "Delete buffer" })
|
||||
|
||||
-- Copy to system clipboard (if not already mapped)
|
||||
map({ "n", "v" }, "<leader>y", [["+y]], { noremap = true, silent = true, desc = "Copy to system clipboard" })
|
||||
|
||||
-- Paste from system clipboard
|
||||
map("n", "<leader>p", [["+p]], { noremap = true, silent = true, desc = "Paste from system clipboard" })
|
||||
|
||||
-- Markdown menu
|
||||
map("n", "<leader>M", [["+M]], { noremap = true, silent = true, desc = "Markdown" })
|
||||
|
||||
vim.keymap.set("n", "<leader>cc", function()
|
||||
local file1 = vim.fn.expand("%")
|
||||
|
||||
local project_root = vim.fn.systemlist("git rev-parse --show-toplevel")[1]
|
||||
if project_root == "" then
|
||||
project_root = vim.fn.getcwd()
|
||||
end
|
||||
|
||||
require("telescope.builtin").find_files({
|
||||
prompt_title = "Compare with...",
|
||||
cwd = project_root,
|
||||
hidden = true,
|
||||
follow = true,
|
||||
attach_mappings = function(_, map)
|
||||
map("i", "<CR>", function(prompt_bufnr)
|
||||
local actions = require("telescope.actions")
|
||||
local action_state = require("telescope.actions.state")
|
||||
local file2 = action_state.get_selected_entry().path
|
||||
actions.close(prompt_bufnr)
|
||||
require("user.utils").meld_diff(file1, file2)
|
||||
end)
|
||||
return true
|
||||
end,
|
||||
})
|
||||
end, { desc = "Compare with" })
|
||||
-- Keymaps are automatically loaded on the VeryLazy event
|
||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||
-- Add any additional keymaps here
|
||||
|
||||
local map = vim.keymap.set
|
||||
|
||||
-- Buffer management
|
||||
map("n", "<leader>bn", ":bnext<CR>", { noremap = true, silent = true, desc = "Next buffer" })
|
||||
map("n", "<leader>bp", ":bprevious<CR>", { noremap = true, silent = true, desc = "Previous buffer" })
|
||||
map("n", "<leader>bd", ":bdelete<CR>", { noremap = true, silent = true, desc = "Delete buffer" })
|
||||
|
||||
-- Copy to system clipboard (if not already mapped)
|
||||
map({ "n", "v" }, "<leader>y", [["+y]], { noremap = true, silent = true, desc = "Copy to system clipboard" })
|
||||
|
||||
-- Paste from system clipboard
|
||||
map("n", "<leader>p", [["+p]], { noremap = true, silent = true, desc = "Paste from system clipboard" })
|
||||
|
||||
vim.keymap.set("n", "<leader>cc", function()
|
||||
local file1 = vim.fn.expand("%")
|
||||
|
||||
local project_root = vim.fn.systemlist("git rev-parse --show-toplevel")[1]
|
||||
if project_root == "" then
|
||||
project_root = vim.fn.getcwd()
|
||||
end
|
||||
|
||||
require("telescope.builtin").find_files({
|
||||
prompt_title = "Compare with...",
|
||||
cwd = project_root,
|
||||
hidden = true,
|
||||
follow = true,
|
||||
attach_mappings = function(_, map)
|
||||
map("i", "<CR>", function(prompt_bufnr)
|
||||
local actions = require("telescope.actions")
|
||||
local action_state = require("telescope.actions.state")
|
||||
local file2 = action_state.get_selected_entry().path
|
||||
actions.close(prompt_bufnr)
|
||||
require("user.utils").meld_diff(file1, file2)
|
||||
end)
|
||||
return true
|
||||
end,
|
||||
})
|
||||
end, { desc = "Compare with" })
|
||||
|
||||
@@ -1,50 +1,170 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- add LazyVim and import its plugins
|
||||
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||
-- import/override with your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
defaults = {
|
||||
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
|
||||
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
|
||||
lazy = false,
|
||||
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
|
||||
-- have outdated releases, which may break your Neovim install.
|
||||
version = false, -- always use the latest git commit
|
||||
-- version = "*", -- try installing the latest stable version for plugins that support semver
|
||||
},
|
||||
checker = { enabled = true }, -- automatically check for plugin updates
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
"matchit",
|
||||
"matchparen",
|
||||
"netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
cache = true,
|
||||
})
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Start LazyVim plugins
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- add LazyVim and import its plugins
|
||||
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||
-- import/override with your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
defaults = {
|
||||
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
|
||||
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
|
||||
lazy = false,
|
||||
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
|
||||
-- have outdated releases, which may break your Neovim install.
|
||||
version = false, -- always use the latest git commit
|
||||
-- version = "*", -- try installing the latest stable version for plugins that support semver
|
||||
},
|
||||
checker = { enabled = true }, -- automatically check for plugin updates
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
"matchit",
|
||||
"matchparen",
|
||||
"netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
cache = true,
|
||||
})
|
||||
|
||||
-- Configure status bar
|
||||
require("config.statusline")
|
||||
|
||||
-- Configure Markdown rendering rules
|
||||
require("render-markdown").setup({
|
||||
heading = { position = "inline" },
|
||||
quote = { repeat_linebreak = true },
|
||||
win_options = {
|
||||
showbreak = {
|
||||
default = "",
|
||||
rendered = " ",
|
||||
},
|
||||
breakindent = {
|
||||
default = false,
|
||||
rendered = true,
|
||||
},
|
||||
breakindentopt = {
|
||||
default = "",
|
||||
rendered = "",
|
||||
},
|
||||
},
|
||||
checkbox = {
|
||||
unchecked = { icon = "✘ " },
|
||||
checked = { icon = "✔ " },
|
||||
},
|
||||
code = {
|
||||
position = "right",
|
||||
width = "block",
|
||||
right_pad = 10,
|
||||
},
|
||||
latex = {
|
||||
enabled = false,
|
||||
},
|
||||
link = {
|
||||
custom = {
|
||||
c = {
|
||||
pattern = "%.[ch]$",
|
||||
icon = " ",
|
||||
},
|
||||
golang = {
|
||||
pattern = "%.go$",
|
||||
icon = " ",
|
||||
},
|
||||
python = {
|
||||
pattern = "%.py$",
|
||||
icon = " ",
|
||||
},
|
||||
lua = {
|
||||
pattern = "%.lua$",
|
||||
icon = " ",
|
||||
},
|
||||
-- shell = {
|
||||
-- pattern = "%.[sh|zsh]$",
|
||||
-- icon = " ",
|
||||
-- },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Configure TreeSitter syntax parsers
|
||||
require("nvim-treesitter.configs").setup({
|
||||
-- A list of parser names, or "all" (the listed parsers MUST always be installed)
|
||||
ensure_installed = {
|
||||
"c",
|
||||
"lua",
|
||||
"bash",
|
||||
"go",
|
||||
"gomod",
|
||||
"gowork",
|
||||
"gosum",
|
||||
"json",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"python",
|
||||
"zig",
|
||||
},
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
-- Automatically install missing parsers when entering buffer
|
||||
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||
auto_install = true,
|
||||
|
||||
-- List of parsers to ignore installing (or "all")
|
||||
ignore_install = { "javascript" },
|
||||
|
||||
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
|
||||
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
|
||||
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
|
||||
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
|
||||
-- the name of the parser)
|
||||
-- list of language that will be disabled
|
||||
disable = {},
|
||||
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
|
||||
disable = function(lang, buf)
|
||||
local max_filesize = 100 * 1024 -- 100 KB
|
||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||
if ok and stats and stats.size > max_filesize then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
})
|
||||
|
||||
-- Configure Mini.AI for textobjects command
|
||||
require("mini.ai").setup()
|
||||
|
||||
@@ -1,57 +1,57 @@
|
||||
-- Options are automatically loaded before lazy.nvim startup
|
||||
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
|
||||
-- Add any additional options here
|
||||
|
||||
local opt = vim.opt
|
||||
|
||||
-- Encoding
|
||||
opt.encoding = "utf-8"
|
||||
opt.fileencoding = "utf-8"
|
||||
|
||||
-- Line numbers
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
|
||||
-- Enable mouse in all modes
|
||||
opt.mouse = "a"
|
||||
|
||||
-- Better searching
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
|
||||
-- Highlight current line
|
||||
opt.cursorline = true
|
||||
opt.cursorlineopt = "number"
|
||||
|
||||
-- Enable true color support
|
||||
opt.termguicolors = true
|
||||
|
||||
-- Enable system clipboard
|
||||
opt.clipboard = "unnamedplus"
|
||||
|
||||
-- Indentation
|
||||
opt.softtabstop = 8
|
||||
opt.shiftwidth = 8
|
||||
opt.tabstop = 8
|
||||
opt.expandtab = true
|
||||
opt.smartindent = true
|
||||
|
||||
-- Split behavior
|
||||
opt.splitright = true
|
||||
opt.splitbelow = true
|
||||
|
||||
-- Enable undo file to persist undo history
|
||||
opt.undofile = true
|
||||
|
||||
-- Set upbar similar to statusline (optional)
|
||||
opt.statusline = "%f %m %r %=%-14.(%l,%c%V%) %P"
|
||||
|
||||
-- Persistent signcolumn to avoid text shifting
|
||||
opt.signcolumn = "yes"
|
||||
|
||||
-- Show file name and modified flag in the window bar
|
||||
opt.winbar = "%=%m %f"
|
||||
|
||||
-- Backup files
|
||||
opt.swapfile = false
|
||||
opt.backup = false
|
||||
-- Options are automatically loaded before lazy.nvim startup
|
||||
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
|
||||
-- Add any additional options here
|
||||
|
||||
local opt = vim.opt
|
||||
|
||||
-- Encoding
|
||||
opt.encoding = "utf-8"
|
||||
opt.fileencoding = "utf-8"
|
||||
|
||||
-- Line numbers
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
|
||||
-- Enable mouse in all modes
|
||||
opt.mouse = "a"
|
||||
|
||||
-- Better searching
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
|
||||
-- Highlight current line
|
||||
opt.cursorline = true
|
||||
opt.cursorlineopt = "number"
|
||||
|
||||
-- Enable true color support
|
||||
opt.termguicolors = true
|
||||
|
||||
-- Enable system clipboard
|
||||
opt.clipboard = "unnamedplus"
|
||||
|
||||
-- Indentation
|
||||
-- opt.softtabstop = 8
|
||||
-- opt.shiftwidth = 8
|
||||
-- opt.tabstop = 8
|
||||
opt.expandtab = true
|
||||
opt.smartindent = true
|
||||
|
||||
-- Split behavior
|
||||
opt.splitright = true
|
||||
opt.splitbelow = true
|
||||
|
||||
-- Enable undo file to persist undo history
|
||||
opt.undofile = true
|
||||
|
||||
-- Set upbar similar to statusline (optional)
|
||||
opt.statusline = "%f %m %r %=%-14.(%l,%c%V%) %P"
|
||||
|
||||
-- Persistent signcolumn to avoid text shifting
|
||||
opt.signcolumn = "yes"
|
||||
|
||||
-- Show file name and modified flag in the window bar
|
||||
opt.winbar = "%=%m %f"
|
||||
|
||||
-- Backup files
|
||||
opt.swapfile = false
|
||||
opt.backup = false
|
||||
|
||||
219
lazyvim/.config/nvim/lua/config/statusline.lua
Executable file
219
lazyvim/.config/nvim/lua/config/statusline.lua
Executable file
@@ -0,0 +1,219 @@
|
||||
-- Eviline config for lualine
|
||||
-- Author: shadmansaleh
|
||||
-- Credit: glepnir
|
||||
local lualine = require("lualine")
|
||||
|
||||
-- Color table for highlights
|
||||
-- stylua: ignore
|
||||
local colors = {
|
||||
bg = '#202328',
|
||||
fg = '#bbc2cf',
|
||||
yellow = '#ECBE7B',
|
||||
cyan = '#008080',
|
||||
darkblue = '#081633',
|
||||
green = '#98be65',
|
||||
orange = '#FF8800',
|
||||
violet = '#a9a1e1',
|
||||
magenta = '#c678dd',
|
||||
blue = '#51afef',
|
||||
red = '#ec5f67',
|
||||
}
|
||||
|
||||
local conditions = {
|
||||
buffer_not_empty = function()
|
||||
return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
|
||||
end,
|
||||
hide_in_width = function()
|
||||
return vim.fn.winwidth(0) > 80
|
||||
end,
|
||||
check_git_workspace = function()
|
||||
local filepath = vim.fn.expand("%:p:h")
|
||||
local gitdir = vim.fn.finddir(".git", filepath .. ";")
|
||||
return gitdir and #gitdir > 0 and #gitdir < #filepath
|
||||
end,
|
||||
}
|
||||
|
||||
-- Config
|
||||
local config = {
|
||||
options = {
|
||||
-- Disable sections and component separators
|
||||
component_separators = "",
|
||||
section_separators = "",
|
||||
theme = "catppuccin",
|
||||
},
|
||||
sections = {
|
||||
-- these are to remove the defaults
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
-- These will be filled later
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
},
|
||||
inactive_sections = {
|
||||
-- these are to remove the defaults
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
},
|
||||
}
|
||||
|
||||
-- Inserts a component in lualine_c at left section
|
||||
local function ins_left(component)
|
||||
table.insert(config.sections.lualine_c, component)
|
||||
end
|
||||
|
||||
-- Inserts a component in lualine_x at right section
|
||||
local function ins_right(component)
|
||||
table.insert(config.sections.lualine_x, component)
|
||||
end
|
||||
|
||||
ins_left({
|
||||
function()
|
||||
return "▊"
|
||||
end,
|
||||
color = { fg = colors.blue }, -- Sets highlighting of component
|
||||
padding = { left = 0, right = 1 }, -- We don't need space before this
|
||||
})
|
||||
|
||||
-- -- Function to get the current mode indicator as a single character
|
||||
local function mode()
|
||||
-- Map of modes to their respective shorthand indicators
|
||||
local mode_map = {
|
||||
n = "NORMAL", -- Normal mode
|
||||
v = "VISUAL", -- Visual mode
|
||||
[""] = "VISUAL BLOCK", -- Visual block mode
|
||||
V = "VISUAL LINE", -- Visual line mode
|
||||
c = "COMMAND", -- Command-line mode
|
||||
no = "N-INSERT", -- NInsert mode
|
||||
s = "SELECT", -- Select mode
|
||||
S = "SELECT-LINE", -- Select line mode
|
||||
ic = "INSERT", -- Insert mode (completion)
|
||||
R = "REPLACE", -- Replace mode
|
||||
Rv = "VISUAL REPLACE", -- Virtual Replace mode
|
||||
cv = "COMMAND-LINE", -- Command-line mode
|
||||
ce = "C", -- Ex mode
|
||||
r = "R", -- Prompt mode
|
||||
rm = "M", -- More mode
|
||||
["r?"] = "?", -- Confirm mode
|
||||
["!"] = "!", -- Shell mode
|
||||
t = "TERMINAL", -- Terminal mode
|
||||
}
|
||||
-- Return the mode shorthand or [UNKNOWN] if no match
|
||||
return mode_map[vim.fn.mode()] or "[UNKNOWN]"
|
||||
end
|
||||
|
||||
ins_left({
|
||||
-- mode component
|
||||
mode,
|
||||
color = function()
|
||||
-- auto change color according to neovims mode
|
||||
local mode_color = {
|
||||
n = colors.red,
|
||||
i = colors.green,
|
||||
v = colors.blue,
|
||||
[""] = colors.blue,
|
||||
V = colors.blue,
|
||||
c = colors.magenta,
|
||||
no = colors.red,
|
||||
s = colors.orange,
|
||||
S = colors.orange,
|
||||
[""] = colors.orange,
|
||||
ic = colors.yellow,
|
||||
R = colors.violet,
|
||||
Rv = colors.violet,
|
||||
cv = colors.red,
|
||||
ce = colors.red,
|
||||
r = colors.cyan,
|
||||
rm = colors.cyan,
|
||||
["r?"] = colors.cyan,
|
||||
["!"] = colors.red,
|
||||
t = colors.red,
|
||||
}
|
||||
return { fg = mode_color[vim.fn.mode()] }
|
||||
end,
|
||||
padding = { right = 1 },
|
||||
})
|
||||
|
||||
ins_left({
|
||||
-- filesize component
|
||||
"filesize",
|
||||
cond = conditions.buffer_not_empty,
|
||||
})
|
||||
|
||||
ins_left({
|
||||
"filename",
|
||||
cond = conditions.buffer_not_empty,
|
||||
color = { fg = colors.magenta, gui = "bold" },
|
||||
})
|
||||
|
||||
ins_left({ "location" })
|
||||
|
||||
ins_left({ "progress", color = { fg = colors.fg, gui = "bold" } })
|
||||
|
||||
ins_left({
|
||||
"diagnostics",
|
||||
sources = { "nvim_diagnostic" },
|
||||
symbols = { error = " ", warn = " ", info = " " },
|
||||
diagnostics_color = {
|
||||
error = { fg = colors.red },
|
||||
warn = { fg = colors.yellow },
|
||||
info = { fg = colors.cyan },
|
||||
},
|
||||
})
|
||||
|
||||
-- Insert mid section. You can make any number of sections in neovim :)
|
||||
-- for lualine it's any number greater then 2
|
||||
ins_left({
|
||||
function()
|
||||
return "%="
|
||||
end,
|
||||
})
|
||||
|
||||
-- Add components to right sections
|
||||
ins_right({
|
||||
"o:encoding", -- option component same as &encoding in viml
|
||||
fmt = string.upper, -- I'm not sure why it's upper case either ;)
|
||||
cond = conditions.hide_in_width,
|
||||
color = { fg = colors.green, gui = "bold" },
|
||||
})
|
||||
|
||||
ins_right({
|
||||
"fileformat",
|
||||
fmt = string.upper,
|
||||
icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh
|
||||
color = { fg = colors.green, gui = "bold" },
|
||||
})
|
||||
|
||||
ins_right({
|
||||
"branch",
|
||||
icon = "",
|
||||
color = { fg = colors.violet, gui = "bold" },
|
||||
})
|
||||
|
||||
ins_right({
|
||||
"diff",
|
||||
-- Is it me or the symbol for modified us really weird
|
||||
symbols = { added = " ", modified = " ", removed = " " },
|
||||
diff_color = {
|
||||
added = { fg = colors.green },
|
||||
modified = { fg = colors.orange },
|
||||
removed = { fg = colors.red },
|
||||
},
|
||||
cond = conditions.hide_in_width,
|
||||
})
|
||||
|
||||
ins_right({
|
||||
function()
|
||||
return "▊"
|
||||
end,
|
||||
color = { fg = colors.blue },
|
||||
padding = { left = 1 },
|
||||
})
|
||||
|
||||
-- Now don't forget to initialize lualine
|
||||
lualine.setup(config)
|
||||
@@ -1,16 +1,16 @@
|
||||
return {
|
||||
"goolord/alpha-nvim",
|
||||
opts = function(_, opts)
|
||||
local logo = [[
|
||||
███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
|
||||
████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
|
||||
██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
|
||||
██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
|
||||
██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
|
||||
[ @elijahmanor ]
|
||||
]]
|
||||
opts.section.header.val = vim.split(logo, "\n", { trimempty = true })
|
||||
end,
|
||||
}
|
||||
return {
|
||||
"goolord/alpha-nvim",
|
||||
opts = function(_, opts)
|
||||
local logo = [[
|
||||
███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
|
||||
████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
|
||||
██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
|
||||
██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
|
||||
██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
|
||||
[ @elijahmanor ]
|
||||
]]
|
||||
opts.section.header.val = vim.split(logo, "\n", { trimempty = true })
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -1,96 +1,96 @@
|
||||
return {
|
||||
{
|
||||
"mason-org/mason.nvim",
|
||||
opts = {
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗",
|
||||
},
|
||||
},
|
||||
ensure_installed = {
|
||||
-- LSP servers
|
||||
"clangd", -- C / C++
|
||||
"gopls", -- Go
|
||||
"python-lsp-server", -- Python
|
||||
"bash-language-server", -- Bash
|
||||
"zls", -- Zig
|
||||
"lua-language-server", -- Lua
|
||||
-- Formatters / Linters
|
||||
"stylua", -- Lua formatter
|
||||
"shfmt", -- Shell formatter
|
||||
"black", -- Python formatter
|
||||
"clang-format", -- C/C++ formatter
|
||||
"goimports", -- Go formatter
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"onsails/lspkind.nvim", -- icone carine nel completamento
|
||||
},
|
||||
opts = function(_, opts)
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
-- Carica snippet
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
opts.snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
}
|
||||
|
||||
opts.mapping = vim.tbl_extend("force", opts.mapping, {
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
})
|
||||
|
||||
opts.sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
})
|
||||
|
||||
opts.formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = "symbol_text",
|
||||
maxwidth = 50,
|
||||
ellipsis_char = "...",
|
||||
}),
|
||||
}
|
||||
|
||||
return opts
|
||||
end,
|
||||
},
|
||||
}
|
||||
return {
|
||||
{
|
||||
"mason-org/mason.nvim",
|
||||
opts = {
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗",
|
||||
},
|
||||
},
|
||||
ensure_installed = {
|
||||
-- LSP servers
|
||||
"clangd", -- C / C++
|
||||
"gopls", -- Go
|
||||
"python-lsp-server", -- Python
|
||||
"bash-language-server", -- Bash
|
||||
"zls", -- Zig
|
||||
"lua-language-server", -- Lua
|
||||
-- Formatters / Linters
|
||||
"stylua", -- Lua formatter
|
||||
"shfmt", -- Shell formatter
|
||||
"black", -- Python formatter
|
||||
"clang-format", -- C/C++ formatter
|
||||
"goimports", -- Go formatter
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"onsails/lspkind.nvim", -- icone carine nel completamento
|
||||
},
|
||||
opts = function(_, opts)
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
-- Carica snippet
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
opts.snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
}
|
||||
|
||||
opts.mapping = vim.tbl_extend("force", opts.mapping, {
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
})
|
||||
|
||||
opts.sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
})
|
||||
|
||||
opts.formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = "symbol_text",
|
||||
maxwidth = 50,
|
||||
ellipsis_char = "...",
|
||||
}),
|
||||
}
|
||||
|
||||
return opts
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
return {
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
opts = {
|
||||
flavour = "mocha",
|
||||
transparent_background = false,
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("catppuccin").setup(opts)
|
||||
-- vim.cmd.colorscheme("catppuccin")
|
||||
vim.cmd.colorscheme("tokyonight-night")
|
||||
end,
|
||||
}
|
||||
return {
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
opts = {
|
||||
flavour = "mocha",
|
||||
transparent_background = false,
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("catppuccin").setup(opts)
|
||||
-- vim.cmd.colorscheme("catppuccin-mocha")
|
||||
vim.cmd.colorscheme("tokyonight-night")
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -1,108 +1,108 @@
|
||||
return {
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
dependencies = {
|
||||
"leoluz/nvim-dap-go",
|
||||
"rcarriga/nvim-dap-ui",
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
"nvim-neotest/nvim-nio",
|
||||
"williamboman/mason.nvim",
|
||||
"jay-babu/mason-nvim-dap.nvim", -- Dependency for managing DAP adapters with Mason
|
||||
"mfussenegger/nvim-dap-python", -- Dependency for Python debugging
|
||||
},
|
||||
config = function()
|
||||
local dap = require("dap")
|
||||
local dapui = require("dapui")
|
||||
local mason_dap = require("mason-nvim-dap")
|
||||
|
||||
-- Configure mason-nvim-dap to automatically install DAP adapters
|
||||
mason_dap.setup({
|
||||
ensure_installed = {
|
||||
"delve", -- Go Debugger Adapter
|
||||
"codelldb", -- C/C++ Debugger Adapter
|
||||
"debugpy", -- Python Debugger Adapter
|
||||
},
|
||||
handlers = {},
|
||||
})
|
||||
|
||||
-- Set up the DAP UI
|
||||
dapui.setup()
|
||||
|
||||
-- Set up the Go debugging configurations
|
||||
require("dap-go").setup()
|
||||
|
||||
-- Set up the Python debugging configurations
|
||||
require("dap-python").setup()
|
||||
|
||||
-- Configure nvim-dap-virtual-text
|
||||
require("nvim-dap-virtual-text").setup({
|
||||
display_callback = function(variable)
|
||||
local name = string.lower(variable.name)
|
||||
local value = string.lower(variable.value)
|
||||
if name:match("secret") or name:match("api") or value:match("secret") or value:match("api") then
|
||||
return "*****"
|
||||
end
|
||||
|
||||
if #variable.value > 15 then
|
||||
return " " .. string.sub(variable.value, 1, 15) .. "... "
|
||||
end
|
||||
|
||||
return " " .. variable.value
|
||||
end,
|
||||
})
|
||||
|
||||
-- Configure the CodeLLDB adapter for C/C++
|
||||
dap.adapters.codelldb = {
|
||||
type = "server",
|
||||
port = "${port}",
|
||||
executable = {
|
||||
command = vim.fn.stdpath("data") .. "/mason/bin/codelldb",
|
||||
args = { "--port", "${port}" },
|
||||
},
|
||||
}
|
||||
|
||||
-- Define launch configurations for C/C++
|
||||
dap.configurations.c = {
|
||||
{
|
||||
name = "Launch C",
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
stopOnEntry = false,
|
||||
},
|
||||
}
|
||||
|
||||
dap.configurations.cpp = dap.configurations.c
|
||||
|
||||
-- Your keyboard shortcuts for debugging
|
||||
vim.keymap.set("n", "<space>b", dap.toggle_breakpoint)
|
||||
vim.keymap.set("n", "<space>gb", dap.run_to_cursor)
|
||||
vim.keymap.set("n", "<space>?", function()
|
||||
dapui.eval(nil, { enter = true })
|
||||
end)
|
||||
vim.keymap.set("n", "<F9>", dap.continue)
|
||||
vim.keymap.set("n", "<F7>", dap.step_into)
|
||||
vim.keymap.set("n", "<F8>", dap.step_over)
|
||||
vim.keymap.set("n", "<F6>", dap.step_out)
|
||||
vim.keymap.set("n", "<F5>", dap.step_back)
|
||||
vim.keymap.set("n", "<F12>", dap.restart)
|
||||
|
||||
-- Listeners to open and close the DAP UI automatically
|
||||
dap.listeners.before.attach.dapui_config = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.launch.dapui_config = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated.dapui_config = function()
|
||||
dapui.close()
|
||||
end
|
||||
dap.listeners.before.event_exited.dapui_config = function()
|
||||
dapui.close()
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
return {
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
dependencies = {
|
||||
"leoluz/nvim-dap-go",
|
||||
"rcarriga/nvim-dap-ui",
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
"nvim-neotest/nvim-nio",
|
||||
"williamboman/mason.nvim",
|
||||
"jay-babu/mason-nvim-dap.nvim", -- Dependency for managing DAP adapters with Mason
|
||||
"mfussenegger/nvim-dap-python", -- Dependency for Python debugging
|
||||
},
|
||||
config = function()
|
||||
local dap = require("dap")
|
||||
local dapui = require("dapui")
|
||||
local mason_dap = require("mason-nvim-dap")
|
||||
|
||||
-- Configure mason-nvim-dap to automatically install DAP adapters
|
||||
mason_dap.setup({
|
||||
ensure_installed = {
|
||||
"delve", -- Go Debugger Adapter
|
||||
"codelldb", -- C/C++ Debugger Adapter
|
||||
"debugpy", -- Python Debugger Adapter
|
||||
},
|
||||
handlers = {},
|
||||
})
|
||||
|
||||
-- Set up the DAP UI
|
||||
dapui.setup()
|
||||
|
||||
-- Set up the Go debugging configurations
|
||||
require("dap-go").setup()
|
||||
|
||||
-- Set up the Python debugging configurations
|
||||
require("dap-python").setup()
|
||||
|
||||
-- Configure nvim-dap-virtual-text
|
||||
require("nvim-dap-virtual-text").setup({
|
||||
display_callback = function(variable)
|
||||
local name = string.lower(variable.name)
|
||||
local value = string.lower(variable.value)
|
||||
if name:match("secret") or name:match("api") or value:match("secret") or value:match("api") then
|
||||
return "*****"
|
||||
end
|
||||
|
||||
if #variable.value > 15 then
|
||||
return " " .. string.sub(variable.value, 1, 15) .. "... "
|
||||
end
|
||||
|
||||
return " " .. variable.value
|
||||
end,
|
||||
})
|
||||
|
||||
-- Configure the CodeLLDB adapter for C/C++
|
||||
dap.adapters.codelldb = {
|
||||
type = "server",
|
||||
port = "${port}",
|
||||
executable = {
|
||||
command = vim.fn.stdpath("data") .. "/mason/bin/codelldb",
|
||||
args = { "--port", "${port}" },
|
||||
},
|
||||
}
|
||||
|
||||
-- Define launch configurations for C/C++
|
||||
dap.configurations.c = {
|
||||
{
|
||||
name = "Launch C",
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
stopOnEntry = false,
|
||||
},
|
||||
}
|
||||
|
||||
dap.configurations.cpp = dap.configurations.c
|
||||
|
||||
-- Your keyboard shortcuts for debugging
|
||||
vim.keymap.set("n", "<space>b", dap.toggle_breakpoint)
|
||||
vim.keymap.set("n", "<space>gb", dap.run_to_cursor)
|
||||
vim.keymap.set("n", "<space>?", function()
|
||||
dapui.eval(nil, { enter = true })
|
||||
end)
|
||||
vim.keymap.set("n", "<F9>", dap.continue)
|
||||
vim.keymap.set("n", "<F7>", dap.step_into)
|
||||
vim.keymap.set("n", "<F8>", dap.step_over)
|
||||
vim.keymap.set("n", "<F6>", dap.step_out)
|
||||
vim.keymap.set("n", "<F5>", dap.step_back)
|
||||
vim.keymap.set("n", "<F12>", dap.restart)
|
||||
|
||||
-- Listeners to open and close the DAP UI automatically
|
||||
dap.listeners.before.attach.dapui_config = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.launch.dapui_config = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated.dapui_config = function()
|
||||
dapui.close()
|
||||
end
|
||||
dap.listeners.before.event_exited.dapui_config = function()
|
||||
dapui.close()
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
return {
|
||||
{ "windwp/nvim-spectre", enabled = false },
|
||||
}
|
||||
return {
|
||||
{ "windwp/nvim-spectre", enabled = false },
|
||||
}
|
||||
|
||||
@@ -1,57 +1,57 @@
|
||||
return {
|
||||
"nvimtools/none-ls.nvim",
|
||||
config = function()
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
-- C
|
||||
null_ls.builtins.formatting.clang_format.with({
|
||||
extra_args = {
|
||||
"--style={BasedOnStyle: LLVM, IndentWidth: 8, TabWith: 8, UseTab: Always, BreakBeforeBraces: Linux, AllowShortIfStatementsOnASingleLine: false, AllowShortLoopsOnASingleLine: false, AllowShortFunctionsOnASingleLine: InlineOnly, ColumnLimit: 80, AlignConsecutiveDeclarations: false, AlignConsecutiveAssignments: false, AlignEscapedNewlines: Left, AlignOperands: false, IndentCaseLabels: false, SpaceBeforeParens: ControlStatements }",
|
||||
},
|
||||
}),
|
||||
|
||||
-- Go
|
||||
null_ls.builtins.formatting.goimports,
|
||||
|
||||
-- Zig
|
||||
-- null_ls.builtins.formatting.zigfmt,
|
||||
|
||||
-- Lua
|
||||
null_ls.builtins.formatting.stylua.with({
|
||||
extra_args = {
|
||||
"--indent-type",
|
||||
"Spaces",
|
||||
"--indent-width",
|
||||
"2",
|
||||
"--column-width",
|
||||
"120",
|
||||
},
|
||||
}),
|
||||
|
||||
-- Python
|
||||
null_ls.builtins.formatting.black.with({
|
||||
extra_args = { "--line-length", "79" },
|
||||
}),
|
||||
|
||||
-- Shell
|
||||
null_ls.builtins.formatting.shfmt.with({
|
||||
extra_args = { "-i", "2", "-ci", "-bn", "-sr", "-p" },
|
||||
}),
|
||||
},
|
||||
|
||||
-- Auto-format on save
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ async = false })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
return {
|
||||
"nvimtools/none-ls.nvim",
|
||||
config = function()
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
-- C
|
||||
null_ls.builtins.formatting.clang_format.with({
|
||||
extra_args = {
|
||||
"--style={BasedOnStyle: LLVM, IndentWidth: 8, TabWith: 8, UseTab: Always, BreakBeforeBraces: Linux, AllowShortIfStatementsOnASingleLine: false, AllowShortLoopsOnASingleLine: false, AllowShortFunctionsOnASingleLine: InlineOnly, ColumnLimit: 80, AlignConsecutiveDeclarations: false, AlignConsecutiveAssignments: false, AlignEscapedNewlines: Left, AlignOperands: false, IndentCaseLabels: false, SpaceBeforeParens: ControlStatements }",
|
||||
},
|
||||
}),
|
||||
|
||||
-- Go
|
||||
null_ls.builtins.formatting.goimports,
|
||||
|
||||
-- Zig
|
||||
-- null_ls.builtins.formatting.zigfmt,
|
||||
|
||||
-- Lua
|
||||
null_ls.builtins.formatting.stylua.with({
|
||||
extra_args = {
|
||||
"--indent-type",
|
||||
"Spaces",
|
||||
"--indent-width",
|
||||
"2",
|
||||
"--column-width",
|
||||
"120",
|
||||
},
|
||||
}),
|
||||
|
||||
-- Python
|
||||
null_ls.builtins.formatting.black.with({
|
||||
extra_args = { "--line-length", "79" },
|
||||
}),
|
||||
|
||||
-- Shell
|
||||
null_ls.builtins.formatting.shfmt.with({
|
||||
extra_args = { "-i", "2", "-ci", "-bn", "-sr", "-p" },
|
||||
}),
|
||||
},
|
||||
|
||||
-- Auto-format on save
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ async = false })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
return {
|
||||
"m4xshen/hardtime.nvim",
|
||||
lazy = false,
|
||||
dependencies = { "MunifTanjim/nui.nvim" },
|
||||
enabled = false,
|
||||
opts = {},
|
||||
}
|
||||
return {
|
||||
"m4xshen/hardtime.nvim",
|
||||
lazy = false,
|
||||
dependencies = { "MunifTanjim/nui.nvim" },
|
||||
enabled = false,
|
||||
opts = {},
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return {
|
||||
"ThePrimeagen/harpoon",
|
||||
branch = "harpoon2",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
}
|
||||
return {
|
||||
"ThePrimeagen/harpoon",
|
||||
branch = "harpoon2",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
}
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
|
||||
-- How to add an LSP for a specific programming language?
|
||||
-- 1. Use `:Mason` to install the corresponding LSP.
|
||||
-- 2. Add the configuration below. The syntax is `lspconfig.<name>.setup(...)`
|
||||
-- Hint (find <name> here): https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md
|
||||
config = function()
|
||||
-- Set different settings for different languages' LSP.
|
||||
-- Support List: https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
-- Case 1. For CMake Users
|
||||
-- $ cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .
|
||||
-- Case 2. For Bazel Users, use https://github.com/hedronvision/bazel-compile-commands-extractor
|
||||
-- Case 3. If you don't use any build tool and all files in a project use the same build flags
|
||||
-- Place your compiler flags in the compile_flags.txt file, located in the root directory
|
||||
-- of your project. Each line in the file should contain a single compiler flag.
|
||||
-- src: https://clangd.llvm.org/installation#compile_commandsjson
|
||||
lspconfig.clangd.setup({})
|
||||
lspconfig.gopls.setup({})
|
||||
lspconfig.bashls.setup({})
|
||||
lspconfig.zls.setup({})
|
||||
lspconfig.pylsp.setup({
|
||||
settings = {
|
||||
-- configure plugins in pylsp
|
||||
pylsp = {
|
||||
plugins = {
|
||||
pyflakes = { enabled = false },
|
||||
pycodestyle = { enabled = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
lspconfig.lua_ls.setup({
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim).
|
||||
version = "LuaJIT",
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global.
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files.
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier.
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
|
||||
-- How to add an LSP for a specific programming language?
|
||||
-- 1. Use `:Mason` to install the corresponding LSP.
|
||||
-- 2. Add the configuration below. The syntax is `lspconfig.<name>.setup(...)`
|
||||
-- Hint (find <name> here): https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md
|
||||
config = function()
|
||||
-- Set different settings for different languages' LSP.
|
||||
-- Support List: https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
-- Case 1. For CMake Users
|
||||
-- $ cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .
|
||||
-- Case 2. For Bazel Users, use https://github.com/hedronvision/bazel-compile-commands-extractor
|
||||
-- Case 3. If you don't use any build tool and all files in a project use the same build flags
|
||||
-- Place your compiler flags in the compile_flags.txt file, located in the root directory
|
||||
-- of your project. Each line in the file should contain a single compiler flag.
|
||||
-- src: https://clangd.llvm.org/installation#compile_commandsjson
|
||||
lspconfig.clangd.setup({})
|
||||
lspconfig.gopls.setup({})
|
||||
lspconfig.bashls.setup({})
|
||||
lspconfig.zls.setup({})
|
||||
lspconfig.pylsp.setup({
|
||||
settings = {
|
||||
-- configure plugins in pylsp
|
||||
pylsp = {
|
||||
plugins = {
|
||||
pyflakes = { enabled = false },
|
||||
pycodestyle = { enabled = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
lspconfig.lua_ls.setup({
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim).
|
||||
version = "LuaJIT",
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global.
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files.
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier.
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
4
lazyvim/.config/nvim/lua/plugins/lualine.lua
Executable file
4
lazyvim/.config/nvim/lua/plugins/lualine.lua
Executable file
@@ -0,0 +1,4 @@
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
}
|
||||
@@ -1,37 +1,9 @@
|
||||
return {
|
||||
-- Browser preview plugin
|
||||
{
|
||||
"iamcco/markdown-preview.nvim",
|
||||
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
|
||||
build = "cd app && yarn install",
|
||||
init = function()
|
||||
vim.g.mkdp_filetypes = { "markdown" }
|
||||
vim.g.mkdp_auto_start = 0
|
||||
vim.g.mkdp_browser = "firefox" -- use your preferred browser
|
||||
vim.g.mkdp_sync_scroll_type = "middle"
|
||||
end,
|
||||
ft = { "markdown" },
|
||||
keys = {
|
||||
{
|
||||
"<leader>Mp",
|
||||
"<cmd>MarkdownPreviewToggle<CR>",
|
||||
desc = "Preview Markdown (Browser)",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Terminal-based preview with Glow
|
||||
{
|
||||
"ellisonleao/glow.nvim",
|
||||
config = true, -- uses default config
|
||||
cmd = "Glow",
|
||||
ft = { "markdown" },
|
||||
keys = {
|
||||
{
|
||||
"<leader>Mg",
|
||||
"<cmd>Glow<CR>",
|
||||
desc = "Preview Markdown (Glow)",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
return {
|
||||
"MeanderingProgrammer/render-markdown.nvim",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.nvim" }, -- if you use the mini.nvim suite
|
||||
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins
|
||||
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons
|
||||
---@module 'render-markdown'
|
||||
---@type render.md.UserConfig
|
||||
opts = {},
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
return {
|
||||
"smoka7/multicursors.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"nvimtools/hydra.nvim",
|
||||
},
|
||||
opts = {},
|
||||
cmd = { "MCstart", "MCvisual", "MCclear", "MCpattern", "MCvisualPattern", "MCunderCursor" },
|
||||
keys = {
|
||||
{
|
||||
mode = { "v", "n" },
|
||||
"<Leader>m",
|
||||
"<cmd>MCstart<cr>",
|
||||
desc = "Create a selection for selected text or word under the cursor",
|
||||
},
|
||||
},
|
||||
}
|
||||
return {
|
||||
"smoka7/multicursors.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"nvimtools/hydra.nvim",
|
||||
},
|
||||
opts = {},
|
||||
cmd = { "MCstart", "MCvisual", "MCclear", "MCpattern", "MCvisualPattern", "MCunderCursor" },
|
||||
keys = {
|
||||
{
|
||||
mode = { "v", "n" },
|
||||
"<Leader>m",
|
||||
"<cmd>MCstart<cr>",
|
||||
desc = "Create a selection for selected text or word under the cursor",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
enabled = false,
|
||||
}
|
||||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
enabled = false,
|
||||
}
|
||||
|
||||
522
lazyvim/.config/nvim/lua/plugins/snacks.lua
Executable file
522
lazyvim/.config/nvim/lua/plugins/snacks.lua
Executable file
@@ -0,0 +1,522 @@
|
||||
return {
|
||||
"folke/snacks.nvim",
|
||||
priority = 1000,
|
||||
lazy = false,
|
||||
---@type snacks.Config
|
||||
opts = {
|
||||
bigfile = { enabled = true },
|
||||
dashboard = { enabled = false },
|
||||
explorer = { enabled = false },
|
||||
indent = { enabled = true },
|
||||
input = { enabled = true },
|
||||
notifier = {
|
||||
enabled = true,
|
||||
timeout = 3000,
|
||||
},
|
||||
picker = { enabled = true },
|
||||
quickfile = { enabled = true },
|
||||
scope = { enabled = true },
|
||||
scroll = { enabled = true },
|
||||
statuscolumn = { enabled = true },
|
||||
words = { enabled = true },
|
||||
styles = {
|
||||
notification = {
|
||||
-- wo = { wrap = true } -- Wrap notifications
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
-- Top Pickers & Explorer
|
||||
{
|
||||
"<leader><space>",
|
||||
function()
|
||||
Snacks.picker.smart()
|
||||
end,
|
||||
desc = "Smart Find Files",
|
||||
},
|
||||
{
|
||||
"<leader>,",
|
||||
function()
|
||||
Snacks.picker.buffers()
|
||||
end,
|
||||
desc = "Buffers",
|
||||
},
|
||||
{
|
||||
"<leader>/",
|
||||
function()
|
||||
Snacks.picker.grep()
|
||||
end,
|
||||
desc = "Grep",
|
||||
},
|
||||
{
|
||||
"<leader>:",
|
||||
function()
|
||||
Snacks.picker.command_history()
|
||||
end,
|
||||
desc = "Command History",
|
||||
},
|
||||
{
|
||||
"<leader>n",
|
||||
function()
|
||||
Snacks.picker.notifications()
|
||||
end,
|
||||
desc = "Notification History",
|
||||
},
|
||||
{
|
||||
"<leader>fb",
|
||||
function()
|
||||
Snacks.picker.buffers()
|
||||
end,
|
||||
desc = "Buffers",
|
||||
},
|
||||
{
|
||||
"<leader>fc",
|
||||
function()
|
||||
Snacks.picker.files({ cwd = vim.fn.stdpath("config") })
|
||||
end,
|
||||
desc = "Find Config File",
|
||||
},
|
||||
{
|
||||
"<leader>ff",
|
||||
function()
|
||||
Snacks.picker.files()
|
||||
end,
|
||||
desc = "Find Files",
|
||||
},
|
||||
{
|
||||
"<leader>fg",
|
||||
function()
|
||||
Snacks.picker.git_files()
|
||||
end,
|
||||
desc = "Find Git Files",
|
||||
},
|
||||
{
|
||||
"<leader>fp",
|
||||
function()
|
||||
Snacks.picker.projects()
|
||||
end,
|
||||
desc = "Projects",
|
||||
},
|
||||
{
|
||||
"<leader>fr",
|
||||
function()
|
||||
Snacks.picker.recent()
|
||||
end,
|
||||
desc = "Recent",
|
||||
},
|
||||
-- git
|
||||
{
|
||||
"<leader>gb",
|
||||
function()
|
||||
Snacks.picker.git_branches()
|
||||
end,
|
||||
desc = "Git Branches",
|
||||
},
|
||||
{
|
||||
"<leader>gl",
|
||||
function()
|
||||
Snacks.picker.git_log()
|
||||
end,
|
||||
desc = "Git Log",
|
||||
},
|
||||
{
|
||||
"<leader>gL",
|
||||
function()
|
||||
Snacks.picker.git_log_line()
|
||||
end,
|
||||
desc = "Git Log Line",
|
||||
},
|
||||
{
|
||||
"<leader>gs",
|
||||
function()
|
||||
Snacks.picker.git_status()
|
||||
end,
|
||||
desc = "Git Status",
|
||||
},
|
||||
{
|
||||
"<leader>gS",
|
||||
function()
|
||||
Snacks.picker.git_stash()
|
||||
end,
|
||||
desc = "Git Stash",
|
||||
},
|
||||
{
|
||||
"<leader>gd",
|
||||
function()
|
||||
Snacks.picker.git_diff()
|
||||
end,
|
||||
desc = "Git Diff (Hunks)",
|
||||
},
|
||||
{
|
||||
"<leader>gf",
|
||||
function()
|
||||
Snacks.picker.git_log_file()
|
||||
end,
|
||||
desc = "Git Log File",
|
||||
},
|
||||
-- Grep
|
||||
{
|
||||
"<leader>sb",
|
||||
function()
|
||||
Snacks.picker.lines()
|
||||
end,
|
||||
desc = "Buffer Lines",
|
||||
},
|
||||
{
|
||||
"<leader>sB",
|
||||
function()
|
||||
Snacks.picker.grep_buffers()
|
||||
end,
|
||||
desc = "Grep Open Buffers",
|
||||
},
|
||||
{
|
||||
"<leader>sg",
|
||||
function()
|
||||
Snacks.picker.grep()
|
||||
end,
|
||||
desc = "Grep",
|
||||
},
|
||||
{
|
||||
"<leader>sw",
|
||||
function()
|
||||
Snacks.picker.grep_word()
|
||||
end,
|
||||
desc = "Visual selection or word",
|
||||
mode = { "n", "x" },
|
||||
},
|
||||
-- search
|
||||
{
|
||||
'<leader>s"',
|
||||
function()
|
||||
Snacks.picker.registers()
|
||||
end,
|
||||
desc = "Registers",
|
||||
},
|
||||
{
|
||||
"<leader>s/",
|
||||
function()
|
||||
Snacks.picker.search_history()
|
||||
end,
|
||||
desc = "Search History",
|
||||
},
|
||||
{
|
||||
"<leader>sa",
|
||||
function()
|
||||
Snacks.picker.autocmds()
|
||||
end,
|
||||
desc = "Autocmds",
|
||||
},
|
||||
{
|
||||
"<leader>sb",
|
||||
function()
|
||||
Snacks.picker.lines()
|
||||
end,
|
||||
desc = "Buffer Lines",
|
||||
},
|
||||
{
|
||||
"<leader>sc",
|
||||
function()
|
||||
Snacks.picker.command_history()
|
||||
end,
|
||||
desc = "Command History",
|
||||
},
|
||||
{
|
||||
"<leader>sC",
|
||||
function()
|
||||
Snacks.picker.commands()
|
||||
end,
|
||||
desc = "Commands",
|
||||
},
|
||||
{
|
||||
"<leader>sd",
|
||||
function()
|
||||
Snacks.picker.diagnostics()
|
||||
end,
|
||||
desc = "Diagnostics",
|
||||
},
|
||||
{
|
||||
"<leader>sD",
|
||||
function()
|
||||
Snacks.picker.diagnostics_buffer()
|
||||
end,
|
||||
desc = "Buffer Diagnostics",
|
||||
},
|
||||
{
|
||||
"<leader>sh",
|
||||
function()
|
||||
Snacks.picker.help()
|
||||
end,
|
||||
desc = "Help Pages",
|
||||
},
|
||||
{
|
||||
"<leader>sH",
|
||||
function()
|
||||
Snacks.picker.highlights()
|
||||
end,
|
||||
desc = "Highlights",
|
||||
},
|
||||
{
|
||||
"<leader>si",
|
||||
function()
|
||||
Snacks.picker.icons()
|
||||
end,
|
||||
desc = "Icons",
|
||||
},
|
||||
{
|
||||
"<leader>sj",
|
||||
function()
|
||||
Snacks.picker.jumps()
|
||||
end,
|
||||
desc = "Jumps",
|
||||
},
|
||||
{
|
||||
"<leader>sk",
|
||||
function()
|
||||
Snacks.picker.keymaps()
|
||||
end,
|
||||
desc = "Keymaps",
|
||||
},
|
||||
{
|
||||
"<leader>sl",
|
||||
function()
|
||||
Snacks.picker.loclist()
|
||||
end,
|
||||
desc = "Location List",
|
||||
},
|
||||
{
|
||||
"<leader>sm",
|
||||
function()
|
||||
Snacks.picker.marks()
|
||||
end,
|
||||
desc = "Marks",
|
||||
},
|
||||
{
|
||||
"<leader>sM",
|
||||
function()
|
||||
Snacks.picker.man()
|
||||
end,
|
||||
desc = "Man Pages",
|
||||
},
|
||||
{
|
||||
"<leader>sp",
|
||||
function()
|
||||
Snacks.picker.lazy()
|
||||
end,
|
||||
desc = "Search for Plugin Spec",
|
||||
},
|
||||
{
|
||||
"<leader>sq",
|
||||
function()
|
||||
Snacks.picker.qflist()
|
||||
end,
|
||||
desc = "Quickfix List",
|
||||
},
|
||||
{
|
||||
"<leader>sR",
|
||||
function()
|
||||
Snacks.picker.resume()
|
||||
end,
|
||||
desc = "Resume",
|
||||
},
|
||||
{
|
||||
"<leader>su",
|
||||
function()
|
||||
Snacks.picker.undo()
|
||||
end,
|
||||
desc = "Undo History",
|
||||
},
|
||||
{
|
||||
"<leader>uC",
|
||||
function()
|
||||
Snacks.picker.colorschemes()
|
||||
end,
|
||||
desc = "Colorschemes",
|
||||
},
|
||||
-- LSP
|
||||
{
|
||||
"gd",
|
||||
function()
|
||||
Snacks.picker.lsp_definitions()
|
||||
end,
|
||||
desc = "Goto Definition",
|
||||
},
|
||||
{
|
||||
"gD",
|
||||
function()
|
||||
Snacks.picker.lsp_declarations()
|
||||
end,
|
||||
desc = "Goto Declaration",
|
||||
},
|
||||
{
|
||||
"gr",
|
||||
function()
|
||||
Snacks.picker.lsp_references()
|
||||
end,
|
||||
nowait = true,
|
||||
desc = "References",
|
||||
},
|
||||
{
|
||||
"gI",
|
||||
function()
|
||||
Snacks.picker.lsp_implementations()
|
||||
end,
|
||||
desc = "Goto Implementation",
|
||||
},
|
||||
{
|
||||
"gy",
|
||||
function()
|
||||
Snacks.picker.lsp_type_definitions()
|
||||
end,
|
||||
desc = "Goto T[y]pe Definition",
|
||||
},
|
||||
{
|
||||
"<leader>ss",
|
||||
function()
|
||||
Snacks.picker.lsp_symbols()
|
||||
end,
|
||||
desc = "LSP Symbols",
|
||||
},
|
||||
{
|
||||
"<leader>sS",
|
||||
function()
|
||||
Snacks.picker.lsp_workspace_symbols()
|
||||
end,
|
||||
desc = "LSP Workspace Symbols",
|
||||
},
|
||||
-- Other
|
||||
{
|
||||
"<leader>z",
|
||||
function()
|
||||
Snacks.zen()
|
||||
end,
|
||||
desc = "Toggle Zen Mode",
|
||||
},
|
||||
{
|
||||
"<leader>Z",
|
||||
function()
|
||||
Snacks.zen.zoom()
|
||||
end,
|
||||
desc = "Toggle Zoom",
|
||||
},
|
||||
{
|
||||
"<leader>.",
|
||||
function()
|
||||
Snacks.scratch()
|
||||
end,
|
||||
desc = "Toggle Scratch Buffer",
|
||||
},
|
||||
{
|
||||
"<leader>S",
|
||||
function()
|
||||
Snacks.scratch.select()
|
||||
end,
|
||||
desc = "Select Scratch Buffer",
|
||||
},
|
||||
{
|
||||
"<leader>n",
|
||||
function()
|
||||
Snacks.notifier.show_history()
|
||||
end,
|
||||
desc = "Notification History",
|
||||
},
|
||||
{
|
||||
"<leader>bd",
|
||||
function()
|
||||
Snacks.bufdelete()
|
||||
end,
|
||||
desc = "Delete Buffer",
|
||||
},
|
||||
{
|
||||
"<leader>cR",
|
||||
function()
|
||||
Snacks.rename.rename_file()
|
||||
end,
|
||||
desc = "Rename File",
|
||||
},
|
||||
{
|
||||
"<leader>gB",
|
||||
function()
|
||||
Snacks.gitbrowse()
|
||||
end,
|
||||
desc = "Git Browse",
|
||||
mode = { "n", "v" },
|
||||
},
|
||||
{
|
||||
"<leader>gg",
|
||||
function()
|
||||
Snacks.lazygit()
|
||||
end,
|
||||
desc = "Lazygit",
|
||||
},
|
||||
{
|
||||
"<leader>un",
|
||||
function()
|
||||
Snacks.notifier.hide()
|
||||
end,
|
||||
desc = "Dismiss All Notifications",
|
||||
},
|
||||
{
|
||||
"<c-/>",
|
||||
function()
|
||||
Snacks.terminal()
|
||||
end,
|
||||
desc = "Toggle Terminal",
|
||||
},
|
||||
{
|
||||
"<c-_>",
|
||||
function()
|
||||
Snacks.terminal()
|
||||
end,
|
||||
desc = "which_key_ignore",
|
||||
},
|
||||
{
|
||||
"]]",
|
||||
function()
|
||||
Snacks.words.jump(vim.v.count1)
|
||||
end,
|
||||
desc = "Next Reference",
|
||||
mode = { "n", "t" },
|
||||
},
|
||||
{
|
||||
"[[",
|
||||
function()
|
||||
Snacks.words.jump(-vim.v.count1)
|
||||
end,
|
||||
desc = "Prev Reference",
|
||||
mode = { "n", "t" },
|
||||
},
|
||||
{
|
||||
"<leader>N",
|
||||
desc = "Neovim News",
|
||||
function()
|
||||
Snacks.win({
|
||||
file = vim.api.nvim_get_runtime_file("doc/news.txt", false)[1],
|
||||
width = 0.6,
|
||||
height = 0.6,
|
||||
wo = {
|
||||
spell = false,
|
||||
wrap = false,
|
||||
signcolumn = "yes",
|
||||
statuscolumn = " ",
|
||||
conceallevel = 3,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
},
|
||||
init = function()
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "VeryLazy",
|
||||
callback = function()
|
||||
-- Setup some globals for debugging (lazy-loaded)
|
||||
_G.dd = function(...)
|
||||
Snacks.debug.inspect(...)
|
||||
end
|
||||
_G.bt = function()
|
||||
Snacks.debug.backtrace()
|
||||
end
|
||||
vim.print = _G.dd -- Override print to use snacks for `:=` command
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.8",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
}
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.8",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
return {
|
||||
"mikavilpas/yazi.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = {},
|
||||
keys = {
|
||||
{ "<leader>e", "<cmd>Yazi<cr>", desc = "Open Yazi" },
|
||||
},
|
||||
}
|
||||
return {
|
||||
"mikavilpas/yazi.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = {},
|
||||
keys = {
|
||||
{ "<leader>e", "<cmd>Yazi<cr>", desc = "Open Yazi" },
|
||||
},
|
||||
}
|
||||
|
||||
13
lazyvim/.config/nvim/lua/scripts/meld_diff_fzf.sh
Executable file
13
lazyvim/.config/nvim/lua/scripts/meld_diff_fzf.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
file1=$(fzf --prompt="Select first file: " < <(find . -type f))
|
||||
[ -z "$file1" ] && echo "Aborted." && exit 1
|
||||
|
||||
file2=$(fzf --prompt="Select second file: " < <(find . -type f))
|
||||
[ -z "$file2" ] && echo "Aborted." && exit 1
|
||||
|
||||
echo "🔍 Comparing:"
|
||||
echo " 1: $file1"
|
||||
echo " 2: $file2"
|
||||
|
||||
meld "$file1" "$file2" &
|
||||
@@ -1,15 +1,15 @@
|
||||
-- This file contains all custom functions for integrate external tools.
|
||||
|
||||
-- Meld for comparing and merging files
|
||||
local M = {}
|
||||
|
||||
function M.meld_diff(file1, file2)
|
||||
if not file1 or not file2 then
|
||||
print("Usage: :lua require'user.utils'.meld_diff('file1', 'file2')")
|
||||
return
|
||||
end
|
||||
local cmd = string.format("meld '%s' '%s' &", file1, file2)
|
||||
os.execute(cmd)
|
||||
end
|
||||
|
||||
return M
|
||||
-- This file contains all custom functions for integrate external tools.
|
||||
|
||||
-- Meld for comparing and merging files
|
||||
local M = {}
|
||||
|
||||
function M.meld_diff(file1, file2)
|
||||
if not file1 or not file2 then
|
||||
print("Usage: :lua require'user.utils'.meld_diff('file1', 'file2')")
|
||||
return
|
||||
end
|
||||
local cmd = string.format("meld '%s' '%s' &", file1, file2)
|
||||
os.execute(cmd)
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user