feat(nvim): add autocmd to create a new dir when saving a file inside (removed mkdir.nvim extra)

This commit is contained in:
sankalp committed 2024-02-10 14:42:51 +05:45
1 parent bff8305e3f
commit ff77cde1c7
7 files changed
+103 -54

No files matched your search

+8 -8
View File
@@ -1,7 +1,7 @@
{
"LazyVim": { "branch": "main", "commit": "c433ea7aa842c446edc2b1570998bf5440c68188" },
"LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" },
"SchemaStore.nvim": { "branch": "main", "commit": "d30f650b1b1b3b059328230a7ed8edccf6aaa522" },
"SchemaStore.nvim": { "branch": "main", "commit": "43963b27883a9705dc5f33749ca7acf237520598" },
"actions-preview.nvim": { "branch": "master", "commit": "9e86d014a72a4121ee27f3d8952e1ea868c3c8c4" },
"animation.nvim": { "branch": "main", "commit": "fb77091ab72ec9971aee0562e7081182527aaa6a" },
"autolist.nvim": { "branch": "main", "commit": "5f70a5f99e96c8fe3069de042abd2a8ed2deb855" },
@@ -18,7 +18,7 @@
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"codeium.vim": { "branch": "main", "commit": "fd440cd718742daab162241c5bd5857cd92f5f72" },
"comment-box.nvim": { "branch": "main", "commit": "06bb771690bc9df0763d14769b779062d8f12bc5" },
"compiler.nvim": { "branch": "main", "commit": "fbdb0e9b39987d2fe99cf1b0fcf31303304edbad" },
"compiler.nvim": { "branch": "main", "commit": "c1d92304fdf478342668b991739ffab46b219d7c" },
"conform.nvim": { "branch": "master", "commit": "c0e0e80f0c233cb3a249f719a44324c660163a3f" },
"crates.nvim": { "branch": "main", "commit": "ec2b04a380c9f3a8e6ca38c230e4990d71978143" },
"dashboard-nvim": { "branch": "master", "commit": "04a48b2e230bc5e50dd099d839443703023b0472" },
@@ -35,7 +35,7 @@
"git-worktree.nvim": { "branch": "master", "commit": "f247308e68dab9f1133759b05d944569ad054546" },
"gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" },
"glance.nvim": { "branch": "master", "commit": "8ed5cf3b3b1231ea696d88c9efd977027429d869" },
"go.nvim": { "branch": "master", "commit": "b111775c494105045803f65c66029012ffeb4d9a" },
"go.nvim": { "branch": "master", "commit": "9ccb57766e44458c233a1e4975f78a9340a4ce4b" },
"guihua.lua": { "branch": "master", "commit": "9fb6795474918b492d9ab01b1ebaf85e8bf6fe0b" },
"harpoon": { "branch": "harpoon2", "commit": "a38be6e0dd4c6db66997deab71fc4453ace97f9c" },
"headlines.nvim": { "branch": "master", "commit": "d39c4e6ed8963717bc9b2dc39fada8fe1039e9bf" },
@@ -64,7 +64,7 @@
"multicursors.nvim": { "branch": "main", "commit": "8e876fe9db46c1b76c151202b418df21eca07bad" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "e578fe7a5832421b0d2c5b3c0a7a1e40e0f6a47a" },
"neoconf.nvim": { "branch": "main", "commit": "660ebf093c63271c546d6c9994d48a17f5beac81" },
"neodev.nvim": { "branch": "main", "commit": "a3626efdeca068de703cf984e0e2849412dbbfe4" },
"neodev.nvim": { "branch": "main", "commit": "b49b976cf2c28cd8283e9d74cb10885f6dd9e3d0" },
"neogen": { "branch": "main", "commit": "70127baaff25611deaf1a29d801fc054ad9d2dc1" },
"neotest": { "branch": "master", "commit": "89a5b1fc22ee5d459262955fe564c3d14e35fd67" },
"neotest-bash": { "branch": "main", "commit": "2eaad2ae4577fadf4af1eec32ec169d0fb2698bb" },
@@ -97,7 +97,7 @@
"nvim-regexplainer": { "branch": "main", "commit": "78fff711edcb986a05a03253c28a90e32c4ce31f" },
"nvim-scissors": { "branch": "main", "commit": "8e892591583f775f272d826295f959867ae0aa6c" },
"nvim-spectre": { "branch": "master", "commit": "6a0785ef64c839d935a2f92e20988e962fb6537e" },
"nvim-treesitter": { "branch": "master", "commit": "76700e147bfab7630e6b97f91b32397175e8153f" },
"nvim-treesitter": { "branch": "master", "commit": "841dde702ce2e58ffc3724808f3dbea2edee57d5" },
"nvim-treesitter-context": { "branch": "master", "commit": "9c06b115abc57c99cf0aa81dc29490f5001f57a1" },
"nvim-treesitter-endwise": { "branch": "master", "commit": "4c344ffc8d54d7e1ba2cefaaa2c10ea93aa1cc2d" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "dd0b2036c3a27cb6e6486f8bd24188c6ca43af0b" },
@@ -105,9 +105,9 @@
"nvim-ts-context-commentstring": { "branch": "main", "commit": "7ab799a9792f7cf3883cf28c6a00ad431f3d382a" },
"nvim-ufo": { "branch": "main", "commit": "b0741a647efd98d9abb6cb653e056d24a07e4581" },
"nvim-various-textobjs": { "branch": "main", "commit": "035243ea3c4bf005b24d8068666c7d571c708503" },
"nvim-web-devicons": { "branch": "master", "commit": "313d9e7193354c5de7cdb1724f9e2d3f442780b0" },
"nvim-web-devicons": { "branch": "master", "commit": "55e956f14ec21115d21188e990dfa15c813f2511" },
"nvim_context_vt": { "branch": "master", "commit": "8f7b6b46292e0819290b0d368abc3366b8a163fc" },
"octo.nvim": { "branch": "master", "commit": "841c2495ec404131815e75da1bcf3a4f5bfe68fd" },
"octo.nvim": { "branch": "master", "commit": "0d0abffed42b0e77aff286279fb7c958f1f79ce6" },
"oil.nvim": { "branch": "master", "commit": "bf753c3e3f8736939ad5597f92329dfe7b1df4f5" },
"openingh.nvim": { "branch": "main", "commit": "52e2727cbd7b52cdc7a5bb52c77c07a329db6cba" },
"outline.nvim": { "branch": "main", "commit": "a8d40aecb799196303ff3521c0e31c87bba57198" },
@@ -149,7 +149,7 @@
"tree-sitter-hyprlang": { "branch": "master", "commit": "e60fc858e6327a15c0b26f99ec96945fecd1e4ee" },
"trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },
"ts-node-action": { "branch": "master", "commit": "e37eb458378de5d994df459a53711b2546abef0f" },
"tsc.nvim": { "branch": "main", "commit": "a8f26d3d6a0faf533afb840816a6d9ac6a1fcbea" },
"tsc.nvim": { "branch": "main", "commit": "4151f82edcafad61201a779908dbc76edc64f494" },
"tw-values.nvim": { "branch": "main", "commit": "3808621a53f6ac9c151b77d9df61b29991c12921" },
"twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" },
"urlview.nvim": { "branch": "main", "commit": "7d622e11adbc2cac5bba62345ade9b6672d564a4" },
+2 -1
View File
@@ -106,4 +106,5 @@
"NEWS.md": "2123"
},
"version": 2
}
}
+12
View File
@@ -128,3 +128,15 @@ au({ "BufLeave", "FocusLost", "InsertEnter", "CmdlineEnter", "WinLeave" }, {
end
end,
})
-- Create a dir when saving a file if it doesnt exist
au("BufWritePre", {
group = ag("auto_create_dir", { clear = true }),
callback = function(args)
if args.match:match("^%w%w+://") then
return
end
local file = vim.loop.fs_realpath(args.match) or args.match
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
end,
})
@@ -8,6 +8,17 @@ return {
opts = function(_, opts)
local actions = require("diffview.actions")
opts.enhanced_diff_hl = true
opts.view = {
default = { winbar_info = true },
file_history = { winbar_info = true },
}
opts.hooks = {
diff_buf_read = function(bufnr)
vim.b[bufnr].view_activated = false
end,
}
opts.keymaps = {
--stylua: ignore
view = {
@@ -1,5 +1,42 @@
return {
{ import = "lazyvim.plugins.extras.lang.omnisharp" },
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "netcoredbg" })
end,
},
{
"mfussenegger/nvim-dap",
optional = true,
opts = function()
local dap = require("dap")
if not dap.adapters["netcoredbg"] then
require("dap").adapters["netcoredbg"] = {
type = "executable",
command = vim.fn.exepath("netcoredbg"),
args = { "--interpreter=vscode" },
}
end
for _, lang in ipairs({ "cs", "fsharp", "vb" }) do
if not dap.configurations[lang] then
dap.configurations[lang] = {
{
type = "netcoredbg",
name = "Launch file",
request = "launch",
---@diagnostic disable-next-line: redundant-parameter
program = function()
return vim.fn.input("Path to dll: ", vim.fn.getcwd() .. "/", "file")
end,
cwd = "${workspaceFolder}",
},
}
end
end
end,
},
{
"nvim-neotest/neotest",
optiona = true,
+33 -41
View File
@@ -1,46 +1,38 @@
return {
{
"edluffy/hologram.nvim", -- TODO: Need to investigate this
enabled = false,
opts = {
auto_display = true, -- WIP automatic markdown image display, may be prone to breaking
},
},
{
"3rd/image.nvim",
event = "LazyFile",
init = function()
package.path = package.path .. ";" .. vim.fn.expand("$HOME") .. "/.luarocks/share/lua/5.1/?/init.lua;"
package.path = package.path .. ";" .. vim.fn.expand("$HOME") .. "/.luarocks/share/lua/5.1/?.lua;"
end,
dependencies = { "nvim-treesitter/nvim-treesitter" },
opts = {
backend = "kitty",
integrations = {
markdown = {
enabled = true,
clear_in_insert_mode = false,
download_remote_images = true,
only_render_image_at_cursor = true,
filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here
},
neorg = {
enabled = true,
clear_in_insert_mode = false,
download_remote_images = true,
only_render_image_at_cursor = true,
filetypes = { "norg" },
},
"3rd/image.nvim",
event = "LazyFile",
init = function()
package.path = package.path .. ";" .. vim.fn.expand("$HOME") .. "/.luarocks/share/lua/5.1/?/init.lua;"
package.path = package.path .. ";" .. vim.fn.expand("$HOME") .. "/.luarocks/share/lua/5.1/?.lua;"
end,
dependencies = { "nvim-treesitter/nvim-treesitter" },
opts = {
backend = "kitty",
integrations = {
markdown = {
enabled = true,
clear_in_insert_mode = false,
download_remote_images = true,
only_render_image_at_cursor = false,
filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here
},
neorg = {
enabled = true,
clear_in_insert_mode = false,
download_remote_images = true,
only_render_image_at_cursor = false,
filetypes = { "norg" },
},
max_width = nil,
max_height = nil,
max_width_window_percentage = nil,
max_height_window_percentage = 50,
window_overlap_clear_enabled = true, -- toggles images when windows are overlapped
window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "" },
editor_only_render_when_focused = true, -- auto show/hide images when the editor gains/looses focus
tmux_show_only_in_active_window = true, -- auto show/hide images in the correct Tmux window (needs visual-activity off)
hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp" }, -- render image files as images when opened
},
max_width = nil,
max_height = nil,
max_width_window_percentage = nil,
max_height_window_percentage = 50,
kitty_method = "normal",
window_overlap_clear_enabled = true, -- toggles images when windows are overlapped
window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "" },
editor_only_render_when_focused = false, -- auto show/hide images when the editor gains/looses focus
tmux_show_only_in_active_window = true, -- auto show/hide images in the correct Tmux window (needs visual-activity off)
hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp" }, -- render image files as images when opened
},
}
@@ -1,4 +0,0 @@
return {
"jghauser/mkdir.nvim",
event = "VeryLazy",
}