fixed dynamic tab inconsistencies, undotree keybind
This commit is contained in:
+14
-6
@@ -74,12 +74,20 @@ silent_map("i", "<Home>", "<C-o>g<Home>")
|
|||||||
silent_map("i", "<End>", "<C-o>g<End>")
|
silent_map("i", "<End>", "<C-o>g<End>")
|
||||||
|
|
||||||
-- half page movement
|
-- half page movement
|
||||||
silent_map("n", "<PageDown>", "M<C-d>")
|
--silent_map("n", "<PageDown>", "M<C-d>")
|
||||||
silent_map("n", "<PageUp>", "M<C-u>")
|
--silent_map("n", "<PageUp>", "M<C-u>")
|
||||||
silent_map("v", "<PageDown>", "M<C-d>")
|
--silent_map("v", "<PageDown>", "M<C-d>")
|
||||||
silent_map("v", "<PageUp>", "M<C-u>")
|
--silent_map("v", "<PageUp>", "M<C-u>")
|
||||||
silent_map("i", "<PageDown>", "<C-o>M<C-o><C-d>")
|
--silent_map("i", "<PageDown>", "<C-o>M<C-o><C-d>")
|
||||||
silent_map("i", "<PageUp>", "<C-o>M<C-o><C-u>")
|
--silent_map("i", "<PageUp>", "<C-o>M<C-o><C-u>")
|
||||||
|
|
||||||
|
-- half page movement, primeagen version
|
||||||
|
silent_map("n", "<PageDown>", "<C-d>zz")
|
||||||
|
silent_map("n", "<PageUp>", "<C-u>zz")
|
||||||
|
silent_map("v", "<PageDown>", "<C-d>zz")
|
||||||
|
silent_map("v", "<PageUp>", "<C-u>zz")
|
||||||
|
silent_map("i", "<PageDown>", "<C-o><C-d><C-o>zz")
|
||||||
|
silent_map("i", "<PageUp>", "<C-o><C-u><C-o>zz")
|
||||||
|
|
||||||
-- dynamic tab
|
-- dynamic tab
|
||||||
silent_map("n", "<Tab>", ":lua require('dynamic_tab').tab()<CR>")
|
silent_map("n", "<Tab>", ":lua require('dynamic_tab').tab()<CR>")
|
||||||
|
|||||||
+3
-11
@@ -1,24 +1,16 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
-- Whether to switch between buffers or tabs
|
-- Whether to switch between buffers or tabs
|
||||||
local function tab_mode()
|
function M.tab_mode()
|
||||||
return vim.fn.tabpagenr("$") > 1
|
return vim.fn.tabpagenr("$") > 1
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Whether to show windows or buffers in lualine
|
|
||||||
local function window_mode()
|
|
||||||
return vim.fn.winnr("$") > 1 or tab_mode()
|
|
||||||
end
|
|
||||||
|
|
||||||
M.tab_mode = tab_mode
|
|
||||||
M.window_mode = window_mode
|
|
||||||
|
|
||||||
function M.tab()
|
function M.tab()
|
||||||
vim.cmd(tab_mode() and "tabn" or "bnext")
|
vim.cmd(M.tab_mode() and "tabn" or "bnext")
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.shift_tab()
|
function M.shift_tab()
|
||||||
vim.cmd(tab_mode() and "tabp" or "bprevious")
|
vim.cmd(M.tab_mode() and "tabp" or "bprevious")
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
+15
-19
@@ -21,14 +21,6 @@ function M.hop()
|
|||||||
map("v", "w", hopword, { silent = true })
|
map("v", "w", hopword, { silent = true })
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.onedark()
|
|
||||||
require("onedark").setup({
|
|
||||||
style = "darker",
|
|
||||||
toggle_style_key = "<nop>",
|
|
||||||
})
|
|
||||||
require("onedark").load()
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.fzf()
|
function M.fzf()
|
||||||
map("n", "<Leader>o", ":Files<CR>")
|
map("n", "<Leader>o", ":Files<CR>")
|
||||||
map("n", "<Leader>O", ":Files ~/<CR>")
|
map("n", "<Leader>O", ":Files ~/<CR>")
|
||||||
@@ -154,6 +146,9 @@ function M.lualine()
|
|||||||
lualine_a = {
|
lualine_a = {
|
||||||
{
|
{
|
||||||
"tabs",
|
"tabs",
|
||||||
|
cond = function()
|
||||||
|
return require("dynamic_tab").tab_mode()
|
||||||
|
end,
|
||||||
max_length = function()
|
max_length = function()
|
||||||
return columns(1)
|
return columns(1)
|
||||||
end,
|
end,
|
||||||
@@ -161,10 +156,10 @@ function M.lualine()
|
|||||||
},
|
},
|
||||||
lualine_b = {
|
lualine_b = {
|
||||||
buffer_window("windows", function()
|
buffer_window("windows", function()
|
||||||
return require("dynamic_tab").window_mode()
|
return require("dynamic_tab").tab_mode()
|
||||||
end),
|
end),
|
||||||
buffer_window("buffers", function()
|
buffer_window("buffers", function()
|
||||||
return not require("dynamic_tab").window_mode()
|
return not require("dynamic_tab").tab_mode()
|
||||||
end),
|
end),
|
||||||
},
|
},
|
||||||
lualine_c = {},
|
lualine_c = {},
|
||||||
@@ -178,14 +173,14 @@ end
|
|||||||
|
|
||||||
function M.nvim_treesitter()
|
function M.nvim_treesitter()
|
||||||
local highlight_disable = {
|
local highlight_disable = {
|
||||||
--typescript = true,
|
|
||||||
--javascript = true,
|
|
||||||
tsx = true,
|
tsx = true,
|
||||||
cpp = true,
|
cpp = true,
|
||||||
}
|
}
|
||||||
local rainbow_disable = vim.tbl_extend("force", highlight_disable, {
|
local rainbow_disable = vim.tbl_extend("force", highlight_disable, {
|
||||||
svelte = true,
|
|
||||||
html = true,
|
html = true,
|
||||||
|
javascript = true,
|
||||||
|
typescript = true,
|
||||||
|
svelte = true,
|
||||||
query = true,
|
query = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -196,14 +191,12 @@ function M.nvim_treesitter()
|
|||||||
require("nvim-treesitter.configs").setup({
|
require("nvim-treesitter.configs").setup({
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"python",
|
"python",
|
||||||
--"htmldjango",
|
|
||||||
"lua",
|
"lua",
|
||||||
"javascript",
|
"javascript",
|
||||||
"typescript",
|
"typescript",
|
||||||
"tsx",
|
"tsx",
|
||||||
"json",
|
"json",
|
||||||
"svelte",
|
"svelte",
|
||||||
"zig",
|
|
||||||
"vim",
|
"vim",
|
||||||
"css",
|
"css",
|
||||||
"scheme",
|
"scheme",
|
||||||
@@ -213,7 +206,7 @@ function M.nvim_treesitter()
|
|||||||
disable = function(lang, bufnr)
|
disable = function(lang, bufnr)
|
||||||
return highlight_disable[lang] or too_many_lines(bufnr)
|
return highlight_disable[lang] or too_many_lines(bufnr)
|
||||||
end,
|
end,
|
||||||
--additional_vim_regex_highlighting = { "htmldjango", "html" },
|
additional_vim_regex_highlighting = { "htmldjango", "html" },
|
||||||
},
|
},
|
||||||
rainbow = {
|
rainbow = {
|
||||||
enable = true,
|
enable = true,
|
||||||
@@ -423,7 +416,7 @@ function M.null_ls()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.nvim_autopairs()
|
function M.nvim_autopairs()
|
||||||
require("nvim-autopairs").setup({ check_ts = false, enable_moveright = false })
|
require("nvim-autopairs").setup({ check_ts = true, enable_moveright = false })
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.nvim_cmp()
|
function M.nvim_cmp()
|
||||||
@@ -485,8 +478,7 @@ function M.lsp_zero()
|
|||||||
--
|
--
|
||||||
-- https://github.com/VonHeikemen/lsp-zero.nvim
|
-- https://github.com/VonHeikemen/lsp-zero.nvim
|
||||||
--
|
--
|
||||||
-- Learn the keybindings, see :help lsp-zero-keybindings
|
|
||||||
-- Learn to configure LSP servers, see :help lsp-zero-api-showcase
|
|
||||||
local lsp = require("lsp-zero")
|
local lsp = require("lsp-zero")
|
||||||
lsp.preset("recommended")
|
lsp.preset("recommended")
|
||||||
|
|
||||||
@@ -496,4 +488,8 @@ function M.lsp_zero()
|
|||||||
lsp.setup()
|
lsp.setup()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.undotree()
|
||||||
|
nmap("<Leader>u", ":UndotreeToggle<CR>")
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@@ -22,3 +22,4 @@ config.gitsigns()
|
|||||||
--config.nvim_lspconfig()
|
--config.nvim_lspconfig()
|
||||||
config.lsp_zero()
|
config.lsp_zero()
|
||||||
config.null_ls()
|
config.null_ls()
|
||||||
|
config.undotree()
|
||||||
|
|||||||
@@ -41,4 +41,4 @@
|
|||||||
"as"
|
"as"
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
(content) @html
|
;(content) @html
|
||||||
|
|||||||
Reference in New Issue
Block a user