diff --git a/lua/base.lua b/lua/base.lua index d1797e0..66cc3bf 100644 --- a/lua/base.lua +++ b/lua/base.lua @@ -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", "", '"+y') @@ -74,12 +74,20 @@ silent_map("i", "", "g") silent_map("i", "", "g") -- half page movement -silent_map("n", "", "M") -silent_map("n", "", "M") -silent_map("v", "", "M") -silent_map("v", "", "M") -silent_map("i", "", "M") -silent_map("i", "", "M") +--silent_map("n", "", "M") +--silent_map("n", "", "M") +--silent_map("v", "", "M") +--silent_map("v", "", "M") +--silent_map("i", "", "M") +--silent_map("i", "", "M") + +-- half page movement, primeagen version +silent_map("n", "", "zz") +silent_map("n", "", "zz") +silent_map("v", "", "zz") +silent_map("v", "", "zz") +silent_map("i", "", "zz") +silent_map("i", "", "zz") -- dynamic tab silent_map("n", "", ":lua require('dynamic_tab').tab()") diff --git a/lua/dynamic_tab.lua b/lua/dynamic_tab.lua index ed6fd97..cd0a650 100644 --- a/lua/dynamic_tab.lua +++ b/lua/dynamic_tab.lua @@ -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 diff --git a/lua/plugins/config.lua b/lua/plugins/config.lua index c18ab03..5738a9f 100644 --- a/lua/plugins/config.lua +++ b/lua/plugins/config.lua @@ -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 = "", - }) - require("onedark").load() -end - function M.fzf() map("n", "o", ":Files") map("n", "O", ":Files ~/") @@ -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("u", ":UndotreeToggle") +end + return M diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 4f986dc..397b927 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -22,3 +22,4 @@ config.gitsigns() --config.nvim_lspconfig() config.lsp_zero() config.null_ls() +config.undotree() diff --git a/queries/htmldjango/highlights.scm b/queries/htmldjango/highlights.scm index 4deb05a..8594da2 100644 --- a/queries/htmldjango/highlights.scm +++ b/queries/htmldjango/highlights.scm @@ -41,4 +41,4 @@ "as" ] @keyword -(content) @html +;(content) @html