Compare commits

...

41 Commits

Author SHA1 Message Date
80a2b12793 [Snacks] Try to get indent to use correct char 2025-11-17 10:41:12 +01:00
695fade431 [LSP] Already load at start 2025-11-14 15:02:40 +01:00
20e1efe3e1 [Events] Improve startup 2025-11-14 11:07:38 +01:00
53ecdf21de [Telescope] Make load on BufRead 2025-11-14 10:58:52 +01:00
12cf4195f3 [Binds] Make latex binds neater 2025-11-12 15:29:52 +01:00
afd1633b4a [General] Fixes 2025-11-12 15:27:33 +01:00
ae8c9a875d [Spell] Add new spelling files 2025-11-11 12:07:37 +01:00
b13d7d7fde [Telescope] Fix bind 2025-11-11 12:07:19 +01:00
ae0ba73a95 [Perf] Half launch time again 2025-11-10 20:02:34 +01:00
3d8232d8fd [Perf] Further improvements 2025-11-10 19:48:11 +01:00
2e3601f2cb [Perf] Improve startup performance by over 2x 2025-11-10 19:46:05 +01:00
3b9e90ea5a [Perf] Start performance improvements 2025-11-10 15:26:18 +01:00
5dfca5bb8b [Snacks] Update indent char 2025-11-10 13:54:37 +01:00
76b571569c [Snacks] Update colors, disable scope anim 2025-11-07 12:06:47 +01:00
053a7f2ba2 [Snacks] Recent files picker 2025-11-07 11:51:09 +01:00
125b0d72cc [Snacks] Increase recent files limit 2025-11-07 11:31:42 +01:00
04ea4ec6e5 [Snacks] Add, remove now obsolete plugins 2025-11-07 10:55:34 +01:00
28d52cf668 [None] Add larger timeout for eslint 2025-11-06 14:57:48 +01:00
8cb6f8bc8f [Snippets] Update latex 2025-11-06 09:37:33 +01:00
856b67cee5 [Colors] Swap builtins 2025-11-05 16:11:06 +01:00
54cb737ad1 [Colors] Make coherent again 2025-11-05 15:50:42 +01:00
0e21a35592 [Colors] Update 2025-11-05 15:32:09 +01:00
290abe97bd [Colors] More updates 2025-11-05 13:26:31 +01:00
48809c55b4 [Colors] Even more updates to colours 2025-11-05 13:24:09 +01:00
080be95de9 [Colors] Update some too dark colours 2025-11-05 13:20:01 +01:00
a5f289dcf0 [LSP] Add phpactor 2025-11-05 10:44:17 +01:00
5c30d33696 [Mason] Remove latexindent from ensure_installed 2025-11-05 09:48:41 +01:00
75be761160 [Spell] Add new words 2025-11-01 08:09:20 +01:00
2ad9567b3f [Usage] Remove usage tracker 2025-10-31 16:15:25 +01:00
fd09f1236d [Noice] Improve routing 2025-10-31 10:12:34 +01:00
9074bbff08 [DAP] Add option to launch gdb with args to the binary 2025-10-29 15:15:21 +01:00
d9febc4783 [Noice] Fix wrong key 2025-10-28 12:37:06 +01:00
b97550e84f [Noice] Improve vimtex filtering 2025-10-28 11:20:24 +01:00
7c83f6d5e8 [Noice] Configure routes 2025-10-28 11:02:03 +01:00
6f8d32df89 [Noice] Make more useful 2025-10-28 07:48:49 +01:00
3f080de750 [Keybinds] Update 2025-10-28 07:48:49 +01:00
074ea0bbb5 [Install] Remove more plugins from pager 2025-10-27 07:43:21 +01:00
66bca51dd1 [Snippets] Update 2025-10-24 15:28:26 +02:00
d0c2b5f693 [Header] Remove 2025-10-24 15:28:19 +02:00
bb592c5a44 [Keybinds] Add tab keybinds 2025-10-24 11:35:23 +02:00
3f6ad02d25 [Header] Remove unnecessary import 2025-10-23 17:42:20 +02:00
53 changed files with 944 additions and 949 deletions

View File

@@ -18,12 +18,23 @@ cp ./lazy-conf-pager.lua ~/.config/nvimpager/lua/lazy-conf.lua
cd ~/.config/nvimpager/
rm -rf ./lua/plugins/lsp
rm -rf ./lua/plugins/testing
rm -rf ./lua/plugins/nav/telescope
rm -rf ./ftplugin
# Remove specific plugins
rm -rf ./lua/plugins/nav/neotree.lua
rm -rf ./lua/plugins/nav/toggleterm.lua
rm -rf ./lua/plugins/style/startup.lua
rm -rf ./lua/plugins/util/autotag.lua
rm -rf ./lua/plugins/util/autopairs.lua
rm -rf ./lua/plugins/util/colour-picker.lua
rm -rf ./lua/plugins/util/indent-blankline.lua
rm -rf ./lua/plugins/util/markdown-preview.lua
rm -rf ./lua/plugins/util/neogen.lua
rm -rf ./lua/plugins/util/move.lua
rm -rf ./lua/plugins/util/neotab.lua
rm -rf ./lua/plugins/util/usage-tracker.lua
rm -rf ./lua/plugins/util/surround.lua
rm -rf ./lua/plugins/util/scratch.lua
rm -rf ./lua/plugins/util/multicrsors.lua
rm -rf ./lua/plugins/util/diff

View File

@@ -1,4 +1,5 @@
local opts = require("utils").opts
local utils = require("utils")
local opts = utils.opts
local keymap = vim.keymap
@@ -15,11 +16,17 @@ else
end
-- Keep selection in visual mode when indenting
keymap.set("v", "<", "<gv", { noremap = true, silent = true })
keymap.set("v", ">", ">gv", { noremap = true, silent = true })
keymap.set("v", "<", "<gv", opts())
keymap.set("v", ">", ">gv", opts())
-- Tabs
keymap.set("n", "<C-t>", ":tabnew<CR>", opts("open new tab"))
keymap.set("n", "<C-t>n", ":tabnew<CR>", opts("open new tab"))
keymap.set("n", "<C-t>j", ":-tabnext<CR>", opts("Go to previous tab"))
keymap.set("n", "<C-t>k", ":+tabnext<CR>", opts("Go to next tab"))
keymap.set("n", "<C-t>l", ":+tabnext<CR>", opts("Go to next tab"))
keymap.set("n", "<C-t>h", ":-tabnext<CR>", opts("Go to previous tab"))
keymap.set("n", "<C-t>0", ":1tabnext<CR>", opts("Go to previous tab"))
keymap.set("n", "<C-t>$", ":$tabnext<CR>", opts("Go to previous tab"))
-- Save and quit (sudo and no sudo)
keymap.set("n", "E", ":wq!<CR>", opts("write and quit file"))
@@ -32,12 +39,9 @@ keymap.set("n", "Q", ":q!<CR>", opts("quit file"))
keymap.set("n", "<leader>dd", ":t.<CR>", opts("Duplicate line"))
-- LaTeX mappings
keymap.set("n", "<leader>lc", ":VimtexCompile<CR>", opts("Compile latex document")) -- Compile LaTeX file
keymap.set("n", "<leader>lv", ":VimtexView<CR>", opts("View compiled latex pdf")) -- View compiled PDF
keymap.set("n", "<leader>lq", ":VimtexStop<CR>", opts("Stop Compiling document")) -- Stop compilation
-- Markdown-Preview
keymap.set("n", "<leader><leader>m", ":MarkdownPreview<CR>", opts("Preview Markdown document in browser")) -- Stop compilation
keymap.set("n", "<leader>lc", utils.run_vim_cmd("VimtexCompile"), opts("Compile latex document")) -- Compile LaTeX file
keymap.set("n", "<leader>lv", utils.run_vim_cmd("VimtexView"), opts("View compiled latex pdf")) -- View compiled PDF
keymap.set("n", "<leader>lq", utils.run_vim_cmd("VimtexStop"), opts("Stop Compiling document")) -- Stop compilation
-- window navigation
keymap.set("n", "<A-h>", "<C-w>h", opts())

View File

@@ -14,7 +14,6 @@ vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
spec = {
{ import = "plugins.nav" },
{ import = "plugins.nav.telescope" },
{ import = "plugins.lsp" },
{ import = "plugins.style" },
{ import = "plugins.util" },

View File

@@ -2,7 +2,7 @@ local M = {}
local keymap = vim.keymap
local opts = { silent = true }
local opts = { silent = true, noremap = true }
M.on_attach = function(client, bufnr)
opts.buffer = bufnr

View File

@@ -2,6 +2,7 @@ vim.g.mapleader = " "
vim.g.maplocalleader = " "
vim.opt.backspace = "2"
vim.opt.termguicolors = true
-- title
vim.opt.title = true

View File

@@ -1,19 +1,16 @@
return {
"aznhe21/actions-preview.nvim",
config = function()
-- Configure actions-preview.nvim
require("actions-preview").setup({
-- Floating window configuration (optional)
max_width = 80, -- Max width of the preview window
max_height = 12, -- Max height of the preview window
min_width = 20, -- Minimum width for the preview window
min_height = 4, -- Minimum height for the preview window
-- Keymaps (optional)
keymaps = {
-- Trigger code action preview with a keybinding (example using <leader>a)
{ "n", "<leader>ca", vim.lsp.buf.code_action },
},
})
end,
opts = {
-- Floating window configuration (optional)
max_width = 80, -- Max width of the preview window
max_height = 12, -- Max height of the preview window
min_width = 20, -- Minimum width for the preview window
min_height = 4, -- Minimum height for the preview window
},
event = {
"LspAttach"
},
keys = {
{ "<leader>ca", vim.lsp.buf.code_action, desc = "View code actions" },
},
}

View File

@@ -1,7 +1,7 @@
return {
-- competion
"hrsh7th/nvim-cmp",
event = "InsertEnter",
event = { "InsertEnter", "LspAttach" },
dependencies = {
{ "hrsh7th/cmp-buffer" }, -- source for text in buffer
{ "hrsh7th/cmp-path" }, -- source for file system paths
@@ -10,7 +10,6 @@ return {
{ "rafamadriz/friendly-snippets" }, -- useful snippets
{ "onsails/lspkind.nvim" }, -- icons for cmp
},
config = function()
local cmp = require("cmp")
local lspkind = require("lspkind")

View File

@@ -1,13 +0,0 @@
return {
-- notifications && lsp progress msgs
"j-hui/fidget.nvim",
config = function()
require("fidget").setup({
notification = {
window = {
winblend = 0,
},
},
})
end,
}

View File

@@ -25,6 +25,14 @@ lsp.config("jsonls", {
on_attach = on_attach,
})
-- ┌ ┐
-- │ PHP │
-- └ ┘
lsp.config("phpactor", {
capabilities = capabilities,
on_attach = on_attach,
})
-- ┌ ┐
-- │ Vue │
-- └ ┘
@@ -75,5 +83,6 @@ local enable = vim.lsp.enable
enable("jsonls")
enable("html")
enable("cssls")
enable("phpactor")
enable("vue_ls")
enable("vtsls")

View File

@@ -5,15 +5,12 @@
return {
-- lsp configuration
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"hrsh7th/cmp-nvim-lsp",
{ "antosha417/nvim-lsp-file-operations", config = true },
"mfussenegger/nvim-jdtls",
},
config = function()
local enable = vim.lsp.enable
-- Change the Diagnostic symbols in the sign column (gutter)
local signs = { Error = "󰅚 ", Warn = "󰀪 ", Hint = "󰌶", Info = "󰋽 " }
for type, icon in pairs(signs) do

View File

@@ -34,9 +34,9 @@ return {
"html",
"hyprls",
"jdtls",
"latexindent",
"marksman",
"lua_ls",
"phpactor",
"pyright",
"rust_analyzer",
"ruby_lsp",

View File

@@ -6,6 +6,7 @@ return {
dependencies = {
"nvimtools/none-ls-extras.nvim",
},
event = { "BufReadPre", "BufNewFile" },
config = function()
local null_ls = require("null-ls")
@@ -55,7 +56,9 @@ return {
null_ls.builtins.code_actions.proselint,
require("none-ls.diagnostics.eslint_d"),
require("none-ls.code_actions.eslint_d"),
require("none-ls.formatting.eslint_d"),
require("none-ls.formatting.eslint_d").with( {
timeout = 4000
} ),
null_ls.builtins.formatting.black,
null_ls.builtins.formatting.clang_format
},

View File

@@ -1,5 +1,6 @@
return {
"lervag/vimtex",
event = "BufRead",
config = function()
-- vimtex settings
-- vim.g.vimtex_view_method = 'zathura' -- PDF viewer (example: zathura, or use 'skim' for macOS)

View File

@@ -3,6 +3,7 @@ return {
"akinsho/bufferline.nvim",
version = "*",
dependencies = "nvim-tree/nvim-web-devicons",
event = "BufRead",
config = function()
local bufferline = require("bufferline")
bufferline.setup({

View File

@@ -1,12 +0,0 @@
return {
"echasnovski/mini.bufremove",
config = function()
_G.MiniBufremove = require("mini.bufremove")
vim.keymap.set(
"n",
"<C-x>",
":lua MiniBufremove.delete()<CR>",
{ silent = true, noremap = true, desc = "Remove buffer" }
)
end,
}

View File

@@ -1,18 +1,17 @@
return {
-- git buffer integration
"lewis6991/gitsigns.nvim",
config = function()
require("gitsigns").setup({
count_chars = { "¹", "²", "³", "", "", "", "", "", "", ["+"] = "" },
signs = {
add = { show_count = true },
change = { show_count = true },
delete = { show_count = true },
topdelete = { show_count = true },
changedelete = { show_count = true },
untracked = { show_count = true },
},
numhl = true,
})
end,
-- git buffer integration
"lewis6991/gitsigns.nvim",
event = "BufRead",
opts = {
count_chars = { "¹", "²", "³", "", "", "", "", "", "", ["+"] = "" },
signs = {
add = { show_count = true },
change = { show_count = true },
delete = { show_count = true },
topdelete = { show_count = true },
changedelete = { show_count = true },
untracked = { show_count = true },
},
numhl = true,
},
}

View File

@@ -1,7 +1,6 @@
return {
-- open file at previous position
"ethanholz/nvim-lastplace",
config = function()
require("nvim-lastplace").setup({})
end,
-- open file at previous position
"ethanholz/nvim-lastplace",
event = { "BufReadPre", "BufNewFile" },
opts = {},
}

View File

@@ -5,6 +5,9 @@ return {
"MunifTanjim/nui.nvim",
},
opts = { lsp = { auto_attach = true } },
keys = {
{ "<leader><leader>n", ":Navbuddy<CR>", desc = "open navbuddy menu" }
},
config = function()
local actions = require("nvim-navbuddy.actions")
require("nvim-navbuddy").setup({
@@ -140,7 +143,5 @@ return {
},
custom_hl_group = nil, -- "Visual" or any other hl group to use instead of inverted colors
})
vim.keymap.set("n", "<leader><leader>n", ":Navbuddy<CR>", { silent = true, desc = "open navbuddy menu" })
end,
}

View File

@@ -6,331 +6,327 @@ return {
"MunifTanjim/nui.nvim",
-- {"3rd/image.nvim", opts = {}}, -- Optional image support in preview window: See `# Preview Mode` for more information
},
lazy = false, -- neo-tree will lazily load itself
config = function()
-- Automatically open up
require("neo-tree").setup({
close_if_last_window = true, -- Close Neo-tree if it is the last window left in the tab
popup_border_style = "rounded",
enable_git_status = true,
enable_diagnostics = true,
use_default_mappings = false,
open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes
open_files_using_relative_paths = false,
sort_case_insensitive = false, -- used when sorting files and directories in the tree
-- sort_function = nil, -- use a custom function for sorting files and directories in the tree
sort_function = function(a, b) -- natural sort
if a.type == b.type then
local ap = a.path:lower()
local bp = b.path:lower()
if ap == bp then
return false
end
for i = 1, math.max(string.len(ap), string.len(bp)), 1 do
local l = string.sub(ap, i, -1)
local r = string.sub(bp, i, -1)
if
type(tonumber(string.sub(l, 1, 1))) == "number"
and type(tonumber(string.sub(r, 1, 1))) == "number"
then
local l_number = tonumber(string.match(l, "^[0-9]+"))
local r_number = tonumber(string.match(r, "^[0-9]+"))
if l_number ~= r_number then
return l_number < r_number
end
elseif string.sub(l, 1, 1) ~= string.sub(r, 1, 1) then
return l < r
end
end
else
return a.type < b.type
end
end,
default_component_configs = {
container = {
enable_character_fade = true,
},
indent = {
indent_size = 2,
padding = 1, -- extra padding on left hand side
-- indent guides
with_markers = true,
indent_marker = "",
last_indent_marker = "",
highlight = "NeoTreeIndentMarker",
-- expander config, needed for nesting files
with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders
expander_collapsed = "",
expander_expanded = "",
expander_highlight = "NeoTreeExpander",
},
icon = {
folder_closed = "",
folder_open = "",
folder_empty = "󰜌",
provider = function(icon, node, state) -- default icon provider utilizes nvim-web-devicons if available
if node.type == "file" or node.type == "terminal" then
local success, web_devicons = pcall(require, "nvim-web-devicons")
local name = node.type == "terminal" and "terminal" or node.name
if success then
local devicon, hl = web_devicons.get_icon(name)
icon.text = devicon or icon.text
icon.highlight = hl or icon.highlight
end
end
end,
-- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there
-- then these will never be used.
default = "*",
highlight = "NeoTreeFileIcon",
},
modified = {
symbol = "[+]",
highlight = "NeoTreeModified",
},
name = {
trailing_slash = true,
use_git_status_colors = true,
highlight = "NeoTreeFileName",
},
git_status = {
symbols = {
-- Change type
added = "+", -- or "✚", but this is redundant info if you use git_status_colors on the name
modified = "", -- or "", but this is redundant info if you use git_status_colors on the name
deleted = "", -- this can only be used in the git_status source
renamed = "󰁕", -- this can only be used in the git_status source
-- Status type
untracked = "",
ignored = "",
unstaged = "󰄱",
staged = "",
conflict = "",
},
},
-- If you don't want to use these columns, you can set `enabled = false` for each of them individually
file_size = {
enabled = true,
width = 12, -- width of the column
required_width = 64, -- min width of window required to show this column
},
type = {
enabled = true,
width = 10, -- width of the column
required_width = 122, -- min width of window required to show this column
},
last_modified = {
enabled = true,
width = 20, -- width of the column
required_width = 88, -- min width of window required to show this column
},
created = {
enabled = true,
width = 20, -- width of the column
required_width = 110, -- min width of window required to show this column
},
symlink_target = {
enabled = false,
},
},
-- A list of functions, each representing a global custom command
-- that will be available in all sources (if not overridden in `opts[source_name].commands`)
-- see `:h neo-tree-custom-commands-global`
commands = {},
window = {
position = "left",
width = 40,
mapping_options = {
noremap = true,
nowait = true,
},
mappings = {
["<2-LeftMouse>"] = "open",
["<cr>"] = "open",
["o"] = "open",
["<esc>"] = "cancel", -- close preview or floating neo-tree window
["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = true } },
-- Read `# Preview Mode` for more information
["l"] = "focus_preview",
["S"] = "open_split",
["v"] = "open_vsplit",
["t"] = "open_tabnew",
["w"] = "open_with_window_picker",
["C"] = "close_node",
-- ['C'] = 'close_all_subnodes',
["z"] = "close_all_nodes",
--["Z"] = "expand_all_nodes",
["q"] = "close_window",
["R"] = "refresh",
["?"] = "show_help",
["<"] = "prev_source",
[">"] = "next_source",
["i"] = "show_file_details",
},
},
nesting_rules = {},
filesystem = {
scan_mode = "deep",
filtered_items = {
visible = false, -- when true, they will just be displayed differently than normal items
hide_dotfiles = true,
hide_gitignored = true,
hide_hidden = true, -- only works on Windows for hidden files/directories
hide_by_name = {
--"node_modules"
},
hide_by_pattern = { -- uses glob style patterns
--"*.meta",
--"*/src/*/tsconfig.json",
},
always_show = { -- remains visible even if other settings would normally hide it
--".gitignored",
},
always_show_by_pattern = { -- uses glob style patterns
--".env*",
},
never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show
--".DS_Store",
--"thumbs.db"
},
never_show_by_pattern = { -- uses glob style patterns
--".null-ls_*",
},
},
follow_current_file = {
enabled = true, -- This will find and focus the file in the active buffer every time
-- -- the current file is changed while the tree is open.
leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal`
},
group_empty_dirs = true, -- when true, empty folders will be grouped together
hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree
-- in whatever position is specified in window.position
-- "open_current", -- netrw disabled, opening a directory opens within the
-- window like netrw would, regardless of window.position
-- "disabled", -- netrw left alone, neo-tree does not handle opening dirs
use_libuv_file_watcher = true, -- This will use the OS level file watchers to detect changes
-- instead of relying on nvim autocmd events.
window = {
mappings = {
["a"] = {
"add",
-- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details
-- some commands may take optional config options, see `:h neo-tree-mappings` for details
config = {
show_path = "none", -- "none", "relative", "absolute"
},
},
["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion.
["d"] = "delete",
["r"] = "rename",
["b"] = "rename_basename",
["y"] = "copy_to_clipboard",
["x"] = "cut_to_clipboard",
["p"] = "paste_from_clipboard",
["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add":
["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add".
["<bs>"] = "navigate_up",
["."] = "set_root",
["H"] = "toggle_hidden",
["/"] = "fuzzy_finder",
["D"] = "fuzzy_finder_directory",
["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm
-- ["D"] = "fuzzy_sorter_directory",
["f"] = "filter_on_submit",
["<c-x>"] = "clear_filter",
["[g"] = "prev_git_modified",
["]g"] = "next_git_modified",
["s"] = {
"show_help",
nowait = false,
config = { title = "Order by", prefix_key = "s" },
},
["sc"] = { "order_by_created", nowait = false },
["sd"] = { "order_by_diagnostics", nowait = false },
["sg"] = { "order_by_git_status", nowait = false },
["sm"] = { "order_by_modified", nowait = false },
["sn"] = { "order_by_name", nowait = false },
["ss"] = { "order_by_size", nowait = false },
["st"] = { "order_by_type", nowait = false },
-- ['<key>'] = function(state) ... end,
},
fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode
["<down>"] = "move_cursor_down",
["<C-n>"] = "move_cursor_down",
["<up>"] = "move_cursor_up",
["<C-p>"] = "move_cursor_up",
["<esc>"] = "close",
-- ['<key>'] = function(state, scroll_padding) ... end,
},
},
commands = {}, -- Add a custom command or override a global one using the same function name
},
buffers = {
follow_current_file = {
enabled = true, -- This will find and focus the file in the active buffer every time
-- -- the current file is changed while the tree is open.
leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal`
},
group_empty_dirs = true, -- when true, empty folders will be grouped together
show_unloaded = true,
window = {
mappings = {
["d"] = "buffer_delete",
["bd"] = "buffer_delete",
["<bs>"] = "navigate_up",
["."] = "set_root",
["s"] = {
"show_help",
nowait = false,
config = { title = "Order by", prefix_key = "s" },
},
["sc"] = { "order_by_created", nowait = false },
["sd"] = { "order_by_diagnostics", nowait = false },
["sm"] = { "order_by_modified", nowait = false },
["sn"] = { "order_by_name", nowait = false },
["ss"] = { "order_by_size", nowait = false },
["st"] = { "order_by_type", nowait = false },
},
},
},
git_status = {
window = {
position = "float",
mappings = {
["A"] = "git_add_all",
["u"] = "git_unstage_file",
["a"] = "git_add_file",
["r"] = "git_revert_file",
["c"] = "git_commit",
["p"] = "git_push",
["g"] = "git_commit_and_push",
["s"] = {
"show_help",
nowait = false,
config = { title = "Order by", prefix_key = "s" },
},
["sc"] = { "order_by_created", nowait = false },
["sd"] = { "order_by_diagnostics", nowait = false },
["sm"] = { "order_by_modified", nowait = false },
["sn"] = { "order_by_name", nowait = false },
["ss"] = { "order_by_size", nowait = false },
["st"] = { "order_by_type", nowait = false },
},
},
},
})
vim.keymap.set("n", "<leader>e", "<Cmd>Neotree<CR>", { silent = true, desc = "Open Neotree" })
vim.keymap.set(
"n",
keys = {
{ "<leader>e", "<Cmd>Neotree<CR>", desc = "Open Neotree" },
{
"<leader><leader>gg",
"<Cmd>Neotree source=git_status position=float<CR>",
{ silent = true, desc = "Open git view" }
)
end,
desc = "Open git view",
},
},
opts = {
close_if_last_window = true, -- Close Neo-tree if it is the last window left in the tab
popup_border_style = "rounded",
enable_git_status = true,
enable_diagnostics = true,
use_default_mappings = false,
open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes
open_files_using_relative_paths = false,
sort_case_insensitive = false, -- used when sorting files and directories in the tree
-- sort_function = nil, -- use a custom function for sorting files and directories in the tree
sort_function = function(a, b) -- natural sort
if a.type == b.type then
local ap = a.path:lower()
local bp = b.path:lower()
if ap == bp then
return false
end
for i = 1, math.max(string.len(ap), string.len(bp)), 1 do
local l = string.sub(ap, i, -1)
local r = string.sub(bp, i, -1)
if
type(tonumber(string.sub(l, 1, 1))) == "number"
and type(tonumber(string.sub(r, 1, 1))) == "number"
then
local l_number = tonumber(string.match(l, "^[0-9]+"))
local r_number = tonumber(string.match(r, "^[0-9]+"))
if l_number ~= r_number then
return l_number < r_number
end
elseif string.sub(l, 1, 1) ~= string.sub(r, 1, 1) then
return l < r
end
end
else
return a.type < b.type
end
end,
default_component_configs = {
container = {
enable_character_fade = true,
},
indent = {
indent_size = 2,
padding = 1, -- extra padding on left hand side
-- indent guides
with_markers = true,
indent_marker = "",
last_indent_marker = "",
highlight = "NeoTreeIndentMarker",
-- expander config, needed for nesting files
with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders
expander_collapsed = "",
expander_expanded = "",
expander_highlight = "NeoTreeExpander",
},
icon = {
folder_closed = "",
folder_open = "",
folder_empty = "󰜌",
provider = function(icon, node, state) -- default icon provider utilizes nvim-web-devicons if available
if node.type == "file" or node.type == "terminal" then
local success, web_devicons = pcall(require, "nvim-web-devicons")
local name = node.type == "terminal" and "terminal" or node.name
if success then
local devicon, hl = web_devicons.get_icon(name)
icon.text = devicon or icon.text
icon.highlight = hl or icon.highlight
end
end
end,
-- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there
-- then these will never be used.
default = "*",
highlight = "NeoTreeFileIcon",
},
modified = {
symbol = "[+]",
highlight = "NeoTreeModified",
},
name = {
trailing_slash = true,
use_git_status_colors = true,
highlight = "NeoTreeFileName",
},
git_status = {
symbols = {
-- Change type
added = "+", -- or "✚", but this is redundant info if you use git_status_colors on the name
modified = "", -- or "", but this is redundant info if you use git_status_colors on the name
deleted = "", -- this can only be used in the git_status source
renamed = "󰁕", -- this can only be used in the git_status source
-- Status type
untracked = "",
ignored = "",
unstaged = "󰄱",
staged = "",
conflict = "",
},
},
-- If you don't want to use these columns, you can set `enabled = false` for each of them individually
file_size = {
enabled = true,
width = 12, -- width of the column
required_width = 64, -- min width of window required to show this column
},
type = {
enabled = true,
width = 10, -- width of the column
required_width = 122, -- min width of window required to show this column
},
last_modified = {
enabled = true,
width = 20, -- width of the column
required_width = 88, -- min width of window required to show this column
},
created = {
enabled = true,
width = 20, -- width of the column
required_width = 110, -- min width of window required to show this column
},
symlink_target = {
enabled = false,
},
},
-- A list of functions, each representing a global custom command
-- that will be available in all sources (if not overridden in `opts[source_name].commands`)
-- see `:h neo-tree-custom-commands-global`
commands = {},
window = {
position = "left",
width = 40,
mapping_options = {
noremap = true,
nowait = true,
},
mappings = {
["<2-LeftMouse>"] = "open",
["<cr>"] = "open",
["o"] = "open",
["<esc>"] = "cancel", -- close preview or floating neo-tree window
["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = true } },
-- Read `# Preview Mode` for more information
["l"] = "focus_preview",
["S"] = "open_split",
["v"] = "open_vsplit",
["t"] = "open_tabnew",
["w"] = "open_with_window_picker",
["C"] = "close_node",
-- ['C'] = 'close_all_subnodes',
["z"] = "close_all_nodes",
--["Z"] = "expand_all_nodes",
["q"] = "close_window",
["R"] = "refresh",
["?"] = "show_help",
["<"] = "prev_source",
[">"] = "next_source",
["i"] = "show_file_details",
},
},
nesting_rules = {},
filesystem = {
scan_mode = "deep",
filtered_items = {
visible = false, -- when true, they will just be displayed differently than normal items
hide_dotfiles = true,
hide_gitignored = true,
hide_hidden = true, -- only works on Windows for hidden files/directories
hide_by_name = {
--"node_modules"
},
hide_by_pattern = { -- uses glob style patterns
--"*.meta",
--"*/src/*/tsconfig.json",
},
always_show = { -- remains visible even if other settings would normally hide it
--".gitignored",
},
always_show_by_pattern = { -- uses glob style patterns
--".env*",
},
never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show
--".DS_Store",
--"thumbs.db"
},
never_show_by_pattern = { -- uses glob style patterns
--".null-ls_*",
},
},
follow_current_file = {
enabled = true, -- This will find and focus the file in the active buffer every time
-- -- the current file is changed while the tree is open.
leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal`
},
group_empty_dirs = true, -- when true, empty folders will be grouped together
hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree
-- in whatever position is specified in window.position
-- "open_current", -- netrw disabled, opening a directory opens within the
-- window like netrw would, regardless of window.position
-- "disabled", -- netrw left alone, neo-tree does not handle opening dirs
use_libuv_file_watcher = true, -- This will use the OS level file watchers to detect changes
-- instead of relying on nvim autocmd events.
window = {
mappings = {
["a"] = {
"add",
-- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details
-- some commands may take optional config options, see `:h neo-tree-mappings` for details
config = {
show_path = "none", -- "none", "relative", "absolute"
},
},
["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion.
["d"] = "delete",
["r"] = "rename",
["b"] = "rename_basename",
["y"] = "copy_to_clipboard",
["x"] = "cut_to_clipboard",
["p"] = "paste_from_clipboard",
["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add":
["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add".
["<bs>"] = "navigate_up",
["."] = "set_root",
["H"] = "toggle_hidden",
["/"] = "fuzzy_finder",
["D"] = "fuzzy_finder_directory",
["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm
-- ["D"] = "fuzzy_sorter_directory",
["f"] = "filter_on_submit",
["<c-x>"] = "clear_filter",
["[g"] = "prev_git_modified",
["]g"] = "next_git_modified",
["s"] = {
"show_help",
nowait = false,
config = { title = "Order by", prefix_key = "s" },
},
["sc"] = { "order_by_created", nowait = false },
["sd"] = { "order_by_diagnostics", nowait = false },
["sg"] = { "order_by_git_status", nowait = false },
["sm"] = { "order_by_modified", nowait = false },
["sn"] = { "order_by_name", nowait = false },
["ss"] = { "order_by_size", nowait = false },
["st"] = { "order_by_type", nowait = false },
-- ['<key>'] = function(state) ... end,
},
fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode
["<down>"] = "move_cursor_down",
["<C-n>"] = "move_cursor_down",
["<up>"] = "move_cursor_up",
["<C-p>"] = "move_cursor_up",
["<esc>"] = "close",
-- ['<key>'] = function(state, scroll_padding) ... end,
},
},
commands = {}, -- Add a custom command or override a global one using the same function name
},
buffers = {
follow_current_file = {
enabled = true, -- This will find and focus the file in the active buffer every time
-- -- the current file is changed while the tree is open.
leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal`
},
group_empty_dirs = true, -- when true, empty folders will be grouped together
show_unloaded = true,
window = {
mappings = {
["d"] = "buffer_delete",
["bd"] = "buffer_delete",
["<bs>"] = "navigate_up",
["."] = "set_root",
["s"] = {
"show_help",
nowait = false,
config = { title = "Order by", prefix_key = "s" },
},
["sc"] = { "order_by_created", nowait = false },
["sd"] = { "order_by_diagnostics", nowait = false },
["sm"] = { "order_by_modified", nowait = false },
["sn"] = { "order_by_name", nowait = false },
["ss"] = { "order_by_size", nowait = false },
["st"] = { "order_by_type", nowait = false },
},
},
},
git_status = {
window = {
position = "float",
mappings = {
["A"] = "git_add_all",
["u"] = "git_unstage_file",
["a"] = "git_add_file",
["r"] = "git_revert_file",
["c"] = "git_commit",
["p"] = "git_push",
["g"] = "git_commit_and_push",
["s"] = {
"show_help",
nowait = false,
config = { title = "Order by", prefix_key = "s" },
},
["sc"] = { "order_by_created", nowait = false },
["sd"] = { "order_by_diagnostics", nowait = false },
["sm"] = { "order_by_modified", nowait = false },
["sn"] = { "order_by_name", nowait = false },
["ss"] = { "order_by_size", nowait = false },
["st"] = { "order_by_type", nowait = false },
},
},
},
},
}

View File

@@ -0,0 +1,140 @@
return {
-- fuzzy finder
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
{
"nvim-telescope/telescope-live-grep-args.nvim",
-- This will not install any breaking changes.
-- For major updates, this must be adjusted manually.
version = "^1.0.0",
},
},
event = { "LspAttach" },
keys = {
{
"<leader>ff",
function()
require("telescope.builtin").find_files()
end,
desc = "Telescope find files",
},
{
"<leader>flg",
function()
require("telescope.builtin").live_grep()
end,
desc = "Telescope live grep",
},
{
"<leader>fg",
function()
require("telescope").extensions.live_grep_args.live_grep_args()
end,
desc = "Telescope live grep args",
},
{
"<leader>fb",
function()
require("telescope.builtin").buffers()
end,
desc = "Telescope buffers",
},
{
"<leader>fh",
function()
require("telescope.builtin").help_tags()
end,
desc = "Telescope nvim functions",
},
{ "<leader>ft", ":TodoTelescope<CR>", desc = "Telescope TODOs" },
-- Git
{
"<leader>fld",
function()
require("telescope.builtin").git_status()
end,
desc = "Telescope git diff",
},
{
"<leader>flc",
function()
require("telescope.builtin").git_commits()
end,
desc = "Telescope git commits",
},
{
"<leader>flf",
function()
require("telescope.builtin").git_files()
end,
desc = "Telescope git files",
},
-- Recent Commands
{ "<leader>foc", ":Telescope command_history<CR>", desc = "Telescope recent commands" },
-- Recent Searches
{ "<leader>fos", ":Telescope search_history<CR>", desc = "Telescope recent searches" },
-- Old Files
{
"<leader>fr",
function()
require("telescope.builtin").oldfiles()
end,
desc = "Telescope recent files",
},
-- Quickfix Items
{ "<leader>fq", ":Telescope quickfix<CR>", desc = "Telescope quickfix items" },
-- Spell Suggestions
{ "<leader>fs", ":Telescope spell_suggest<CR>", desc = "Telescope spellsuggestions" },
-- Diagnostics
{ "<leader>fd", ":Telescope diagnostics<CR>", desc = "Telescope Diagnostics" },
-- Notifications
{ "<leader>fn", ":Telescope notify<CR>", desc = "Telescope Notifications" },
-- Implementations
{ "<leader>fi", ":Telescope lsp_implementations<CR>", desc = "Telescope lsp implementations" },
},
config = function()
local actions = require("telescope.actions")
local telescope = require("telescope")
local lga_actions = require("telescope-live-grep-args.actions")
telescope.setup({
defaults = {
mappings = {
i = {
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<C-q>"] = actions.smart_add_to_qflist,
["<C-A-q>"] = actions.smart_send_to_qflist,
["<C-Space>"] = lga_actions.quote_prompt(),
},
},
path_display = { "truncate" },
},
extensions = {
frecency = {
db_safe_mode = false,
matcher = "fuzzy",
},
},
})
telescope.load_extension("live_grep_args")
end,
}

View File

@@ -1,8 +0,0 @@
return {
"nvim-telescope/telescope-frecency.nvim",
-- install the latest stable version
version = "*",
config = function()
require("telescope").load_extension("frecency")
end,
}

View File

@@ -1,120 +0,0 @@
return {
-- fuzzy finder
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
{
"nvim-telescope/telescope-live-grep-args.nvim",
-- This will not install any breaking changes.
-- For major updates, this must be adjusted manually.
version = "^1.0.0",
},
},
config = function()
local builtin = require("telescope.builtin")
local actions = require("telescope.actions")
local opts = { silent = true }
local telescope = require("telescope")
local lga_actions = require("telescope-live-grep-args.actions")
telescope.setup({
defaults = {
mappings = {
i = {
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<C-q>"] = actions.smart_add_to_qflist,
["<C-A-q>"] = actions.smart_send_to_qflist,
["<C-Space>"] = lga_actions.quote_prompt(),
},
},
path_display = { "truncate" },
},
extensions = {
frecency = {
db_safe_mode = false,
matcher = "fuzzy"
},
},
})
telescope.load_extension("live_grep_args")
opts.desc = "telescope find files"
vim.keymap.set("n", "<leader>ff", builtin.find_files, opts)
opts.desc = "telescope live grep"
vim.keymap.set("n", "<leader>flg", builtin.live_grep, opts)
opts.desc = "telescope live grep args"
local function start_live_grep_args()
telescope.extensions.live_grep_args.live_grep_args()
end
vim.keymap.set("n", "<leader>fg", start_live_grep_args, opts)
opts.desc = "telescope buffers"
vim.keymap.set("n", "<leader>fb", builtin.buffers, opts)
opts.desc = "Show nvim functions"
vim.keymap.set("n", "<leader>fh", builtin.help_tags, opts)
opts.desc = "Telescope TODOs"
vim.keymap.set("n", "<leader>ft", ":TodoTelescope<CR>", opts)
-- Git
opts.desc = "Show git diff"
vim.keymap.set("n", "<leader>fld", builtin.git_status, opts)
opts.desc = "Show git commits"
vim.keymap.set("n", "<leader>flc", builtin.git_commits, opts)
opts.desc = "Show git files"
vim.keymap.set("n", "<leader>flf", builtin.git_files, opts)
-- Recent Commands
opts.desc = "Show recent commands"
vim.keymap.set("n", "<leader>foc", ":Telescope command_history<CR>", opts)
-- Recent Searches
opts.desc = "Show recent searches"
vim.keymap.set("n", "<leader>fos", ":Telescope search_history<CR>", opts)
-- Old Files
opts.desc = "Show recent files"
vim.keymap.set("n", "<leader>fof", builtin.oldfiles, opts)
-- Frecency (Old files, but better)
local function run_frecency()
require("telescope").extensions.frecency.frecency({
workspace = "CWD",
})
end
opts.desc = "Show recent files (Frecency algorithm)"
vim.keymap.set("n", "<leader>fr", run_frecency, opts)
-- Quickfix Items
opts.desc = "Show quickfix items"
vim.keymap.set("n", "<leader>fq", ":Telescope quickfix<CR>", opts)
-- Spell Suggestions
opts.desc = "Show spell suggestions"
vim.keymap.set("n", "<leader>fs", ":Telescope spell_suggest<CR>", opts)
-- Diagnostics
opts.desc = "Show diagnostics"
vim.keymap.set("n", "<leader>fd", ":Telescope diagnostics<CR>", opts)
-- Notifications
opts.desc = "Show notifications"
vim.keymap.set("n", "<leader>fn", ":Telescope notify<CR>", opts)
-- Implementations
opts.desc = "Show implementations"
vim.keymap.set("n", "<leader>fi", ":Telescope lsp_implementations<CR>", opts)
-- quickfix
opts.desc = "Show quickfix list"
vim.keymap.set("n", "<leader>fq", ":Telescope quickfix<CR>", opts)
end,
}

View File

@@ -2,16 +2,17 @@ return {
-- literally the name, quick term toggle
"akinsho/toggleterm.nvim",
version = "*",
config = function()
require("toggleterm").setup({
insert_mappings = false,
terminal_mappings = false,
open_mapping = "<leader>t",
direction = "float",
float_opts = {
border = "curved",
},
})
vim.keymap.set("t", "<S-Esc>", [[<cmd>ToggleTerm<CR>]], {}) -- close terminal wih esc
end,
opts = {
insert_mappings = false,
terminal_mappings = false,
open_mapping = "<leader>t",
direction = "float",
float_opts = {
border = "curved",
},
},
keys = {
{ "<S-Esc>", "<CMD>ToggleTerm<CR>", desc = "Close Terminal", mode = "t" }, -- close terminal wih esc
{ "<leader>t", "<CMD>ToggleTerm<CR>", desc = "Open Terminal" }, -- close terminal wih esc
},
}

View File

@@ -1,7 +1,7 @@
return {
-- colorizes colors in code
"NvChad/nvim-colorizer.lua",
--cmd = 'ColorizerToggle',
event = "BufRead",
config = function()
require("colorizer").setup({
filetypes = { "*" },

View File

@@ -33,9 +33,10 @@ return {
magenta = Shade.new("#C02490", 0.30, -0.15),
pink = Shade.new("#ff82c2", 0.15, -0.15),
purple = Shade.new("#761464", 0.15, -0.15),
turquoise = Shade.new("#3fffb0", 0.15, -0.15),
cyan = Shade.new("#7ac9ff", 0.15, -0.15),
lightblue = Shade.new("#5c77ff", 0.15, -0.15),
softblue = Shade.new("#10ddff", 0.15, -0.15),
lightblue = Shade.new("#add8e6", 0.15, -0.15),
softblue = Shade.new("#10aaff", 0.15, -0.15),
brown = Shade.new("#664010", 0.15, -0.15),
bg0 = "#0f1512", -- Dark bg (status line and float)
@@ -60,9 +61,9 @@ return {
syntax = {
comment = "comment",
bracket = "darkyellow",
builtin0 = "softblue",
builtin1 = "brown",
builtin2 = "sel1",
builtin0 = "turquoise",
builtin1 = "cyan",
builtin2 = "lightblue",
conditional = "darkblue",
const = "gray",
dep = "darkred",
@@ -75,14 +76,14 @@ return {
preproc = "strongred",
regex = "purple",
statement = "magenta",
string = "cyan",
string = "softblue",
type = "red",
variable = "orange",
},
diag = {
error = "darkred",
warn = "yellow",
info = "lightblue",
info = "softblue",
hint = "fg3",
ok = "darkgreen",
},
@@ -96,13 +97,13 @@ return {
diff = {
add = "darkgreen",
delete = "darkred",
changed = "lightblue",
changed = "softblue",
text = "fg0",
},
git = {
add = "darkgreen",
removed = "darkred",
changed = "lightblue",
changed = "softblue",
conflict = "orange",
ignored = "gray",
},
@@ -115,20 +116,17 @@ return {
EndOfBuffer = { link = "WinSeparator" }, -- filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|.
CursorLine = { bg = "palette.bg1" },
CursorLineNr = { fg = "palette.cyan", style = "bold" }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line.
Search = { fg = "palette.lightblue", bg = "#00513b" }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out.
IncSearch = { fg = "palette.lightblue", bg = "#1a6b51" }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c"
Search = { fg = "palette.softblue", bg = "#00513b" }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out.
IncSearch = { fg = "palette.softblue", bg = "#1a6b51" }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c"
ModeMsg = { fg = "palette.fg3", style = "bold" }, -- 'showmode' message (e.g., "-- INSERT --")
NvimTreeRootFolder = { fg = "palette.lightblue", style = "bold" },
NvimTreeFolderName = { fg = "palette.lightblue" },
NvimTreeFolderIcon = { fg = "palette.lightblue" },
NvimTreeOpenedFolderName = { fg = "palette.lightblue" },
NvimTreeSymlinkFolderName = { fg = "palette.magenta" },
NvimTreeExecFile = { fg = "palette.red" },
NvimTreeImageFile = { fg = "palette.white" },
NvimTreeSpecialFile = { fg = "palette.yellow" },
NvimTreeSymlink = { fg = "palette.magenta" },
SnacksDashboardNormal = { fg = "palette.green" },
SnacksDashboardDesc = { fg = "palette.softblue" },
SnacksDashboardFile = { fg = "palette.softblue" },
SnacksDashboardIcon = { fg = "palette.orange" },
SnacksDashboardHeader = { fg = "palette.darkred" },
SnacksDashboardTitle = { fg = "palette.turquoise" },
SnacksIndentScope = { fg = "palette.lightblue" }
},
},
})

View File

@@ -41,21 +41,13 @@ return {
box_width = 50,
line_width = 70,
})
local opts = { silent = true }
opts.desc = "comment text box"
vim.keymap.set({ "n", "v" }, "<leader>cb", ":CBccbox<CR>", opts)
opts.desc = "comment text line"
vim.keymap.set({ "n", "v" }, "<leader>cl", ":CBllline<CR>", opts)
opts.desc = "comment line"
vim.keymap.set({ "n", "v" }, "<leader>ce", ":CBline<CR>", opts)
opts.desc = "comment highlight"
vim.keymap.set({ "n", "v" }, "<leader>ch", ":CBlcbox18<CR>", opts)
opts.desc = "delete comment box"
vim.keymap.set({ "n", "v" }, "<leader>cd", ":CBd<CR>", opts)
opts.desc = "yank comment box contents"
vim.keymap.set({ "n", "v" }, "<leader>cy", ":CBy<CR>", opts)
end,
keys = {
{ "<leader>cb", ":CBccbox<CR>", mode = { "n", "v" }, desc = "Comment text box" },
{ "<leader>cl", ":CBllline<CR>", mode = { "n", "v" }, desc = "Comment text line" },
{ "<leader>ce", ":CBline<CR>", mode = { "n", "v" }, desc = "Comment line" },
{ "<leader>ch", ":CBlcbox18<CR>", mode = { "n", "v" }, desc = "Comment highlight" },
{ "<leader>cd", ":CBd<CR>", mode = { "n", "v" }, desc = "Delete comment box" },
{ "<leader>cy", ":CBy<CR>", mode = { "n", "v" }, desc = "Yank comment box content" }
},
}

View File

@@ -2,7 +2,7 @@ return {
-- add comment keybinds
"numToStr/Comment.nvim",
opts = {},
lazy = false,
event = "BufRead",
config = function()
require("Comment").setup()
require("Comment.ft").set("hyprlang", "#%s")

View File

@@ -2,6 +2,7 @@ return {
-- status line
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
event = "BufRead",
config = function()
local function getWords()
local wc = vim.api.nvim_eval("wordcount()")

View File

@@ -1,9 +1,6 @@
return {
"folke/noice.nvim",
event = "VeryLazy",
opts = {
-- add any options here
},
dependencies = {
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
"MunifTanjim/nui.nvim",
@@ -11,9 +8,9 @@ return {
},
config = function()
require("notify").setup({
max_width = 80,
max_width = 60,
minimum_width = 30,
render = "wrapped-default", -- default, minimal, simple, compact, wrapped-compact or wrapped-default
render = "wrapped-compact", -- default, minimal, simple, compact, wrapped-compact or wrapped-default
stages = "slide", -- fade_in_slide_out, fade, slide, static
})
require("noice").setup({
@@ -24,6 +21,13 @@ return {
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp
},
progress = {
format = "lsp_progress",
format_done = "lsp_progress_done",
throttle = 1000 / 30,
view = "mini",
timeout = 2000
}
},
-- you can enable a preset for easier configuration
presets = {
@@ -33,6 +37,53 @@ return {
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
routes = {
{
filter = {
event = "msg_show",
kind = "bufwrite",
},
opts = { skip = true },
},
{
filter = {
event = "msg_show",
kind = "echo",
find = "VimTeX:",
},
opts = { skip = true },
},
{
filter = {
event = "msg_show",
kind = "echo",
find = "Compil",
},
view = "mini",
-- opts = {
-- format = { "VimTeX: {message}" },
-- timeout = 2000
-- },
},
{
filter = {
event = "msg_show",
kind = "",
find = "written"
},
opts = { skip = true },
},
{
view = "popup",
filter = {
event = "msg_show",
kind = "lua_print",
cmdline = "UsageTracker.*",
},
},
},
})
local opts = require("utils").opts
vim.keymap.set("n", "<leader><leader>h", "<CMD>Noice dismiss<CR>", opts("Dismiss notifications"))
end,
}

View File

@@ -1,77 +0,0 @@
return {
"startup-nvim/startup.nvim",
dependencies = {
"nvim-telescope/telescope.nvim",
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope-file-browser.nvim",
},
config = function()
require("startup").setup({
title = {
type = "text",
align = "center",
content = {
[[]],
[[]],
[[]],
[[ ]],
[[ ██████ █████ █████ █████ ███ ]],
[[ ░░██████ ░░███ ░░███ ░░███ ░░░ ]],
[[ ░███░███ ░███ ██████ ██████ ░███ ░███ ████ █████████████ ]],
[[ ░███░░███░███ ███░░███ ███░░███ ░███ ░███ ░░███ ░░███░░███░░███ ]],
[[ ░███ ░░██████ ░███████ ░███ ░███ ░░███ ███ ░███ ░███ ░███ ░███ ]],
[[ ░███ ░░█████ ░███░░░ ░███ ░███ ░░░█████░ ░███ ░███ ░███ ░███ ]],
[[ █████ ░░█████░░██████ ░░██████ ░░███ █████ █████░███ █████ ]],
[[ ░░░░░ ░░░░░ ░░░░░░ ░░░░░░ ░░░ ░░░░░ ░░░░░ ░░░ ░░░░░ ]],
[[ ]],
},
highlight = "String",
default_color = "#010155",
},
quotes = {
type = "text",
align = "center",
content = function()
local handle = io.popen("pwd")
if handle then
local cwd = handle:read("*l")
handle:close()
return { "Currently in " .. cwd }
else
return { "Error running command" }
end
end,
highlight = "String",
default_color = "#FFFFFF",
},
old = {
type = "oldfiles",
oldfiles_directory = true,
align = "center",
title = "Old files",
oldfiles_amount = 10,
highlight = "String",
default_color = "#FFFFFF",
content = "",
},
options = {
mapping_keys = false,
},
colors = {
background = "#000000",
folded_section = "#100000",
},
mappings = {
execute_command = "<C-r>",
open_file = "<CR>",
},
parts = { "title", "quotes", "old" },
})
end,
}

View File

@@ -1,6 +1,7 @@
return {
"folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
event = "BufRead",
opts = {
{
signs = true, -- show icons in the signs column
@@ -13,7 +14,7 @@ return {
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
-- signs = false, -- configure signs for some keywords individually
},
TODO = { icon = "", color = "info" },
TODO = { icon = "", color = "todo" },
HACK = { icon = "", color = "warning" },
WARN = { icon = "", color = "warning", alt = { "WARNING", "XXX" } },
PERF = { icon = "", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
@@ -46,7 +47,7 @@ return {
colors = {
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
info = { "DiagnosticInfo", "#2563EB" },
todo = { "DiagnosticInfo", "#2563EB" },
hint = { "DiagnosticHint", "#10B981" },
default = { "Identifier", "#7C3AED" },
test = { "Identifier", "#FF00FF" },

View File

@@ -17,6 +17,29 @@ dap.configurations.c = {
cwd = "${workspaceFolder}",
stopAtBeginningOfMainSubprogram = false,
},
{
name = "Launch (with args)",
type = "gdb",
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
args = function()
local arguments = vim.fn.input("Arguments: ")
if string.len(arguments) < 1 then
return {}
end
local table = { "--args" }
local index = 1
for arg in string.gmatch(arguments, "[^%s]+") do
table[index] = arg
index = index + 1
end
return table
end,
cwd = "${workspaceFolder}",
stopAtBeginningOfMainSubprogram = false,
},
{
name = "Select and attach to process",
type = "gdb",

View File

@@ -9,9 +9,36 @@ return {
"orjangj/neotest-ctest",
"rouge8/neotest-rust",
},
keys = {
-- Run nearest test
{ "<leader><leader>tr", '<cmd>lua require("neotest").run.run()<cr>', desc = "Run nearest test" },
-- Run all tests in the current file
{
"<leader><leader>tf",
'<cmd>lua require("neotest").run.run(vim.fn.expand("%"))<cr>',
desc = "Run all tests in current file",
},
-- Stop running tests
{ "<leader><leader>ts", '<cmd>lua require("neotest").run.stop()<cr>', desc = "Stop tests" },
{ "<leader><leader>ta", '<cmd>lua require("neotest").run.attach()<cr>', desc = "Attach to nearest test" },
{ "<leader><leader>tn", "<cmd>Neotest jump next<cr>", desc = "Jump to next test" },
{ "<leader><leader>tp", "<cmd>Neotest jump prev<cr>", desc = "Jump to previous test" },
-- Show test summary
{ "<leader><leader>tv", "<cmd>Neotest summary<cr>", desc = "Show neotest test summary" },
-- Toggle the Neotest panel
{ "<leader><leader>to", "<cmd>Neotest output<cr>", desc = "Show neotest output" },
{ "<leader><leader>tn", "<cmd>Neotest output-panel<cr>", desc = "Show neotest output as panel" },
},
config = function()
local neotest = require("neotest")
local keymap = vim.keymap.set
-- General setup for neotest
neotest.setup({
@@ -30,38 +57,5 @@ return {
})
-- Keybinding Setup
local opts = { noremap = true, silent = true }
-- Run nearest test
opts.desc = "Run nearest test"
keymap("n", "<leader><leader>tr", '<cmd>lua require("neotest").run.run()<cr>', opts)
-- Run all tests in the current file
opts.desc = "Run all tests in current file"
keymap("n", "<leader><leader>tf", '<cmd>lua require("neotest").run.run(vim.fn.expand("%"))<cr>', opts)
-- Stop running tests
opts.desc = "Stop tests"
keymap("n", "<leader><leader>ts", '<cmd>lua require("neotest").run.stop()<cr>', opts)
opts.desc = "Attach to nearest test"
keymap("n", "<leader><leader>ta", '<cmd>lua require("neotest").run.attach()<cr>', opts)
opts.desc = "Jump to next test"
keymap("n", "<leader><leader>tn", "<cmd>Neotest jump next<cr>", opts)
opts.desc = "Jump to previous test"
keymap("n", "<leader><leader>tp", "<cmd>Neotest jump prev<cr>", opts)
-- Show test summary
opts.desc = "Show neotest test summary"
keymap("n", "<leader><leader>tv", "<cmd>Neotest summary<cr>", opts)
-- Toggle the Neotest panel
opts.desc = "Show neotest output"
keymap("n", "<leader><leader>to", "<cmd>Neotest output<cr>", opts)
opts.desc = "Show neotest output as panel"
keymap("n", "<leader><leader>tn", "<cmd>Neotest output-panel<cr>", opts)
end,
}

View File

@@ -1,13 +1,12 @@
return {
"windwp/nvim-ts-autotag",
config = function()
require("nvim-ts-autotag").setup({
opts = {
-- Defaults
enable_close = true, -- Auto close tags
enable_rename = true, -- Auto rename pairs of tags
enable_close_on_slash = true, -- Auto close on trailing </
},
})
end,
event = "InsertEnter",
opts = {
opts = {
-- Defaults
enable_close = true, -- Auto close tags
enable_rename = true, -- Auto rename pairs of tags
enable_close_on_slash = true, -- Auto close on trailing </
},
}
}

View File

@@ -1,21 +1,16 @@
return {
"uga-rosa/ccc.nvim",
config = function()
local ccc = require("ccc")
vim.opt.termguicolors = true
ccc.setup({
highlighter = {
auto_enable = false,
lsp = true,
},
})
local keymap = vim.keymap
keymap.set(
"n",
opts = {
highlighter = {
auto_enable = false,
lsp = true,
},
},
keys = {
{
"<leader>cp",
"<cmd>CccPick<CR>",
{ noremap = true, silent = true, desc = "Toggle colour picker" }
)
end,
desc = "Toggle colour picker",
},
},
}

View File

@@ -1,4 +1,5 @@
return {
-- similar to sticky scroll in vscode
"nvim-treesitter/nvim-treesitter-context",
event = "BufRead"
}

View File

@@ -1,11 +1,10 @@
return {
-- Diffview
"sindrets/diffview.nvim",
config = function()
local opts = require('utils').opts
vim.keymap.set("n", "<leader><leader>gd", ":DiffviewOpen<CR>", opts("Start diffview"))
vim.keymap.set("n", "<leader><leader>gf", ":DiffviewFileHistory<CR>", opts("View file history"))
vim.keymap.set("n", "<leader><leader>gc", ":DiffviewClose<CR>", opts("Close diffview"))
vim.keymap.set("n", "<leader><leader>gr", ":DiffviewRefresh<CR>", opts("Refresh diffview"))
end
keys = {
{ "<leader><leader>gd", ":DiffviewOpen<CR>", desc = "Open diffview" },
{ "<leader><leader>gf", ":DiffviewFileHistory<CR>", desc = "View file history" },
{ "<leader><leader>gc", ":DiffviewClose<CR>", desc = "Close diffview" },
{ "<leader><leader>gr", ":DiffviewRefresh<CR>", desc = "Refresh diffview" },
},
}

View File

@@ -1,71 +0,0 @@
return {
"attilarepka/header.nvim",
config = function()
local header = require("header")
local augroup = vim.api.nvim_create_augroup
local autocmd = vim.api.nvim_create_autocmd
local opts = require("utils").opts
header.setup({
allow_autocmds = true,
file_name = true,
date_created = true,
date_created_fmt = "%Y-%m-%d %H:%M:%S",
date_modified = true,
date_modified_fmt = "%Y-%m-%d %H:%M:%S",
line_separator = "------",
use_block_header = false,
license_from_file = false,
author_from_git = true,
})
vim.keymap.set("n", "<leader><leader>h", function()
header.add_headers()
end, opts("Add headers to file"))
augroup("file-header", { clear = true })
autocmd("BufWritePre", {
pattern = "*",
callback = function()
local header = require("header")
if header and header.update_date_modified then
header.update_date_modified()
else
vim.notify_once("header.update_date_modified is not available", vim.log.levels.WARN)
end
end,
group = "file-header",
desc = "Update header's date modified",
})
autocmd({ "BufNewFile", "BufReadPost" }, {
pattern = "*",
callback = function()
local header = require("header")
if not header then
vim.notify_once(
"Could not automatically add header to new file: header module couldn't be found",
vim.log.levels.ERROR
)
return
end
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
local is_empty = #lines == 1 and lines[1] == ""
if header.config.allow_autocmds and is_empty then
local original_fmt = header.config.date_created_fmt
local now = os.date(header.config.date_created_fmt, os.time())
-- force add_headers to use the current datetime, otherwise it will show 1970-01-01
header.config.date_created_fmt = now
header.add_headers()
header.config.date_created_fmt = original_fmt -- restore the original format
end
end,
group = "file-header",
desc = "Add copyright header to new/empty files",
})
end,
}

View File

@@ -1,9 +0,0 @@
return {
-- indent lines
"lukas-reineke/indent-blankline.nvim",
opts = {},
main = "ibl",
config = function()
require("ibl").setup()
end,
}

View File

@@ -3,6 +3,9 @@ return {
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
ft = { "markdown" },
keys = {
{ "<leader><leader>m", ":MarkdownPreview<CR>", desc = "Preview Markdown document in browser" },
},
build = function(plugin)
if vim.fn.executable("npx") then
vim.cmd("!cd " .. plugin.dir .. " && cd app && npx --yes yarn install")

View File

@@ -1,22 +1,19 @@
local utils = require("utils")
return {
"fedepujol/move.nvim",
config = function()
local opts = require("utils").opts
require("move").setup({})
local keymap = vim.keymap
opts = {},
"fedepujol/move.nvim",
keys = {
{ "<A-S-k>", utils.run_vim_cmd("MoveLine(-1)"), desc = "Move line up" },
{ "<A-S-j>", utils.run_vim_cmd("MoveLine(1)"), desc = "Move line down" },
{ "<leader>mk", utils.run_vim_cmd("MoveLine(-1)"), desc = "Move line up" },
{ "<leader>mj", utils.run_vim_cmd("MoveLine(1)"), desc = "Move line down" },
-- Move lines up and down
keymap.set("n", "<A-S-k>", ":MoveLine(-1)<CR>", opts("Move line up"))
keymap.set("n", "<A-S-j>", ":MoveLine(1)<CR>", opts("Move line down"))
keymap.set("n", "<leader>mk", ":MoveLine(-1)<CR>", opts("Move line up"))
keymap.set("n", "<leader>mj", ":MoveLine(1)<CR>", opts("Move line down"))
-- Move blocks in visual mode
{ "<A-k>", utils.run_vim_cmd("MoveBlock(-1)"), desc = "Move line up" },
{ "<A-j>", utils.run_vim_cmd("MoveBlock(1)"), desc = "Move line down" },
-- Move blocks in visual mode
keymap.set("v", "<A-k>", ":MoveBlock(-1)<CR>", opts("Move line up"))
keymap.set("v", "<A-j>", ":MoveBlock(1)<CR>", opts("Move line down"))
-- Move lines in insert mode
keymap.set("i", "<A-k>", "<C-o>:MoveLine(-1)<CR>", opts("Move line up"))
keymap.set("i", "<A-j>", "<C-o>:MoveLine(1)<CR>", opts("Move line down"))
end,
-- Move lines in insert mode
{ "<A-k>", utils.run_vim_cmd("MoveLine(-1)"), desc = "Move line up" },
{ "<A-j>", utils.run_vim_cmd("MoveLine(1)"), desc = "Move line down" },
},
}

View File

@@ -1,17 +1,17 @@
local utils = require("utils")
return {
"smoka7/multicursors.nvim",
event = "VeryLazy",
dependencies = {
"nvimtools/hydra.nvim",
},
opts = {},
cmd = { "MCstart", "MCvisual", "MCclear", "MCpattern", "MCvisualPattern", "MCunderCursor" },
keys = {
{
mode = { "v", "n" },
"<leader><leader>c",
"<cmd>MCstart<cr>",
desc = "Create a selection for selected text or word under the cursor",
},
},
"smoka7/multicursors.nvim",
dependencies = {
"nvimtools/hydra.nvim",
},
opts = {},
cmd = { "MCstart", "MCvisual", "MCclear", "MCpattern", "MCvisualPattern", "MCunderCursor" },
keys = {
{
mode = { "v", "n" },
"<leader><leader>c",
utils.run_vim_cmd("MCstart(-1)"),
desc = "Create a selection for selected text or word under the cursor",
},
},
}

View File

@@ -1,19 +1,15 @@
return {
"danymat/neogen",
config = function()
local opts = { noremap = true, silent = true, desc = "Generate docs" }
vim.keymap.set("n", "<leader>gd", ":lua require('neogen').generate()<CR>", opts)
opts = {
snippet_engine = "luasnip",
},
keys = {
{ "<leader>gd", ":lua require('neogen').generate()<CR>", desc = "Autogenerate docs" },
opts.desc = "Generate function docs"
vim.keymap.set("n", "<leader>gg", ":lua require('neogen').generate( { type = 'func' } )<CR>", opts)
{ "<leader>gg", ":lua require('neogen').generate( { type = 'func' } )<CR>", desc = "Generate function docs" },
opts.desc = "Generate type docs"
vim.keymap.set("n", "<leader>gt", ":lua require('neogen').generate( { type = 'type' } )<CR>", opts)
{ "<leader>gt", ":lua require('neogen').generate( { type = 'type' } )<CR>", desc = "Generate type docs" },
opts.desc = "Generate class docs"
vim.keymap.set("n", "<leader>gc", ":lua require('neogen').generate( { type = 'class' } )<CR>", opts)
require("neogen").setup({
snippet_engine = "luasnip",
})
end,
{ "<leader>gc", ":lua require('neogen').generate( { type = 'class' } )<CR>", desc = "Generate class docs" },
},
}

View File

@@ -1,9 +1,6 @@
return {
"LintaoAmons/scratch.nvim",
event = "VeryLazy",
config = function()
local opts = require("utils").opts
vim.keymap.set("n", "<leader><leader>+", ":Scratch<CR>", opts("Open a scratchpad"))
end,
keys = {
{ "<leader><leader>+", ":Scratch<CR>", desc = "Open a scratchpad" }
}
}

View File

@@ -0,0 +1,108 @@
return {
"folke/snacks.nvim",
priority = 1000,
lazy = false,
---@type snacks.Config
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
animate = { enabled = true },
bigfile = { enabled = true },
bufdelete = { enabled = true },
dashboard = {
enabled = true,
sections = {
{ section = "header", hl = "SnacksDashboardHeader" },
{
pane = 2,
section = "terminal",
cmd = "colorscript -e square",
height = 5,
padding = 1,
},
{ section = "keys", hl = "SnacksDashboardPrimary", gap = 1, padding = 1 },
{
pane = 2,
icon = "",
title = "Recent Files (in project)",
section = "recent_files",
indent = 2,
limit = 5,
padding = 1,
cwd = true,
},
{
pane = 2,
icon = "",
title = "Projects",
section = "projects",
indent = 2,
padding = 1,
limit = 4,
},
{
pane = 2,
icon = "",
title = "Git Status",
section = "terminal",
enabled = function()
return Snacks.git.get_root() ~= nil
end,
cmd = "git status --short --branch --renames",
height = 5,
padding = 1,
ttl = 5 * 60,
indent = 3,
},
{ section = "startup" },
},
},
indent = {
enabled = true,
priority = 1,
char = "",
animate = {
enabled = false,
},
},
lazygit = { enabled = true },
picker = { enabled = true },
quickfile = { enabled = true },
statuscolumn = { enabled = true },
},
keys = {
{
"<leader><leader>gl",
function()
Snacks.lazygit()
end,
desc = "Open LazyGit",
mode = "n",
},
{
"<leader>fcs",
function()
Snacks.picker.highlights({ pattern = "hl_group:^Snacks" })
end,
desc = "Show Snacks highlights",
mode = "n",
},
{
"<leader>fca",
function()
Snacks.picker.highlights()
end,
desc = "Show highlight groups",
mode = "n",
},
{
"<C-x>",
function()
Snacks.bufdelete()
end,
desc = "Close buffer",
mode = "n",
},
},
}

View File

@@ -1,8 +1,6 @@
return {
"kylechui/nvim-surround",
version = "*",
event = "VeryLazy",
config = function()
require("nvim-surround").setup()
end,
event = "InsertEnter",
opts = {}
}

View File

@@ -1,6 +1,7 @@
return {
-- syntax highlighting
"nvim-treesitter/nvim-treesitter",
event = { "BufRead", "BufNewFile" },
build = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({

View File

@@ -1,13 +0,0 @@
return {
"gaborvecsei/usage-tracker.nvim",
config = function()
require("usage-tracker").setup({
keep_eventlog_days = 35,
cleanup_freq_days = 7,
event_wait_period_in_sec = 5,
inactivity_threshold_in_min = 2,
inactivity_check_freq_in_sec = 10,
verbose = 0,
})
end,
}

View File

@@ -1,14 +1,13 @@
return {
-- view buffer w/o distractions
"folke/zen-mode.nvim",
config = function()
require("zen-mode").setup({
window = {
width = 1,
height = 1,
},
})
vim.keymap.set("n", "<leader>z", ":ZenMode<CR>", { silent = true, desc = "open current buffer in zen mode" })
end,
opts = {
window = {
width = 1,
height = 1,
},
},
keys = {
{ "<leader>z", ":ZenMode<CR>", desc = "open current buffer in zen mode" },
},
}

View File

@@ -3,56 +3,62 @@
local M = {}
M.opts = function(desc)
if desc then
return { silent = true, desc = desc }
else
return { silent = true }
end
if desc then
return { noremap = true, silent = true, desc = desc }
else
return { noremap = true, silent = true }
end
end
M.run_vim_cmd = function(cmd)
return function()
vim.cmd(cmd)
end
end
M.sudo_exec = function(cmd, print_output)
vim.fn.inputsave()
local password = vim.fn.inputsecret("Password: ")
vim.fn.inputrestore()
if not password or #password == 0 then
print("Invalid password, sudo aborted")
return false
end
local out = vim.fn.system(string.format("sudo -p '' -S %s", cmd), password)
if vim.v.shell_error ~= 0 then
print("\r\n")
print(out)
return false
end
if print_output then
print("\r\n", out)
end
return true
vim.fn.inputsave()
local password = vim.fn.inputsecret("Password: ")
vim.fn.inputrestore()
if not password or #password == 0 then
print("Invalid password, sudo aborted")
return false
end
local out = vim.fn.system(string.format("sudo -p '' -S %s", cmd), password)
if vim.v.shell_error ~= 0 then
print("\r\n")
print(out)
return false
end
if print_output then
print("\r\n", out)
end
return true
end
M.sudo_write = function(tmpfile, filepath)
if not tmpfile then
tmpfile = vim.fn.tempname()
end
if not filepath then
filepath = vim.fn.expand("%")
end
if not filepath or #filepath == 0 then
print("E32: No file name")
return
end
-- `bs=1048576` is equivalent to `bs=1M` for GNU dd or `bs=1m` for BSD dd
-- Both `bs=1M` and `bs=1m` are non-POSIX
local cmd = string.format("dd if=%s of=%s bs=1048576", vim.fn.shellescape(tmpfile), vim.fn.shellescape(filepath))
-- no need to check error as this fails the entire function
vim.api.nvim_exec(string.format("write! %s", tmpfile), true)
if M.sudo_exec(cmd) then
-- refreshes the buffer and prints the "written" message
vim.cmd.checktime()
-- exit command mode
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Esc>", true, false, true), "n", true)
end
vim.fn.delete(tmpfile)
if not tmpfile then
tmpfile = vim.fn.tempname()
end
if not filepath then
filepath = vim.fn.expand("%")
end
if not filepath or #filepath == 0 then
print("E32: No file name")
return
end
-- `bs=1048576` is equivalent to `bs=1M` for GNU dd or `bs=1m` for BSD dd
-- Both `bs=1M` and `bs=1m` are non-POSIX
local cmd = string.format("dd if=%s of=%s bs=1048576", vim.fn.shellescape(tmpfile), vim.fn.shellescape(filepath))
-- no need to check error as this fails the entire function
vim.api.nvim_exec(string.format("write! %s", tmpfile), true)
if M.sudo_exec(cmd) then
-- refreshes the buffer and prints the "written" message
vim.cmd.checktime()
-- exit command mode
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Esc>", true, false, true), "n", true)
end
vim.fn.delete(tmpfile)
end
return M

View File

@@ -3,9 +3,7 @@
"prefix": "latex-prepare",
"body": [
"\\documentclass{article}\n",
"\\newcommand{\\dir}{~/projects/latex} % IMPORTANT: No trailing slashes!",
"\\input{\\dir/include.tex}",
"\\load{recommended}\n",
"\\input{~/projects/latex/dist/recommended.tex}\n",
"\\setup{$1}\n",
"\\begin{document}",
"\\startDocument",
@@ -396,8 +394,8 @@
"\\underbar{$1}"
]
},
"algebra": {
"prefix": "algebra",
"angles": {
"prefix": "angles",
"body": [
"\\langle $1 \\rangle"
]
@@ -430,9 +428,7 @@
"prefix": "latex-letter",
"body": [
"\\documentclass[12pt,a4paper]{scrlttr2}\n",
"\\newcommand{\\dir}{~/projects/latex} % IMPORTANT: No trailing slashes!",
"\\input{\\dir/include.tex}",
"\\load{letter}\n",
"\\input{~/projects/latex/dist/letter.tex}\n",
"% Subject",
"\\setkomavar{subject}{$1}",
"\\begin{document}\\raggedright",

View File

@@ -4,3 +4,8 @@ Simpson
Lagrange
Quadraturgewichte
Interpolationspolynom
aufzählbare
aufzählbar
Konvergenzordnung
Konvergenzrate
Konvergenzkurve

Binary file not shown.