update nvim structor

update kitty theme on macos
This commit is contained in:
DefectingCat
2023-11-24 10:00:12 +08:00
parent 53570bb9c2
commit 982695dbd4
8 changed files with 213 additions and 92 deletions

View File

@ -750,7 +750,7 @@ window_padding_width 0
#: Fade the text in inactive windows by the specified amount (a number
#: between zero and one, with zero being fully faded).
# hide_window_decorations yes
hide_window_decorations titlebar-only
#: Hide the window decorations (title-bar and window borders) with
#: yes. On macOS, titlebar-only can be used to only hide the titlebar.
@ -978,7 +978,7 @@ tab_title_template "{index}: {title[title.rfind('/')+1:]}"
#: The foreground and background colors.
# background_opacity 1.0
background_opacity 0.95
#: The opacity of the background. A number between zero and one, where
#: one is opaque and zero is fully transparent. This will only work if
@ -1408,7 +1408,7 @@ macos_option_as_alt yes
#: Use the macOS traditional full-screen transition, that is faster,
#: but less pretty.
# macos_show_window_title_in all
macos_show_window_title_in none
#: Control where the window title is displayed on macOS. A value of
#: window will show the title of the currently active window at the
@ -1419,7 +1419,7 @@ macos_option_as_alt yes
#: macos_menubar_title_max_length for how to control the length of the
#: title in the menu bar.
# macos_menubar_title_max_length 0
macos_menubar_title_max_length 0
#: The maximum number of characters from the window title to show in
#: the macOS global menu bar. Values less than one means that there is

View File

@ -37,17 +37,15 @@ M.ui = {
"⡝⡵⡕⡀⠑⠳⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⡠⡲⡫⡪⡪⡣",
},
--[[ header = {
" ▄ ▄ ",
" ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ ",
" █ ▄ █▄█ ▄▄▄ █ █▄█ █ █ ",
" ▄▄ █▄█▄▄▄█ █▄█▄█▄▄█▄▄█ █ ",
" ▄ █▄▄█ ▄ ▄▄ ▄█ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ",
" █▄▄▄▄ ▄▄▄ █ ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ █ ▄",
"▄ █ █▄█ █▄█ █ █ █▄█ █ █▄█ ▄▄▄ █ █",
"█▄█ ▄ █▄▄█▄▄█ █ ▄▄█ █ ▄ █ █▄█▄█ █",
" █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█ █▄█▄▄▄█ ",
}, ]]
extended_integrations = {
"dap",
"hop",
"rainbowdelimiters",
"codeactionmenu",
"todo",
"trouble",
"notify",
},
buttons = {
{ " Find File", "Spc f f", "Telescope find_files" },
@ -73,6 +71,18 @@ M.ui = {
selected_item_bg = "colored", -- colored / simple
},
}
--[[ M.gitsigns = {
signs = {
add = { text = " " },
change = { text = " " },
delete = { text = " " },
topdelete = { text = " " },
changedelete = { text = " " },
untracked = { text = " " },
},
} ]]
M.plugins = "custom.plugins"
M.mappings = require "custom.mappings"

View File

@ -1,68 +1,11 @@
-- conform.nvim auto save
-- vim.api.nvim_create_autocmd("BufWritePre", {
-- pattern = "*",
-- callback = function(args)
-- require("conform").format { bufnr = args.buf }
-- end,
-- })
vim.fn.sign_define("DapBreakpoint", { text = "", numhl = "DapBreakpoint", texthl = "DapBreakpoint" })
vim.fn.sign_define("DagLogPoint", { text = "", numhl = "DapLogPoint", texthl = "DapLogPoint" })
vim.fn.sign_define("DapStopped", { text = "", numhl = "DapStopped", texthl = "DapStopped" })
vim.fn.sign_define(
"DapBreakpointRejected",
{ text = "", numhl = "DapBreakpointRejected", texthl = "DapBreakpointRejected" }
)
-- nvim-lint
-- require('lint').linters_by_ft = {
-- javascript = {"eslint"},
-- typescript = {"eslint"},
-- }
--
-- vim.api.nvim_create_autocmd({ "BufWritePost" }, {
-- callback = function()
-- require("lint").try_lint()
-- end,
-- })
--
local opt = vim.opt
local autocmd = vim.api.nvim_create_autocmd
local user_command = vim.api.nvim_create_user_command
vim.g.dap_virtual_text = true
vim.wo.relativenumber = true
-- opt.iskeyword:append("-")
opt.foldmethod = "expr"
opt.foldexpr = "nvim_treesitter#foldexpr()"
opt.foldlevel = 20
opt.ignorecase = true
opt.wildignore:append { "*/node_modules/*" }
opt.clipboard:append { "unnamedplus" }
---- 用o换行不要延续注释
local myAutoGroup = vim.api.nvim_create_augroup("myAutoGroup", {
clear = true,
})
autocmd("BufEnter", {
group = myAutoGroup,
pattern = "*",
callback = function()
vim.opt.formatoptions = vim.opt.formatoptions
- "o" -- O and o, don't continue comments
+ "r" -- But do continue when pressing enter.
end,
})
-- Highlight on yank
local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true })
autocmd("TextYankPost", {
callback = function()
vim.highlight.on_yank()
end,
group = highlight_group,
pattern = "*",
})
-- Copy file path
user_command("Cppath", function()
local path = vim.fn.expand "%:p"
vim.fn.setreg("+", path)
vim.notify('Copied "' .. path .. '" to the clipboard!')
end, {})
user_command("CpRelPath", function()
local path = vim.fn.expand "%"
vim.fn.setreg("+", path)
vim.notify('Copied "' .. path .. '" to the clipboard!')
end, {})
require "custom.utils.autocmd"
require "custom.utils.usercmd"
require "custom.utils.options"

View File

