fixed dynamic tab inconsistencies, undotree keybind

This commit is contained in:
2023-02-13 05:22:55 -06:00
parent da374365c8
commit 849fc17535
5 changed files with 35 additions and 38 deletions
+15 -7
View File
@@ -9,7 +9,7 @@ g.mapleader = ","
-- Move cursor relative to visual line breaks
local function silent_map(mode, lhs, rhs)
map(mode, lhs, rhs, { silent = true })
map(mode, lhs, rhs, { silent = true })
end
silent_map("v", "<C-C>", '"+y')
@@ -74,12 +74,20 @@ silent_map("i", "<Home>", "<C-o>g<Home>")
silent_map("i", "<End>", "<C-o>g<End>")
-- half page movement
silent_map("n", "<PageDown>", "M<C-d>")
silent_map("n", "<PageUp>", "M<C-u>")
silent_map("v", "<PageDown>", "M<C-d>")
silent_map("v", "<PageUp>", "M<C-u>")
silent_map("i", "<PageDown>", "<C-o>M<C-o><C-d>")
silent_map("i", "<PageUp>", "<C-o>M<C-o><C-u>")
--silent_map("n", "<PageDown>", "M<C-d>")
--silent_map("n", "<PageUp>", "M<C-u>")
--silent_map("v", "<PageDown>", "M<C-d>")
--silent_map("v", "<PageUp>", "M<C-u>")
--silent_map("i", "<PageDown>", "<C-o>M<C-o><C-d>")
--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
silent_map("n", "<Tab>", ":lua require('dynamic_tab').tab()<CR>")
+3 -11
View File
@@ -1,24 +1,16 @@
local M = {}
-- Whether to switch between buffers or tabs
local function tab_mode()
function M.tab_mode()
return vim.fn.tabpagenr("$") > 1
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()
vim.cmd(tab_mode() and "tabn" or "bnext")
vim.cmd(M.tab_mode() and "tabn" or "bnext")
end
function M.shift_tab()
vim.cmd(tab_mode() and "tabp" or "bprevious")
vim.cmd(M.tab_mode() and "tabp" or "bprevious")
end
return M
+15 -19
View File
@@ -21,14 +21,6 @@ function M.hop()
map("v", "w", hopword, { silent = true })
end
function M.onedark()
require("onedark").setup({
style = "darker",
toggle_style_key = "<nop>",
})
require("onedark").load()
end
function M.fzf()
map("n", "<Leader>o", ":Files<CR>")
map("n", "<Leader>O", ":Files ~/<CR>")
@@ -154,6 +146,9 @@ function M.lualine()
lualine_a = {
{
"tabs",
cond = function()
return require("dynamic_tab").tab_mode()
end,
max_length = function()
return columns(1)
end,
@@ -161,10 +156,10 @@ function M.lualine()
},
lualine_b = {
buffer_window("windows", function()
return require("dynamic_tab").window_mode()
return require("dynamic_tab").tab_mode()
end),
buffer_window("buffers", function()
return not require("dynamic_tab").window_mode()
return not require("dynamic_tab").tab_mode()
end),
},
lualine_c = {},
@@ -178,14 +173,14 @@ end
function M.nvim_treesitter()
local highlight_disable = {
--typescript = true,
--javascript = true,
tsx = true,
cpp = true,
}
local rainbow_disable = vim.tbl_extend("force", highlight_disable, {
svelte = true,
html = true,
javascript = true,
typescript = true,
svelte = true,
query = true,
})
@@ -196,14 +191,12 @@ function M.nvim_treesitter()
require("nvim-treesitter.configs").setup({
ensure_installed = {
"python",
--"htmldjango",
"lua",
"javascript",
"typescript",
"tsx",
"json",
"svelte",
"zig",
"vim",
"css",
"scheme",
@@ -213,7 +206,7 @@ function M.nvim_treesitter()
disable = function(lang, bufnr)
return highlight_disable[lang] or too_many_lines(bufnr)
end,
--additional_vim_regex_highlighting = { "htmldjango", "html" },
additional_vim_regex_highlighting = { "htmldjango", "html" },
},
rainbow = {
enable = true,
@@ -423,7 +416,7 @@ function M.null_ls()
end
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
function M.nvim_cmp()
@@ -485,8 +478,7 @@ function M.lsp_zero()
--
-- 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")
lsp.preset("recommended")
@@ -496,4 +488,8 @@ function M.lsp_zero()
lsp.setup()
end
function M.undotree()
nmap("<Leader>u", ":UndotreeToggle<CR>")
end
return M
+1
View File
@@ -22,3 +22,4 @@ config.gitsigns()
--config.nvim_lspconfig()
config.lsp_zero()
config.null_ls()
config.undotree()