Compare commits

..

No commits in common. "d27da86f4063a4b3a0a66d45d2e26968474eb3ce" and "4d32d464ba95f809889e187fde084bccd6bc1f61" have entirely different histories.

12 changed files with 149 additions and 183 deletions

View file

@ -1,9 +1,6 @@
-- enable read config from CWD -- enable read config from CWD
vim.o.exrc = true vim.o.exrc = true
-- enable 24-bit color for nvim-notify
vim.o.termguicolors = true
-- Disable intro message on startup, or many other plugins will -- Disable intro message on startup, or many other plugins will
-- close this message on load, which may cause a flash of intro message. -- close this message on load, which may cause a flash of intro message.
vim.opt.shortmess:append({ I = true }) vim.opt.shortmess:append({ I = true })
@ -26,23 +23,20 @@ vim.o.colorcolumn = "101"
vim.g.mapleader = " " vim.g.mapleader = " "
vim.g.maplocalleader = " " vim.g.maplocalleader = " "
vim.keymap.set("n", "\\\\", "<cmd>split<cr>", { silent = true })
vim.keymap.set("n", "||", "<cmd>vsplit<cr>", { silent = true })
vim.keymap.set("n", "\\q", "<cmd>wincmd q<cr>", { silent = true }) vim.keymap.set("n", "\\q", "<cmd>wincmd q<cr>", { silent = true })
vim.keymap.set("n", "<C-h>", "<cmd>wincmd h<cr>", { silent = true }) vim.keymap.set("n", "zh", "<cmd>wincmd h<cr>", { silent = true })
vim.keymap.set("n", "<C-j>", "<cmd>wincmd j<cr>", { silent = true }) vim.keymap.set("n", "zj", "<cmd>wincmd j<cr>", { silent = true })
vim.keymap.set("n", "<C-k>", "<cmd>wincmd k<cr>", { silent = true }) vim.keymap.set("n", "zk", "<cmd>wincmd k<cr>", { silent = true })
vim.keymap.set("n", "<C-l>", "<cmd>wincmd l<cr>", { silent = true }) vim.keymap.set("n", "zl", "<cmd>wincmd l<cr>", { silent = true })
vim.keymap.set("n", "<leader><C-h>", "<cmd>wincmd H<cr>", { silent = true }) vim.keymap.set("n", "zch", "<cmd>wincmd H<cr>", { silent = true })
vim.keymap.set("n", "<leader><C-j>", "<cmd>wincmd J<cr>", { silent = true }) vim.keymap.set("n", "zcj", "<cmd>wincmd J<cr>", { silent = true })
vim.keymap.set("n", "<leader><C-k>", "<cmd>wincmd K<cr>", { silent = true }) vim.keymap.set("n", "zck", "<cmd>wincmd K<cr>", { silent = true })
vim.keymap.set("n", "<leader><C-l>", "<cmd>wincmd L<cr>", { silent = true }) vim.keymap.set("n", "zcl", "<cmd>wincmd L<cr>", { silent = true })
vim.keymap.set("n", "]b", "<cmd>bnext<cr>", { silent = true }) vim.keymap.set("n", "zn", "<cmd>bnext<cr>", { silent = true })
vim.keymap.set("n", "[b", "<cmd>bprevious<cr>", { silent = true }) vim.keymap.set("n", "zp", "<cmd>bprevious<cr>", { silent = true })
vim.keymap.set("n", "<leader>c", "<cmd>bdelete<cr>", { silent = true }) vim.keymap.set("n", "zx", "<cmd>bdelete<cr>", { silent = true })
vim.keymap.set("n", "<leader>nh", "<cmd>nohlsearch<cr>", { silent = true }) vim.keymap.set("n", "<leader>nh", "<cmd>nohlsearch<cr>", { silent = true })

View file

@ -7,6 +7,12 @@ return {
vim.cmd("colorscheme gruvbox-material") vim.cmd("colorscheme gruvbox-material")
end end
}, },
{
'stevearc/dressing.nvim',
enabled = custom.full_feature,
event = "VeryLazy",
opts = { },
},
{ {
"lukas-reineke/indent-blankline.nvim", "lukas-reineke/indent-blankline.nvim",
main = "ibl", main = "ibl",
@ -21,9 +27,16 @@ return {
{ {
"famiu/bufdelete.nvim", "famiu/bufdelete.nvim",
keys = { keys = {
{ "<leader>c", "<cmd>Bdelete<cr>", mode = "n" }, { "zx", "<cmd>Bdelete<cr>", mode = "n" },
}, },
}, },
{
"karb94/neoscroll.nvim",
enabled = custom.full_feature,
main = "neoscroll",
event = "VeryLazy",
opts = { },
},
{ {
"dstein64/nvim-scrollview", "dstein64/nvim-scrollview",
enabled = custom.full_feature, enabled = custom.full_feature,

80
lua/plugins/13-lines.lua Normal file
View file

@ -0,0 +1,80 @@
local function my_location()
local line = vim.fn.line(".")
local line_cnt = vim.fn.line("$")
local col = vim.fn.virtcol(".")
local col_cnt = vim.fn.virtcol("$") - 1
return string.format("%3d(%d):%d(%d)", line, line_cnt, col, col_cnt)
end
return {
{
"akinsho/bufferline.nvim",
enabled = custom.full_feature,
main = "bufferline",
event = "VeryLazy",
keys = {
{ "zn", "<cmd>BufferLineCycleNext<cr>" },
{ "zp", "<cmd>BufferLineCyclePrev<cr>" },
{ "zcn", "<cmd>BufferLineMoveNext<cr>" },
{ "zcp", "<cmd>BufferLineMovePrev<cr>" },
},
opts = {
options = {
numbers = "ordinal",
diagnostics = "nvim_lsp",
diagnostics_indicator = function(count, level, diagnostics_dict, context)
local icon = level:match("error") and "" or ""
return " " .. icon .. count
end,
separator_style = "thick",
offsets = {
{
filetype = "NvimTree",
text = "Nvim Tree",
text_align = "center",
separator = true,
},
},
persist_buffer_sort = false,
}
},
},
{
"nvim-lualine/lualine.nvim",
enabled = custom.full_feature,
dependencies = {
"nvim-tree/nvim-web-devicons",
"dokwork/lualine-ex",
"nvim-lua/plenary.nvim",
},
main = "lualine",
event = "VeryLazy",
opts = {
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff", "ex.lsp.single", "diagnostics" },
lualine_c = { "filename" },
lualine_x = { "encoding" , "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { my_location },
},
inactive_sections = {
lualine_a = { },
lualine_b = { },
lualine_c = { "filename" },
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { my_location },
},
options = {
disabled_filetypes = {
statusline = {"NvimTree"},
winbar = {},
},
},
},
init = function(_)
vim.o.mousemoveevent = true
end,
},
}

41
lua/plugins/15-tree.lua Normal file
View file

@ -0,0 +1,41 @@
return{
{
"nvim-tree/nvim-tree.lua",
enabled = custom.full_feature,
dependencies = {
"nvim-tree/nvim-web-devicons"
},
main = "nvim-tree",
event = "VeryLazy",
opts = {
filters = {
git_ignored = false,
},
},
keys = {
{ "<leader>t", "<cmd>NvimTreeFocus<cr>", mode = "n" },
{ "<leader>f", "<cmd>NvimTreeFindFile<cr>", mode = "n" },
},
init = function(_)
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.api.nvim_create_autocmd("QuitPre", {
callback = function()
local invalid_win = {}
local wins = vim.api.nvim_list_wins()
for _, w in ipairs(wins) do
local bufname = vim.api.nvim_buf_get_name(vim.api.nvim_win_get_buf(w))
if bufname:match("NvimTree_") ~= nil then
table.insert(invalid_win, w)
end
end
if #invalid_win == #wins - 1 then
-- Should quit, so we close all invalid windows.
for _, w in ipairs(invalid_win) do vim.api.nvim_win_close(w, true) end
end
end
})
end,
},
}

View file

@ -12,13 +12,13 @@ return {
vim.keymap.set(mode, l, r, opts) vim.keymap.set(mode, l, r, opts)
end end
m("n", "]h", function() m("n", "<leader>hn", function()
if vim.wo.diff then return "]c" end if vim.wo.diff then return "]c" end
vim.schedule(function() gs.next_hunk() end) vim.schedule(function() gs.next_hunk() end)
return "<Ignore>" return "<Ignore>"
end, {expr=true}) end, {expr=true})
m("n", "[h", function() m("n", "<leader>hp", function()
if vim.wo.diff then return "[c" end if vim.wo.diff then return "[c" end
vim.schedule(function() gs.prev_hunk() end) vim.schedule(function() gs.prev_hunk() end)
return "<Ignore>" return "<Ignore>"
@ -31,7 +31,7 @@ return {
m("n", "<leader>hS", gs.stage_buffer) m("n", "<leader>hS", gs.stage_buffer)
m("n", "<leader>hu", gs.undo_stage_hunk) m("n", "<leader>hu", gs.undo_stage_hunk)
m("n", "<leader>hR", gs.reset_buffer) m("n", "<leader>hR", gs.reset_buffer)
m("n", "<leader>hp", gs.preview_hunk) m("n", "<leader>hv", gs.preview_hunk)
m("n", "<leader>hb", function() gs.blame_line{full=true} end) m("n", "<leader>hb", function() gs.blame_line{full=true} end)
m("n", "<leader>htb", gs.toggle_current_line_blame) m("n", "<leader>htb", gs.toggle_current_line_blame)
m("n", "<leader>hd", gs.diffthis) m("n", "<leader>hd", gs.diffthis)

View file

@ -1,32 +0,0 @@
return {
"akinsho/bufferline.nvim",
enabled = custom.full_feature,
main = "bufferline",
event = "VeryLazy",
keys = {
{ "]b", "<cmd>BufferLineCycleNext<cr>" },
{ "[b", "<cmd>BufferLineCyclePrev<cr>" },
{ ">b", "<cmd>BufferLineMoveNext<cr>" },
{ "<b", "<cmd>BufferLineMovePrev<cr>" },
},
opts = {
options = {
numbers = "ordinal",
diagnostics = "nvim_lsp",
diagnostics_indicator = function(count, level, diagnostics_dict, context)
local icon = level:match("error") and "" or ""
return " " .. icon .. count
end,
separator_style = "thick",
offsets = {
{
filetype = "neo-tree",
text = "neo-tree",
text_align = "center",
separator = true,
},
},
persist_buffer_sort = false,
}
},
}

View file

@ -1,3 +0,0 @@
return {
"NMAC427/guess-indent.nvim",
}

View file

@ -1,47 +0,0 @@
local function my_location()
local line = vim.fn.line(".")
local line_cnt = vim.fn.line("$")
local col = vim.fn.virtcol(".")
local col_cnt = vim.fn.virtcol("$") - 1
return string.format("%3d(%d):%d(%d)", line, line_cnt, col, col_cnt)
end
return {
"nvim-lualine/lualine.nvim",
enabled = custom.full_feature,
dependencies = {
"nvim-tree/nvim-web-devicons",
"dokwork/lualine-ex",
"nvim-lua/plenary.nvim",
},
main = "lualine",
event = "VeryLazy",
opts = {
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff", "ex.lsp.single", "diagnostics" },
lualine_c = { "filename" },
lualine_x = { "encoding" , "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { my_location },
},
inactive_sections = {
lualine_a = { },
lualine_b = { },
lualine_c = { "filename" },
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { my_location },
},
options = {
disabled_filetypes = {
statusline = {"NvimTree"},
winbar = {},
},
},
extensions = { "lazy", "neo-tree", "quickfix" }
},
init = function(_)
vim.o.mousemoveevent = true
end,
}

View file

@ -1,8 +0,0 @@
return {
"echasnovski/mini.animate",
main = "mini.animate",
opt = {},
config = function()
require("mini.animate").setup()
end,
}

View file

@ -1,49 +0,0 @@
return {
"nvim-neo-tree/neo-tree.nvim",
dependencies = {
{ "nvim-lua/plenary.nvim", lazy = true },
{ "nvim-tree/nvim-web-devicons", lazy = true },
{ "MunifTanjim/nui.nvim", lazy = true },
},
cmd = "Neotree",
opts = function()
local git_available = vim.fn.executable("git") == 1
local get_icon = require("nvim-web-devicons").get_icon
local opts = {
enable_git_status = git_available,
auto_clean_after_session_restore = true,
close_if_last_window = true,
sources = { "filesystem", "buffers", "git_status" },
source_selector = {
winbar = true,
content_layout = "center",
sources = {
{ source = "filesystem", display_name = " 󰉓 Files " },
{ source = "buffers", display_name = " 󰈚 Bufs " },
{ source = "git_status", display_name = " 󰊢 Git " },
},
},
window = {
width = 30,
mappings = {
["[b"] = "prev_source",
["]b"] = "next_source",
}
},
}
return opts
end,
keys = {
{ "<leader>e", "<cmd>Neotree toggle<cr>", desc = "Toggle explorer"},
{
"<leader>o",
function()
if vim.bo.filetype == "neo-tree" then
vim.cmd.wincmd("p")
else
vim.cmd.Neotree("focus")
end
end,
desc = "Toggle explorer"},
},
}

View file

@ -1,8 +0,0 @@
return {
"rcarriga/nvim-notify",
config = function(LazyPlugin, opts)
local notify = require("notify")
vim.notify = notify
notify.setup(opts)
end
}

View file

@ -1,15 +0,0 @@
return {
"mrjones2014/smart-splits.nvim",
event = "VeryLazy",
opts = { ignored_filetypes = { "nofile", "quickfix", "qf", "prompt" }, ignored_buftypes = { "nofile" } },
keys = {
{ "<c-h>", function() require("smart-splits").move_cursor_left() end, desc = "Move to left split" },
{ "<c-j>", function() require("smart-splits").move_cursor_down() end, desc = "Move to below split" },
{ "<c-k>", function() require("smart-splits").move_cursor_up() end, desc = "Move to above split" },
{ "<c-l>", function() require("smart-splits").move_cursor_right() end, desc = "Move to right split" },
{ "<c-up>", function() require("smart-splits").resize_up() end, desc = "Resize split up" },
{ "<c-down>", function() require("smart-splits").resize_down() end, desc = "Resize split down" },
{ "<c-left>", function() require("smart-splits").resize_left() end, desc = "Resize split left" },
{ "<c-right>", function() require("smart-splits").resize_right() end, desc = "Resize split right" },
},
}