mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
refractor(nvim): Separate config files
This commit is contained in:
parent
5455e68b8c
commit
2a76a6fbe4
24 changed files with 326 additions and 157 deletions
|
|
@ -1,128 +1,2 @@
|
|||
local M = {}
|
||||
local global_default_opts = { noremap = true, silent = true }
|
||||
local global_default_mode = { "n" }
|
||||
local mode_arrow = { "n", "v", "o", "s", "x" }
|
||||
require("keymaps")
|
||||
|
||||
local function set_keymaps(maps, default_opts, default_mode)
|
||||
for _, map in ipairs(maps) do
|
||||
local opts = vim.tbl_extend("force", default_opts, map.opts or {})
|
||||
local mode = map.mode or global_default_mode
|
||||
vim.keymap.set(mode, map.keys, map.cmd, opts)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
local keymaps_basic = { -- Modification of Original Keymap - Colemak
|
||||
{ mode = mode_arrow, keys = "n", cmd = "j" },
|
||||
{ mode = mode_arrow, keys = "e", cmd = "k" },
|
||||
{ mode = mode_arrow, keys = "i", cmd = "l" },
|
||||
{ keys = "N", cmd = "J" },
|
||||
{ keys = "E", cmd = "K" },
|
||||
{ keys = "I", cmd = "L" },
|
||||
{ keys = "l", cmd = "i" },
|
||||
{ keys = "L", cmd = "I" },
|
||||
{ keys = "k", cmd = "n" },
|
||||
{ keys = "K", cmd = "N" },
|
||||
{ keys = "j", cmd = "e" },
|
||||
{ keys = "J", cmd = "E" },
|
||||
{ keys = "Y", cmd = "y$"},
|
||||
}
|
||||
|
||||
local keymaps_lsp = {
|
||||
}
|
||||
|
||||
local keymaps_nvim_tree_general = {
|
||||
{ mode = "n", keys = "<leader>e", cmd = ":NvimTreeToggle<CR>" },
|
||||
}
|
||||
|
||||
set_keymaps(keymaps_basic, global_default_opts, global_default_mode)
|
||||
set_keymaps(keymaps_lsp, global_default_opts, global_default_mode)
|
||||
set_keymaps(keymaps_nvim_tree_general, global_default_opts, global_default_mode)
|
||||
|
||||
function M.nvim_tree_keymaps(api, opts)
|
||||
-- mode is set to "n" by default, in `./lua/plugins/nvim-tree.lua`
|
||||
return {
|
||||
-- Toggle
|
||||
{ keys = "<leader>e", cmd = ":NvimTreeToggle<CR>", opts = opts("Toggle") },
|
||||
-- Arrow 箭头 hnei
|
||||
{ keys = "h", cmd = api.node.navigate.parent_close, opts = opts("Close node") },
|
||||
{ keys = "i", cmd = api.node.open.edit, opts = opts("Open") },
|
||||
{ keys = "H", cmd = api.tree.toggle_hidden_filter, opts = opts("Toggle Dotfiles") },
|
||||
{ keys = "N", cmd = api.node.navigate.sibling.next, opts = opts("Next Sibling") },
|
||||
{ keys = "E", cmd = api.node.navigate.sibling.prev, opts = opts("Previous Sibling") },
|
||||
{ keys = "I", cmd = api.tree.toggle_gitignore_filter, opts = opts("Toggle GitIgnored") },
|
||||
-- CONTROL KEYS 控制键
|
||||
{ keys = "<BS>", cmd = api.node.navigate.parent_close, opts = opts("Close node") },
|
||||
{ keys = "<CR>", cmd = api.node.open.edit, opts = opts("Open") },
|
||||
{ keys = "<Tab>", cmd = api.node.open.preview, opts = opts("Open Preview") },
|
||||
-- Alpha 字母键
|
||||
{ keys = "a", cmd = api.fs.create, opts = opts("Create") },
|
||||
{ keys = "A", cmd = api.fs.create, opts = opts("Create") },
|
||||
{ keys = "bd", cmd = api.marks.bulk.delete, opts = opts("Delete Bookmarked") },
|
||||
{ keys = "bt", cmd = api.marks.bulk.trash, opts = opts("Trash Bookmarked") },
|
||||
{ keys = "bmv", cmd = api.marks.bulk.move, opts = opts("Move Bookmarked") },
|
||||
{ keys = "B", cmd = api.tree.toggle_no_buffer_filter, opts = opts("Toggle Filter: No Buffer") },
|
||||
{ keys = "c", cmd = api.fs.copy.node, opts = opts("Copy") },
|
||||
{ keys = "C", cmd = api.fs.copy.filename, opts = opts("Copy") },
|
||||
{ keys = "d", cmd = api.fs.remove, opts = opts("Delete") },
|
||||
{ keys = "D", cmd = api.fs.trash, opts = opts("Trash") },
|
||||
{ keys = "]e", cmd = api.node.navigate.diagnostics.next, opts = opts("Next Diagnostic") },
|
||||
{ keys = "[e", cmd = api.node.navigate.diagnostics.prev, opts = opts("Prev Diagnostic") },
|
||||
{ keys = "F", cmd = api.live_filter.clear, opts = opts("Live Filter: Clear") },
|
||||
{ keys = "f", cmd = api.live_filter.start, opts = opts("Live Filter: Start") },
|
||||
{ keys = "[g", cmd = api.node.navigate.git.prev, opts = opts("Prev Git") },
|
||||
{ keys = "]g", cmd = api.node.navigate.git.next, opts = opts("Next Git") },
|
||||
{ keys = "L", cmd = api.node.open.toggle_group_empty, opts = opts("Toggle Group Empty") },
|
||||
{ keys = "M", cmd = api.tree.toggle_no_bookmark_filter, opts = opts("Toggle Filter: No Bookmark") },
|
||||
{ keys = "m", cmd = api.marks.toggle, opts = opts("Toggle Bookmark") },
|
||||
{ keys = "o", cmd = api.node.open.edit, opts = opts("Open") },
|
||||
{ keys = "O", cmd = api.node.open.no_window_picker, opts = opts("Open: No Window Picker") },
|
||||
{ keys = "p", cmd = api.fs.paste, opts = opts("Paste") },
|
||||
{ keys = "P", cmd = api.node.navigate.parent, opts = opts("Parent Directory") },
|
||||
{ keys = "q", cmd = api.tree.close, opts = opts("Close") },
|
||||
{ keys = "r", cmd = api.fs.rename, opts = opts("Rename") },
|
||||
{ keys = "R", cmd = api.tree.reload, opts = opts("Refresh") },
|
||||
{ keys = "s", cmd = api.node.run.system, opts = opts("Run System") },
|
||||
{ keys = "S", cmd = api.tree.search_node, opts = opts("Search") },
|
||||
{ keys = "u", cmd = api.fs.rename_full, opts = opts("Rename: Full Path") },
|
||||
{ keys = "U", cmd = api.tree.toggle_custom_filter, opts = opts("Toggle Filter: Hidden") },
|
||||
{ keys = "W", cmd = api.tree.collapse_all, opts = opts("Collapse") },
|
||||
{ keys = "x", cmd = api.fs.cut, opts = opts("Cut") },
|
||||
{ keys = "y", cmd = api.fs.copy.relative_path, opts = opts("Copy Relative Path") },
|
||||
{ keys = "Y", cmd = api.fs.copy.absolute_path, opts = opts("Copy Absolute Path") },
|
||||
-- Numeric 数字键
|
||||
{ keys = "!", cmd = api.node.run.cmd, opts = opts("Run Command") },
|
||||
-- Non-Alphanumeric 非字母数字键
|
||||
{ keys = "?", cmd = api.tree.toggle_help, opts = opts("Help") },
|
||||
{ keys = ">", cmd = api.node.navigate.sibling.next, opts = opts("Next Sibling") },
|
||||
{ keys = "<", cmd = api.node.navigate.sibling.prev, opts = opts("Previous Sibling") },
|
||||
{ keys = ".", cmd = api.node.run.cmd, opts = opts("Run Command") },
|
||||
{ keys = ";", cmd = api.node.run.cmd, opts = opts("Run Command") },
|
||||
{ keys = "-", cmd = api.tree.change_root_to_parent, opts = opts("Up") },
|
||||
-- MOD KEYS Ctrl+
|
||||
{ keys = "<C-]>", cmd = api.tree.change_root_to_node, opts = opts("CD") },
|
||||
{ keys = "<C-e>", cmd = api.node.open.replace_tree_buffer, opts = opts("Open: In Place") },
|
||||
{ keys = "<C-k>", cmd = api.node.show_info_popup, opts = opts("Info") },
|
||||
{ keys = "<C-r>", cmd = api.fs.rename_sub, opts = opts("Rename: Omit Filename") },
|
||||
{ keys = "<C-t>", cmd = api.node.open.tab, opts = opts("Open: New Tab") },
|
||||
{ keys = "<C-v>", cmd = api.node.open.vertical, opts = opts("Open: Vertical Split") },
|
||||
{ keys = "<C-h>", cmd = api.node.open.horizontal, opts = opts("Open: Horizontal Split") },
|
||||
-- Mouse 鼠标键
|
||||
{ keys = "<2-LeftMouse>", cmd = api.node.open.edit, opts = opts("Open") },
|
||||
{ keys = "<2-RightMouse>",cmd = api.tree.change_root_to_node, opts = opts("CD") },
|
||||
}
|
||||
end
|
||||
|
||||
--- `map` default for `cmp.mapping`
|
||||
function M.cmp_nvim_keymaps(map)
|
||||
return {
|
||||
{ keys = "<C-n>", cmd = map.select_next_item(), desc = "Select next completion item" },
|
||||
{ keys = "<C-p>", cmd = map.select_prev_item(), desc = "Select previous completion item" },
|
||||
{ keys = "<C-y>", cmd = map.confirm({ select = true }), desc = "Confirm completion" },
|
||||
{ keys = "<C-Space>", cmd = map.complete(), desc = "Trigger completion" },
|
||||
{ keys = "<C-e>", cmd = map.abort(), desc = "Abort completion" },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -48,3 +48,5 @@ opt.cmdheight = 0
|
|||
-- Scroll
|
||||
opt.scrolloff = 5
|
||||
opt.sidescrolloff = 10
|
||||
|
||||
opt.conceallevel = 2
|
||||
|
|
|
|||
1
.config/nvim/lua/config/plugins.lua
Normal file
1
.config/nvim/lua/config/plugins.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
require("plugins")
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
--- Available LSP goes here
|
||||
--- Check https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md
|
||||
--- for available server and name
|
||||
local servers = {
|
||||
local M = {}
|
||||
M.servers = {
|
||||
"arduino_language_server", -- Arduino
|
||||
"bashls", -- Bash
|
||||
"clangd", -- C/C++
|
||||
|
|
@ -19,4 +20,15 @@ local servers = {
|
|||
"vimls", -- vimscript
|
||||
}
|
||||
|
||||
return servers
|
||||
M.server_config = {
|
||||
lua_ls = {
|
||||
capabilities = vim.lsp.protocol.make_client_capabilities(),
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = { globals = { "vim" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
|
|
|
|||
20
.config/nvim/lua/keymaps/basic.lua
Normal file
20
.config/nvim/lua/keymaps/basic.lua
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
local mode_arrow = { "n", "v", "o", "s", "x" }
|
||||
|
||||
local keymaps_basic = { -- Modification of Original Keymap - Colemak
|
||||
{ mode = mode_arrow, keys = "n", cmd = "j" },
|
||||
{ mode = mode_arrow, keys = "e", cmd = "k" },
|
||||
{ mode = mode_arrow, keys = "i", cmd = "l" },
|
||||
{ keys = "H", cmd = ":bprevious<CR>" },
|
||||
{ keys = "N", cmd = "J" },
|
||||
{ keys = "E", cmd = "K" },
|
||||
{ keys = "I", cmd = ":bnext<CR>" },
|
||||
{ keys = "l", cmd = "i" },
|
||||
{ keys = "L", cmd = "I" },
|
||||
{ keys = "k", cmd = "n" },
|
||||
{ keys = "K", cmd = "N" },
|
||||
{ keys = "j", cmd = "e" },
|
||||
{ keys = "J", cmd = "E" },
|
||||
{ keys = "Y", cmd = "y$"},
|
||||
}
|
||||
|
||||
return keymaps_basic
|
||||
37
.config/nvim/lua/keymaps/init.lua
Normal file
37
.config/nvim/lua/keymaps/init.lua
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
local M = {}
|
||||
local global_default_opts = { noremap = true, silent = true }
|
||||
local global_default_mode = { "n" }
|
||||
-- local mode_arrow = { "n", "v", "o", "s", "x" }
|
||||
|
||||
local function set_keymaps(maps, default_opts, default_mode)
|
||||
for _, map in ipairs(maps) do
|
||||
local opts = vim.tbl_extend("force", default_opts, map.opts or {})
|
||||
local mode = map.mode or default_mode
|
||||
vim.keymap.set(mode, map.keys, map.cmd, opts)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
local keymaps_basic = require("keymaps.basic")
|
||||
local keymaps_nvim_tree_general = require("keymaps.nvim-tree").global
|
||||
local keymaps_leader = require("keymaps.leaders")
|
||||
|
||||
set_keymaps(keymaps_basic, global_default_opts, global_default_mode)
|
||||
set_keymaps(keymaps_nvim_tree_general, global_default_opts, global_default_mode)
|
||||
set_keymaps(keymaps_leader, global_default_opts, global_default_mode)
|
||||
|
||||
M.nvim_tree_keymaps = require("keymaps.nvim-tree").plugin
|
||||
|
||||
--- `map` default for `cmp.mapping`
|
||||
function M.cmp_nvim_keymaps(map)
|
||||
return {
|
||||
{ keys = "<C-n>", cmd = map.select_next_item(), desc = "Select next completion item" },
|
||||
{ keys = "<C-p>", cmd = map.select_prev_item(), desc = "Select previous completion item" },
|
||||
{ keys = "<C-y>", cmd = map.confirm({ select = true }), desc = "Confirm completion" },
|
||||
{ keys = "<C-Space>", cmd = map.complete(), desc = "Trigger completion" },
|
||||
{ keys = "<C-e>", cmd = map.abort(), desc = "Abort completion" },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
36
.config/nvim/lua/keymaps/leaders.lua
Normal file
36
.config/nvim/lua/keymaps/leaders.lua
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
local M = {}
|
||||
|
||||
local leader_general = {
|
||||
{ keys = "<space>", cmd = ":Telescope find_files<CR>", desc = "Find Files" },
|
||||
{ keys = "/", cmd = ":Telescope live_grep<CR>", desc = "Grep Files" },
|
||||
}
|
||||
|
||||
for _,map in ipairs(leader_general) do
|
||||
map.keys = "<leader>" .. map.keys
|
||||
table.insert(M, map)
|
||||
end
|
||||
|
||||
local leader_w = { -- leader w: Windows Management
|
||||
{ keys = "h", cmd = "<C-w>h", desc = "Left Window" },
|
||||
{ keys = "n", cmd = "<C-w>j", desc = "Down Window" },
|
||||
{ keys = "e", cmd = "<C-w>k", desc = "Up Window" },
|
||||
{ keys = "i", cmd = "<C-w>l", desc = "Right Window" },
|
||||
{ keys = "-", cmd = ":split<CR>", desc = "Split to down" },
|
||||
{ keys = "|", cmd = ":vsplit<CR>", desc = "Split to right" },
|
||||
{ keys = "c", cmd = "<C-w>c", desc = "Close Window" },
|
||||
{ keys = "o", cmd = "<C-w>o", desc = "Close Other Windows" },
|
||||
{ keys = "r", cmd = "<C-w>r", desc = "Rotate Windows" },
|
||||
{ keys = "R", cmd = "<C-w>R", desc = "Reverse Rotate Windows" },
|
||||
{ keys = "t", cmd = "<C-w>T", desc = "Move Window to New Tab" },
|
||||
{ keys = "H", cmd = ":vertical resize -5<CR>", desc = "Decrease Window Height" },
|
||||
{ keys = "N", cmd = ":resize +5<CR>", desc = "Increase Window Height" },
|
||||
{ keys = "E", cmd = ":vertical resize +5<CR>", desc = "Increase Window Width" },
|
||||
{ keys = "I", cmd = ":resize -5<CR>", desc = "Decrease Window Width" },
|
||||
}
|
||||
|
||||
for _, map in ipairs(leader_w) do
|
||||
map.keys = "<leader>w" .. map.keys
|
||||
table.insert(M, map)
|
||||
end
|
||||
|
||||
return M
|
||||
81
.config/nvim/lua/keymaps/nvim-tree.lua
Normal file
81
.config/nvim/lua/keymaps/nvim-tree.lua
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
local M = {}
|
||||
|
||||
M.global = {
|
||||
{ mode = "n", keys = "<leader>e", cmd = ":NvimTreeToggle<CR>" },
|
||||
}
|
||||
|
||||
function M.plugin(api, opts)
|
||||
-- mode is set to "n" by default, in `./lua/plugins/nvim-tree.lua`
|
||||
return {
|
||||
-- Toggle
|
||||
{ keys = "<leader>e", cmd = ":NvimTreeToggle<CR>", opts = opts("Toggle") },
|
||||
-- Arrow 箭头 hnei
|
||||
{ keys = "h", cmd = api.node.navigate.parent_close, opts = opts("Close node") },
|
||||
{ keys = "i", cmd = api.node.open.edit, opts = opts("Open") },
|
||||
{ keys = "H", cmd = api.tree.toggle_hidden_filter, opts = opts("Toggle Dotfiles") },
|
||||
{ keys = "N", cmd = api.node.navigate.sibling.next, opts = opts("Next Sibling") },
|
||||
{ keys = "E", cmd = api.node.navigate.sibling.prev, opts = opts("Previous Sibling") },
|
||||
{ keys = "I", cmd = api.tree.toggle_gitignore_filter, opts = opts("Toggle GitIgnored") },
|
||||
-- CONTROL KEYS 控制键
|
||||
{ keys = "<BS>", cmd = api.node.navigate.parent_close, opts = opts("Close node") },
|
||||
{ keys = "<CR>", cmd = api.node.open.edit, opts = opts("Open") },
|
||||
{ keys = "<Tab>", cmd = api.node.open.preview, opts = opts("Open Preview") },
|
||||
-- Alpha 字母键
|
||||
{ keys = "a", cmd = api.fs.create, opts = opts("Create") },
|
||||
{ keys = "A", cmd = api.fs.create, opts = opts("Create") },
|
||||
{ keys = "bd", cmd = api.marks.bulk.delete, opts = opts("Delete Bookmarked") },
|
||||
{ keys = "bt", cmd = api.marks.bulk.trash, opts = opts("Trash Bookmarked") },
|
||||
{ keys = "bmv", cmd = api.marks.bulk.move, opts = opts("Move Bookmarked") },
|
||||
{ keys = "B", cmd = api.tree.toggle_no_buffer_filter, opts = opts("Toggle Filter: No Buffer") },
|
||||
{ keys = "c", cmd = api.fs.copy.node, opts = opts("Copy") },
|
||||
{ keys = "C", cmd = api.fs.copy.filename, opts = opts("Copy") },
|
||||
{ keys = "d", cmd = api.fs.remove, opts = opts("Delete") },
|
||||
{ keys = "D", cmd = api.fs.trash, opts = opts("Trash") },
|
||||
{ keys = "]e", cmd = api.node.navigate.diagnostics.next, opts = opts("Next Diagnostic") },
|
||||
{ keys = "[e", cmd = api.node.navigate.diagnostics.prev, opts = opts("Prev Diagnostic") },
|
||||
{ keys = "F", cmd = api.live_filter.clear, opts = opts("Live Filter: Clear") },
|
||||
{ keys = "f", cmd = api.live_filter.start, opts = opts("Live Filter: Start") },
|
||||
{ keys = "[g", cmd = api.node.navigate.git.prev, opts = opts("Prev Git") },
|
||||
{ keys = "]g", cmd = api.node.navigate.git.next, opts = opts("Next Git") },
|
||||
{ keys = "L", cmd = api.node.open.toggle_group_empty, opts = opts("Toggle Group Empty") },
|
||||
{ keys = "M", cmd = api.tree.toggle_no_bookmark_filter, opts = opts("Toggle Filter: No Bookmark") },
|
||||
{ keys = "m", cmd = api.marks.toggle, opts = opts("Toggle Bookmark") },
|
||||
{ keys = "o", cmd = api.node.open.edit, opts = opts("Open") },
|
||||
{ keys = "O", cmd = api.node.open.no_window_picker, opts = opts("Open: No Window Picker") },
|
||||
{ keys = "p", cmd = api.fs.paste, opts = opts("Paste") },
|
||||
{ keys = "P", cmd = api.node.navigate.parent, opts = opts("Parent Directory") },
|
||||
{ keys = "q", cmd = api.tree.close, opts = opts("Close") },
|
||||
{ keys = "r", cmd = api.fs.rename, opts = opts("Rename") },
|
||||
{ keys = "R", cmd = api.tree.reload, opts = opts("Refresh") },
|
||||
{ keys = "s", cmd = api.node.run.system, opts = opts("Run System") },
|
||||
{ keys = "S", cmd = api.tree.search_node, opts = opts("Search") },
|
||||
{ keys = "u", cmd = api.fs.rename_full, opts = opts("Rename: Full Path") },
|
||||
{ keys = "U", cmd = api.tree.toggle_custom_filter, opts = opts("Toggle Filter: Hidden") },
|
||||
{ keys = "W", cmd = api.tree.collapse_all, opts = opts("Collapse") },
|
||||
{ keys = "x", cmd = api.fs.cut, opts = opts("Cut") },
|
||||
{ keys = "y", cmd = api.fs.copy.relative_path, opts = opts("Copy Relative Path") },
|
||||
{ keys = "Y", cmd = api.fs.copy.absolute_path, opts = opts("Copy Absolute Path") },
|
||||
-- Numeric 数字键
|
||||
{ keys = "!", cmd = api.node.run.cmd, opts = opts("Run Command") },
|
||||
-- Non-Alphanumeric 非字母数字键
|
||||
{ keys = "?", cmd = api.tree.toggle_help, opts = opts("Help") },
|
||||
{ keys = ">", cmd = api.node.navigate.sibling.next, opts = opts("Next Sibling") },
|
||||
{ keys = "<", cmd = api.node.navigate.sibling.prev, opts = opts("Previous Sibling") },
|
||||
{ keys = ".", cmd = api.node.run.cmd, opts = opts("Run Command") },
|
||||
{ keys = ";", cmd = api.node.run.cmd, opts = opts("Run Command") },
|
||||
{ keys = "-", cmd = api.tree.change_root_to_parent, opts = opts("Up") },
|
||||
-- MOD KEYS Ctrl+
|
||||
{ keys = "<C-]>", cmd = api.tree.change_root_to_node, opts = opts("CD") },
|
||||
{ keys = "<C-e>", cmd = api.node.open.replace_tree_buffer, opts = opts("Open: In Place") },
|
||||
{ keys = "<C-k>", cmd = api.node.show_info_popup, opts = opts("Info") },
|
||||
{ keys = "<C-r>", cmd = api.fs.rename_sub, opts = opts("Rename: Omit Filename") },
|
||||
{ keys = "<C-t>", cmd = api.node.open.tab, opts = opts("Open: New Tab") },
|
||||
{ keys = "<C-v>", cmd = api.node.open.vertical, opts = opts("Open: Vertical Split") },
|
||||
{ keys = "<C-h>", cmd = api.node.open.horizontal, opts = opts("Open: Horizontal Split") },
|
||||
-- Mouse 鼠标键
|
||||
{ keys = "<2-LeftMouse>", cmd = api.node.open.edit, opts = opts("Open") },
|
||||
{ keys = "<2-RightMouse>", cmd = api.tree.change_root_to_node, opts = opts("CD") },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -8,5 +8,6 @@ return {
|
|||
end,
|
||||
},
|
||||
{ import = "plugins.mod.alpha-nvim" },
|
||||
{ import = "plugins.mod.winbar-nvim"},
|
||||
{ import = "plugins.mod.bufferline" },
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ return {
|
|||
},
|
||||
config = function()
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
local servers = require("config.servers")
|
||||
local servers = require("config.servers").servers
|
||||
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = servers,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
return {
|
||||
{ 'wakatime/vim-wakatime', lazy = false },
|
||||
{ 'epwalsh/obsidian.nvim', lazy = true },
|
||||
{ import = "plugins.mod.obsidian-nvim" },
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@ return {
|
|||
dashboard.button('c', ' 新建文件', ':enew<CR>'),
|
||||
dashboard.button('SPC f f', ' 查找文件', ':Telescope find_files<CR>'),
|
||||
dashboard.button('SPC f h', ' 历史文件', ':Telescope oldfiles<CR>'),
|
||||
dashboard.button('SPC s l', ' 加载会话', ':SessionSearch<CR>'), -- 加载会话
|
||||
dashboard.button('SPC s l', ' 加载会话', ':SessionSearch<CR>'),
|
||||
dashboard.button('SPC f c', ' 转到设置', ':Telescope find_files cwd=~/.config/nvim<CR>'),
|
||||
dashboard.button('SPC q', ' 退出', ':qa<CR>'),
|
||||
}
|
||||
local handle = io.popen('fortune')
|
||||
|
|
|
|||
17
.config/nvim/lua/plugins/mod/bufferline.lua
Normal file
17
.config/nvim/lua/plugins/mod/bufferline.lua
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
return {
|
||||
"akinsho/bufferline.nvim",
|
||||
dependencies = "nvim-tree/nvim-web-devicons", -- 图标支持
|
||||
config = function()
|
||||
require("bufferline").setup({
|
||||
options = {
|
||||
numbers = "ordinal", -- 显示 buffer 序号
|
||||
close_command = "bdelete! %d", -- 关闭 buffer 的命令
|
||||
right_mouse_command = "bdelete! %d", -- 右键关闭
|
||||
offsets = {
|
||||
{ filetype = "NvimTree", text = "资源管理器", text_align = "center" },
|
||||
},
|
||||
separator_style = "thin",
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
lazy = false
|
||||
"neovim/nvim-lspconfig",
|
||||
lazy = false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ ins_left {
|
|||
ins_left {
|
||||
-- mode component
|
||||
function()
|
||||
return ''
|
||||
return ''
|
||||
end,
|
||||
color = function()
|
||||
-- auto change color according to neovims mode
|
||||
|
|
|
|||
|
|
@ -20,7 +20,11 @@ return {
|
|||
local cmp = require("cmp")
|
||||
local lspconfig = require("lspconfig")
|
||||
local capabitilies = require("cmp_nvim_lsp").default_capabilities()
|
||||
local servers = require("config.servers")
|
||||
local servers = require("config.servers").servers
|
||||
local servers_config = require("config.servers").server_config
|
||||
local default_server_config = {
|
||||
capabilities = capabitilies,
|
||||
}
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
|
|
@ -41,7 +45,7 @@ return {
|
|||
}
|
||||
),
|
||||
})
|
||||
local keymaps = require("config.keymaps")
|
||||
local keymaps = require("keymaps")
|
||||
local keymaps_cmp = keymaps.cmp_nvim_keymaps(cmp.mapping)
|
||||
|
||||
local function set_keymaps()
|
||||
|
|
@ -63,9 +67,9 @@ return {
|
|||
})
|
||||
|
||||
for _, server in ipairs(servers) do
|
||||
lspconfig[server].setup({
|
||||
capabilities = capabitilies,
|
||||
})
|
||||
local config = servers_config[server] or {}
|
||||
config = vim.tbl_extend("force", default_server_config, config)
|
||||
lspconfig[server].setup(config)
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ local function my_on_attach(bufnr)
|
|||
-- local keymaps = require("config.keymaps")
|
||||
local api = require "nvim-tree.api"
|
||||
local default_mode = { "n" }
|
||||
local keymaps = require("config.keymaps")
|
||||
local keymaps = require("keymaps")
|
||||
|
||||
local function opts(desc)
|
||||
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
||||
|
|
@ -16,7 +16,7 @@ local function my_on_attach(bufnr)
|
|||
end
|
||||
end
|
||||
|
||||
local raw_keymaps = keymaps.nvim_tree_keymaps(api, opts)
|
||||
local raw_keymaps = require("keymaps.nvim-tree").plugin(api, opts)
|
||||
set_keymaps(raw_keymaps)
|
||||
end
|
||||
|
||||
|
|
@ -32,10 +32,6 @@ return {
|
|||
on_attach = my_on_attach,
|
||||
sync_root_with_cwd = true,
|
||||
respect_buf_cwd = true,
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_cwd = true,
|
||||
},
|
||||
}
|
||||
end
|
||||
}
|
||||
|
|
|
|||
11
.config/nvim/lua/plugins/mod/nvim-treesitter.lua
Normal file
11
.config/nvim/lua/plugins/mod/nvim-treesitter.lua
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
run = ":TSUpdate",
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = { "markdown", "markdown_inline" },
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
})
|
||||
end,
|
||||
}
|
||||
33
.config/nvim/lua/plugins/mod/obsidian-nvim.lua
Normal file
33
.config/nvim/lua/plugins/mod/obsidian-nvim.lua
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
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 = "personal",
|
||||
path = "/mnt/c/Users/citoy/Obsidian",
|
||||
},
|
||||
},
|
||||
completion = {
|
||||
nvim_cmp = true,
|
||||
min_chars = 2
|
||||
}
|
||||
-- see below for full list of options 👇
|
||||
},
|
||||
}
|
||||
39
.config/nvim/lua/plugins/mod/winbar-nvim.lua
Normal file
39
.config/nvim/lua/plugins/mod/winbar-nvim.lua
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
return {
|
||||
{
|
||||
"fgheng/winbar.nvim",
|
||||
config = function()
|
||||
require("winbar").setup({
|
||||
enabled = true,
|
||||
show_file_path = true,
|
||||
show_symbols = true,
|
||||
colors = {
|
||||
path = '',
|
||||
file_name = '',
|
||||
symbols = '',
|
||||
},
|
||||
icons = {
|
||||
file_icon_default = '',
|
||||
seperator = '>',
|
||||
editor_state = '●',
|
||||
lock_icon = '',
|
||||
},
|
||||
exclude_filetype = {
|
||||
'help',
|
||||
'startify',
|
||||
'dashboard',
|
||||
'packer',
|
||||
'neogitstatus',
|
||||
'NvimTree',
|
||||
'Trouble',
|
||||
'alpha',
|
||||
'lir',
|
||||
'Outline',
|
||||
'spectre_panel',
|
||||
'toggleterm',
|
||||
'qf',
|
||||
}
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -1,6 +1,3 @@
|
|||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
},
|
||||
{ import = "plugins.mod.nvim-treesitter", },
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue