mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 00:33:00 +00:00
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:
parent
1a1c8707ce
commit
2248d3a237
14 changed files with 244 additions and 127 deletions
|
|
@ -19,6 +19,13 @@
|
|||
;; Initial Visibility
|
||||
(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
|
||||
(map! :map org-mode-map
|
||||
|
|
|
|||
|
|
@ -1,17 +1,58 @@
|
|||
-- This file *currently* contains the colorscheme for lualine (status line)
|
||||
local colors = {
|
||||
bg = "#202328",
|
||||
fg = "#bbc2cf",
|
||||
yellow = "#ECBE7B",
|
||||
cyan = "#008080",
|
||||
darkblue = "#081633",
|
||||
green = "#98be65",
|
||||
orange = "#FF8800",
|
||||
violet = "#a9a1e1",
|
||||
magenta = "#c678dd",
|
||||
purple = "#c678dd",
|
||||
blue = "#51afef",
|
||||
red = "#ec5f67",
|
||||
|
||||
local M = {}
|
||||
-- Mocha
|
||||
M.scheme = {
|
||||
rosewater = "#f5e0dc",
|
||||
flamingo = "#f2cdcd",
|
||||
pink = "#f5c2e7",
|
||||
mauve = "#cba6f7",
|
||||
red = "#f38ba8",
|
||||
maroon = "#eba0ac",
|
||||
peach = "#fab387",
|
||||
yellow = "#f9e2af",
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
-- Change the colorscheme here, use SPACE u i or :Telescope colorscheme to change colorscheme
|
||||
vim.cmd.colorscheme("catppuccin-mocha")
|
||||
vim.cmd.colorscheme("catppuccin")
|
||||
|
|
|
|||
|
|
@ -17,6 +17,33 @@ local M = {
|
|||
Rename = "",
|
||||
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
|
||||
|
|
|
|||
|
|
@ -45,7 +45,10 @@ opt.termguicolors = true
|
|||
opt.foldmethod = "expr"
|
||||
-- Folding provided by treesitter
|
||||
opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
-- Disable fold at start
|
||||
opt.foldlevelstart = 99
|
||||
opt.foldlevel = 99
|
||||
opt.foldenable = false
|
||||
opt.foldlevelstart = 1
|
||||
|
||||
-- Disable status line: Use `lualine` instead
|
||||
|
|
|
|||
|
|
@ -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`
|
||||
local keymaps_basic = require("keymaps.basic")
|
||||
local keymaps_buffer = require("keymaps.buffer")
|
||||
local keymaps_modifier = require("keymaps.modifier")
|
||||
-- local keymaps_leader = require("keymaps.leaders")
|
||||
-- local keymaps_lsp = require("keymaps.lspkeys")
|
||||
|
||||
|
|
@ -15,6 +16,7 @@ utils.set_keymaps(keymaps_general)
|
|||
utils.set_keymaps(keymaps_basic)
|
||||
utils.set_keymaps(keymaps_nvim_tree_general)
|
||||
utils.set_keymaps(keymaps_buffer)
|
||||
utils.set_keymaps(keymaps_modifier)
|
||||
|
||||
M.nvim_tree_keymaps = require("keymaps.nvim-tree").plugin
|
||||
|
||||
|
|
|
|||
10
tools/nvim/lua/keymaps/modifier.lua
Normal file
10
tools/nvim/lua/keymaps/modifier.lua
Normal 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
|
||||
|
|
@ -1,6 +1,21 @@
|
|||
return {
|
||||
-- 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" },
|
||||
{ "rebelot/kanagawa.nvim" },
|
||||
-- Highlight objects under the cursor
|
||||
|
|
@ -24,10 +39,10 @@ return {
|
|||
})
|
||||
end,
|
||||
},
|
||||
{ import = "plugins.mod.alpha-nvim" }, -- Dashboard
|
||||
{ import = "plugins.mod.alpha-nvim" }, -- Dashboard
|
||||
{ import = "plugins.mod.winbar-nvim" }, -- Breadcrumb
|
||||
{ import = "plugins.mod.bufferline" }, -- Buffer Top Bar
|
||||
{ -- Git Blames, Changes
|
||||
{ import = "plugins.mod.bufferline" }, -- Buffer Top Bar
|
||||
{ -- Git Blames, Changes
|
||||
"lewis6991/gitsigns.nvim",
|
||||
config = function()
|
||||
require("gitsigns").setup({
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ return {
|
|||
require("luasnip").config.setup({ enable_autosnippets = true })
|
||||
end,
|
||||
},
|
||||
{ "williamboman/mason.nvim", config = true },
|
||||
{ "williamboman/mason.nvim", config = true },
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
lazy = false,
|
||||
|
|
@ -38,6 +38,7 @@ return {
|
|||
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = servers,
|
||||
automatic_installation = false,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
|
@ -47,6 +48,12 @@ return {
|
|||
"NoahTheDuke/vim-just",
|
||||
ft = { "just" },
|
||||
},
|
||||
{
|
||||
"akinsho/org-bullets.nvim",
|
||||
config = function()
|
||||
require("org-bullets").setup()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-orgmode/orgmode",
|
||||
event = "VeryLazy",
|
||||
|
|
@ -54,8 +61,16 @@ return {
|
|||
config = function()
|
||||
-- Setup orgmode
|
||||
require("orgmode").setup({
|
||||
org_agenda_files = "~/orgfiles/**/*",
|
||||
org_default_notes_file = "~/orgfiles/refile.org",
|
||||
org_agenda_files = "~/OrgFiles/tasks/*",
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
return {
|
||||
"akinsho/bufferline.nvim",
|
||||
dependencies = "nvim-tree/nvim-web-devicons", -- 图标支持
|
||||
after = "catppuccin",
|
||||
config = function()
|
||||
require("bufferline").setup({
|
||||
options = {
|
||||
indicator = {
|
||||
icon = "▎", -- this should be omitted if indicator style is not 'icon'
|
||||
style = "icon",
|
||||
},
|
||||
diagnostics = "nvim_lsp",
|
||||
diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
||||
local icon = level:match("error") and " " or " "
|
||||
|
|
@ -19,6 +24,7 @@ return {
|
|||
},
|
||||
separator_style = "thin",
|
||||
},
|
||||
highlights = require("catppuccin.groups.integrations.bufferline").get(),
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,61 +13,17 @@ local function diff_source()
|
|||
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 = {
|
||||
function()
|
||||
return ""
|
||||
end,
|
||||
color = mode_color_bg,
|
||||
-- color = mode_color_bg,
|
||||
}
|
||||
|
||||
M.git = {
|
||||
"branch",
|
||||
icon = icons.git.Branch,
|
||||
color = { fg = colors.violet, gui = "bold" },
|
||||
color = { fg = colors.scheme.violet, gui = "bold" },
|
||||
}
|
||||
|
||||
M.diagnostics = {
|
||||
|
|
@ -99,31 +55,31 @@ M.lsp = {
|
|||
return msg
|
||||
end,
|
||||
icon = icons.lsp,
|
||||
color = { fg = colors.yellow, gui = "italic" },
|
||||
color = { fg = colors.scheme.yellow, gui = "italic" },
|
||||
}
|
||||
|
||||
M.filetype = {
|
||||
function()
|
||||
return vim.bo.filetype
|
||||
end,
|
||||
color = { fg = colors.blue, gui = "bold" },
|
||||
color = { fg = colors.scheme.blue, gui = "bold" },
|
||||
}
|
||||
|
||||
M.eol = {
|
||||
function()
|
||||
return vim.bo.eol == true and icons.eol or ""
|
||||
end,
|
||||
color = { fg = colors.red },
|
||||
color = { fg = colors.scheme.red },
|
||||
}
|
||||
|
||||
M.command = {
|
||||
"command",
|
||||
color = { fg = colors.green, gui = "bold" },
|
||||
color = { fg = colors.scheme.green, gui = "bold" },
|
||||
}
|
||||
|
||||
M.encoding = {
|
||||
"o:encoding",
|
||||
color = { fg = colors.green, gui = "bold" },
|
||||
color = { fg = colors.scheme.green, gui = "bold" },
|
||||
}
|
||||
|
||||
M.indent = {
|
||||
|
|
@ -134,17 +90,6 @@ M.indent = {
|
|||
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 = {
|
||||
"diff",
|
||||
source = diff_source,
|
||||
|
|
@ -156,13 +101,34 @@ M.diff = {
|
|||
},
|
||||
padding = { left = 2, right = 1 },
|
||||
diff_color = {
|
||||
added = { fg = colors.green },
|
||||
modified = { fg = colors.yellow },
|
||||
removed = { fg = colors.red },
|
||||
added = { fg = colors.scheme.green },
|
||||
modified = { fg = colors.scheme.yellow },
|
||||
removed = { fg = colors.scheme.red },
|
||||
},
|
||||
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
|
||||
|
|
|
|||
|
|
@ -5,6 +5,11 @@ local lualine = require("lualine")
|
|||
local colors = require("config.colors")
|
||||
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
|
||||
local config = {
|
||||
options = {
|
||||
|
|
@ -12,25 +17,65 @@ local config = {
|
|||
statusline = { "NvimTree", "alpha" },
|
||||
},
|
||||
-- Disable sections and component separators
|
||||
component_separators = "",
|
||||
section_separators = "",
|
||||
component_separators = { left = "", right = "" },
|
||||
section_separators = { left = "", right = "" },
|
||||
theme = {
|
||||
-- We are going to use lualine_c an lualine_x as left and
|
||||
-- right section. Both are highlighted by c theme . So we
|
||||
-- are just setting default looks o statusline
|
||||
normal = { c = { fg = colors.fg, bg = colors.bg } },
|
||||
inactive = { c = { fg = colors.fg, bg = colors.bg } },
|
||||
-- normal = { c = { fg = colors.mantle, bg = colors.mantle } },
|
||||
-- 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 = {
|
||||
-- these are to remove the defaults
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
-- These will be filled later
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_a = {
|
||||
components.mode,
|
||||
},
|
||||
lualine_b = {
|
||||
components.diff,
|
||||
},
|
||||
lualine_c = {
|
||||
components.diagnostics,
|
||||
},
|
||||
lualine_x = {
|
||||
components.indent,
|
||||
components.encoding,
|
||||
components.eol,
|
||||
},
|
||||
lualine_y = {
|
||||
components.filetype,
|
||||
components.lsp,
|
||||
},
|
||||
lualine_z = {
|
||||
components.progress,
|
||||
},
|
||||
},
|
||||
inactive_sections = {
|
||||
-- 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)
|
||||
|
|
|
|||
|
|
@ -31,8 +31,15 @@ return {
|
|||
|
||||
local raw_keymaps = require("keymaps").cmp_nvim_keymaps(cmp.mapping)
|
||||
local mapped = set_keymaps(raw_keymaps)
|
||||
local kind_icons = require("config.icons").lsp_kind
|
||||
-- 配置 nvim-cmp
|
||||
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 = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ tabline.setup({
|
|||
|
||||
return function(config)
|
||||
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
|
||||
config.use_fancy_tab_bar = false
|
||||
config.colors = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue