mirror of
https://github.com/ksyasuda/dotfiles.git
synced 2025-12-05 02:53:38 -08:00
update nvim config
This commit is contained in:
@@ -160,7 +160,7 @@ local lsp_mappings = {
|
||||
{ mode = "n", key = "<leader>ch", cmd = ":lua vim.lsp.buf.signature_help()<CR>", group = "Signature Help" },
|
||||
{ mode = "n", key = "<leader>cR", cmd = ":lua vim.lsp.buf.rename()<CR>", group = "Rename" },
|
||||
{ mode = "n", key = "<leader>cr", cmd = ":Telescope lsp_references<CR>", group = "LSP References" },
|
||||
{ mode = "n", key = "<leader>cs", cmd = ":Telescope lsp_document_symbols<CR>", group = "LsP Document Symbols" },
|
||||
{ mode = "n", key = "<leader>cs", cmd = ":Telescope lsp_document_symbols<CR>", group = "LSP Document Symbols" },
|
||||
{ mode = "n", key = "<leader>ct", cmd = ":Telescope lsp_type_definitions<CR>", group = "LSP Definitions" },
|
||||
{
|
||||
mode = "n",
|
||||
@@ -465,32 +465,28 @@ local diffview_mappings = {
|
||||
|
||||
--{{{ Custom Terminals
|
||||
local programs_map = {
|
||||
gg = { cmd = "lazygit", display_name = "lazygit", direction = "tab", hidden = true, group = "Lazygit" },
|
||||
op = { cmd = "ipython", display_name = "ipython", direction = "vertical", hidden = true, group = "Ipython" },
|
||||
gg = { cmd = "lazygit", display_name = "lazygit", direction = "tab", hidden = true },
|
||||
op = { cmd = "ipython", display_name = "ipython", direction = "vertical", hidden = true },
|
||||
oP = {
|
||||
cmd = "ipython",
|
||||
display_name = "ipython-full",
|
||||
direction = "tab",
|
||||
hidden = true,
|
||||
group = "Ipython Fullscreen",
|
||||
},
|
||||
oi = { cmd = "sudo iotop", display_name = "ncmpcpp", direction = "tab", hidden = true, group = "Ncmpcpp" },
|
||||
on = { cmd = "ncmpcpp", display_name = "ncmpcpp", direction = "tab", hidden = true, group = "Ncmpcpp" },
|
||||
oN = { cmd = "nvtop", display_name = "nvtop", direction = "tab", hidden = true, group = "Nvtop" },
|
||||
ob = { cmd = "/usr/bin/btop", display_name = "btop", direction = "tab", hidden = true, group = "Btop" },
|
||||
od = { cmd = "lazydocker", display_name = "lazydocker", direction = "tab", hidden = true, group = "Lazydocker" },
|
||||
oi = { cmd = "sudo iotop", display_name = "iotop", direction = "tab", hidden = true },
|
||||
on = { cmd = "rmpc", display_name = "rmpc", direction = "tab", hidden = true },
|
||||
oN = { cmd = "nvtop", display_name = "nvtop", direction = "tab", hidden = true },
|
||||
ob = { cmd = "/usr/bin/btop", display_name = "btop", direction = "tab", hidden = true },
|
||||
od = { cmd = "lazydocker", display_name = "lazydocker", direction = "tab", hidden = true },
|
||||
}
|
||||
|
||||
for key, value in pairs(programs_map) do
|
||||
map("n", "<leader>" .. key, function()
|
||||
term_toggle(term_factory(value))
|
||||
end, opts)
|
||||
end
|
||||
|
||||
local temp
|
||||
local tbl = {}
|
||||
for key, value in pairs(programs_map) do
|
||||
local temp = {
|
||||
cmd = value.cmd,
|
||||
temp = {
|
||||
cmd = function()
|
||||
term_toggle(term_factory(value))
|
||||
end,
|
||||
key = "<leader>" .. key,
|
||||
group = value.group,
|
||||
mode = "n",
|
||||
@@ -509,6 +505,25 @@ end
|
||||
vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()")
|
||||
--}}}
|
||||
|
||||
-- {{{ NVIM-IMAGE
|
||||
local image_mappings = {
|
||||
{
|
||||
|
||||
mode = "n",
|
||||
key = "<leader>id",
|
||||
cmd = ":lua require('image').disable()<CR>",
|
||||
desc = "Disable image rendering",
|
||||
},
|
||||
{
|
||||
|
||||
mode = "n",
|
||||
key = "<leader>ie",
|
||||
cmd = ":lua require('image').enable()<CR>",
|
||||
desc = "Enable image rendering",
|
||||
},
|
||||
}
|
||||
-- }}}
|
||||
|
||||
--{{{ Groups
|
||||
add_to_whichkey(nil, { key = "<leader>a", group = "AnyJump" })
|
||||
add_to_whichkey(nil, { key = "<leader>b", group = "Buffers" })
|
||||
@@ -519,16 +534,11 @@ add_to_whichkey(nil, { key = "<leader>d", group = "ODIS" })
|
||||
add_to_whichkey(nil, { key = "<leader>f", group = "Find" })
|
||||
add_to_whichkey(nil, { key = "<leader>g", group = "Git" })
|
||||
add_to_whichkey(nil, { key = "<leader>gd", group = "DiffView" })
|
||||
add_to_whichkey(nil, { key = "<leader>gg", group = "Lazygit" })
|
||||
add_to_whichkey(nil, { key = "<leader>h", group = "Help" })
|
||||
add_to_whichkey(nil, { key = "<leader>i", group = "Image" })
|
||||
add_to_whichkey(nil, { key = "<leader>j", group = "AnyJump" })
|
||||
add_to_whichkey(nil, { key = "<leader>N", group = "Noice" })
|
||||
-- add_to_whichkey(nil, { key = "<leader>o", group = "Open" })
|
||||
add_to_whichkey(nil, { key = "<leader>ob", group = "Btop" })
|
||||
add_to_whichkey(nil, { key = "<leader>on", group = "Ncmpcpp" })
|
||||
add_to_whichkey(nil, { key = "<leader>od", group = "Lazydocker" })
|
||||
add_to_whichkey(nil, { key = "<leader>op", group = "Ipython" })
|
||||
add_to_whichkey(nil, { key = "<leader>oP", group = "Ipython Full" })
|
||||
add_to_whichkey(nil, { key = "<leader>p", group = "Paste in Place" })
|
||||
add_to_whichkey(nil, { key = "<leader>s", group = "Search" })
|
||||
add_to_whichkey(nil, { key = "<leader>t", group = "Terminal" })
|
||||
@@ -540,18 +550,25 @@ add_to_whichkey(nil, { key = "<leader>0", group = "Horizontal Terminal" })
|
||||
--}}}
|
||||
|
||||
--{{{ Whichkey Mappings
|
||||
add_to_whichkey(map_from_table(basic_mappings))
|
||||
add_to_whichkey(map_from_table(buffer_navigation_mappings))
|
||||
add_to_whichkey(map_from_table(terminal_mappings))
|
||||
add_to_whichkey(map_from_table(lsp_mappings))
|
||||
add_to_whichkey(map_from_table(code_companion_mappings))
|
||||
add_to_whichkey(map_from_table(telescope_mappings))
|
||||
add_to_whichkey(map_from_table(file_explorer_mappings))
|
||||
add_to_whichkey(map_from_table(misc_utilities_mappings))
|
||||
add_to_whichkey(map_from_table(goto_preview_mappings))
|
||||
add_to_whichkey(map_from_table(workspace_management_mappings))
|
||||
add_to_whichkey(map_from_table(noice_mappings))
|
||||
add_to_whichkey(map_from_table(odis_mappings))
|
||||
add_to_whichkey(map_from_table(diffview_mappings))
|
||||
local mappings_tables = {
|
||||
basic_mappings,
|
||||
buffer_navigation_mappings,
|
||||
terminal_mappings,
|
||||
lsp_mappings,
|
||||
code_companion_mappings,
|
||||
telescope_mappings,
|
||||
file_explorer_mappings,
|
||||
misc_utilities_mappings,
|
||||
goto_preview_mappings,
|
||||
workspace_management_mappings,
|
||||
noice_mappings,
|
||||
odis_mappings,
|
||||
diffview_mappings,
|
||||
image_mappings,
|
||||
}
|
||||
|
||||
for _, mapping in ipairs(mappings_tables) do
|
||||
add_to_whichkey(map_from_table(mapping))
|
||||
end
|
||||
add_to_whichkey(nil, { key = "<leader>dc", group = "Close" })
|
||||
--}}}
|
||||
|
||||
@@ -7,7 +7,7 @@ return {
|
||||
integrations = {
|
||||
markdown = {
|
||||
enabled = true,
|
||||
clear_in_insert_mode = false,
|
||||
clear_in_insert_mode = true,
|
||||
download_remote_images = true,
|
||||
only_render_image_at_cursor = false,
|
||||
floating_windows = false, -- if true, images will be rendered in floating markdown windows
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
vim.notify = require("notify")
|
||||
return {
|
||||
"epwalsh/obsidian.nvim",
|
||||
version = "*", -- recommended, use latest release instead of latest commit
|
||||
lazy = true,
|
||||
ft = "markdown",
|
||||
-- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
|
||||
-- event = {
|
||||
-- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
|
||||
-- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md"
|
||||
-- -- refer to `:h file-pattern` for more examples
|
||||
-- "BufReadPre path/to/my-vault/*.md",
|
||||
-- "BufNewFile path/to/my-vault/*.md",
|
||||
-- },
|
||||
dependencies = {
|
||||
-- Required.
|
||||
"nvim-lua/plenary.nvim",
|
||||
|
||||
-- see below for full list of optional dependencies 👇
|
||||
},
|
||||
opts = {
|
||||
workspaces = {
|
||||
{
|
||||
name = "vault",
|
||||
path = "~/S/obsidian/Vault",
|
||||
},
|
||||
-- {
|
||||
-- name = "work",
|
||||
-- path = "~/vaults/work",
|
||||
-- },
|
||||
},
|
||||
completion = {
|
||||
-- Set to false to disable completion.
|
||||
nvim_cmp = true,
|
||||
-- Trigger completion at 2 chars.
|
||||
min_chars = 2,
|
||||
},
|
||||
-- Optional, configure additional syntax highlighting / extmarks.
|
||||
-- This requires you have `conceallevel` set to 1 or 2. See `:help conceallevel` for more details.
|
||||
ui = {
|
||||
enable = true, -- set to false to disable all additional syntax features
|
||||
update_debounce = 200, -- update delay after a text change (in milliseconds)
|
||||
max_file_length = 5000, -- disable UI features for files with more than this many lines
|
||||
-- Define how various check-boxes are displayed
|
||||
checkboxes = {
|
||||
-- NOTE: the 'char' value has to be a single character, and the highlight groups are defined below.
|
||||
[" "] = { char = "", hl_group = "ObsidianTodo" },
|
||||
["x"] = { char = "", hl_group = "ObsidianDone" },
|
||||
[">"] = { char = "", hl_group = "ObsidianRightArrow" },
|
||||
["~"] = { char = "", hl_group = "ObsidianTilde" },
|
||||
["!"] = { char = "", hl_group = "ObsidianImportant" },
|
||||
-- Replace the above with this if you don't have a patched font:
|
||||
-- [" "] = { char = "☐", hl_group = "ObsidianTodo" },
|
||||
-- ["x"] = { char = "✔", hl_group = "ObsidianDone" },
|
||||
|
||||
-- You can also add more custom ones...
|
||||
},
|
||||
},
|
||||
attachments = {
|
||||
-- The default folder to place images in via `:ObsidianPasteImg`.
|
||||
-- If this is a relative path it will be interpreted as relative to the vault root.
|
||||
-- You can always override this per image by passing a full path to the command instead of just a filename.
|
||||
img_folder = "screenshots", -- This is the default
|
||||
|
||||
-- Optional, customize the default name or prefix when pasting images via `:ObsidianPasteImg`.
|
||||
---@return string
|
||||
img_name_func = function()
|
||||
-- Prefix image names with timestamp.
|
||||
return string.format("%s-", os.time())
|
||||
end,
|
||||
|
||||
-- A function that determines the text to insert in the note when pasting an image.
|
||||
-- It takes two arguments, the `obsidian.Client` and an `obsidian.Path` to the image file.
|
||||
-- This is the default implementation.
|
||||
---@param client obsidian.Client
|
||||
---@param path obsidian.Path the absolute path to the image file
|
||||
---@return string
|
||||
img_text_func = function(client, path)
|
||||
path = client:vault_relative_path(path) or path
|
||||
return string.format("", path.name, path)
|
||||
end,
|
||||
},
|
||||
-- Optional, by default when you use `:ObsidianFollowLink` on a link to an external
|
||||
-- URL it will be ignored but you can customize this behavior here.
|
||||
---@param url string
|
||||
follow_url_func = function(url)
|
||||
-- Open the URL in the default web browser.
|
||||
vim.fn.jobstart({ "open", url }) -- Mac OS
|
||||
-- vim.fn.jobstart({"xdg-open", url}) -- linux
|
||||
-- vim.cmd(':silent exec "!start ' .. url .. '"') -- Windows
|
||||
-- vim.ui.open(url) -- need Neovim 0.10.0+
|
||||
end,
|
||||
-- Optional, by default when you use `:ObsidianFollowLink` on a link to an image
|
||||
-- file it will be ignored but you can customize this behavior here.
|
||||
---@param img string
|
||||
follow_img_func = function(url)
|
||||
-- vim.fn.jobstart({ "qlmanage", "-p", img }) -- Mac OS quick look preview
|
||||
vim.fn.jobstart({ "xdg-open", url }) -- linux
|
||||
-- vim.cmd(':silent exec "!start ' .. url .. '"') -- Windows
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
return {
|
||||
url = "https://gitea.suda.codes/sudacode/odis",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"neovim/nvim-lspconfig",
|
||||
},
|
||||
opts = {
|
||||
opts = {
|
||||
display = {
|
||||
default_mode = "vsplit",
|
||||
picker = true,
|
||||
float = {
|
||||
maxwidth = 80,
|
||||
maxheight = 40,
|
||||
border = "rounded",
|
||||
title = true,
|
||||
style = "minimal",
|
||||
auto_focus = true,
|
||||
anchor = "bottom_right",
|
||||
offset = { row = -2, col = -2 },
|
||||
},
|
||||
window = {
|
||||
width = 0.4,
|
||||
height = 0.25,
|
||||
position = "bottom|right",
|
||||
floating = false,
|
||||
border = "none",
|
||||
},
|
||||
},
|
||||
integrations = {
|
||||
treesitter = {
|
||||
enabled = true, -- Enable Treesitter integration
|
||||
highlight = true, -- Enable syntax highlighting
|
||||
langs = { -- Language mapping for different doc types
|
||||
lsp = "markdown",
|
||||
man = "man",
|
||||
help = "vimdoc",
|
||||
},
|
||||
},
|
||||
},
|
||||
sources = {
|
||||
lsp = { enabled = true },
|
||||
vim = { enabled = true },
|
||||
man = { enabled = true },
|
||||
},
|
||||
priority = { "LSP", "Vim", "Man" },
|
||||
mappings = {
|
||||
close = "<leader>dc",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user