mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 16:53:00 +00:00
minor refractor
This commit is contained in:
parent
679f5bea9d
commit
1b99070718
22 changed files with 248 additions and 298 deletions
|
|
@ -3,12 +3,14 @@ return {
|
|||
"rmagatti/auto-session",
|
||||
event = "BufReadPre",
|
||||
cmd = {
|
||||
"SessionSearch",
|
||||
"SessionSave",
|
||||
"AutoSession",
|
||||
},
|
||||
opts = {
|
||||
suppressed_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>ps", "<Cmd>AutoSession search<CR>", desc = "List all sessions" },
|
||||
},
|
||||
},
|
||||
-- { import = "plugins.mod.nvim-tree" },
|
||||
-- { import = "plugins.mod.telescope" },
|
||||
|
|
@ -35,5 +37,5 @@ return {
|
|||
-- "Neogit",
|
||||
-- },
|
||||
-- },
|
||||
{ import = "plugins.mod.neo-tree" }
|
||||
{ import = "plugins.mod.neo-tree" },
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
local uuid = function()
|
||||
local template = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
|
||||
return string.gsub(template, '[xy]', function(c)
|
||||
local v = (c == 'x') and math.random(0, 0xf) or math.random(8, 0xb)
|
||||
return string.format('%x', v)
|
||||
local template = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
|
||||
return string.gsub(template, "[xy]", function(c)
|
||||
local v = (c == "x") and math.random(0, 0xf) or math.random(8, 0xb)
|
||||
return string.format("%x", v)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
return {
|
||||
"obsidian-nvim/obsidian.nvim",
|
||||
version = "*", -- recommended, use latest release instead of latest commit
|
||||
|
|
@ -83,45 +82,47 @@ return {
|
|||
yesterday = function()
|
||||
return os.date("%Y-%m-%d", os.time() - 86400)
|
||||
end,
|
||||
uuid = uuid()
|
||||
uuid = uuid(),
|
||||
},
|
||||
},
|
||||
---@return table
|
||||
note_frontmatter_func = function(note)
|
||||
-- Add the title of the note as an alias.
|
||||
if note.title then
|
||||
note:add_alias(note.title)
|
||||
end
|
||||
|
||||
-- Force to use UUID as the note id.
|
||||
local note_id
|
||||
if note.metadata then
|
||||
note_id = note.id
|
||||
else
|
||||
note_id = uuid()
|
||||
end
|
||||
|
||||
local out = {
|
||||
id = note_id,
|
||||
aliases = note.aliases,
|
||||
tags = note.tags,
|
||||
title = note.id,
|
||||
date = os.date(
|
||||
"%Y-%m-%dT00:00:00"),
|
||||
}
|
||||
|
||||
-- `note.metadata` contains any manually added fields in the frontmatter.
|
||||
-- So here we just make sure those fields are kept in the frontmatter.
|
||||
if note.metadata ~= nil and not vim.tbl_isempty(note.metadata) then
|
||||
for k, v in pairs(note.metadata) do
|
||||
out[k] = v
|
||||
frontmatter = {
|
||||
func = function(note)
|
||||
-- Add the title of the note as an alias.
|
||||
if note.title then
|
||||
note:add_alias(note.title)
|
||||
end
|
||||
end
|
||||
|
||||
-- Force to update mtime.
|
||||
out.mtime = os.date("%Y-%m-%dT%H:%M:%S")
|
||||
return out
|
||||
end,
|
||||
-- Force to use UUID as the note id.
|
||||
local note_id = uuid()
|
||||
if note.metadata.id == nil then
|
||||
note_id = uuid()
|
||||
else
|
||||
note_id = note.metadata.id
|
||||
end
|
||||
|
||||
local out = {
|
||||
-- id = note_id,
|
||||
aliases = note.aliases,
|
||||
tags = note.tags,
|
||||
title = note.id,
|
||||
-- date = os.date("%Y-%m-%dT00:00:00"),
|
||||
-- mtime = os.date("%Y-%m-%dT%H:%M:%S"),
|
||||
}
|
||||
|
||||
-- `note.metadata` contains any manually added fields in the frontmatter.
|
||||
-- So here we just make sure those fields are kept in the frontmatter.
|
||||
if note.metadata ~= nil and not vim.tbl_isempty(note.metadata) then
|
||||
for k, v in pairs(note.metadata) do
|
||||
out[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
-- Force to update mtime.
|
||||
out.mtime = os.date("%Y-%m-%dT%H:%M:%S")
|
||||
return out
|
||||
end,
|
||||
},
|
||||
daily_notes = {
|
||||
folder = "_Global/Periodic",
|
||||
date_format = "%Y-%m-%d",
|
||||
|
|
|
|||
|
|
@ -3,28 +3,29 @@ return {
|
|||
-- optional for icon support
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
cmd = "FzfLua",
|
||||
--stylua: ignore start
|
||||
keys = {
|
||||
{ "<leader><leader>", "<cmd>FzfLua files<CR>", desc = "Find Files" },
|
||||
{ "<leader>fc", "<cmd>FzfLua files cwd=~/.config/nvim<CR>", desc = "Edit configs" },
|
||||
{ "<leader>/", "<cmd>FzfLua live_grep<CR>", desc = "Grep Files" },
|
||||
{ "<leader>;", "<cmd>FzfLua<CR>", desc = "Show Telescope Commands" },
|
||||
{ "<leader>ui", "<cmd>FzfLua colorschemes<CR>", desc = "Change colorscheme" },
|
||||
-- find_files { "<leader>pp", "<cmd>FzfLua projects<CR>", desc = "Listfind_files all Projects" },
|
||||
{ "<leader>pd", "<cmd>FzfLua zoxide<CR>", desc = "List recent directories" },
|
||||
-- { "<leader>pg", "<cmd>FzfLua projects<CR>", desc = "List all Git Projects" },
|
||||
{ "<leader>ps", "<cmd>FzfLua session-lens<CR>", desc = "List all sessions" },
|
||||
{ "<leader>gs", "<cmd>FzfLua git_status<CR>", desc = "Git Status" },
|
||||
{ "<leader>gt", "<cmd>FzfLua git_branches<CR>", desc = "Git Branches" },
|
||||
{ "<leader>gc", "<cmd>FzfLua git_commits<CR>", desc = "Show commits" },
|
||||
{ "<leader>fb", "<cmd>FzfLua buffers<CR>", desc = "List Buffers" },
|
||||
{ "<leader>ff", "<cmd>FzfLua fd<CR>", desc = "Find Files" },
|
||||
{ "<leader>fh", "<cmd>FzfLua oldfiles<CR>", desc = "Recent Files" },
|
||||
{ "<leader>ce", "<cmd>FzfLua diagnostics<CR>", desc = "Navigate errors/warnings" },
|
||||
{ "<leader>cs", "<cmd>FzfLua treesitter<CR>", desc = "Search symbols" },
|
||||
{ "<leader>cS", "<cmd>FzfLua grep_string<CR>", desc = "Search current symbol" },
|
||||
{ "<leader>bB", "<cmd>FzfLua buffers<CR>", desc = "List Buffers" },
|
||||
{ "<leader>fl", "<cmd>FzfLua filetypes<CR>", desc = "Set Filetype/Lang to ..." },
|
||||
{ "<leader>R", "<cmd>FzfLua resume<CR>", desc = "Resume FzfLua" },
|
||||
{ "<leader><leader>", function() require("fzf-lua").files() end, desc = "Find Files" },
|
||||
{ "<leader>fc", function() require("fzf-lua").files({ cwd="~/.dotfiles/home/dot_config/nvim"}) end, desc = "Edit configs" },
|
||||
{ "<leader>/", function() require("fzf-lua").live_grep() end, desc = "Grep Files" },
|
||||
{ "<leader>;", function() require("fzf-lua").commands() end, desc = "Show Telescope Commands" },
|
||||
{ "<leader>ui", function() require("fzf-lua").colorschemes() end, desc = "Change colorscheme" },
|
||||
-- find_files { "<leader>pp", require("fzf-lua").projects, des c = "Listfind_files all Projects" },
|
||||
{ "<leader>pd", function() require("fzf-lua").zoxide() end, desc = "List recent directories" },
|
||||
-- { "<leader>pg", require("fzf-lua").projects, desc = "List all Git Projects" },
|
||||
{ "<leader>gs", function() require("fzf-lua").git_status() end, desc = "Git Status" },
|
||||
{ "<leader>gt", function() require("fzf-lua").git_branches() end, desc = "Git Branches" },
|
||||
{ "<leader>gc", function() require("fzf-lua").git_commits() end, desc = "Show commits" },
|
||||
{ "<leader>fb", function() require("fzf-lua").buffers() end, desc = "List Buffers" },
|
||||
{ "<leader>ff", function() require("fzf-lua").files() end, desc = "Find Files" },
|
||||
{ "<leader>fh", function() require("fzf-lua").oldfiles() end, desc = "Recent Files" },
|
||||
-- { "<leader>ce", require("fzf-lua").diagnostics(), desc = "Navi gate errors/warnings" },
|
||||
{ "<leader>cs", function() require("fzf-lua").treesitter() end, desc = "Search symbols" },
|
||||
{ "<leader>cS", function() require("fzf-lua").grep_visual() end, desc = "Search current symbol" },
|
||||
{ "<leader>bB", function() require("fzf-lua").buffers() end, desc = "List Buffers" },
|
||||
{ "<leader>fl", function() require("fzf-lua").filetypes() end, desc = "Set Filetype/Lang to ..." },
|
||||
{ "<leader>R", function() require("fzf-lua").resume() end, desc = "Resume FzfLua" },
|
||||
},
|
||||
--stylua: ignore end
|
||||
opts = {},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,15 +10,16 @@ return {
|
|||
dashboard = {
|
||||
enabled = true,
|
||||
preset = {
|
||||
-- stylua: ignore start
|
||||
keys = {
|
||||
-- { key = "p", icon = " ", desc = "查找项目", action = "<cmd>Telescope projects<CR>" },
|
||||
{ key = "h", icon = " ", desc = "历史文件", action = "<cmd>FzfLua oldfiles<CR>" },
|
||||
{ key = "l", icon = " ", desc = "加载会话", action = "<cmd>SessionSearch<CR>" },
|
||||
{ key = "h", icon = " ", desc = "历史文件", action = function () require("fzf-lua").oldfiles() end },
|
||||
{ key = "l", icon = " ", desc = "加载会话", action = "<cmd>AutoSession search<CR>" },
|
||||
{
|
||||
key = "c",
|
||||
icon = " ",
|
||||
desc = "转到设置",
|
||||
action = "<cmd>FzfLua files cwd=~/.config/nvim<CR>",
|
||||
action = function() require("fzf-lua").files({ cwd = "~/.dotfiles/home/dot_config/nvim" }) end,
|
||||
},
|
||||
{ key = "q", icon = " ", desc = "退出", action = "<cmd>qa<CR>" },
|
||||
},
|
||||
|
|
@ -69,19 +70,21 @@ return {
|
|||
{ section = "startup" },
|
||||
},
|
||||
},
|
||||
-- stylua: ignore end
|
||||
-- explorer = {
|
||||
-- },
|
||||
indent = { enabled = true },
|
||||
-- input = { enabled = true },
|
||||
input = { enabled = true },
|
||||
notifier = { enabled = true },
|
||||
-- quickfile = { enabled = true },
|
||||
quickfile = { enabled = true },
|
||||
scope = { enabled = true },
|
||||
-- scroll = { enabled = true },
|
||||
scroll = { enabled = true },
|
||||
statuscolumn = { enabled = true },
|
||||
-- words = { enabled = true },
|
||||
image = {
|
||||
enabled = true,
|
||||
img_dirs = { "90 - System/Assets" }
|
||||
-- See: ../lang/markdown/obsidian-nvim.lua
|
||||
img_dirs = { "90 - System/Assets" },
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue