Compare commits
11 commits
2cb236a26f
...
3e49c39e53
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3e49c39e53 | ||
![]() |
e001ecc980 | ||
![]() |
9e3d55617c | ||
![]() |
1c0045f059 | ||
![]() |
3ca8337437 | ||
![]() |
2294b9a10c | ||
![]() |
4f9bbad9d7 | ||
![]() |
e3df1c2a03 | ||
![]() |
8ac25e0bc4 | ||
![]() |
78d671c682 | ||
![]() |
8144c96f32 |
35
init.lua
35
init.lua
|
@ -1,28 +1,39 @@
|
|||
-- enable read config from CWD
|
||||
vim.o.exrc = true
|
||||
|
||||
-- Disable intro message on startup, or many other plugins will
|
||||
-- close this message on load, which may cause a flash of intro message.
|
||||
vim.opt.shortmess:append({ I = true })
|
||||
|
||||
vim.o.tabstop = 4
|
||||
vim.o.shiftwidth = 0
|
||||
vim.o.softtabstop = -1
|
||||
vim.o.shiftround = true
|
||||
|
||||
vim.o.list = true
|
||||
vim.o.relativenumber = true
|
||||
vim.o.number = true
|
||||
|
||||
vim.o.expandtab = true
|
||||
vim.o.autoindent = true
|
||||
vim.o.smartindent = true
|
||||
|
||||
vim.keymap.set("n", "\\q", "<cmd>wincmd q<CR>", { silent = true })
|
||||
vim.keymap.set("n", "zh", "<cmd>wincmd h<CR>", { silent = true })
|
||||
vim.keymap.set("n", "zj", "<cmd>wincmd j<CR>", { silent = true })
|
||||
vim.keymap.set("n", "zk", "<cmd>wincmd k<CR>", { silent = true })
|
||||
vim.keymap.set("n", "zl", "<cmd>wincmd l<CR>", { silent = true })
|
||||
vim.o.list = true
|
||||
vim.o.relativenumber = true
|
||||
vim.o.number = true
|
||||
|
||||
vim.keymap.set("n", "zn", "<cmd>bnext<CR>", { silent = true })
|
||||
vim.keymap.set("n", "zp", "<cmd>bprevious<CR>", { silent = true })
|
||||
vim.keymap.set("n", "zx", "<cmd>bdelete<CR>", { silent = true })
|
||||
vim.keymap.set("n", "\\q", "<cmd>wincmd q<cr>", { silent = true })
|
||||
vim.keymap.set("n", "zh", "<cmd>wincmd h<cr>", { silent = true })
|
||||
vim.keymap.set("n", "zj", "<cmd>wincmd j<cr>", { silent = true })
|
||||
vim.keymap.set("n", "zk", "<cmd>wincmd k<cr>", { silent = true })
|
||||
vim.keymap.set("n", "zl", "<cmd>wincmd l<cr>", { silent = true })
|
||||
|
||||
vim.keymap.set("n", "zch", "<cmd>wincmd H<cr>", { silent = true })
|
||||
vim.keymap.set("n", "zcj", "<cmd>wincmd J<cr>", { silent = true })
|
||||
vim.keymap.set("n", "zck", "<cmd>wincmd K<cr>", { silent = true })
|
||||
vim.keymap.set("n", "zcl", "<cmd>wincmd L<cr>", { silent = true })
|
||||
|
||||
vim.keymap.set("n", "zn", "<cmd>bnext<cr>", { silent = true })
|
||||
vim.keymap.set("n", "zp", "<cmd>bprevious<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.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
|
|
@ -10,93 +10,20 @@ return {
|
|||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
main = "ibl",
|
||||
event = "VeryLazy",
|
||||
opts = { },
|
||||
},
|
||||
{
|
||||
"famiu/bufdelete.nvim",
|
||||
lazy = false,
|
||||
keys = {
|
||||
{ "zx", "<cmd>Bdelete<CR>", mode = "n" },
|
||||
{ "zx", "<cmd>Bdelete<cr>", mode = "n" },
|
||||
},
|
||||
},
|
||||
{
|
||||
"karb94/neoscroll.nvim",
|
||||
enabled = custom.full_feature,
|
||||
main = "neoscroll",
|
||||
event = "VeryLazy",
|
||||
opts = { },
|
||||
},
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
enabled = custom.full_feature,
|
||||
main = "bufferline",
|
||||
opts = {
|
||||
options = {
|
||||
numbers = "both",
|
||||
diagnostics = "nvim_lsp",
|
||||
separator_style = "slant",
|
||||
offsets = {
|
||||
{
|
||||
filetype = "NvimTree",
|
||||
text = "File Explorer",
|
||||
text_align = "center",
|
||||
separator = true,
|
||||
},
|
||||
},
|
||||
hover = {
|
||||
delay = 200,
|
||||
reveal = { "close" },
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
enabled = custom.full_feature,
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons"
|
||||
},
|
||||
main = "lualine",
|
||||
opts = { },
|
||||
init = function(_)
|
||||
vim.o.mousemoveevent = true
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
enabled = custom.full_feature,
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons"
|
||||
},
|
||||
main = "nvim-tree",
|
||||
opts = {
|
||||
filters = {
|
||||
git_ignored = false,
|
||||
},
|
||||
},
|
||||
lazy = false,
|
||||
keys = {
|
||||
{ "<leader>t", "<cmd>NvimTreeFocus<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,
|
||||
}
|
||||
}
|
||||
|
|
80
lua/plugins/13-lines.lua
Normal file
80
lua/plugins/13-lines.lua
Normal 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
41
lua/plugins/15-tree.lua
Normal 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,
|
||||
},
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
return {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
main = "gitsigns",
|
||||
event = "VeryLazy",
|
||||
enabled = custom.full_feature,
|
||||
opts = {
|
||||
on_attach = function(bufnr)
|
||||
|
@ -11,31 +12,31 @@ return {
|
|||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
m("n", "]h", function()
|
||||
m("n", "<leader>hj", function()
|
||||
if vim.wo.diff then return "]c" end
|
||||
vim.schedule(function() gs.next_hunk() end)
|
||||
return "<Ignore>"
|
||||
end, {expr=true})
|
||||
|
||||
m('n', '[h', function()
|
||||
if vim.wo.diff then return '[c' end
|
||||
m("n", "<leader>hk", function()
|
||||
if vim.wo.diff then return "[c" end
|
||||
vim.schedule(function() gs.prev_hunk() end)
|
||||
return '<Ignore>'
|
||||
return "<Ignore>"
|
||||
end, {expr=true})
|
||||
|
||||
m('n', '<leader>hs', gs.stage_hunk)
|
||||
m('n', '<leader>hr', gs.reset_hunk)
|
||||
m('v', '<leader>hs', function() gs.stage_hunk {vim.fn.line("."), vim.fn.line("v")} end)
|
||||
m('v', '<leader>hr', function() gs.reset_hunk {vim.fn.line("."), vim.fn.line("v")} end)
|
||||
m('n', '<leader>hS', gs.stage_buffer)
|
||||
m('n', '<leader>hu', gs.undo_stage_hunk)
|
||||
m('n', '<leader>hR', gs.reset_buffer)
|
||||
m('n', '<leader>hp', gs.preview_hunk)
|
||||
m('n', '<leader>hb', function() gs.blame_line{full=true} end)
|
||||
-- m('n', '<leader>tb', gs.toggle_current_line_blame)
|
||||
m('n', '<leader>hd', gs.diffthis)
|
||||
m('n', '<leader>hD', function() gs.diffthis('~') end)
|
||||
-- m('n', '<leader>td', gs.toggle_deleted)
|
||||
m("n", "<leader>hs", gs.stage_hunk)
|
||||
m("n", "<leader>hr", gs.reset_hunk)
|
||||
m("v", "<leader>hs", function() gs.stage_hunk {vim.fn.line("."), vim.fn.line("v")} end)
|
||||
m("v", "<leader>hr", function() gs.reset_hunk {vim.fn.line("."), vim.fn.line("v")} end)
|
||||
m("n", "<leader>hS", gs.stage_buffer)
|
||||
m("n", "<leader>hu", gs.undo_stage_hunk)
|
||||
m("n", "<leader>hR", gs.reset_buffer)
|
||||
m("n", "<leader>hp", gs.preview_hunk)
|
||||
m("n", "<leader>hb", function() gs.blame_line{full=true} end)
|
||||
m("n", "<leader>htb", gs.toggle_current_line_blame)
|
||||
m("n", "<leader>hd", gs.diffthis)
|
||||
m("n", "<leader>hD", function() gs.diffthis("~") end)
|
||||
m("n", "<leader>htd", gs.toggle_deleted)
|
||||
end,
|
||||
},
|
||||
config = function (lazyplug, opts)
|
||||
|
|
|
@ -53,6 +53,7 @@ end
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
name = "nvim-treesitter",
|
||||
event = "VeryLazy",
|
||||
build = ":TSUpdate",
|
||||
opts = {
|
||||
indent = { enable = true },
|
||||
|
|
|
@ -48,7 +48,7 @@ return {
|
|||
"hrsh7th/cmp-cmdline",
|
||||
"L3MON4D3/LuaSnip",
|
||||
},
|
||||
lazy = false,
|
||||
event = "VeryLazy",
|
||||
config = function (_, opts)
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
|
|
Loading…
Reference in a new issue