mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
feat(nvim): Build another nvim from scratch
* Neovim: Backup original LazyVim setup to .config/nvim.lazy.d * Neovim: Currently done with basic completions and LSP * Git: Always use ssh to connect github remote * Zsh: Add more antidots config
This commit is contained in:
parent
74f2883139
commit
eeb3387112
53 changed files with 1617 additions and 682 deletions
|
|
@ -20,3 +20,5 @@
|
|||
required = true
|
||||
[safe]
|
||||
directory = %(prefix)///wsl.localhost/Arch/home/js0ny/inf2c/coursework-2-mips-simulator-js0ny
|
||||
[url "git@github.com:"]
|
||||
insteadOf = https://github.com/
|
||||
|
|
|
|||
8
.config/nvim.lazy.d/init.lua
Normal file
8
.config/nvim.lazy.d/init.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
-- bootstrap lazy.nvim, LazyVim and your plugins
|
||||
if (vim.g.vscode) then
|
||||
print("VSCode detected, skipping lazy loading")
|
||||
require("vscode.code")
|
||||
else
|
||||
require("config.lazy")
|
||||
-- require("config.lazy")
|
||||
end
|
||||
8
.config/nvim.lazy.d/lazy-lock.json
Normal file
8
.config/nvim.lazy.d/lazy-lock.json
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "be7bd4c5f860c79da97af3a26d489af50babfd4b" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "c646154d6e4db9b2979eeb517d0b817ad00c9c47" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "efb2e9c607cab1e4f7171493b7c6f63bd39073fc" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }
|
||||
}
|
||||
10
.config/nvim.lazy.d/lazyvim.json
Normal file
10
.config/nvim.lazy.d/lazyvim.json
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"extras": [
|
||||
"lazyvim.plugins.extras.ai.copilot",
|
||||
"lazyvim.plugins.extras.ai.copilot-chat"
|
||||
],
|
||||
"news": {
|
||||
"NEWS.md": "7429"
|
||||
},
|
||||
"version": 7
|
||||
}
|
||||
146
.config/nvim.lazy.d/lua/config/keymaps.lua
Normal file
146
.config/nvim.lazy.d/lua/config/keymaps.lua
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
-- Keymaps are automatically loaded on the VeryLazy event
|
||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||
-- Add any additional keymaps here
|
||||
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- ================= GENERAL KEYBINDS =================
|
||||
-- SAVE/QUIT {{{
|
||||
vim.keymap.set("n", "Q", "<cmd>q<CR>", { desc = "Q to quit" })
|
||||
vim.keymap.set("n", "<C-s>", "<cmd>w<CR>", { desc = "S to write file" })
|
||||
--}}}
|
||||
|
||||
-- NVIM CONFIG SHORTCUTS {{{
|
||||
-- stylua: ignore
|
||||
vim.keymap.set("n", "<leader>rc", "<cmd>e $HOME/.config/nvim/lua/config/options.lua<CR>", { desc = "Open nvim options.lua" })
|
||||
vim.keymap.set("n", "<leader>rp", "<cmd>e $HOME/.config/nvim/lua/plugins/.<CR>", { desc = "lazy plugins dir" })
|
||||
--}}}
|
||||
|
||||
-- UNDO
|
||||
vim.keymap.set({ "n", "v" }, "l", "u", { desc = "Undo" })
|
||||
|
||||
-- INSERT
|
||||
vim.keymap.set({ "n", "v" }, "l", "i", { desc = "Insert" })
|
||||
vim.keymap.set({ "n", "v" }, "L", "I", { desc = "Insert at line start" })
|
||||
|
||||
-- YANK TO SYSTEM CLIPBOARD
|
||||
vim.keymap.set("v", "Y", '"+y', { desc = "Copy to (System) Clipboard" })
|
||||
|
||||
-- SEARCH {{{
|
||||
vim.keymap.set("n", "<LEADER><CR>", "<CMD>nohlsearch<CR>", { desc = "clear search highlight" })
|
||||
--}}}
|
||||
|
||||
-- SPACE TO TAB{{{
|
||||
vim.keymap.set("n", "<LEADER>tt", "<CMD>%s/ /\t/g<CR>", { desc = "space to tab" })
|
||||
vim.keymap.set("v", "<LEADER>tt", "<CMD>s/ /\t/g<CR>", { desc = "space to tab" })
|
||||
--}}}
|
||||
|
||||
-- MISC {{{
|
||||
vim.keymap.set("n", "<LEADER>o", "za", { desc = "folding" })
|
||||
vim.keymap.set("i", "<C-y>", "<ESC>A {}<ESC>i<CR><ESC>ko", { desc = "insert a pair of {} and goto next line" })
|
||||
--}}}
|
||||
|
||||
-- ================= CURSOR MOVEMENT ===================== {{{
|
||||
-- NEW CURSOR MOVEMENT (ARROW KEY RESIZE WINDOWS)
|
||||
-- ^
|
||||
-- e
|
||||
-- < h i >
|
||||
-- n
|
||||
-- v
|
||||
--
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "e", "k", { desc = "move cursor ⇧" })
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "n", "j", { desc = "move cursor ⇩" })
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "h", "h", { desc = "move cursor ⇦" })
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "i", "l", { desc = "move cursor ⇨" })
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "E", "5k", { desc = "Move 5up K -> U" })
|
||||
vim.keymap.set({ "n", "v" }, "N", "5j", { desc = "Move 5down J -> E" })
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "H", "0", { desc = "Move start of line" })
|
||||
vim.keymap.set({ "n", "v" }, "I", "$", { desc = "Move end of line" })
|
||||
|
||||
vim.keymap.set("n", "gu", "gk", { desc = "move up gk -> gu" })
|
||||
vim.keymap.set("n", "ge", "gj", { desc = "move down gj -> ge" })
|
||||
|
||||
vim.keymap.set("n", "\v", "v$h", { desc = "???" })
|
||||
|
||||
-- FASTER IN-LINE NAVIGATION
|
||||
|
||||
-- SET h (SAME AS n, CURSOR LEFT) TO 'END OF WORD'
|
||||
vim.keymap.set("n", "j", "e", { desc = "Move cursor to end of word" })
|
||||
-- CTRL + U OR E WILL MOVE UP/DOWN THE VIEW PORT WITHOUT MOVING THE CURSOR
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "<C-e>", "5<C-y>", { desc = "Move viewport ⇧" })
|
||||
vim.keymap.set({ "n", "v" }, "<C-n>", "5<C-e>", { desc = "Move viewport ⇩" })
|
||||
|
||||
-- INSERT MODE CURSOR MOVEMENT
|
||||
vim.keymap.set("i", "<C-a>", "<ESC>A")
|
||||
|
||||
-- COMMAND MODE CURSOR MOVEMENT
|
||||
vim.keymap.set("c", "<C-a>", "<Home>")
|
||||
vim.keymap.set("c", "<C-e>", "<End>")
|
||||
vim.keymap.set("c", "<C-p>", "<Up>")
|
||||
vim.keymap.set("c", "<C-n>", "<Down>")
|
||||
vim.keymap.set("c", "<C-b>", "<Left>")
|
||||
vim.keymap.set("c", "<C-f>", "<Right>")
|
||||
vim.keymap.set("c", "<M-b>", "<S-Left>")
|
||||
vim.keymap.set("c", "<M-w>", "<S-Right>")
|
||||
--}}}
|
||||
|
||||
-- ================= SPLIT MANAGMENT ===================== {{{
|
||||
vim.keymap.set("n", "<C-w>E", "<CMD>set nosplitbelow<CR><CMD>split<CR><CMD>set splitbelow<CR>", { desc = "Split ⇧" })
|
||||
vim.keymap.set("n", "<C-w>N", "<CMD>set splitbelow<CR><CMD>split<CR>", { desc = "Split ⇩" })
|
||||
vim.keymap.set("n", "<C-w>H", "<CMD>set nosplitright<CR><CMD>vsplit<CR><CMD>set splitright<CR>", { desc = "Split ⇦" })
|
||||
vim.keymap.set("n", "<C-w>I", "<CMD>set splitright<CR><CMD>vsplit<CR>", { desc = "Split ⇨" })
|
||||
|
||||
vim.keymap.set({ "n", "t" }, "<C-w>e", "<C-w>k", { desc = "Move cursor to split ⇧" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-w>n", "<C-w>j", { desc = "Move cursor to split ⇩" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-w>h", "<C-w>h", { desc = "Move cursor to split ⇦" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-w>i", "<C-w>l", { desc = "Move cursor to split ⇨" })
|
||||
|
||||
vim.keymap.set({ "n", "t" }, "<C-e>", "<C-k>", { desc = "Move cursor to split ⇧" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-n>", "<C-j>", { desc = "Move cursor to split ⇩" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-h>", "<C-h>", { desc = "Move cursor to split ⇦" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-i>", "<C-l>", { desc = "Move cursor to split ⇨" })
|
||||
|
||||
vim.keymap.set("n", "<up>", "<CMD>res -5<CR>", { desc = "Resize split 0,-5" })
|
||||
vim.keymap.set("n", "<down>", "<CMD>res +5<CR>", { desc = "Resize split 0,+5" })
|
||||
vim.keymap.set("n", "<left>", "<CMD>vertical resize +5<CR>", { desc = "Resize split +5,0" })
|
||||
vim.keymap.set("n", "<right>", "<CMD>vertical resize -5<CR>", { desc = "Resize split -5,0" })
|
||||
|
||||
vim.keymap.set("n", "<C-w>H", "<C-w>t<C-w>K", { desc = "Make splits [H]orizontal" })
|
||||
vim.keymap.set("n", "<C-w>V", "<C-w>t<C-w>H", { desc = "Make splits [V]ertical" })
|
||||
|
||||
vim.keymap.set("n", "<C-w>ri", "<C-w>b<C-w>K", { desc = "Rotate splits 90" })
|
||||
vim.keymap.set("n", "<C-w>rh", "<C-w>b<C-w>H", { desc = "Rotate splits -90" })
|
||||
|
||||
vim.keymap.set("n", "<LEADER>q", "<C-w>j<CMD>q<CR>", { desc = "Close Split ⇩ (Below)" })
|
||||
--}}}
|
||||
|
||||
-- TAB MANAGEMENT {{{
|
||||
vim.keymap.set("n", "<TAB><TAB>", "<CMD>tabe<CR>", { desc = "New [Tab]" })
|
||||
|
||||
vim.keymap.set("n", "<TAB>h", "<CMD>-tabnext<CR>", { desc = "Select Tab ⇦" })
|
||||
vim.keymap.set("n", "<TAB>i", "<CMD>+tabnext<CR>", { desc = "Select Tab ⇨" })
|
||||
|
||||
vim.keymap.set("n", "<TAB>H", "<CMD>-tabmove<CR>", { desc = "Tab move ⇦" })
|
||||
vim.keymap.set("n", "<TAB>I", "<CMD>+tabmove<CR>", { desc = "Tab move ⇨" })
|
||||
|
||||
-- NOTE: Doesn't seem to work:
|
||||
-- vim.keymap.set("n", "<TAB>c", "<CMD>tab split<CR>", { desc = "New Tab from [C]urrent" })
|
||||
-- vim.keymap.set('n', '<LEADER>dw', '/\(\<\w\+\>\)\_s*\1', {desc='adjacent duplicate words'})
|
||||
|
||||
--vim.keymap.del("n", "<C-w>j")
|
||||
--vim.keymap.del("n", "<C-w>k")
|
||||
--vim.keymap.del("n", "<C-w>l")
|
||||
-- }}}
|
||||
|
||||
-- =================== TERM BEHAVIORS ====================
|
||||
vim.keymap.set("t", "<C-n>", "<C-\\><C-n>", { desc = "escape terminal, allowing excmds" })
|
||||
vim.keymap.set("t", "<C-o>", "<C-\\><C-n><C-o>", { desc = "close terminal" })
|
||||
|
||||
--vim: set fdm=marker fdl=0
|
||||
|
||||
-- buffers
|
||||
vim.keymap.set("n", "<S-h>", "<cmd>bprevious<cr>", { desc = "Prev Buffer" })
|
||||
vim.keymap.set("n", "<S-i>", "<cmd>bnext<cr>", { desc = "Next Buffer" })
|
||||
3
.config/nvim.lazy.d/lua/config/options.lua
Normal file
3
.config/nvim.lazy.d/lua/config/options.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
-- 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
|
||||
-- Add any additional options here
|
||||
|
|
@ -1,54 +1,54 @@
|
|||
return {
|
||||
"catppuccin/nvim",
|
||||
lazy = true,
|
||||
name = "catppuccin",
|
||||
opts = {
|
||||
integrations = {
|
||||
aerial = true,
|
||||
alpha = true,
|
||||
cmp = true,
|
||||
dashboard = true,
|
||||
flash = true,
|
||||
grug_far = true,
|
||||
gitsigns = true,
|
||||
headlines = true,
|
||||
illuminate = true,
|
||||
indent_blankline = { enabled = true },
|
||||
leap = true,
|
||||
lsp_trouble = true,
|
||||
mason = true,
|
||||
markdown = true,
|
||||
mini = true,
|
||||
native_lsp = {
|
||||
enabled = true,
|
||||
underlines = {
|
||||
errors = { "undercurl" },
|
||||
hints = { "undercurl" },
|
||||
warnings = { "undercurl" },
|
||||
information = { "undercurl" },
|
||||
},
|
||||
},
|
||||
navic = { enabled = true, custom_bg = "lualine" },
|
||||
neotest = true,
|
||||
neotree = true,
|
||||
noice = true,
|
||||
notify = true,
|
||||
semantic_tokens = true,
|
||||
telescope = true,
|
||||
treesitter = true,
|
||||
treesitter_context = true,
|
||||
which_key = true,
|
||||
},
|
||||
},
|
||||
specs = {
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
if (vim.g.colors_name or ""):find("catppuccin") then
|
||||
opts.highlights = require("catppuccin.groups.integrations.bufferline").get()
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
return {
|
||||
"catppuccin/nvim",
|
||||
lazy = true,
|
||||
name = "catppuccin",
|
||||
opts = {
|
||||
integrations = {
|
||||
aerial = true,
|
||||
alpha = true,
|
||||
cmp = true,
|
||||
dashboard = true,
|
||||
flash = true,
|
||||
grug_far = true,
|
||||
gitsigns = true,
|
||||
headlines = true,
|
||||
illuminate = true,
|
||||
indent_blankline = { enabled = true },
|
||||
leap = true,
|
||||
lsp_trouble = true,
|
||||
mason = true,
|
||||
markdown = true,
|
||||
mini = true,
|
||||
native_lsp = {
|
||||
enabled = true,
|
||||
underlines = {
|
||||
errors = { "undercurl" },
|
||||
hints = { "undercurl" },
|
||||
warnings = { "undercurl" },
|
||||
information = { "undercurl" },
|
||||
},
|
||||
},
|
||||
navic = { enabled = true, custom_bg = "lualine" },
|
||||
neotest = true,
|
||||
neotree = true,
|
||||
noice = true,
|
||||
notify = true,
|
||||
semantic_tokens = true,
|
||||
telescope = true,
|
||||
treesitter = true,
|
||||
treesitter_context = true,
|
||||
which_key = true,
|
||||
},
|
||||
},
|
||||
specs = {
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
if (vim.g.colors_name or ""):find("catppuccin") then
|
||||
opts.highlights = require("catppuccin.groups.integrations.bufferline").get()
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
return {
|
||||
-- add gruvbox
|
||||
{ "ellisonleao/gruvbox.nvim" },
|
||||
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 },
|
||||
|
||||
-- Configure LazyVim to load gruvbox
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
opts = {
|
||||
colorscheme = "catppuccin",
|
||||
},
|
||||
},
|
||||
}
|
||||
return {
|
||||
-- add gruvbox
|
||||
{ "ellisonleao/gruvbox.nvim" },
|
||||
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 },
|
||||
|
||||
-- Configure LazyVim to load gruvbox
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
opts = {
|
||||
colorscheme = "catppuccin",
|
||||
},
|
||||
},
|
||||
}
|
||||
65
.config/nvim.lazy.d/lua/plugins/dashboard.lua
Normal file
65
.config/nvim.lazy.d/lua/plugins/dashboard.lua
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
return {
|
||||
"nvimdev/dashboard-nvim",
|
||||
lazy = false, -- As https://github.com/nvimdev/dashboard-nvim/pull/450, dashboard-nvim shouldn't be lazy-loaded to properly handle stdin.
|
||||
opts = function()
|
||||
local logo = [[
|
||||
██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z
|
||||
██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z
|
||||
██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z
|
||||
██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z
|
||||
███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
]]
|
||||
|
||||
-- logo = string.rep("\n", 8) .. logo .. "\n\n"
|
||||
|
||||
local opts = {
|
||||
theme = "doom",
|
||||
hide = {
|
||||
-- this is taken care of by lualine
|
||||
-- enabling this messes up the actual laststatus setting after loading a file
|
||||
statusline = false,
|
||||
},
|
||||
config = {
|
||||
header = vim.split(logo, "\n"),
|
||||
-- stylua: ignore
|
||||
center = {
|
||||
{ action = 'lua LazyVim.pick()()', desc = " Find File", icon = " ", key = "f" },
|
||||
{ action = "ene | startinsert", desc = " New File", icon = " ", key = "n" },
|
||||
{ action = 'lua LazyVim.pick("oldfiles")()', desc = " Recent Files", icon = " ", key = "r" },
|
||||
{ action = 'lua LazyVim.pick("live_grep")()', desc = " Find Text", icon = " ", key = "g" },
|
||||
{ action = 'lua LazyVim.pick.config_files()()', desc = " Config", icon = " ", key = "c" },
|
||||
{ action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" },
|
||||
{ action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "x" },
|
||||
{ action = "Lazy", desc = " Lazy", icon = " ", key = "l" },
|
||||
{ action = function() vim.api.nvim_input("<cmd>qa<cr>") end, desc = " Quit", icon = " ", key = "q" },
|
||||
},
|
||||
footer = function()
|
||||
local stats = require("lazy").stats()
|
||||
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
|
||||
return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" }
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
for _, button in ipairs(opts.config.center) do
|
||||
button.desc = button.desc .. string.rep(" ", 43 - #button.desc)
|
||||
button.key_format = " %s"
|
||||
end
|
||||
|
||||
-- open dashboard after closing lazy
|
||||
if vim.o.filetype == "lazy" then
|
||||
vim.api.nvim_create_autocmd("WinClosed", {
|
||||
pattern = tostring(vim.api.nvim_get_current_win()),
|
||||
once = true,
|
||||
callback = function()
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_exec_autocmds("UIEnter", { group = "dashboard" })
|
||||
end)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return opts
|
||||
end,
|
||||
}
|
||||
|
|
@ -1,197 +1,197 @@
|
|||
-- since this is just an example spec, don't actually load anything here and return an empty spec
|
||||
-- stylua: ignore
|
||||
if true then return {} end
|
||||
|
||||
-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim
|
||||
--
|
||||
-- In your plugin files, you can:
|
||||
-- * add extra plugins
|
||||
-- * disable/enabled LazyVim plugins
|
||||
-- * override the configuration of LazyVim plugins
|
||||
return {
|
||||
-- add gruvbox
|
||||
{ "ellisonleao/gruvbox.nvim" },
|
||||
|
||||
-- Configure LazyVim to load gruvbox
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
opts = {
|
||||
colorscheme = "gruvbox",
|
||||
},
|
||||
},
|
||||
|
||||
-- change trouble config
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
-- opts will be merged with the parent spec
|
||||
opts = { use_diagnostic_signs = true },
|
||||
},
|
||||
|
||||
-- disable trouble
|
||||
{ "folke/trouble.nvim", enabled = false },
|
||||
|
||||
-- override nvim-cmp and add cmp-emoji
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = { "hrsh7th/cmp-emoji" },
|
||||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sources, { name = "emoji" })
|
||||
end,
|
||||
},
|
||||
|
||||
-- change some telescope options and a keymap to browse plugin files
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
keys = {
|
||||
-- add a keymap to browse plugin files
|
||||
-- stylua: ignore
|
||||
{
|
||||
"<leader>fp",
|
||||
function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
|
||||
desc = "Find Plugin File",
|
||||
},
|
||||
},
|
||||
-- change some options
|
||||
opts = {
|
||||
defaults = {
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = { prompt_position = "top" },
|
||||
sorting_strategy = "ascending",
|
||||
winblend = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add pyright to lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
-- pyright will be automatically installed with mason and loaded with lspconfig
|
||||
pyright = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add tsserver and setup with typescript.nvim instead of lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"jose-elias-alvarez/typescript.nvim",
|
||||
init = function()
|
||||
require("lazyvim.util").lsp.on_attach(function(_, buffer)
|
||||
-- stylua: ignore
|
||||
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
|
||||
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
|
||||
end)
|
||||
end,
|
||||
},
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
-- tsserver will be automatically installed with mason and loaded with lspconfig
|
||||
tsserver = {},
|
||||
},
|
||||
-- you can do any additional lsp server setup here
|
||||
-- return true if you don't want this server to be setup with lspconfig
|
||||
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
|
||||
setup = {
|
||||
-- example to setup with typescript.nvim
|
||||
tsserver = function(_, opts)
|
||||
require("typescript").setup({ server = opts })
|
||||
return true
|
||||
end,
|
||||
-- Specify * to use this function as a fallback for any server
|
||||
-- ["*"] = function(server, opts) end,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
|
||||
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
|
||||
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
||||
|
||||
-- add more treesitter parsers
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"lua",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"yaml",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
|
||||
-- would overwrite `ensure_installed` with the new value.
|
||||
-- If you'd rather extend the default config, use the code below instead:
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
-- add tsx and treesitter
|
||||
vim.list_extend(opts.ensure_installed, {
|
||||
"tsx",
|
||||
"typescript",
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- the opts function can also be used to change the default opts:
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sections.lualine_x, {
|
||||
function()
|
||||
return "😄"
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- or you can return new options to override all the defaults
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function()
|
||||
return {
|
||||
--[[add your custom lualine config here]]
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- use mini.starter instead of alpha
|
||||
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
|
||||
|
||||
-- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
|
||||
{ import = "lazyvim.plugins.extras.lang.json" },
|
||||
|
||||
-- add any tools you want to have installed below
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"stylua",
|
||||
"shellcheck",
|
||||
"shfmt",
|
||||
"flake8",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
-- since this is just an example spec, don't actually load anything here and return an empty spec
|
||||
-- stylua: ignore
|
||||
if true then return {} end
|
||||
|
||||
-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim
|
||||
--
|
||||
-- In your plugin files, you can:
|
||||
-- * add extra plugins
|
||||
-- * disable/enabled LazyVim plugins
|
||||
-- * override the configuration of LazyVim plugins
|
||||
return {
|
||||
-- add gruvbox
|
||||
{ "ellisonleao/gruvbox.nvim" },
|
||||
|
||||
-- Configure LazyVim to load gruvbox
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
opts = {
|
||||
colorscheme = "gruvbox",
|
||||
},
|
||||
},
|
||||
|
||||
-- change trouble config
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
-- opts will be merged with the parent spec
|
||||
opts = { use_diagnostic_signs = true },
|
||||
},
|
||||
|
||||
-- disable trouble
|
||||
{ "folke/trouble.nvim", enabled = false },
|
||||
|
||||
-- override nvim-cmp and add cmp-emoji
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = { "hrsh7th/cmp-emoji" },
|
||||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sources, { name = "emoji" })
|
||||
end,
|
||||
},
|
||||
|
||||
-- change some telescope options and a keymap to browse plugin files
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
keys = {
|
||||
-- add a keymap to browse plugin files
|
||||
-- stylua: ignore
|
||||
{
|
||||
"<leader>fp",
|
||||
function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
|
||||
desc = "Find Plugin File",
|
||||
},
|
||||
},
|
||||
-- change some options
|
||||
opts = {
|
||||
defaults = {
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = { prompt_position = "top" },
|
||||
sorting_strategy = "ascending",
|
||||
winblend = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add pyright to lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
-- pyright will be automatically installed with mason and loaded with lspconfig
|
||||
pyright = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add tsserver and setup with typescript.nvim instead of lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"jose-elias-alvarez/typescript.nvim",
|
||||
init = function()
|
||||
require("lazyvim.util").lsp.on_attach(function(_, buffer)
|
||||
-- stylua: ignore
|
||||
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
|
||||
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
|
||||
end)
|
||||
end,
|
||||
},
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
-- tsserver will be automatically installed with mason and loaded with lspconfig
|
||||
tsserver = {},
|
||||
},
|
||||
-- you can do any additional lsp server setup here
|
||||
-- return true if you don't want this server to be setup with lspconfig
|
||||
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
|
||||
setup = {
|
||||
-- example to setup with typescript.nvim
|
||||
tsserver = function(_, opts)
|
||||
require("typescript").setup({ server = opts })
|
||||
return true
|
||||
end,
|
||||
-- Specify * to use this function as a fallback for any server
|
||||
-- ["*"] = function(server, opts) end,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
|
||||
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
|
||||
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
||||
|
||||
-- add more treesitter parsers
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"lua",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"yaml",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
|
||||
-- would overwrite `ensure_installed` with the new value.
|
||||
-- If you'd rather extend the default config, use the code below instead:
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
-- add tsx and treesitter
|
||||
vim.list_extend(opts.ensure_installed, {
|
||||
"tsx",
|
||||
"typescript",
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- the opts function can also be used to change the default opts:
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sections.lualine_x, {
|
||||
function()
|
||||
return "😄"
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- or you can return new options to override all the defaults
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function()
|
||||
return {
|
||||
--[[add your custom lualine config here]]
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- use mini.starter instead of alpha
|
||||
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
|
||||
|
||||
-- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
|
||||
{ import = "lazyvim.plugins.extras.lang.json" },
|
||||
|
||||
-- add any tools you want to have installed below
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"stylua",
|
||||
"shellcheck",
|
||||
"shfmt",
|
||||
"flake8",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
126
.config/nvim.lazy.d/lua/plugins/lualine.lua
Normal file
126
.config/nvim.lazy.d/lua/plugins/lualine.lua
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.g.lualine_laststatus = vim.o.laststatus
|
||||
if vim.fn.argc(-1) > 0 then
|
||||
-- set an empty statusline till lualine loads
|
||||
vim.o.statusline = " "
|
||||
else
|
||||
-- hide the statusline on the starter page
|
||||
vim.o.laststatus = 0
|
||||
end
|
||||
end,
|
||||
opts = function()
|
||||
-- PERF: we don't need this lualine require madness 🤷
|
||||
local lualine_require = require("lualine_require")
|
||||
lualine_require.require = require
|
||||
|
||||
local icons = LazyVim.config.icons
|
||||
|
||||
vim.o.laststatus = vim.g.lualine_laststatus
|
||||
|
||||
local opts = {
|
||||
options = {
|
||||
theme = "auto",
|
||||
globalstatus = vim.o.laststatus == 3,
|
||||
disabled_filetypes = { statusline = { "dashboard", "alpha", "ministarter", "snacks_dashboard", "NvimTree_1" } },
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch" },
|
||||
|
||||
lualine_c = {
|
||||
LazyVim.lualine.root_dir(),
|
||||
{
|
||||
"diagnostics",
|
||||
symbols = {
|
||||
error = icons.diagnostics.Error,
|
||||
warn = icons.diagnostics.Warn,
|
||||
info = icons.diagnostics.Info,
|
||||
hint = icons.diagnostics.Hint,
|
||||
},
|
||||
},
|
||||
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
|
||||
{ LazyVim.lualine.pretty_path() },
|
||||
},
|
||||
lualine_x = {
|
||||
-- stylua: ignore
|
||||
{
|
||||
function() return require("noice").api.status.command.get() end,
|
||||
cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end,
|
||||
color = function() return LazyVim.ui.fg("Statement") end,
|
||||
},
|
||||
-- stylua: ignore
|
||||
{
|
||||
function() return require("noice").api.status.mode.get() end,
|
||||
cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end,
|
||||
color = function() return LazyVim.ui.fg("Constant") end,
|
||||
},
|
||||
-- stylua: ignore
|
||||
{
|
||||
function() return " " .. require("dap").status() end,
|
||||
cond = function() return package.loaded["dap"] and require("dap").status() ~= "" end,
|
||||
color = function() return LazyVim.ui.fg("Debug") end,
|
||||
},
|
||||
-- stylua: ignore
|
||||
{
|
||||
require("lazy.status").updates,
|
||||
cond = require("lazy.status").has_updates,
|
||||
color = function() return LazyVim.ui.fg("Special") end,
|
||||
},
|
||||
{
|
||||
"diff",
|
||||
symbols = {
|
||||
added = icons.git.added,
|
||||
modified = icons.git.modified,
|
||||
removed = icons.git.removed,
|
||||
},
|
||||
source = function()
|
||||
local gitsigns = vim.b.gitsigns_status_dict
|
||||
if gitsigns then
|
||||
return {
|
||||
added = gitsigns.added,
|
||||
modified = gitsigns.changed,
|
||||
removed = gitsigns.removed,
|
||||
}
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
lualine_y = {
|
||||
{ "progress", separator = " ", padding = { left = 1, right = 0 } },
|
||||
{ "location", padding = { left = 0, right = 1 } },
|
||||
},
|
||||
lualine_z = {
|
||||
function()
|
||||
return " " .. os.date("%R")
|
||||
end,
|
||||
},
|
||||
},
|
||||
extensions = { "neo-tree", "lazy" },
|
||||
}
|
||||
|
||||
-- do not add trouble symbols if aerial is enabled
|
||||
-- And allow it to be overriden for some buffer types (see autocmds)
|
||||
if vim.g.trouble_lualine and LazyVim.has("trouble.nvim") then
|
||||
local trouble = require("trouble")
|
||||
local symbols = trouble.statusline({
|
||||
mode = "symbols",
|
||||
groups = {},
|
||||
title = false,
|
||||
filter = { range = true },
|
||||
format = "{kind_icon}{symbol.name:Normal}",
|
||||
hl_group = "lualine_c_normal",
|
||||
})
|
||||
table.insert(opts.sections.lualine_c, {
|
||||
symbols and symbols.get,
|
||||
cond = function()
|
||||
return vim.b.trouble_lualine ~= false and symbols.has()
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return opts
|
||||
end,
|
||||
}
|
||||
|
|
@ -1,127 +1,138 @@
|
|||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
cmd = "Neotree",
|
||||
keys = {
|
||||
{
|
||||
"<leader>fe",
|
||||
function()
|
||||
require("neo-tree.command").execute({ toggle = true, dir = LazyVim.root() })
|
||||
end,
|
||||
desc = "Explorer NeoTree (Root Dir)",
|
||||
},
|
||||
{
|
||||
"<leader>fE",
|
||||
function()
|
||||
require("neo-tree.command").execute({ toggle = true, dir = vim.uv.cwd() })
|
||||
end,
|
||||
desc = "Explorer NeoTree (cwd)",
|
||||
},
|
||||
{ "<leader>e", "<leader>fe", desc = "Explorer NeoTree (Root Dir)", remap = true },
|
||||
{ "<leader>E", "<leader>fE", desc = "Explorer NeoTree (cwd)", remap = true },
|
||||
{
|
||||
"<leader>ge",
|
||||
function()
|
||||
require("neo-tree.command").execute({ source = "git_status", toggle = true })
|
||||
end,
|
||||
desc = "Git Explorer",
|
||||
},
|
||||
{
|
||||
"<leader>be",
|
||||
function()
|
||||
require("neo-tree.command").execute({ source = "buffers", toggle = true })
|
||||
end,
|
||||
desc = "Buffer Explorer",
|
||||
},
|
||||
},
|
||||
deactivate = function()
|
||||
vim.cmd([[Neotree close]])
|
||||
end,
|
||||
init = function()
|
||||
-- FIX: use `autocmd` for lazy-loading neo-tree instead of directly requiring it,
|
||||
-- because `cwd` is not set up properly.
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
group = vim.api.nvim_create_augroup("Neotree_start_directory", { clear = true }),
|
||||
desc = "Start Neo-tree with directory",
|
||||
once = true,
|
||||
callback = function()
|
||||
if package.loaded["neo-tree"] then
|
||||
return
|
||||
else
|
||||
local stats = vim.uv.fs_stat(vim.fn.argv(0))
|
||||
if stats and stats.type == "directory" then
|
||||
require("neo-tree")
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
opts = {
|
||||
sources = { "filesystem", "buffers", "git_status" },
|
||||
open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" },
|
||||
filesystem = {
|
||||
bind_to_cwd = false,
|
||||
follow_current_file = { enabled = true },
|
||||
use_libuv_file_watcher = true,
|
||||
},
|
||||
window = {
|
||||
mappings = {
|
||||
-- MARKED
|
||||
["i"] = "open",
|
||||
-- MARKED
|
||||
["e"] = "noop",
|
||||
["h"] = "close_node",
|
||||
["<space>"] = "none",
|
||||
["Y"] = {
|
||||
function(state)
|
||||
local node = state.tree:get_node()
|
||||
local path = node:get_id()
|
||||
vim.fn.setreg("+", path, "c")
|
||||
end,
|
||||
desc = "Copy Path to Clipboard",
|
||||
},
|
||||
["O"] = {
|
||||
function(state)
|
||||
require("lazy.util").open(state.tree:get_node().path, { system = true })
|
||||
end,
|
||||
desc = "Open with System Application",
|
||||
},
|
||||
["P"] = { "toggle_preview", config = { use_float = false } },
|
||||
},
|
||||
},
|
||||
default_component_configs = {
|
||||
indent = {
|
||||
with_expanders = true, -- if nil and file nesting is enabled, will enable expanders
|
||||
expander_collapsed = "",
|
||||
expander_expanded = "",
|
||||
expander_highlight = "NeoTreeExpander",
|
||||
},
|
||||
git_status = {
|
||||
symbols = {
|
||||
unstaged = "",
|
||||
staged = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local function on_move(data)
|
||||
LazyVim.lsp.on_rename(data.source, data.destination)
|
||||
end
|
||||
|
||||
local events = require("neo-tree.events")
|
||||
opts.event_handlers = opts.event_handlers or {}
|
||||
vim.list_extend(opts.event_handlers, {
|
||||
{ event = events.FILE_MOVED, handler = on_move },
|
||||
{ event = events.FILE_RENAMED, handler = on_move },
|
||||
})
|
||||
require("neo-tree").setup(opts)
|
||||
vim.api.nvim_create_autocmd("TermClose", {
|
||||
pattern = "*lazygit",
|
||||
callback = function()
|
||||
if package.loaded["neo-tree.sources.git_status"] then
|
||||
require("neo-tree.sources.git_status").refresh()
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
cmd = "Neotree",
|
||||
keys = {
|
||||
{
|
||||
"<leader>fe",
|
||||
function()
|
||||
require("neo-tree.command").execute({ toggle = true, dir = LazyVim.root() })
|
||||
end,
|
||||
desc = "Explorer NeoTree (Root Dir)",
|
||||
},
|
||||
{
|
||||
"<leader>fE",
|
||||
function()
|
||||
require("neo-tree.command").execute({ toggle = true, dir = vim.uv.cwd() })
|
||||
end,
|
||||
desc = "Explorer NeoTree (cwd)",
|
||||
},
|
||||
{ "<leader>e", "<leader>fe", desc = "Explorer NeoTree (Root Dir)", remap = true },
|
||||
{ "<leader>E", "<leader>fE", desc = "Explorer NeoTree (cwd)", remap = true },
|
||||
{
|
||||
"<leader>ge",
|
||||
function()
|
||||
require("neo-tree.command").execute({ source = "git_status", toggle = true })
|
||||
end,
|
||||
desc = "Git Explorer",
|
||||
},
|
||||
{
|
||||
"<leader>be",
|
||||
function()
|
||||
require("neo-tree.command").execute({ source = "buffers", toggle = true })
|
||||
end,
|
||||
desc = "Buffer Explorer",
|
||||
},
|
||||
},
|
||||
deactivate = function()
|
||||
vim.cmd([[Neotree close]])
|
||||
end,
|
||||
init = function()
|
||||
-- FIX: use `autocmd` for lazy-loading neo-tree instead of directly requiring it,
|
||||
-- because `cwd` is not set up properly.
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
group = vim.api.nvim_create_augroup("Neotree_start_directory", { clear = true }),
|
||||
desc = "Start Neo-tree with directory",
|
||||
once = true,
|
||||
callback = function()
|
||||
if package.loaded["neo-tree"] then
|
||||
return
|
||||
else
|
||||
local stats = vim.uv.fs_stat(vim.fn.argv(0))
|
||||
if stats and stats.type == "directory" then
|
||||
require("neo-tree")
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
opts = {
|
||||
sources = { "filesystem", "buffers", "git_status" },
|
||||
open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" },
|
||||
filesystem = {
|
||||
hide_dotfiles = false,
|
||||
hide_hidden = false,
|
||||
bind_to_cwd = false,
|
||||
follow_current_file = { enabled = true },
|
||||
use_libuv_file_watcher = true,
|
||||
hide_by_name = {
|
||||
".git",
|
||||
"node_modules",
|
||||
"requirements.txt",
|
||||
"desktop.ini",
|
||||
},
|
||||
never_show = {
|
||||
".DS_Store",
|
||||
},
|
||||
},
|
||||
window = {
|
||||
mappings = {
|
||||
-- MARKED
|
||||
["i"] = "open",
|
||||
-- MARKED
|
||||
["e"] = "noop",
|
||||
["h"] = "close_node",
|
||||
["<space>"] = "none",
|
||||
["Y"] = {
|
||||
function(state)
|
||||
local node = state.tree:get_node()
|
||||
local path = node:get_id()
|
||||
vim.fn.setreg("+", path, "c")
|
||||
end,
|
||||
desc = "Copy Path to Clipboard",
|
||||
},
|
||||
["O"] = {
|
||||
function(state)
|
||||
require("lazy.util").open(state.tree:get_node().path, { system = true })
|
||||
end,
|
||||
desc = "Open with System Application",
|
||||
},
|
||||
["P"] = { "toggle_preview", config = { use_float = false } },
|
||||
},
|
||||
},
|
||||
default_component_configs = {
|
||||
indent = {
|
||||
with_expanders = true, -- if nil and file nesting is enabled, will enable expanders
|
||||
expander_collapsed = "",
|
||||
expander_expanded = "",
|
||||
expander_highlight = "NeoTreeExpander",
|
||||
},
|
||||
git_status = {
|
||||
symbols = {
|
||||
unstaged = "",
|
||||
staged = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local function on_move(data)
|
||||
LazyVim.lsp.on_rename(data.source, data.destination)
|
||||
end
|
||||
|
||||
local events = require("neo-tree.events")
|
||||
opts.event_handlers = opts.event_handlers or {}
|
||||
vim.list_extend(opts.event_handlers, {
|
||||
{ event = events.FILE_MOVED, handler = on_move },
|
||||
{ event = events.FILE_RENAMED, handler = on_move },
|
||||
})
|
||||
require("neo-tree").setup(opts)
|
||||
vim.api.nvim_create_autocmd("TermClose", {
|
||||
pattern = "*lazygit",
|
||||
callback = function()
|
||||
if package.loaded["neo-tree.sources.git_status"] then
|
||||
require("neo-tree.sources.git_status").refresh()
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
11
.config/nvim.lazy.d/lua/plugins/nvim-tree.lua
Normal file
11
.config/nvim.lazy.d/lua/plugins/nvim-tree.lua
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
return {
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
version = "*",
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
config = function()
|
||||
require("nvim-tree").setup({})
|
||||
end,
|
||||
}
|
||||
22
.config/nvim.lazy.d/lua/plugins/obsidian.lua
Normal file
22
.config/nvim.lazy.d/lua/plugins/obsidian.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
return {
|
||||
"epwalsh/obsidian.nvim",
|
||||
version = "*", -- recommended, use latest release instead of latest commit
|
||||
lazy = true,
|
||||
ft = "markdown",
|
||||
dependencies = {
|
||||
-- Required.
|
||||
"nvim-lua/plenary.nvim",
|
||||
|
||||
-- see below for full list of optional dependencies 👇
|
||||
},
|
||||
opts = {
|
||||
workspaces = {
|
||||
{
|
||||
name = "Obsidian",
|
||||
path = "/mnt/c/Users/citoy/Obsidian",
|
||||
},
|
||||
},
|
||||
|
||||
-- see below for full list of options 👇
|
||||
},
|
||||
}
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
return {
|
||||
{ 'wakatime/vim-wakatime', lazy = false },
|
||||
return {
|
||||
{ 'wakatime/vim-wakatime', lazy = false },
|
||||
}
|
||||
3
.config/nvim.lazy.d/stylua.toml
Normal file
3
.config/nvim.lazy.d/stylua.toml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
column_width = 120
|
||||
BIN
.config/nvim/.DS_Store
vendored
BIN
.config/nvim/.DS_Store
vendored
Binary file not shown.
12
.config/nvim/.editorconfig
Normal file
12
.config/nvim/.editorconfig
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.lua]
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
column_width = 120
|
||||
1
.config/nvim/.gitignore
vendored
Normal file
1
.config/nvim/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
lazy-lock.json
|
||||
|
|
@ -1,8 +1,20 @@
|
|||
-- bootstrap lazy.nvim, LazyVim and your plugins
|
||||
if (vim.g.vscode) then
|
||||
print("VSCode detected, skipping lazy loading")
|
||||
require("vscode.code")
|
||||
else
|
||||
require("config.lazy")
|
||||
-- require("config.lazy")
|
||||
end
|
||||
--[[
|
||||
-*- coding: utf-8 -*-
|
||||
@Filename init.lua
|
||||
@Author js0ny
|
||||
@Date 2024-11-27
|
||||
@Description neovim 配置文件
|
||||
]]
|
||||
-- 加载配置
|
||||
require("config.options")
|
||||
-- 加载键位映射
|
||||
require("config.keymaps")
|
||||
|
||||
-- 加载插件
|
||||
require("plugins")
|
||||
|
||||
-- 加载主题
|
||||
require("config.colorscheme")
|
||||
|
||||
|
||||
-- vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
|
||||
|
|
|
|||
BIN
.config/nvim/lua/.DS_Store
vendored
BIN
.config/nvim/lua/.DS_Store
vendored
Binary file not shown.
1
.config/nvim/lua/config/colorscheme.lua
Normal file
1
.config/nvim/lua/config/colorscheme.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
vim.cmd.colorscheme("catppuccin")
|
||||
|
|
@ -1,146 +1,128 @@
|
|||
-- Keymaps are automatically loaded on the VeryLazy event
|
||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||
-- Add any additional keymaps here
|
||||
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- ================= GENERAL KEYBINDS =================
|
||||
-- SAVE/QUIT {{{
|
||||
vim.keymap.set("n", "Q", "<cmd>q<CR>", { desc = "Q to quit" })
|
||||
vim.keymap.set("n", "<C-s>", "<cmd>w<CR>", { desc = "S to write file" })
|
||||
--}}}
|
||||
|
||||
-- NVIM CONFIG SHORTCUTS {{{
|
||||
-- stylua: ignore
|
||||
vim.keymap.set("n", "<leader>rc", "<cmd>e $HOME/.config/nvim/lua/config/options.lua<CR>", { desc = "Open nvim options.lua" })
|
||||
vim.keymap.set("n", "<leader>rp", "<cmd>e $HOME/.config/nvim/lua/plugins/.<CR>", { desc = "lazy plugins dir" })
|
||||
--}}}
|
||||
|
||||
-- UNDO
|
||||
vim.keymap.set({ "n", "v" }, "l", "u", { desc = "Undo" })
|
||||
|
||||
-- INSERT
|
||||
vim.keymap.set({ "n", "v" }, "l", "i", { desc = "Insert" })
|
||||
vim.keymap.set({ "n", "v" }, "L", "I", { desc = "Insert at line start" })
|
||||
|
||||
-- YANK TO SYSTEM CLIPBOARD
|
||||
vim.keymap.set("v", "Y", '"+y', { desc = "Copy to (System) Clipboard" })
|
||||
|
||||
-- SEARCH {{{
|
||||
vim.keymap.set("n", "<LEADER><CR>", "<CMD>nohlsearch<CR>", { desc = "clear search highlight" })
|
||||
--}}}
|
||||
|
||||
-- SPACE TO TAB{{{
|
||||
vim.keymap.set("n", "<LEADER>tt", "<CMD>%s/ /\t/g<CR>", { desc = "space to tab" })
|
||||
vim.keymap.set("v", "<LEADER>tt", "<CMD>s/ /\t/g<CR>", { desc = "space to tab" })
|
||||
--}}}
|
||||
|
||||
-- MISC {{{
|
||||
vim.keymap.set("n", "<LEADER>o", "za", { desc = "folding" })
|
||||
vim.keymap.set("i", "<C-y>", "<ESC>A {}<ESC>i<CR><ESC>ko", { desc = "insert a pair of {} and goto next line" })
|
||||
--}}}
|
||||
|
||||
-- ================= CURSOR MOVEMENT ===================== {{{
|
||||
-- NEW CURSOR MOVEMENT (ARROW KEY RESIZE WINDOWS)
|
||||
-- ^
|
||||
-- e
|
||||
-- < h i >
|
||||
-- n
|
||||
-- v
|
||||
--
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "e", "k", { desc = "move cursor ⇧" })
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "n", "j", { desc = "move cursor ⇩" })
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "h", "h", { desc = "move cursor ⇦" })
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "i", "l", { desc = "move cursor ⇨" })
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "E", "5k", { desc = "Move 5up K -> U" })
|
||||
vim.keymap.set({ "n", "v" }, "N", "5j", { desc = "Move 5down J -> E" })
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "H", "0", { desc = "Move start of line" })
|
||||
vim.keymap.set({ "n", "v" }, "I", "$", { desc = "Move end of line" })
|
||||
|
||||
vim.keymap.set("n", "gu", "gk", { desc = "move up gk -> gu" })
|
||||
vim.keymap.set("n", "ge", "gj", { desc = "move down gj -> ge" })
|
||||
|
||||
vim.keymap.set("n", "\v", "v$h", { desc = "???" })
|
||||
|
||||
-- FASTER IN-LINE NAVIGATION
|
||||
|
||||
-- SET h (SAME AS n, CURSOR LEFT) TO 'END OF WORD'
|
||||
vim.keymap.set("n", "j", "e", { desc = "Move cursor to end of word" })
|
||||
-- CTRL + U OR E WILL MOVE UP/DOWN THE VIEW PORT WITHOUT MOVING THE CURSOR
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "<C-e>", "5<C-y>", { desc = "Move viewport ⇧" })
|
||||
vim.keymap.set({ "n", "v" }, "<C-n>", "5<C-e>", { desc = "Move viewport ⇩" })
|
||||
|
||||
-- INSERT MODE CURSOR MOVEMENT
|
||||
vim.keymap.set("i", "<C-a>", "<ESC>A")
|
||||
|
||||
-- COMMAND MODE CURSOR MOVEMENT
|
||||
vim.keymap.set("c", "<C-a>", "<Home>")
|
||||
vim.keymap.set("c", "<C-e>", "<End>")
|
||||
vim.keymap.set("c", "<C-p>", "<Up>")
|
||||
vim.keymap.set("c", "<C-n>", "<Down>")
|
||||
vim.keymap.set("c", "<C-b>", "<Left>")
|
||||
vim.keymap.set("c", "<C-f>", "<Right>")
|
||||
vim.keymap.set("c", "<M-b>", "<S-Left>")
|
||||
vim.keymap.set("c", "<M-w>", "<S-Right>")
|
||||
--}}}
|
||||
|
||||
-- ================= SPLIT MANAGMENT ===================== {{{
|
||||
vim.keymap.set("n", "<C-w>E", "<CMD>set nosplitbelow<CR><CMD>split<CR><CMD>set splitbelow<CR>", { desc = "Split ⇧" })
|
||||
vim.keymap.set("n", "<C-w>N", "<CMD>set splitbelow<CR><CMD>split<CR>", { desc = "Split ⇩" })
|
||||
vim.keymap.set("n", "<C-w>H", "<CMD>set nosplitright<CR><CMD>vsplit<CR><CMD>set splitright<CR>", { desc = "Split ⇦" })
|
||||
vim.keymap.set("n", "<C-w>I", "<CMD>set splitright<CR><CMD>vsplit<CR>", { desc = "Split ⇨" })
|
||||
|
||||
vim.keymap.set({ "n", "t" }, "<C-w>e", "<C-w>k", { desc = "Move cursor to split ⇧" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-w>n", "<C-w>j", { desc = "Move cursor to split ⇩" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-w>h", "<C-w>h", { desc = "Move cursor to split ⇦" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-w>i", "<C-w>l", { desc = "Move cursor to split ⇨" })
|
||||
|
||||
vim.keymap.set({ "n", "t" }, "<C-e>", "<C-k>", { desc = "Move cursor to split ⇧" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-n>", "<C-j>", { desc = "Move cursor to split ⇩" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-h>", "<C-h>", { desc = "Move cursor to split ⇦" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-i>", "<C-l>", { desc = "Move cursor to split ⇨" })
|
||||
|
||||
vim.keymap.set("n", "<up>", "<CMD>res -5<CR>", { desc = "Resize split 0,-5" })
|
||||
vim.keymap.set("n", "<down>", "<CMD>res +5<CR>", { desc = "Resize split 0,+5" })
|
||||
vim.keymap.set("n", "<left>", "<CMD>vertical resize +5<CR>", { desc = "Resize split +5,0" })
|
||||
vim.keymap.set("n", "<right>", "<CMD>vertical resize -5<CR>", { desc = "Resize split -5,0" })
|
||||
|
||||
vim.keymap.set("n", "<C-w>H", "<C-w>t<C-w>K", { desc = "Make splits [H]orizontal" })
|
||||
vim.keymap.set("n", "<C-w>V", "<C-w>t<C-w>H", { desc = "Make splits [V]ertical" })
|
||||
|
||||
vim.keymap.set("n", "<C-w>ri", "<C-w>b<C-w>K", { desc = "Rotate splits 90" })
|
||||
vim.keymap.set("n", "<C-w>rh", "<C-w>b<C-w>H", { desc = "Rotate splits -90" })
|
||||
|
||||
vim.keymap.set("n", "<LEADER>q", "<C-w>j<CMD>q<CR>", { desc = "Close Split ⇩ (Below)" })
|
||||
--}}}
|
||||
|
||||
-- TAB MANAGEMENT {{{
|
||||
vim.keymap.set("n", "<TAB><TAB>", "<CMD>tabe<CR>", { desc = "New [Tab]" })
|
||||
|
||||
vim.keymap.set("n", "<TAB>h", "<CMD>-tabnext<CR>", { desc = "Select Tab ⇦" })
|
||||
vim.keymap.set("n", "<TAB>i", "<CMD>+tabnext<CR>", { desc = "Select Tab ⇨" })
|
||||
|
||||
vim.keymap.set("n", "<TAB>H", "<CMD>-tabmove<CR>", { desc = "Tab move ⇦" })
|
||||
vim.keymap.set("n", "<TAB>I", "<CMD>+tabmove<CR>", { desc = "Tab move ⇨" })
|
||||
|
||||
-- NOTE: Doesn't seem to work:
|
||||
-- vim.keymap.set("n", "<TAB>c", "<CMD>tab split<CR>", { desc = "New Tab from [C]urrent" })
|
||||
-- vim.keymap.set('n', '<LEADER>dw', '/\(\<\w\+\>\)\_s*\1', {desc='adjacent duplicate words'})
|
||||
|
||||
--vim.keymap.del("n", "<C-w>j")
|
||||
--vim.keymap.del("n", "<C-w>k")
|
||||
--vim.keymap.del("n", "<C-w>l")
|
||||
-- }}}
|
||||
|
||||
-- =================== TERM BEHAVIORS ====================
|
||||
vim.keymap.set("t", "<C-n>", "<C-\\><C-n>", { desc = "escape terminal, allowing excmds" })
|
||||
vim.keymap.set("t", "<C-o>", "<C-\\><C-n><C-o>", { desc = "close terminal" })
|
||||
|
||||
--vim: set fdm=marker fdl=0
|
||||
|
||||
-- buffers
|
||||
vim.keymap.set("n", "<S-h>", "<cmd>bprevious<cr>", { desc = "Prev Buffer" })
|
||||
vim.keymap.set("n", "<S-i>", "<cmd>bnext<cr>", { desc = "Next Buffer" })
|
||||
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 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
|
||||
|
|
|
|||
|
|
@ -1,3 +1,50 @@
|
|||
-- 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
|
||||
-- Add any additional options here
|
||||
-- <leader> is space
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
-- Disable netrw
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
-- Disable Perl
|
||||
vim.g.loaded_perl_provider = 0 -- Don't load Perl
|
||||
|
||||
vim.g.autoformat = true
|
||||
|
||||
local opt = vim.opt
|
||||
|
||||
-- Clipboard
|
||||
opt.clipboard = vim.env.SSH_TTY and "" or "unnamedplus"
|
||||
-- Line number
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
|
||||
opt.confirm = true
|
||||
|
||||
-- Word wrap
|
||||
opt.linebreak = true
|
||||
|
||||
-- Indentation
|
||||
opt.expandtab = true
|
||||
opt.shiftwidth = 4
|
||||
opt.shiftround = true
|
||||
|
||||
-- Case
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
|
||||
opt.cursorline = true
|
||||
-- Terminal GUI
|
||||
opt.termguicolors = true
|
||||
|
||||
-- Fold
|
||||
opt.foldlevel = 99
|
||||
opt.foldmethod = "expr"
|
||||
|
||||
-- Statusline
|
||||
opt.laststatus = 0
|
||||
|
||||
-- Hide Command Line if empty
|
||||
opt.cmdheight = 0
|
||||
|
||||
-- Scroll
|
||||
opt.scrolloff = 5
|
||||
opt.sidescrolloff = 10
|
||||
|
|
|
|||
22
.config/nvim/lua/config/servers.lua
Normal file
22
.config/nvim/lua/config/servers.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
--- Available LSP goes here
|
||||
--- Check https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md
|
||||
--- for available server and name
|
||||
local servers = {
|
||||
"arduino_language_server", -- Arduino
|
||||
"bashls", -- Bash
|
||||
"clangd", -- C/C++
|
||||
"cmake", -- CMake
|
||||
"eslint", -- JavaScript
|
||||
"gopls", -- Go
|
||||
"html", -- HTML
|
||||
"julials", -- Julia
|
||||
"lua_ls", -- Lua
|
||||
"omnisharp", -- C# & F#
|
||||
"powershell_es", -- PowerShell
|
||||
"pyright", -- Python
|
||||
"rust_analyzer", -- Rust
|
||||
"taplo", -- TOML
|
||||
"vimls", -- vimscript
|
||||
}
|
||||
|
||||
return servers
|
||||
12
.config/nvim/lua/plugins/appearance.lua
Normal file
12
.config/nvim/lua/plugins/appearance.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
return {
|
||||
{ "catppuccin/nvim", name = "catppuccin" },
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
config = function()
|
||||
require("plugins.mod.lualine")
|
||||
end,
|
||||
},
|
||||
{ import = "plugins.mod.alpha-nvim" },
|
||||
}
|
||||
|
||||
8
.config/nvim/lua/plugins/completion.lua
Normal file
8
.config/nvim/lua/plugins/completion.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
{ import = "plugins.mod.nvim-cmp" },
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = { "rafamadriz/friendly-snippets" },
|
||||
},
|
||||
{ "rafamadriz/friendly-snippets" }
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"nvimdev/dashboard-nvim",
|
||||
lazy = false, -- As https://github.com/nvimdev/dashboard-nvim/pull/450, dashboard-nvim shouldn't be lazy-loaded to properly handle stdin.
|
||||
opts = function()
|
||||
local logo = [[
|
||||
██╗███████╗ ██████╗ ███╗ ██╗██╗ ██╗
|
||||
██║██╔════╝██╔═████╗████╗ ██║╚██╗ ██╔╝
|
||||
██║███████╗██║██╔██║██╔██╗ ██║ ╚████╔╝
|
||||
██ ██║╚════██║████╔╝██║██║╚██╗██║ ╚██╔╝
|
||||
╚█████╔╝███████║╚██████╔╝██║ ╚████║ ██║
|
||||
╚════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝
|
||||
]]
|
||||
|
||||
logo = string.rep("\n", 8) .. logo .. "\n\n"
|
||||
|
||||
local opts = {
|
||||
theme = "doom",
|
||||
hide = {
|
||||
-- this is taken care of by lualine
|
||||
-- enabling this messes up the actual laststatus setting after loading a file
|
||||
statusline = false,
|
||||
},
|
||||
config = {
|
||||
header = vim.split(logo, "\n"),
|
||||
-- stylua: ignore
|
||||
center = {
|
||||
{ action = 'lua LazyVim.pick()()', desc = " Find File", icon = " ", key = "f" },
|
||||
{ action = 'lua LazyVim.pick("oldfiles")()', desc = " Recent Files", icon = " ", key = "r" },
|
||||
{ action = 'lua LazyVim.pick("live_grep")()', desc = " Find Text", icon = " ", key = "g" },
|
||||
{ action = 'lua LazyVim.pick.config_files()()', desc = " Config", icon = " ", key = "c" },
|
||||
{ action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" },
|
||||
{ action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "x" },
|
||||
{ action = "Lazy", desc = " Lazy", icon = " ", key = "l" },
|
||||
{ action = function() vim.api.nvim_input("<cmd>qa<cr>") end, desc = " Quit", icon = " ", key = "q" },
|
||||
},
|
||||
footer = function()
|
||||
local stats = require("lazy").stats()
|
||||
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
|
||||
return {
|
||||
"⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms",
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
for _, button in ipairs(opts.config.center) do
|
||||
button.desc = button.desc .. string.rep(" ", 43 - #button.desc)
|
||||
button.key_format = " %s"
|
||||
end
|
||||
|
||||
-- open dashboard after closing lazy
|
||||
if vim.o.filetype == "lazy" then
|
||||
vim.api.nvim_create_autocmd("WinClosed", {
|
||||
pattern = tostring(vim.api.nvim_get_current_win()),
|
||||
once = true,
|
||||
callback = function()
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_exec_autocmds("UIEnter", { group = "dashboard" })
|
||||
end)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return opts
|
||||
end,
|
||||
},
|
||||
}
|
||||
5
.config/nvim/lua/plugins/fileutils.lua
Normal file
5
.config/nvim/lua/plugins/fileutils.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
{ import = "plugins.mod.auto-session" },
|
||||
{ import = "plugins.mod.nvim-tree" },
|
||||
{ "nvim-telescope/telescope.nvim", dependencies = { "nvim-lua/plenary.nvim" } },
|
||||
}
|
||||
22
.config/nvim/lua/plugins/init.lua
Normal file
22
.config/nvim/lua/plugins/init.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
-- Entry point of the plugin manager
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable",
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
{ import = "plugins.appearance" },
|
||||
{ import = "plugins.completion" },
|
||||
{ import = "plugins.fileutils" },
|
||||
{ import = "plugins.lsp" },
|
||||
{ import = "plugins.syntax" },
|
||||
{ import = "plugins.misc" },
|
||||
})
|
||||
21
.config/nvim/lua/plugins/lsp.lua
Normal file
21
.config/nvim/lua/plugins/lsp.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
return {
|
||||
{ import = "plugins.mod.lspconfig" },
|
||||
{ "williamboman/mason.nvim", config = true },
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
{ "williamboman/mason.nvim" },
|
||||
{ "neovim/nvim-lspconfig" },
|
||||
},
|
||||
config = function()
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
local servers = require("config.servers")
|
||||
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = servers,
|
||||
})
|
||||
end
|
||||
},
|
||||
}
|
||||
22
.config/nvim/lua/plugins/misc.lua
Normal file
22
.config/nvim/lua/plugins/misc.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
return {
|
||||
{ 'wakatime/vim-wakatime', lazy = false },
|
||||
{ 'epwalsh/obsidian.nvim', lazy = true },
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>?",
|
||||
function()
|
||||
require("which-key").show({ global = false })
|
||||
end,
|
||||
desc = "Buffer Local Keymaps (which-key)",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
59
.config/nvim/lua/plugins/mod/alpha-nvim.lua
Normal file
59
.config/nvim/lua/plugins/mod/alpha-nvim.lua
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
-- alpha-nvim.lua
|
||||
return {
|
||||
{
|
||||
'goolord/alpha-nvim',
|
||||
dependencies = {
|
||||
-- 'echasnovski/mini.icons',
|
||||
-- 'nvim-lua/plenary.nvim'
|
||||
},
|
||||
config = function ()
|
||||
local alpha = require'alpha'
|
||||
local dashboard = require'alpha.themes.dashboard'
|
||||
dashboard.section.header.val = {
|
||||
" ",
|
||||
"================= =============== =============== ======== ========",
|
||||
"\\\\ . . . . . . .\\\\ //. . . . . . .\\\\ //. . . . . . .\\\\ \\\\. . .\\\\// . . //",
|
||||
"||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\\/ . . .||",
|
||||
"|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||",
|
||||
"||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||",
|
||||
"|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\\ . . . . ||",
|
||||
"||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\\_ . .|. .||",
|
||||
"|| . _|| || || || || ||_ . || || . _|| || || || |\\ `-_/| . ||",
|
||||
"||_-' || .|/ || || \\|. || `-_|| ||_-' || .|/ || || | \\ / |-_.||",
|
||||
"|| ||_-' || || `-_|| || || ||_-' || || | \\ / | `||",
|
||||
"|| `' || || `' || || `' || || | \\ / | ||",
|
||||
"|| .===' `===. .==='.`===. .===' /==. | \\/ | ||",
|
||||
"|| .==' \\_|-_ `===. .===' _|_ `===. .===' _-|/ `== \\/ | ||",
|
||||
"|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \\/ | ||",
|
||||
"|| .==' _-' `-__\\._-' `-_./__-' `' |. /| | ||",
|
||||
"||.==' _-' `' | /==.||",
|
||||
"==' _-' j s 0 n y N E O V I M \\/ `==",
|
||||
"\\ _-' `-_ /",
|
||||
" `'' ``' ",
|
||||
}
|
||||
dashboard.section.buttons.val.leader = "SPC"
|
||||
dashboard.section.buttons.val = {
|
||||
-- leader = "SPC",
|
||||
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 q', ' 退出', ':qa<CR>'),
|
||||
}
|
||||
local handle = io.popen('fortune')
|
||||
--- Handle the case where fortune is not installed
|
||||
local fortune = ""
|
||||
if handle then
|
||||
fortune = handle:read("*a")
|
||||
handle:close()
|
||||
end
|
||||
dashboard.section.footer.val = "今日 " .. os.date("%Y-%m-%d %A") .. " " .. fortune
|
||||
|
||||
dashboard.config.opts.noautocmd = true
|
||||
|
||||
-- vim.cmd[[autocmd User AlphaReady echo 'Alpha ready!']]
|
||||
|
||||
alpha.setup(dashboard.config)
|
||||
end
|
||||
};
|
||||
}
|
||||
15
.config/nvim/lua/plugins/mod/auto-session.lua
Normal file
15
.config/nvim/lua/plugins/mod/auto-session.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
---@diagnostic disable: undefined-doc-name
|
||||
return {
|
||||
{
|
||||
'rmagatti/auto-session',
|
||||
lazy = false,
|
||||
|
||||
---enables autocomplete for opts
|
||||
---@module "auto-session"
|
||||
---@type AutoSession.Config
|
||||
opts = {
|
||||
suppressed_dirs = { '~/', '~/Projects', '~/Downloads', '/' },
|
||||
-- log_level = 'debug',
|
||||
}
|
||||
}
|
||||
}
|
||||
4
.config/nvim/lua/plugins/mod/lspconfig.lua
Normal file
4
.config/nvim/lua/plugins/mod/lspconfig.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
lazy = false
|
||||
}
|
||||
223
.config/nvim/lua/plugins/mod/lualine.lua
Normal file
223
.config/nvim/lua/plugins/mod/lualine.lua
Normal file
|
|
@ -0,0 +1,223 @@
|
|||
-- Author: shadmansaleh
|
||||
-- Credit: glepnir
|
||||
local lualine = require('lualine')
|
||||
|
||||
-- Color table for highlights
|
||||
-- stylua: ignore
|
||||
local colors = {
|
||||
bg = '#202328',
|
||||
fg = '#bbc2cf',
|
||||
yellow = '#ECBE7B',
|
||||
cyan = '#008080',
|
||||
darkblue = '#081633',
|
||||
green = '#98be65',
|
||||
orange = '#FF8800',
|
||||
violet = '#a9a1e1',
|
||||
magenta = '#c678dd',
|
||||
blue = '#51afef',
|
||||
red = '#ec5f67',
|
||||
}
|
||||
|
||||
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,
|
||||
}
|
||||
|
||||
-- Config
|
||||
local config = {
|
||||
options = {
|
||||
disabled_filetypes = {
|
||||
statusline = { "NvimTree", "alpha" }
|
||||
},
|
||||
-- Disable sections and component separators
|
||||
component_separators = '',
|
||||
section_separators = '',
|
||||
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 } },
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
-- these are to remove the defaults
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
-- These will be filled later
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
},
|
||||
inactive_sections = {
|
||||
-- these are to remove the defaults
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
},
|
||||
}
|
||||
|
||||
-- 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
|
||||
|
||||
ins_left {
|
||||
function()
|
||||
return '▊'
|
||||
end,
|
||||
color = { fg = colors.blue }, -- Sets highlighting of component
|
||||
padding = { left = 0, right = 1 }, -- We don't need space before this
|
||||
}
|
||||
|
||||
ins_left {
|
||||
-- mode component
|
||||
function()
|
||||
return ''
|
||||
end,
|
||||
color = function()
|
||||
-- auto change color according to neovims mode
|
||||
local mode_color = {
|
||||
n = colors.red,
|
||||
i = colors.green,
|
||||
v = colors.blue,
|
||||
[''] = colors.blue,
|
||||
V = colors.blue,
|
||||
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,
|
||||
}
|
||||
return { fg = mode_color[vim.fn.mode()] }
|
||||
end,
|
||||
padding = { right = 1 },
|
||||
}
|
||||
|
||||
ins_left {
|
||||
-- filesize component
|
||||
'filesize',
|
||||
cond = conditions.buffer_not_empty,
|
||||
}
|
||||
|
||||
ins_left {
|
||||
'filename',
|
||||
cond = conditions.buffer_not_empty,
|
||||
color = { fg = colors.magenta, gui = 'bold' },
|
||||
}
|
||||
|
||||
ins_left { 'location' }
|
||||
|
||||
ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } }
|
||||
|
||||
ins_left {
|
||||
'diagnostics',
|
||||
sources = { 'nvim_diagnostic' },
|
||||
symbols = { error = ' ', warn = ' ', info = ' ' },
|
||||
diagnostics_color = {
|
||||
error = { fg = colors.red },
|
||||
warn = { fg = colors.yellow },
|
||||
info = { fg = colors.cyan },
|
||||
},
|
||||
}
|
||||
|
||||
-- Insert mid section. You can make any number of sections in neovim :)
|
||||
-- for lualine it's any number greater then 2
|
||||
ins_left {
|
||||
function()
|
||||
return '%='
|
||||
end,
|
||||
}
|
||||
|
||||
ins_left {
|
||||
-- Lsp server name .
|
||||
function()
|
||||
local msg = 'No Active Lsp'
|
||||
local buf_ft = vim.api.nvim_get_option_value('filetype', { buf = 0 })
|
||||
local clients = vim.lsp.get_clients()
|
||||
if next(clients) == nil then
|
||||
return msg
|
||||
end
|
||||
for _, client in ipairs(clients) do
|
||||
local filetypes = client.config.filetypes
|
||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||
return client.name
|
||||
end
|
||||
end
|
||||
return msg
|
||||
end,
|
||||
icon = ' LSP:',
|
||||
color = { fg = '#ffffff', gui = 'bold' },
|
||||
}
|
||||
|
||||
-- Add components to right sections
|
||||
ins_right {
|
||||
'o:encoding', -- option component same as &encoding in viml
|
||||
fmt = string.upper, -- I'm not sure why it's upper case either ;)
|
||||
cond = conditions.hide_in_width,
|
||||
color = { fg = colors.green, gui = 'bold' },
|
||||
}
|
||||
|
||||
ins_right {
|
||||
'fileformat',
|
||||
fmt = string.upper,
|
||||
icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh
|
||||
color = { fg = colors.green, gui = 'bold' },
|
||||
}
|
||||
|
||||
ins_right {
|
||||
'branch',
|
||||
icon = '',
|
||||
color = { fg = colors.violet, gui = 'bold' },
|
||||
}
|
||||
|
||||
ins_right {
|
||||
'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,
|
||||
}
|
||||
|
||||
ins_right {
|
||||
function()
|
||||
return '▊'
|
||||
end,
|
||||
color = { fg = colors.blue },
|
||||
padding = { left = 1 },
|
||||
}
|
||||
|
||||
-- Now don't forget to initialize lualine
|
||||
lualine.setup(config)
|
||||
71
.config/nvim/lua/plugins/mod/nvim-cmp.lua
Normal file
71
.config/nvim/lua/plugins/mod/nvim-cmp.lua
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
|
||||
--- Available LSP goes here
|
||||
--- Check https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md
|
||||
--- for available server and name
|
||||
|
||||
|
||||
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local lspconfig = require("lspconfig")
|
||||
local capabitilies = require("cmp_nvim_lsp").default_capabilities()
|
||||
local servers = require("config.servers")
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
|
||||
sources = cmp.config.sources(
|
||||
-- This order defines the priority of sources.
|
||||
{
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
},
|
||||
{
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
}
|
||||
),
|
||||
})
|
||||
local keymaps = require("config.keymaps")
|
||||
local keymaps_cmp = keymaps.cmp_nvim_keymaps(cmp.mapping)
|
||||
|
||||
local function set_keymaps()
|
||||
local mappings = {}
|
||||
for _, map in ipairs(keymaps_cmp) do
|
||||
mappings[map.keys] = map.cmd
|
||||
end
|
||||
return mappings
|
||||
end
|
||||
cmp.setup.mapping = cmp.mapping.preset.insert(set_keymaps())
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = "cmdline" },
|
||||
-- Use `path` is slow under WSL since WSL loads Windows paths
|
||||
-- https://github.com/zsh-users/zsh-syntax-highlighting/issues/790
|
||||
-- { name = "path" },
|
||||
}
|
||||
})
|
||||
|
||||
for _, server in ipairs(servers) do
|
||||
lspconfig[server].setup({
|
||||
capabilities = capabitilies,
|
||||
})
|
||||
end
|
||||
end,
|
||||
}
|
||||
41
.config/nvim/lua/plugins/mod/nvim-tree.lua
Normal file
41
.config/nvim/lua/plugins/mod/nvim-tree.lua
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
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 function opts(desc)
|
||||
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
||||
end
|
||||
|
||||
|
||||
local function set_keymaps(maps)
|
||||
for _, map in ipairs(maps) do
|
||||
local mode = map.mode or default_mode
|
||||
vim.keymap.set(mode, map.keys, map.cmd, map.opts)
|
||||
end
|
||||
end
|
||||
|
||||
local raw_keymaps = keymaps.nvim_tree_keymaps(api, opts)
|
||||
set_keymaps(raw_keymaps)
|
||||
end
|
||||
|
||||
return {
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
version = "*",
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
config = function()
|
||||
require("nvim-tree").setup {
|
||||
on_attach = my_on_attach,
|
||||
sync_root_with_cwd = true,
|
||||
respect_buf_cwd = true,
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_cwd = true,
|
||||
},
|
||||
}
|
||||
end
|
||||
}
|
||||
6
.config/nvim/lua/plugins/syntax.lua
Normal file
6
.config/nvim/lua/plugins/syntax.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
},
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
local keymap = vim.keymap.set
|
||||
|
||||
vim.g.mapleader = " "
|
||||
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "e", "k", { desc = "move cursor ⇧" })
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "n", "j", { desc = "move cursor ⇩" })
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "h", "h", { desc = "move cursor ⇦" })
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "i", "l", { desc = "move cursor ⇨" })
|
||||
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "N", "J", { desc = "Insert at the line start" })
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "E", "K", { desc = "Insert at the line start" })
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "I", "L", { desc = "Insert at the line start" })
|
||||
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "l", "i", { desc = "Insert mode" })
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "L", "I", { desc = "Insert at the line start" })
|
||||
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "k", "n", { desc = "Insert at the line start" })
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "K", "N", { desc = "Insert at the line start" })
|
||||
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "j", "e", { desc = "Insert at the line start" })
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "J", "E", { desc = "Insert at the line start" })
|
||||
|
||||
vim.opt.clipboard = "unnamedplus"
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.tabstop = 5
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.autoindent = true
|
||||
vim.opt.smartindent = true
|
||||
vim.opt.wrap = true
|
||||
vim.opt.scrolloff = 3
|
||||
vim.opt.hlsearch = true
|
||||
vim.opt.incsearch = true
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
-- VSCode commands
|
||||
keymap({ "n", "v" }, "<leader>pp", "<cmd>lua require('vscode').action('workbench.view.extension.project-manager')<CR>")
|
||||
keymap({ "n", "v" }, "<leader>pP", "<cmd>lua require('vscode').action('projectManager.listProjects')<CR>")
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
column_width = 120
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
column_width = 120
|
||||
[sort_requires]
|
||||
enabled = true
|
||||
|
|
|
|||
19
.config/readline/inputrc
Normal file
19
.config/readline/inputrc
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# $XDG_CONFIG_HOME/readline/inputrc
|
||||
|
||||
# Colemak Key Remaps
|
||||
set editing-mode vi
|
||||
set keymap vi
|
||||
set show-mode-in-prompt on
|
||||
|
||||
set mark-directories on
|
||||
set completion-ignore-case on
|
||||
set show-all-if-ambiguous on
|
||||
set bell-style none
|
||||
|
||||
$if mode=vi
|
||||
"n": next-history
|
||||
"e": previous-history
|
||||
"l": vi-insertion-mode
|
||||
"L": vi-insert-beg
|
||||
"i": forward-char
|
||||
$endif
|
||||
|
|
@ -49,7 +49,7 @@ bind -r N resize-pane -D 5
|
|||
bind -r E resize-pane -U 5
|
||||
bind -r I resize-pane -R 5
|
||||
bind C-h select-window -t :-
|
||||
bind C-l select-window -t :+
|
||||
bind C-i select-window -t :+
|
||||
bind ` resize-pane -Z
|
||||
|
||||
# Status Bar
|
||||
|
|
|
|||
|
|
@ -40,6 +40,11 @@ set smartcase
|
|||
set number
|
||||
set relativenumber
|
||||
|
||||
set laststatus=2
|
||||
set showcmd
|
||||
set statusline=%<%f\ %h%m%r\ %=\ [%l,%v]\ [%p%%]\ [\ %Y]\ [\ %{strftime('%H:%M:%S')}]
|
||||
|
||||
|
||||
" XDG Directory Specifications
|
||||
" Reference to https://jorenar.com/blog/vim-xdg
|
||||
|
||||
|
|
|
|||
22
wsl/.bashrc
22
wsl/.bashrc
|
|
@ -1,18 +1,16 @@
|
|||
# Append to original bashrc for minimal setup
|
||||
# echo $DOTFILES/wsl/.bashrc >> ~/.bashrc
|
||||
bind 'set show-mode-in-prompt on'
|
||||
set -o vi
|
||||
|
||||
bind '"\en": "\C-j"'
|
||||
bind '"\ee": "\C-k"'
|
||||
bind '"\ei": "\C-l"'
|
||||
bind -m vi-command '"n": next-history'
|
||||
bind -m vi-command '"e": previous-history'
|
||||
bind -m vi-command '"l": vi-insertion-mode'
|
||||
bind -m vi-command '"L": vi-insert-beg'
|
||||
bind -m vi-command '"i": forward-char'
|
||||
|
||||
bind '"\el": "\ei"'
|
||||
bind '"\eL": "\eI"'
|
||||
# bind -m vi-insert '"\C-r": reverse-search-history"'
|
||||
# bind -m vi-insert '"\C-l": clear-screen'
|
||||
|
||||
bind '"\ek": "\en"'
|
||||
bind '"\eK": "\eN"'
|
||||
|
||||
bind '"\ej": "\ee"'
|
||||
bind '"\eJ": "\eE"'
|
||||
|
||||
bind '"\eY": "\ey$"'
|
||||
bind -m vi-command '"j": vi-end-word'
|
||||
bind -m vi-command '"J": vi-end-word'
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ alias clpp='clang++ -std=c++2b'
|
|||
alias python=python3 # Set the default Python version to Python 3
|
||||
alias py=python # Alias for Python
|
||||
alias pip=pip3 # Alias for pip
|
||||
alias bashcfg="nvim ~/.bashrc"
|
||||
alias zshcfg="nvim ~/.zshrc"
|
||||
# alias bashcfg="nvim ~/.bashrc"
|
||||
alias zshcfg="nvim $ZDOTDIR/.zshrc"
|
||||
alias shcfg=zshcfg
|
||||
alias reload="source $ZDOTDIR/.zshrc"
|
||||
alias nvimrc="nvim $XDG_CONFIG_HOME/nvim/"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
# ZSH Config #
|
||||
export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
|
||||
export PATH=$HOME/.local/share/gem/ruby/3.3.0/bin:$PATH # Ruby Executables
|
||||
HIST_STAMPS="yyyy-mm-dd"
|
||||
|
||||
export NVM_DIR="$HOME/.config/nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
|
||||
# plugins=(git web-search jsontools z vi-mode zsh-syntax-highlighting zsh-autosuggestions)
|
||||
|
||||
# Plugins (Manually Managed) #
|
||||
|
|
@ -24,21 +29,21 @@ VISUAL="nvim"
|
|||
|
||||
# ~/.azure/ -> $XDG_DATA_HOME/azure/
|
||||
export AZURE_CONFIG_DIR="$XDG_DATA_HOME"/azure
|
||||
# ~/.cargo/ -> $XDG_DATA_HOME/cargo
|
||||
export CARGO_HOME="$XDG_DATA_HOME"/cargo
|
||||
# ~/.cgdb/ -> $XDG_CONFIG_HOME/cgdb/
|
||||
export CGDB_DIR="$XDG_CONFIG_HOME"/cgdb
|
||||
# ~/.nv -> $XDG_CACHE_HOME/nv (CUDA)
|
||||
# macOS does not have Cuda; Check if CUDA is installed
|
||||
if [ "$(uname)" != "Darwin" ] && [ -d "/usr/local/cuda" ]; then
|
||||
export CUDA_CACHE_PATH="$XDG_CACHE_HOME"/nv
|
||||
fi
|
||||
# ~/.docker -> $XDG_CONFIG_HOME/docker
|
||||
export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker
|
||||
# ~/.dotnet -> $XDG_DATA_HOME/dotnet
|
||||
export DOTNET_CLI_HOME="$XDG_DATA_HOME"/dotnet
|
||||
# Not working
|
||||
# export DOTNET_CLI_HOME="$XDG_DATA_HOME"/dotnet
|
||||
# ~/.gnupg -> $XDG_CONFIG_HOME/gnupg
|
||||
export GNUPGHOME="$XDG_DATA_HOME"/gnupg
|
||||
# ~/go -> $XDG_DATA_HOME/go
|
||||
export GOPATH="$XDG_DATA_HOME"/go
|
||||
# ~/.inputrc -> $XDG_CONFIG_HOME/readline/inputrc
|
||||
export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc
|
||||
# ~/.juliaup/ -> $XDG_DATA_HOME/julia/
|
||||
export JULIA_DEPOT_PATH="$XDG_DATA_HOME/julia:$JULIA_DEPOT_PATH"
|
||||
# Check if node is installed
|
||||
|
|
@ -54,9 +59,22 @@ if command -v node > /dev/null; then
|
|||
export NPM_CONFIG_CACHE="$XDG_CACHE_HOME"/npm
|
||||
export NPM_CONFIG_TMP="$XDG_RUNTIME_DIR"/npm
|
||||
fi
|
||||
# ~/.nv -> $XDG_CACHE_HOME/nv (CUDA)
|
||||
# macOS does not have Cuda; Check if CUDA is installed
|
||||
if [ "$(uname)" != "Darwin" ] && [ -d "/usr/local/cuda" ]; then
|
||||
export CUDA_CACHE_PATH="$XDG_CACHE_HOME"/nv
|
||||
fi
|
||||
# ~/,parallel -> $XDG_CONFIG_HOME/parallel
|
||||
export PARALLEL_HOME="$XDG_CONFIG_HOME"/parallel
|
||||
# ~/.python_history -> $XDG_DATA_HOME/python/history
|
||||
# Works only with Python 3.13.0a3 and later
|
||||
export PYTHON_HISTORY="$XDG_DATA_HOME"/python/history
|
||||
# ~/.screenrc -> $XDG_CONFIG_HOME/screen/screenrc
|
||||
export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc
|
||||
# ~/.screen/ -> $XDG_RUNTIME_DIR/screen
|
||||
export SCREENDIR="${XDG_RUNTIME_DIR}/screen"
|
||||
# ~/.spacemacs/ -> $XDG_CONFIG_HOME/spacemacs
|
||||
export SPACEMACSDIR="$XDG_CONFIG_HOME"/spacemacs
|
||||
# ~/.tldrc/ -> $XDG_CACHE_HOME/tldr
|
||||
export TLDR_CACHE_DIR="$XDG_CACHE_HOME"/tldr
|
||||
# ~/.w3m -> $XDG_DATA_HOME/w3m
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue