nvim changes

* refractor(nvim-lualine): lualine in powerline style
* feat(nvim, emacs): Org Mode Integrations Setup
* feat(nvim): C-w keymaps
* feat(wezterm): Change tab bar to top
* feat(nvim): catppuccin integrations
* feat(nvim-cmp): Icon supports
This commit is contained in:
js0ny 2025-02-09 18:27:53 +00:00
parent 1a1c8707ce
commit 2248d3a237
14 changed files with 244 additions and 127 deletions

View file

@ -19,6 +19,13 @@
;; Initial Visibility ;; Initial Visibility
(setq org-startup-folded "show2levels") (setq org-startup-folded "show2levels")
;; Log into drawer
(setq org-log-into-drawer "LOGBOOK")
;;
(setq org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "WAIT(w@/!)" "|" "DONE(d!)" "CANCELLED(c@)")
(sequence "[ ](T)" "[-](P)" "[?](Q)" "|" "[X](D)")))
;; Keymaps ;; Keymaps
(map! :map org-mode-map (map! :map org-mode-map

View file

@ -1,17 +1,58 @@
-- This file *currently* contains the colorscheme for lualine (status line) -- This file *currently* contains the colorscheme for lualine (status line)
local colors = {
bg = "#202328", local M = {}
fg = "#bbc2cf", -- Mocha
yellow = "#ECBE7B", M.scheme = {
cyan = "#008080", rosewater = "#f5e0dc",
darkblue = "#081633", flamingo = "#f2cdcd",
green = "#98be65", pink = "#f5c2e7",
orange = "#FF8800", mauve = "#cba6f7",
violet = "#a9a1e1", red = "#f38ba8",
magenta = "#c678dd", maroon = "#eba0ac",
purple = "#c678dd", peach = "#fab387",
blue = "#51afef", yellow = "#f9e2af",
red = "#ec5f67", green = "#a6e3a1",
teal = "#94e2d5",
sky = "#89dceb",
sapphire = "#74c7ec",
blue = "#89b4fa",
lavender = "#b4befe",
text = "#cdd6f4",
subtext1 = "#bac2de",
subtext0 = "#a6adc8",
overlay2 = "#9399b2",
overlay1 = "#7f849c",
overlay0 = "#6c7086",
surface2 = "#585b70",
surface1 = "#45475a",
surface0 = "#313244",
base = "#1e1e2e",
mantle = "#181825",
crust = "#11111b",
}
M.accent = M.scheme.pink
M.mode = {
n = M.scheme.sky,
i = M.scheme.green,
v = M.scheme.mauve,
[""] = M.scheme.mauve,
V = M.scheme.mauve,
c = M.scheme.mauve,
no = M.scheme.red,
s = M.scheme.orange,
S = M.scheme.orange,
[""] = M.scheme.orange,
ic = M.scheme.yellow,
R = M.scheme.violet,
Rv = M.scheme.violet,
cv = M.scheme.red,
ce = M.scheme.red,
r = M.scheme.cyan,
rm = M.scheme.cyan,
["r?"] = M.scheme.cyan,
["!"] = M.scheme.red,
t = M.scheme.red,
} }
return colors return M

View file

@ -1,2 +1,2 @@
-- Change the colorscheme here, use SPACE u i or :Telescope colorscheme to change colorscheme -- Change the colorscheme here, use SPACE u i or :Telescope colorscheme to change colorscheme
vim.cmd.colorscheme("catppuccin-mocha") vim.cmd.colorscheme("catppuccin")

View file

@ -17,6 +17,33 @@ local M = {
Rename = "", Rename = "",
Branch = "", Branch = "",
}, },
lsp_kind = {
Text = "󰉿",
Method = "󰆧",
Function = "󰊕",
Constructor = "",
Field = "󰜢",
Variable = "󰀫",
Class = "󰠱",
Interface = "",
Module = "",
Property = "󰜢",
Unit = "󰑭",
Value = "󰎠",
Enum = "",
Keyword = "󰌋",
Snippet = "",
Color = "󰏘",
File = "󰈙",
Reference = "󰈇",
Folder = "󰉋",
EnumMember = "",
Constant = "󰏿",
Struct = "󰙅",
Event = "",
Operator = "󰆕",
TypeParameter = "󰅲",
},
} }
return M return M

