Skip to content

Commit

Permalink
update dotfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
guodongq committed Sep 9, 2024
1 parent 4419e7e commit 8535533
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 129 deletions.
28 changes: 15 additions & 13 deletions .config/nvim/lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"aerial.nvim": { "branch": "master", "commit": "b59e01e4380932b375ecff165b48a9400c4af929" },
"alpha-nvim": { "branch": "main", "commit": "b6f4129302db197a7249e67a90de3f2b676de13e" },
"bufferline.nvim": { "branch": "main", "commit": "2e3c8cc5a57ddd32f1edd2ffd2ccb10c09421f6c" },
"catppuccin": { "branch": "main", "commit": "4fd72a9ab64b393c2c22b168508fd244877fec96" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
Expand All @@ -15,41 +16,42 @@
"friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" },
"gruvbox.nvim": { "branch": "main", "commit": "7a1b23e4edf73a39642e77508ee6b9cbb8c60f9e" },
"hop.nvim": { "branch": "master", "commit": "8f51ef02700bb3cdcce94e92eff16170a6343c4f" },
"indent-blankline.nvim": { "branch": "master", "commit": "db926997af951da38e5004ec7b9fbdc480b48f5d" },
"indent-blankline.nvim": { "branch": "master", "commit": "18603eb949eba08300799f64027af11ef922283f" },
"lazy.nvim": { "branch": "main", "commit": "48b52b5cfcf8f88ed0aff8fde573a5cc20b1306d" },
"lazydev.nvim": { "branch": "main", "commit": "491452cf1ca6f029e90ad0d0368848fac717c6d2" },
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
"luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "482350b050bd413931c2cdd4857443c3da7d57cb" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"maximizer.nvim": { "branch": "main", "commit": "a517c762168bc1f9881f67d257fe9565712776f0" },
"mini.nvim": { "branch": "main", "commit": "73f2e7a596bbb4e6ae6728d3a4426221ffc9512d" },
"nvim-autopairs": { "branch": "master", "commit": "19606af7c039271d5aa96bceff101e7523af3136" },
"mini.nvim": { "branch": "main", "commit": "8413efde2546be4dec9ea424bc6af346a14dffbe" },
"nvim-autopairs": { "branch": "master", "commit": "fd2badc24e675f947162a16c124d395bde80dbd6" },
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
"nvim-dap": { "branch": "master", "commit": "281a2e4cd1e7a17cea7ecb1745d84a8ab1249925" },
"nvim-dap": { "branch": "master", "commit": "20a4859ebde1c9bc8e96f8cc11a20667e7fdd516" },
"nvim-dap-go": { "branch": "main", "commit": "5511788255c92bdd845f8d9690f88e2e0f0ff9f2" },
"nvim-dap-ui": { "branch": "master", "commit": "1c351e4e417d4691da12948b6ecf966936a56d28" },
"nvim-lint": { "branch": "master", "commit": "debabca63c0905b59ce596a55a8e33eafdf66342" },
"nvim-lspconfig": { "branch": "master", "commit": "3ad562700d0615818bf358268ac8914f6ce2b079" },
"nvim-lint": { "branch": "master", "commit": "a7ce9c78a7c710c28bee56dfab10a5c0c80b7fb5" },
"nvim-lspconfig": { "branch": "master", "commit": "bdbc65aadc708ce528efb22bca5f82a7cca6b54d" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-spectre": { "branch": "master", "commit": "ba7fb777edff6c1fbbeffd343e113af64c04e90a" },
"nvim-tree.lua": { "branch": "master", "commit": "ad0b95dee55955817af635fa121f6e2486b10583" },
"nvim-treesitter": { "branch": "master", "commit": "2d8f0f37c4056022b6643cbe8671319881f8b369" },
"nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" },
"nvim-tree.lua": { "branch": "master", "commit": "d41b4ca013ed89e41b9c0ecbdae5f1633e42f7fa" },
"nvim-treesitter": { "branch": "master", "commit": "4770d9a1a77b0cc2b723c646c3dbe43a9133e5db" },
"nvim-web-devicons": { "branch": "master", "commit": "9793801f974bba70e4ac5d7eae6c4f5659993d8e" },
"nvim-window": { "branch": "main", "commit": "81f29840ac3aaeea6fc2153edfabebd00d692476" },
"plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "8f47c3d70286a85940cafe990a64b0eac1033671" },
"telescope-file-browser.nvim": { "branch": "master", "commit": "a46780830b576049c675680650f773bedfa8677a" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "5f73b24aeb94f5274c218955573153c69ce4d1ee" },
"spaceduck": { "branch": "master", "commit": "f476d6804114d04295ecad83979c7b3946b08010" },
"telescope-file-browser.nvim": { "branch": "master", "commit": "c5a14e0550699a7db575805cdb9ddc969ba0f1f5" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
"telescope-project.nvim": { "branch": "master", "commit": "1aaf16580a614601a7f7077d9639aeb457dc5559" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"todo-comments.nvim": { "branch": "main", "commit": "319c01b99b7a8c9ac2066bf0efd4d6ec68fef444" },
"toggleterm.nvim": { "branch": "main", "commit": "48be57eaba817f038d61bbf64d2c597f578c0827" },
"tokyonight.nvim": { "branch": "main", "commit": "4b386e66a9599057587c30538d5e6192e3d1c181" },
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" },
"vim-sleuth": { "branch": "master", "commit": "cd9d382e33bb817abe7f10cdc3a606bf1d491d75" },
"which-key.nvim": { "branch": "main", "commit": "bfec3d6bc0a9b0b2cb11644642f78c2c3915eef0" }
}
118 changes: 61 additions & 57 deletions .config/nvim/lua/config/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,59 +69,47 @@ require("lazy").setup({
{ -- Useful plugin to show you pending keybinds.
"folke/which-key.nvim",
event = "VimEnter", -- Sets the loading event to 'VimEnter'
keys = {
{
"<leader>?",
function()
require("which-key").show({ global = false })
end,
desc = "Buffer Local Keymaps (which-key)",
},
},
config = function()
-- This is the function that runs, AFTER loading
require("which-key").setup({
icons = {
-- set icon mappings to true if you have a Nerd Font
mappings = vim.g.have_nerd_font,
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
-- default whick-key.nvim defined Nerd Font icons, otherwise define a string table
keys = vim.g.have_nerd_font and {} or {
Up = "<Up> ",
Down = "<Down> ",
Left = "<Left> ",
Right = "<Right> ",
C = "<C-…> ",
M = "<M-…> ",
D = "<D-…> ",
S = "<S-…> ",
CR = "<CR> ",
Esc = "<Esc> ",
ScrollWheelDown = "<ScrollWheelDown> ",
ScrollWheelUp = "<ScrollWheelUp> ",
NL = "<NL> ",
BS = "<BS> ",
Space = "<Space> ",
Tab = "<Tab> ",
F1 = "<F1>",
F2 = "<F2>",
F3 = "<F3>",
F4 = "<F4>",
F5 = "<F5>",
F6 = "<F6>",
F7 = "<F7>",
F8 = "<F8>",
F9 = "<F9>",
F10 = "<F10>",
F11 = "<F11>",
F12 = "<F12>",
},
opts = {
icons = {
-- set icon mappings to true if you have a Nerd Font
mappings = vim.g.have_nerd_font,
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
-- default whick-key.nvim defined Nerd Font icons, otherwise define a string table
keys = vim.g.have_nerd_font and {} or {
Up = '<Up> ',
Down = '<Down> ',
Left = '<Left> ',
Right = '<Right> ',
C = '<C-…> ',
M = '<M-…> ',
D = '<D-…> ',
S = '<S-…> ',
CR = '<CR> ',
Esc = '<Esc> ',
ScrollWheelDown = '<ScrollWheelDown> ',
ScrollWheelUp = '<ScrollWheelUp> ',
NL = '<NL> ',
BS = '<BS> ',
Space = '<Space> ',
Tab = '<Tab> ',
F1 = '<F1>',
F2 = '<F2>',
F3 = '<F3>',
F4 = '<F4>',
F5 = '<F5>',
F6 = '<F6>',
F7 = '<F7>',
F8 = '<F8>',
F9 = '<F9>',
F10 = '<F10>',
F11 = '<F11>',
F12 = '<F12>',
},
})
},

-- Document existing key chains
require("which-key").add({
{ "<leader>c", group = "[C]ode" },
spec = {
{ "<leader>c", group = "[C]ode", mode = { "n", "x" } },
{ "<leader>d", group = "[D]ocument" },
{ "<leader>r", group = "[R]ename" },
{ "<leader>s", group = "[S]earch" },
Expand All @@ -141,8 +129,17 @@ require("lazy").setup({
{ "<leader>H", "<cmd>nohlsearch<cr>", desc = "Clear [H]ighlights" },
{ "<leader>Q", "<cmd>confirm qall<cr>", desc = "[Q]uit Neovim" },
{ "<leader>S", "<cmd>w!<cr>", desc = "[S]ave file" },
})
end,
},
},
keys = {
{
"<leader>?",
function()
require("which-key").show({ global = false })
end,
desc = "Buffer Local Keymaps (which-key)",
},
},
},

-- NOTE: Plugins can specify dependencies.
Expand Down Expand Up @@ -343,8 +340,9 @@ require("lazy").setup({
--
-- In this case, we create a function that lets us more easily define mappings specific
-- for LSP related items. It sets the mode, buffer and description for us each time.
local map = function(keys, func, desc)
vim.keymap.set("n", keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
local map = function(keys, func, desc, mode)
mode = mode or "n"
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
end

-- Jump to the definition of the word under your cursor.
Expand Down Expand Up @@ -382,7 +380,7 @@ require("lazy").setup({

-- Execute a code action, usually your cursor needs to be on top of an error
-- or a suggestion from your LSP for this to activate.
map("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction")
map("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction", { "n", "x" })

-- code outline
map("<leader>co", "<cmd>AerialToggle float<cr>", "[C]ode [O]utline")
Expand Down Expand Up @@ -521,7 +519,7 @@ require("lazy").setup({
{
"<leader>f",
function()
require("conform").format({ async = true, lsp_fallback = true })
require("conform").format({ async = true, lsp_format = "fallback" })
end,
mode = "",
desc = "[F]ormat buffer",
Expand All @@ -534,9 +532,15 @@ require("lazy").setup({
-- have a well standardized coding style. You can add additional
-- languages here or re-enable it for the disabled ones.
local disable_filetypes = { c = true, cpp = true }
local lsp_format_opt
if disable_filetypes[vim.bo[bufnr].filetype] then
lsp_format_opt = 'never'
else
lsp_format_opt = 'fallback'
end
return {
timeout_ms = 500,
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
lsp_format = lsp_format_opt,
}
end,
formatters_by_ft = {
Expand Down
4 changes: 2 additions & 2 deletions .config/nvim/lua/plugins/colorscheme.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ return {
{ -- tokyonight
"folke/tokyonight.nvim",
priority = 1000, -- Make sure to load this before all the other start plugins.
enabled = true,
enabled = false,
init = function()
-- Load the colorscheme here.
-- Like many other themes, this one has different styles, and you could load
Expand All @@ -22,7 +22,7 @@ return {
"ellisonleao/gruvbox.nvim",
enabled = true,
--lazy = false,
config = false,
-- config = false,
priority = 1000,
init = function()
vim.opt.background = "dark"
Expand Down
110 changes: 55 additions & 55 deletions .config/nvim/lua/plugins/nvim-tree.lua
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
-- https://github.com/nvim-tree/nvim-tree.lua
return {
"nvim-tree/nvim-tree.lua",
version = "*",
lazy = false,
dependencies = {
{ "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font },
},
keys = {
{ "<leader>e", "<cmd>NvimTreeToggle<cr>", desc = "Nvim: Toggle [E]xplorer" },
},
opts = {
on_attach = function(bufnr)
local api = require("nvim-tree.api")
"nvim-tree/nvim-tree.lua",
version = "*",
lazy = false,
dependencies = {
{ "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font },
},
keys = {
{ "<leader>e", "<cmd>NvimTreeToggle<cr>", desc = "Nvim: Toggle [E]xplorer", silent = true },
},
opts = {
on_attach = function(bufnr)
local api = require("nvim-tree.api")

local function opts(desc)
return { desc = "nvim-tree:" .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
local function opts(desc)
return { desc = "nvim-tree:" .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end

-- default mappings
api.config.mappings.default_on_attach(bufnr)
-- custom mappings
vim.keymap.set("n", "u", api.tree.change_root_to_parent, opts("Up"))
vim.keymap.set("n", "?", api.tree.toggle_help, opts("Help"))
vim.keymap.set("n", "C", api.tree.change_root_to_node, opts("CD"))
vim.keymap.set("n", "l", api.node.open.edit, opts("Open"))
end,
update_focused_file = {
enable = true,
update_cwd = true,
},
sort = {
sorter = "case_sensitive",
},
view = {
-- width = 30,
adaptive_size = true,
side = "left",
},
renderer = {
group_empty = true,
},
diagnostics = {
enable = true,
show_on_dirs = false,
},
filters = {
dotfiles = true,
},
},
config = function(_, opts)
-- disable netrw at the very start of your init.lua
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- default mappings
api.config.mappings.default_on_attach(bufnr)
-- custom mappings
vim.keymap.set("n", "u", api.tree.change_root_to_parent, opts("Up"))
vim.keymap.set("n", "?", api.tree.toggle_help, opts("Help"))
vim.keymap.set("n", "C", api.tree.change_root_to_node, opts("CD"))
vim.keymap.set("n", "l", api.node.open.edit, opts("Open"))
end,
update_focused_file = {
enable = true,
update_cwd = true,
},
sort = {
sorter = "case_sensitive",
},
view = {
-- width = 30,
adaptive_size = true,
side = "left",
},
renderer = {
group_empty = true,
},
diagnostics = {
enable = true,
show_on_dirs = false,
},
filters = {
dotfiles = true,
},
},
config = function(_, opts)
-- disable netrw at the very start of your init.lua
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1

-- optionally enable 24-bit colour
vim.opt.termguicolors = vim.g.have_nerd_font
-- optionally enable 24-bit colour
vim.opt.termguicolors = vim.g.have_nerd_font

require("nvim-tree").setup(opts)
require("nvim-tree").setup(opts)

vim.cmd([[
vim.cmd([[
:hi NvimTreeExecFile guifg=#ffa0a0
:hi NvimTreeSpecialFile guifg=#ff80ff gui=underline
:hi NvimTreeSymlink guifg=Yellow gui=italic
:hi link NvimTreeImageFile Title
]])
end,
end,
}

Loading

0 comments on commit 8535533

Please sign in to comment.