@ -60,6 +60,39 @@ M.dap_go = {
},
}
M.lspsaga = {
n = {
["<C-.>"] = {
function()
vim.lsp.buf.code_action()
end,
"󰅱 Code Action",
},
["gf"] = {
function()
vim.cmd "Lspsaga lsp_finder"
end,
" Go to definition",
},
["gt"] = {
"<CMD>Lspsaga goto_definition<CR>",
" Go to definition",
},
["<leader>lp"] = {
"<CMD>Lspsaga peek_definition<CR>",
" Peek definition",
},
["gh"] = {
function()
--[[ vim.lsp.buf.hover() ]]
require("pretty_hover").hover()
end,
"󱙼 Hover lsp",
},
["gr"] = { "<CMD>Telescope lsp_references<CR>", " Lsp references" },
},
}
M.rua = {
n = {
["<S-l>"] = {
@ -68,22 +101,12 @@ M.rua = {
end,
"Goto next buffer",
},
["<S-h>"] = {
function()
require("nvchad.tabufline").tabuflinePrev()
end,
"Goto prev buffer",
},
["gh"] = {
function()
vim.lsp.buf.hover()
end,
"LSP hover",
},
["gb"] = { "viw" },
["<C-a>"] = { "gg<S-v>G" },
-- $ 跳到行尾不带空格
["$"] = { "g_" },
@ -185,6 +208,17 @@ M.rua = {
},
}
M.trouble = {
n = {
["<leader>xx"] = { "<cmd>TroubleToggle<CR>" },
["<leader>xw"] = { "<cmd>TroubleToggle workspace_diagnostics<CR>" },
["<leader>xd"] = { "<cmd>TroubleToggle document_diagnostics<CR>" },
["<leader>xq"] = { "<cmd>TroubleToggle quickfix<CR>" },
["<leader>xl"] = { "<cmd>TroubleToggle loclist<CR>" },
["gR"] = { "<cmd>TroubleToggle lsp_references<CR>" },
},
}
M.telescope = {
plugin = true,

View File

@ -40,6 +40,13 @@ local plugins = {
},
},
},
--[[ {
"nvimdev/lspsaga.nvim",
event = "LspAttach",
config = function()
require "custom.configs.lspsaga"
end,
}, ]]
{
"nvim-treesitter/nvim-treesitter",
opts = {
@ -132,6 +139,12 @@ local plugins = {
{
"b0o/schemastore.nvim",
},
{
"folke/trouble.nvim",
cmd = { "TroubleToggle", "Trouble", "TroubleRefresh" },
dependencies = { "nvim-tree/nvim-web-devicons" },
opts = {},
},
-- debug
{
@ -279,9 +292,11 @@ local plugins = {
{
"sindrets/diffview.nvim",
opts = {
enhanced_diff_hl = true,
view = {
merge_tool = {
layout = "diff3_mixed",
disable_diagnostics = true,
},
},
},

View File

@ -0,0 +1,91 @@
local autocmd = vim.api.nvim_create_autocmd
-- Disbale diagnostic for files in node_modules
autocmd({ "BufNewFile", "BufRead" }, {
pattern = { "**/node_modules/**", "node_modules", "/node_modules/*" },
callback = function()
vim.diagnostic.disable(0)
end,
})
autocmd("FileType", {
desc = "Close NvimTree before quit nvim",
pattern = { "NvimTree" },
callback = function(args)
autocmd("VimLeavePre", {
callback = function()
vim.api.nvim_buf_delete(args.buf, { force = true })
return true
end,
})
end,
})
autocmd("BufEnter", {
desc = "Close nvim if NvimTree is only running buffer",
command = [[if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif]],
})
-- Automatically update changed file in Vim
-- Triger `autoread` when files changes on disk
-- https://unix.stackexchange.com/questions/149209/refresh-changed-content-of-file-opened-in-vim/383044#383044
-- https://vi.stackexchange.com/questions/13692/prevent-focusgained-autocmd-running-in-command-line-editing-mode
autocmd({ "FocusGained", "BufEnter", "CursorHold", "CursorHoldI" }, {
command = [[silent! if mode() != 'c' && !bufexists("[Command Line]") | checktime | endif]],
})
-- Notification after file change
-- https://vi.stackexchange.com/questions/13091/autocmd-event-for-autoread
autocmd("FileChangedShellPost", {
command = [[echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None]],
})
---- 用o换行不要延续注释
local myAutoGroup = vim.api.nvim_create_augroup("myAutoGroup", {
clear = true,
})
autocmd("BufEnter", {
group = myAutoGroup,
pattern = "*",
callback = function()
vim.opt.formatoptions = vim.opt.formatoptions
- "o" -- O and o, don't continue comments
+ "r" -- But do continue when pressing enter.
end,
})
-- Highlight on yank
local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true })
autocmd("TextYankPost", {
callback = function()
vim.highlight.on_yank()
end,
group = highlight_group,
pattern = "*",
})
-- Remove all trailing whitespace on save
-- autocmd("BufWritePre", {
-- command = [[:%s/\s\+$//e]],
-- group = augroup("TrimWhiteSpaceGrp", { clear = true }),
--})
-- conform.nvim auto save
-- vim.api.nvim_create_autocmd("BufWritePre", {
-- pattern = "*",
-- callback = function(args)
-- require("conform").format { bufnr = args.buf }
-- end,
-- })
-- nvim-lint
-- require('lint').linters_by_ft = {
-- javascript = {"eslint"},
-- typescript = {"eslint"},
-- }
--
-- vim.api.nvim_create_autocmd({ "BufWritePost" }, {
-- callback = function()
-- require("lint").try_lint()
-- end,
-- })

View File

@ -0,0 +1,15 @@
local opt = vim.opt
vim.g.dap_virtual_text = true
vim.wo.relativenumber = true
vim.wo.wrap = false
-- opt.iskeyword:append("-")
opt.foldmethod = "expr"
opt.foldexpr = "nvim_treesitter#foldexpr()"
opt.foldlevel = 20
opt.ignorecase = true
opt.wildignore:append { "*/node_modules/*" }
opt.clipboard:append { "unnamedplus" }
opt.iskeyword:append "-"
opt.termguicolors = true -- True color support
opt.autoindent = true --- Good auto indent

View File

@ -0,0 +1,13 @@
local user_command = vim.api.nvim_create_user_command
-- Copy file path
user_command("Cppath", function()
local path = vim.fn.expand "%:p"
vim.fn.setreg("+", path)
vim.notify('Copied "' .. path .. '" to the clipboard!')
end, {})
user_command("CpRelPath", function()
local path = vim.fn.expand "%"
vim.fn.setreg("+", path)
vim.notify('Copied "' .. path .. '" to the clipboard!')
end, {})