View file

@ -45,7 +45,10 @@ opt.termguicolors = true
opt.foldmethod = "expr" opt.foldmethod = "expr"
-- Folding provided by treesitter -- Folding provided by treesitter
opt.foldexpr = "nvim_treesitter#foldexpr()" opt.foldexpr = "nvim_treesitter#foldexpr()"
-- Disable fold at start
opt.foldlevelstart = 99
opt.foldlevel = 99 opt.foldlevel = 99
opt.foldenable = false
opt.foldlevelstart = 1 opt.foldlevelstart = 1
-- Disable status line: Use `lualine` instead -- Disable status line: Use `lualine` instead

View file

@ -8,6 +8,7 @@ local keymaps_general = vim.tbl_extend("force", {}, require("keymaps.leaders"),
-- Tables cannot be merged since `mode` are set in some keymaps of `keymaps_basic` -- Tables cannot be merged since `mode` are set in some keymaps of `keymaps_basic`
local keymaps_basic = require("keymaps.basic") local keymaps_basic = require("keymaps.basic")
local keymaps_buffer = require("keymaps.buffer") local keymaps_buffer = require("keymaps.buffer")
local keymaps_modifier = require("keymaps.modifier")
-- local keymaps_leader = require("keymaps.leaders") -- local keymaps_leader = require("keymaps.leaders")
-- local keymaps_lsp = require("keymaps.lspkeys") -- local keymaps_lsp = require("keymaps.lspkeys")
@ -15,6 +16,7 @@ utils.set_keymaps(keymaps_general)
utils.set_keymaps(keymaps_basic) utils.set_keymaps(keymaps_basic)
utils.set_keymaps(keymaps_nvim_tree_general) utils.set_keymaps(keymaps_nvim_tree_general)
utils.set_keymaps(keymaps_buffer) utils.set_keymaps(keymaps_buffer)
utils.set_keymaps(keymaps_modifier)
M.nvim_tree_keymaps = require("keymaps.nvim-tree").plugin M.nvim_tree_keymaps = require("keymaps.nvim-tree").plugin

View file

@ -0,0 +1,10 @@
local keymaps_modifier = {
-- Use C-w to move between windows
{ keys = "<C-w>h", cmd = "<C-w>h", opts = { desc = "left Window" } },
{ keys = "<C-w>n", cmd = "<C-w>j", opts = { desc = "Down Window" } },
{ keys = "<C-w>e", cmd = "<C-w>k", opts = { desc = "Up Window" } },
{ keys = "<C-w>i", cmd = "<C-w>l", opts = { desc = "Right Window" } },
{ keys = "<A-x>", cmd = "<Cmd>Telescope commands<CR>", opts = { desc = "Commands" } },
}
return keymaps_modifier

View file

@ -1,6 +1,21 @@
return { return {
-- Colorschemes -- Colorschemes
{ "catppuccin/nvim", name = "catppuccin" }, {
"catppuccin/nvim",
name = "catppuccin",
config = function()
require("catppuccin").setup({
floavor = "auto",
background = {
light = "latte",
dark = "mocha",
},
styles = {
-- keywords = { "underline" },
},
})
end,
},
{ "olimorris/onedarkpro.nvim" }, { "olimorris/onedarkpro.nvim" },
{ "rebelot/kanagawa.nvim" }, { "rebelot/kanagawa.nvim" },
-- Highlight objects under the cursor -- Highlight objects under the cursor

View file

@ -38,6 +38,7 @@ return {
mason_lspconfig.setup({ mason_lspconfig.setup({
ensure_installed = servers, ensure_installed = servers,
automatic_installation = false,
}) })
end, end,
}, },
@ -47,6 +48,12 @@ return {
"NoahTheDuke/vim-just", "NoahTheDuke/vim-just",
ft = { "just" }, ft = { "just" },
}, },
{
"akinsho/org-bullets.nvim",
config = function()
require("org-bullets").setup()
end,
},
{ {
"nvim-orgmode/orgmode", "nvim-orgmode/orgmode",
event = "VeryLazy", event = "VeryLazy",
@ -54,8 +61,16 @@ return {
config = function() config = function()
-- Setup orgmode -- Setup orgmode
require("orgmode").setup({ require("orgmode").setup({
org_agenda_files = "~/orgfiles/**/*", org_agenda_files = "~/OrgFiles/tasks/*",
org_default_notes_file = "~/orgfiles/refile.org", org_default_notes_file = "~/OrgFiles/tasks/inbox.org",
org_archive_location = "~/OrgFiles/archive/%s_archive::",
org_todo_keywords = { "TODO(t)", "NEXT(n)", "WAIT(w)", "|", "DONE(d)", "CANCELLED(c)" },
org_hide_leading_stars = true,
org_hide_emphasis_markers = true,
org_log_into_drawer = "LOGBOOK",
org_highlight_latex_and_related = "native",
org_startup_indented = true,
org_deadline_warning_days = 10,
}) })
-- NOTE: If you are using nvim-treesitter with ~ensure_installed = "all"~ option -- NOTE: If you are using nvim-treesitter with ~ensure_installed = "all"~ option

View file

@ -1,9 +1,14 @@
return { return {
"akinsho/bufferline.nvim", "akinsho/bufferline.nvim",
dependencies = "nvim-tree/nvim-web-devicons", -- 图标支持 dependencies = "nvim-tree/nvim-web-devicons", -- 图标支持
after = "catppuccin",
config = function() config = function()
require("bufferline").setup({ require("bufferline").setup({
options = { options = {
indicator = {
icon = "", -- this should be omitted if indicator style is not 'icon'
style = "icon",
},
diagnostics = "nvim_lsp", diagnostics = "nvim_lsp",
diagnostics_indicator = function(count, level, diagnostics_dict, context) diagnostics_indicator = function(count, level, diagnostics_dict, context)
local icon = level:match("error") and "" or "" local icon = level:match("error") and "" or ""
@ -19,6 +24,7 @@ return {
}, },
separator_style = "thin", separator_style = "thin",
}, },
highlights = require("catppuccin.groups.integrations.bufferline").get(),
}) })
end, end,
} }

View file

@ -13,61 +13,17 @@ local function diff_source()
end end
end end
local conditions = {
buffer_not_empty = function()
return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
end,
hide_in_width = function()
return vim.fn.winwidth(0) > 80
end,
check_git_workspace = function()
local filepath = vim.fn.expand("%:p:h")
local gitdir = vim.fn.finddir(".git", filepath .. ";")
return gitdir and #gitdir > 0 and #gitdir < #filepath
end,
}
local mode_color = {
n = colors.blue,
i = colors.green,
v = colors.magenta,
[""] = colors.magenta,
V = colors.magenta,
c = colors.magenta,
no = colors.red,
s = colors.orange,
S = colors.orange,
[""] = colors.orange,
ic = colors.yellow,
R = colors.violet,
Rv = colors.violet,
cv = colors.red,
ce = colors.red,
r = colors.cyan,
rm = colors.cyan,
["r?"] = colors.cyan,
["!"] = colors.red,
t = colors.red,
}
local mode_color_bg = function()
return { fg = colors.bg, bg = mode_color[vim.fn.mode()] }
end
-- local mode_color_fg = function()
-- return { fg = mode_color[vim.fn.mode()] }
-- end
M.mode = { M.mode = {
function() function()
return "" return ""
end, end,
color = mode_color_bg, -- color = mode_color_bg,
} }
M.git = { M.git = {
"branch", "branch",
icon = icons.git.Branch, icon = icons.git.Branch,
color = { fg = colors.violet, gui = "bold" }, color = { fg = colors.scheme.violet, gui = "bold" },
} }
M.diagnostics = { M.diagnostics = {
@ -99,31 +55,31 @@ M.lsp = {
return msg return msg
end, end,
icon = icons.lsp, icon = icons.lsp,
color = { fg = colors.yellow, gui = "italic" }, color = { fg = colors.scheme.yellow, gui = "italic" },
} }
M.filetype = { M.filetype = {
function() function()
return vim.bo.filetype return vim.bo.filetype
end, end,
color = { fg = colors.blue, gui = "bold" }, color = { fg = colors.scheme.blue, gui = "bold" },
} }
M.eol = { M.eol = {
function() function()
return vim.bo.eol == true and icons.eol or "" return vim.bo.eol == true and icons.eol or ""
end, end,
color = { fg = colors.red }, color = { fg = colors.scheme.red },
} }
M.command = { M.command = {
"command", "command",
color = { fg = colors.green, gui = "bold" }, color = { fg = colors.scheme.green, gui = "bold" },
} }
M.encoding = { M.encoding = {
"o:encoding", "o:encoding",
color = { fg = colors.green, gui = "bold" }, color = { fg = colors.scheme.green, gui = "bold" },
} }
M.indent = { M.indent = {
@ -134,17 +90,6 @@ M.indent = {
padding = 1, padding = 1,
} }
-- M.diff = {
-- "diff",
-- -- Is it me or the symbol for modified us really weird
-- symbols = { added = " ", modified = "󰝤 ", removed = " " },
-- diff_color = {
-- added = { fg = colors.green },
-- modified = { fg = colors.orange },
-- removed = { fg = colors.red },
-- },
-- cond = conditions.hide_in_width,
-- }
M.diff = { M.diff = {
"diff", "diff",
source = diff_source, source = diff_source,
@ -156,13 +101,34 @@ M.diff = {
}, },
padding = { left = 2, right = 1 }, padding = { left = 2, right = 1 },
diff_color = { diff_color = {
added = { fg = colors.green }, added = { fg = colors.scheme.green },
modified = { fg = colors.yellow }, modified = { fg = colors.scheme.yellow },
removed = { fg = colors.red }, removed = { fg = colors.scheme.red },
}, },
cond = nil, cond = nil,
} }
M.progress = { "progress", color = mode_color_bg } M.progress = {
"progress",
}
-- local conditions = {
-- buffer_not_empty = function()
-- return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
-- end,
-- hide_in_width = function()
-- return vim.fn.winwidth(0) > 80
-- end,
-- check_git_workspace = function()
-- local filepath = vim.fn.expand("%:p:h")
-- local gitdir = vim.fn.finddir(".git", filepath .. ";")
-- return gitdir and #gitdir > 0 and #gitdir < #filepath
-- end,
-- }
-- local mode_color = colors.mode
--
-- local mode_color_bg = function()
-- return { fg = colors.mantle, bg = mode_color[vim.fn.mode()] }
-- end
return M return M

View file

@ -5,6 +5,11 @@ local lualine = require("lualine")
local colors = require("config.colors") local colors = require("config.colors")
local components = require("plugins.mod.lualine.components") local components = require("plugins.mod.lualine.components")
--[[
VSCode Style:
Remote | Git Branch | Diagnostics | Command | | MID | | Line:Column | Indent | Encoding | EOL | File Type LSP | Notifications
--]]
-- Config -- Config
local config = { local config = {
options = { options = {
@ -12,25 +17,65 @@ local config = {
statusline = { "NvimTree", "alpha" }, statusline = { "NvimTree", "alpha" },
}, },
-- Disable sections and component separators -- Disable sections and component separators
component_separators = "", component_separators = { left = "", right = "" },
section_separators = "", section_separators = { left = "", right = "" },
theme = { theme = {
-- We are going to use lualine_c an lualine_x as left and -- We are going to use lualine_c an lualine_x as left and
-- right section. Both are highlighted by c theme . So we -- right section. Both are highlighted by c theme . So we
-- are just setting default looks o statusline -- are just setting default looks o statusline
normal = { c = { fg = colors.fg, bg = colors.bg } }, -- normal = { c = { fg = colors.mantle, bg = colors.mantle } },
inactive = { c = { fg = colors.fg, bg = colors.bg } }, -- visual = { c = { fg = colors.mantle, bg = colors.mauve } },
-- normal = { c = { fg = colors.mantle, bg = colors.sapphire } },
inactive = { c = { fg = colors.mantle, bg = colors.mantle } },
normal = {
a = {
fg = colors.scheme.mantle,
bg = colors.mode.n,
},
b = {
bg = colors.scheme.surface2,
},
c = {
bg = colors.scheme.crust,
},
},
visual = {
a = {
fg = colors.scheme.mantle,
bg = colors.mode.v,
},
},
insert = {
a = {
fg = colors.scheme.mantle,
bg = colors.mode.i,
},
},
}, },
}, },
sections = { sections = {
-- these are to remove the defaults -- these are to remove the defaults
lualine_a = {}, lualine_a = {
lualine_b = {}, components.mode,
lualine_y = {}, },
lualine_z = {}, lualine_b = {
-- These will be filled later components.diff,
lualine_c = {}, },
lualine_x = {}, lualine_c = {
components.diagnostics,
},
lualine_x = {
components.indent,
components.encoding,
components.eol,
},
lualine_y = {
components.filetype,
components.lsp,
},
lualine_z = {
components.progress,
},
}, },
inactive_sections = { inactive_sections = {
-- these are to remove the defaults -- these are to remove the defaults
@ -43,31 +88,4 @@ local config = {
}, },
} }
-- Inserts a component in lualine_c at left section
local function ins_left(component)
table.insert(config.sections.lualine_c, component)
end
-- Inserts a component in lualine_x at right section
local function ins_right(component)
table.insert(config.sections.lualine_x, component)
end
--[[
VSCode Style:
Remote | Git Branch | Diagnostics | Command | | MID | | Line:Column | Indent | Encoding | EOL | File Type LSP | Notifications
--]]
ins_left(components.mode)
ins_left(components.diff)
ins_left(components.git)
ins_left(components.diagnostics)
ins_left(components.command)
ins_right(components.indent)
ins_right(components.encoding)
ins_right(components.eol)
ins_right(components.filetype)
ins_right(components.lsp)
ins_right(components.progress)
lualine.setup(config) lualine.setup(config)

View file

@ -31,8 +31,15 @@ return {
local raw_keymaps = require("keymaps").cmp_nvim_keymaps(cmp.mapping) local raw_keymaps = require("keymaps").cmp_nvim_keymaps(cmp.mapping)
local mapped = set_keymaps(raw_keymaps) local mapped = set_keymaps(raw_keymaps)
local kind_icons = require("config.icons").lsp_kind
-- 配置 nvim-cmp -- 配置 nvim-cmp
cmp.setup({ cmp.setup({
formatting = {
format = function(entry, vim_item)
vim_item.kind = string.format("%s %s", kind_icons[vim_item.kind] or "", vim_item.kind)
return vim_item
end,
},
snippet = { snippet = {
expand = function(args) expand = function(args)
require("luasnip").lsp_expand(args.body) require("luasnip").lsp_expand(args.body)

View file

@ -90,7 +90,7 @@ tabline.setup({
return function(config) return function(config)
config.hide_tab_bar_if_only_one_tab = true config.hide_tab_bar_if_only_one_tab = true
config.tab_bar_at_bottom = true config.tab_bar_at_bottom = false
-- If set to false, the tab bar will be terminal-like -- If set to false, the tab bar will be terminal-like
config.use_fancy_tab_bar = false config.use_fancy_tab_bar = false
config.colors = { config.colors = {