mirror of
https://github.com/Dichgrem/DCGOS.git
synced 2025-12-16 11:12:00 -05:00
chore:nvim_setting
feat:use biome fmt chore:let terminal just one fix:keymaps for close buffer fix:disable markdown view && fix conceallevel
This commit is contained in:
@@ -45,6 +45,7 @@
|
|||||||
python312Packages.python-lsp-server
|
python312Packages.python-lsp-server
|
||||||
|
|
||||||
#JS/TS/Web
|
#JS/TS/Web
|
||||||
|
biome
|
||||||
prettierd
|
prettierd
|
||||||
nodePackages.prettier
|
nodePackages.prettier
|
||||||
|
|
||||||
@@ -93,7 +94,6 @@
|
|||||||
which-key-nvim
|
which-key-nvim
|
||||||
fzf-lua
|
fzf-lua
|
||||||
snacks-nvim
|
snacks-nvim
|
||||||
markview-nvim
|
|
||||||
{
|
{
|
||||||
name = "lazydev.nvim";
|
name = "lazydev.nvim";
|
||||||
path = lazydev-nvim;
|
path = lazydev-nvim;
|
||||||
@@ -223,8 +223,6 @@
|
|||||||
yaml
|
yaml
|
||||||
toml
|
toml
|
||||||
dockerfile
|
dockerfile
|
||||||
markdown
|
|
||||||
markdown_inline
|
|
||||||
])).dependencies;
|
])).dependencies;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|||||||
@@ -5,40 +5,31 @@
|
|||||||
local map = vim.keymap.set
|
local map = vim.keymap.set
|
||||||
local opts = { noremap = true, silent = true }
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
-- === VSCode-like buffer/tab navigation ===
|
-- === VSCode-like buffer/tab navigation ===
|
||||||
map("n", "<C-Tab>", "<cmd>bnext<CR>", { desc = "Next buffer (like VSCode)" })
|
map("n", "<C-Tab>", "<cmd>bnext<CR>", { desc = "Next buffer (like VSCode)" })
|
||||||
map("n", "<C-S-Tab>", "<cmd>bprevious<CR>", { desc = "Previous buffer (like VSCode)" })
|
map("n", "<C-S-Tab>", "<cmd>bprevious<CR>", { desc = "Previous buffer (like VSCode)" })
|
||||||
|
|
||||||
-- === Close buffer like Ctrl + W in VSCode ===
|
-- === Vscode-like Close buffer navigation ===
|
||||||
vim.keymap.set("n", "<C-w>", "<cmd>BufferLinePickClose<CR>", { desc = "Close buffer (BufferLine)" })
|
vim.keymap.set("n", "<C-w>", function()
|
||||||
|
local current = vim.api.nvim_get_current_buf()
|
||||||
|
local buffers = vim.fn.getbufinfo({buflisted = 1})
|
||||||
|
|
||||||
vim.keymap.set("n", "<C-S-5>", function()
|
local next_buf = nil
|
||||||
if vim.bo.buftype == "terminal" then
|
for i, buf in ipairs(buffers) do
|
||||||
vim.cmd("vsplit | terminal")
|
if buf.bufnr == current then
|
||||||
else
|
next_buf = buffers[i + 1] or buffers[i - 1]
|
||||||
vim.cmd("botright split | terminal")
|
break
|
||||||
end
|
end
|
||||||
end, { desc = "Split terminal" })
|
end
|
||||||
|
|
||||||
-- 在终端模式下的快捷键
|
if next_buf then
|
||||||
vim.keymap.set("t", "<C-h>", "<C-\\><C-n><C-w>h", { desc = "Go to left window" })
|
vim.api.nvim_set_current_buf(next_buf.bufnr)
|
||||||
vim.keymap.set("t", "<C-j>", "<C-\\><C-n><C-w>j", { desc = "Go to lower window" })
|
end
|
||||||
vim.keymap.set("t", "<C-k>", "<C-\\><C-n><C-w>k", { desc = "Go to upper window" })
|
|
||||||
vim.keymap.set("t", "<C-l>", "<C-\\><C-n><C-w>l", { desc = "Go to right window" })
|
|
||||||
|
|
||||||
|
vim.api.nvim_buf_delete(current, { force = true })
|
||||||
|
end, { desc = "Close current buffer like VSCode" })
|
||||||
|
|
||||||
|
-- XDG Open
|
||||||
vim.keymap.set("n", "<leader>xo", function()
|
vim.keymap.set("n", "<leader>xo", function()
|
||||||
vim.fn.jobstart({ "xdg-open", vim.fn.expand("%:p") }, { detach = true })
|
vim.fn.jobstart({ "xdg-open", vim.fn.expand("%:p") }, { detach = true })
|
||||||
end, { desc = "使用系统默认应用程序打开当前文件" })
|
end, { desc = "使用系统默认应用程序打开当前文件" })
|
||||||
|
|
||||||
-- === Markdown priview ===
|
|
||||||
vim.keymap.set("n", "<leader>mp", "<cmd>Markview<CR>", {
|
|
||||||
desc = "Toggle Markview Inline Preview",
|
|
||||||
})
|
|
||||||
-- 开启对比预览
|
|
||||||
vim.keymap.set("n", "<leader>mv", "<cmd>Markview splitToggle<CR>", {
|
|
||||||
desc = "Toggle Markview Split Preview",
|
|
||||||
})
|
|
||||||
-- 关闭对比预览
|
|
||||||
vim.keymap.set("n", "<leader>mc", "<cmd>Markview splitClose<CR>", {
|
|
||||||
desc = "Close Markview Split Preview",
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -1,4 +1,16 @@
|
|||||||
-- Options are automatically loaded before lazy.nvim startup
|
-- Options are automatically loaded before lazy.nvim startup
|
||||||
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
|
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
|
||||||
-- Add any additional options here
|
-- Add any additional options here
|
||||||
vim.g.autoformat = false
|
|
||||||
|
-- Disable autoformat
|
||||||
|
vim.g.autoformat = false
|
||||||
|
-- Let terminal just one
|
||||||
|
vim.g.root_spec = { "cwd" }
|
||||||
|
-- Disable markdown views
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = "markdown",
|
||||||
|
callback = function()
|
||||||
|
vim.opt_local.conceallevel = 0
|
||||||
|
vim.opt_local.concealcursor = ""
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|||||||
@@ -34,11 +34,11 @@ return {
|
|||||||
-- Python
|
-- Python
|
||||||
opts.formatters_by_ft.python = { "black", "ruff_format" }
|
opts.formatters_by_ft.python = { "black", "ruff_format" }
|
||||||
-- JS/TS/Web
|
-- JS/TS/Web
|
||||||
opts.formatters_by_ft.javascript = { "prettierd" }
|
opts.formatters_by_ft.javascript = { "biome" }
|
||||||
opts.formatters_by_ft.typescript = { "prettierd" }
|
opts.formatters_by_ft.typescript = { "biome" }
|
||||||
opts.formatters_by_ft.javascriptreact = { "prettierd" }
|
opts.formatters_by_ft.javascriptreact = { "biome" }
|
||||||
opts.formatters_by_ft.typescriptreact = { "prettierd" }
|
opts.formatters_by_ft.typescriptreact = { "biome" }
|
||||||
opts.formatters_by_ft.vue = { "prettierd" }
|
opts.formatters_by_ft.vue = { "biome" }
|
||||||
-- JSON
|
-- JSON
|
||||||
opts.formatters_by_ft.json = { "jq" }
|
opts.formatters_by_ft.json = { "jq" }
|
||||||
-- YAML
|
-- YAML
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
return {
|
|
||||||
"OXY2DEV/markview.nvim",
|
|
||||||
name = "markview.nvim",
|
|
||||||
lazy = false,
|
|
||||||
dependencies = {
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
"nvim-tree/nvim-web-devicons",
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
require("markview").setup({
|
|
||||||
markdown = { enable = true },
|
|
||||||
latex = {
|
|
||||||
enable = true,
|
|
||||||
inline = { enable = true },
|
|
||||||
block = { enable = true },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user