From a13300d1b52260583ce863a1ba96e8bc9774ca02 Mon Sep 17 00:00:00 2001 From: Max Richter Date: Wed, 25 Jan 2023 16:35:57 +0100 Subject: [PATCH] some improvements --- configs/.p10k.zsh | 2 +- configs/.tmux.conf | 6 ++ configs/nvim/lazy-lock.json | 63 +++++++++-------- configs/nvim/lua/max/configs/gestures.lua | 27 ++++++++ configs/nvim/lua/max/configs/lsp-glsl.lua | 14 ++-- configs/nvim/lua/max/configs/lsp.lua | 63 ++++++++--------- configs/nvim/lua/max/configs/lualine.lua | 1 + configs/nvim/lua/max/configs/telescope.lua | 2 +- configs/nvim/lua/max/configs/tree.lua | 4 +- configs/nvim/lua/max/configs/treesitter.lua | 3 + configs/nvim/lua/max/configs/ufo.lua | 41 +++++++++++ configs/nvim/lua/max/core/autocommands.lua | 7 +- configs/nvim/lua/max/core/keymappings.lua | 4 +- configs/nvim/lua/max/core/plugins.lua | 76 ++++++++++++++------- configs/nvim/lua/max/theme/statuscolumn.lua | 32 +++++++++ configs/nvim/lua/max/utils/init.lua | 26 +++---- configs/wezterm/wezterm.lua | 9 +++ configs/zsh/aliases.sh | 1 + 18 files changed, 265 insertions(+), 116 deletions(-) create mode 100644 configs/nvim/lua/max/configs/gestures.lua create mode 100644 configs/nvim/lua/max/configs/ufo.lua create mode 100644 configs/nvim/lua/max/theme/statuscolumn.lua diff --git a/configs/.p10k.zsh b/configs/.p10k.zsh index 5d22ba3..0a4a3c4 100644 --- a/configs/.p10k.zsh +++ b/configs/.p10k.zsh @@ -80,7 +80,7 @@ # Red prompt symbol if the last command failed. typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red # Default prompt symbol. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='ᐷ' + typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='›' # Prompt symbol in command vi mode. typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='❮' # Prompt symbol in visual vi mode is the same as in command mode. diff --git a/configs/.tmux.conf b/configs/.tmux.conf index 363ce76..4e5fdaa 100644 --- a/configs/.tmux.conf +++ b/configs/.tmux.conf @@ -58,3 +58,9 @@ set-option -g status-style bg=default set -g @yank_action 'copy-pipe-no-clear' bind -T copy-mode C-c send -X copy-pipe-no-clear "xsel -i --clipboard" bind -T copy-mode-vi C-c send -X copy-pipe-no-clear "xsel -i --clipboard" + +set -g focus-events on +set -g status-style bg=default +set -g status-left-length 90 +set -g status-right-length 90 +# set -g status-justify centre diff --git a/configs/nvim/lazy-lock.json b/configs/nvim/lazy-lock.json index d55d58e..f029ed6 100644 --- a/configs/nvim/lazy-lock.json +++ b/configs/nvim/lazy-lock.json @@ -1,12 +1,12 @@ { - "ChatGPT.nvim": { "branch": "main", "commit": "c33babb015005cda6042f908ac587e4bc498d041" }, - "Comment.nvim": { "branch": "master", "commit": "e89df176e8b38e931b7e71a470f923a317976d86" }, + "ChatGPT.nvim": { "branch": "main", "commit": "dac83f630fc6aafd256b149a2c2ae0d4466ec85e" }, + "Comment.nvim": { "branch": "master", "commit": "eab2c83a0207369900e92783f56990808082eac2" }, "FixCursorHold.nvim": { "branch": "master", "commit": "70a9516a64668cbfe59f31b66d0a21678c5e9b12" }, - "LuaSnip": { "branch": "master", "commit": "45670282dc861b51c4e028e6930c75371fe0b88f" }, + "LuaSnip": { "branch": "master", "commit": "8c23e1af82bdafa86556a36c4e075079dd167771" }, "alpha-nvim": { "branch": "main", "commit": "21a0f2520ad3a7c32c0822f943368dc063a569fb" }, "autolist.nvim": { "branch": "main", "commit": "f8b4c11b79b0fef77a64b03810839a1abbbc67d5" }, "boole.nvim": { "branch": "main", "commit": "f4f9996f91159e54b8f1893b20e2e599c91bc1bd" }, - "catppuccin": { "branch": "main", "commit": "ee756bf71c444303d9ea378dc4996e59edb1aa2b" }, + "catppuccin": { "branch": "main", "commit": "6368edcd0b5e5cb5d9fb7cdee9d62cffe3e14f0e" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" }, "cmp-nvim-lsp": { "branch": "main", "commit": "59224771f91b86d1de12570b4070fe4ad7cd1eeb" }, @@ -14,58 +14,65 @@ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, "copilot-cmp": { "branch": "master", "commit": "b732a58ac8b7287b981cd9f0d9c0f61e5e9d5760" }, - "copilot.lua": { "branch": "master", "commit": "5b911f2d8ecccc684c13fdb8af4145cca19dc3cf" }, + "copilot.lua": { "branch": "master", "commit": "6ca9b4b3eda9138406291493750a6890c927dbfa" }, "dressing.nvim": { "branch": "master", "commit": "4436d6f41e2f6b8ada57588acd1a9f8b3d21453c" }, - "editorconfig-vim": { "branch": "master", "commit": "1953c0f2541446e8a56ba4e2f4477e91e78f6d13" }, + "editorconfig-vim": { "branch": "master", "commit": "ed23a49992a8adfc0a1db765cb5353adeb12f9ff" }, "flit.nvim": { "branch": "main", "commit": "be110f9814a45788d10537fd59b3c76d956bb7ad" }, - "friendly-snippets": { "branch": "main", "commit": "7ab483b355613ef4f74189c7789278d765724d12" }, + "friendly-snippets": { "branch": "main", "commit": "046e4d3491baf664e0eef5231d28beb49333578b" }, "fwatch.nvim": { "branch": "main", "commit": "a691f7349dc66285cd75a1a698dd28bca45f2bf8" }, - "fzf": { "branch": "master", "commit": "20230117636c9dfa3ed6f6428c5bc4c51b02f60a" }, + "fzf": { "branch": "master", "commit": "d51980a3f50dfa8ce43b01a3dce216afb8a0bd8f" }, + "gesture.nvim": { "branch": "master", "commit": "9451add0df9c32f3e41e6cc45211e3f2c6809025" }, "git-conflict.nvim": { "branch": "main", "commit": "cbefa7075b67903ca27f6eefdc9c1bf0c4881017" }, - "gitsigns.nvim": { "branch": "main", "commit": "addd6e174a85fc1c4007ab0b65d77e6555b417bf" }, - "lazy.nvim": { "branch": "main", "commit": "c05d61d208afaccb2a6765c0a6eb2d4e506a8c18" }, - "leap.nvim": { "branch": "main", "commit": "a968ab4250840dc879e805f918b4f3b892310a12" }, + "git-worktree.nvim": { "branch": "master", "commit": "d7f4e2584e81670154f07ca9fa5dd791d9c1b458" }, + "gitsigns.nvim": { "branch": "main", "commit": "7b37bd5c2dd4d7abc86f2af096af79120608eeca" }, + "lazy.nvim": { "branch": "main", "commit": "96d759d1cbd8b0bd0ea0a0c2987f99410272f348" }, + "leap.nvim": { "branch": "main", "commit": "ff4c3663e5a0a0ecbb3fffbc8318825def35d2aa" }, "lsp-format.nvim": { "branch": "master", "commit": "ca0df5c8544e51517209ea7b86ecc522c98d4f0a" }, "lspkind.nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" }, - "lspsaga.nvim": { "branch": "main", "commit": "963ede052055c371d1968252c040fe19f2ad16ad" }, + "lspsaga.nvim": { "branch": "main", "commit": "fb5ec294f833ce5563fc5abce4eb9725d7809652" }, "lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" }, "lualine.nvim": { "branch": "master", "commit": "0050b308552e45f7128f399886c86afefc3eb988" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "610f5919fe633ac872239a0ab786572059f0d91d" }, - "mason.nvim": { "branch": "main", "commit": "e50e1940de5a4d840326c8ddee68ed7440555f4f" }, - "neotest": { "branch": "master", "commit": "fee5ce9bdc3dff4706a29b012e75025ab376becb" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "5b388c0de30f1605671ebfb9a20a620cda50ffce" }, + "mason.nvim": { "branch": "main", "commit": "bb88357eff0d0c69ab8ecc5985952e0a9a72175a" }, + "neodev.nvim": { "branch": "main", "commit": "34dd33cd283b3a89f70d32c8f55bb5ec4ce2de93" }, + "neotest": { "branch": "master", "commit": "6676edc3078b8936df989df639900dc9a70dfc8a" }, "neotest-jest": { "branch": "main", "commit": "8b8926480865e56053681d0c56e3be0a3b5e716c" }, "neotest-vitest": { "branch": "main", "commit": "d6577b191e16c174bffbec1eadfcd65c22fdcc0d" }, - "no-neck-pain.nvim": { "branch": "main", "commit": "5830248d1196080df91cc8f3e3f2ecb181f0a12d" }, + "no-neck-pain.nvim": { "branch": "main", "commit": "40369b2d38271e320d3584860c89b87299bf60ae" }, "nui.nvim": { "branch": "main", "commit": "b99e6cb13dc51768abc1c4c8585045a0c0459ef1" }, - "null-ls.nvim": { "branch": "main", "commit": "c02509dc9a5f71ccbfa48fc7d2614686b538f80e" }, - "nvim-autopairs": { "branch": "master", "commit": "f00eb3b766c370cb34fdabc29c760338ba9e4c6c" }, + "null-ls.nvim": { "branch": "main", "commit": "33cfeb7a761f08e8535dca722d4b237cabadd371" }, + "nvim-autopairs": { "branch": "master", "commit": "31042a5823b55c4bfb30efcbba2fc1b5b53f90dc" }, "nvim-cmp": { "branch": "main", "commit": "11a95792a5be0f5a40bab5fc5b670e5b1399a939" }, - "nvim-dap": { "branch": "master", "commit": "5a1479c5d633daa0db06988ed44663f07f10f5dd" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" }, + "nvim-dap": { "branch": "master", "commit": "c64a6627bb01eb151da96b28091797beaac09536" }, "nvim-dap-ui": { "branch": "master", "commit": "b80227ea56a48177786904f6322abc8b2dc0bc36" }, "nvim-dap-vscode-js": { "branch": "main", "commit": "e7c05495934a658c8aa10afd995dacd796f76091" }, - "nvim-lspconfig": { "branch": "master", "commit": "8ebe6894dddaeb1459e1397c865f54fa5ecaac80" }, - "nvim-notify": { "branch": "master", "commit": "72e77098a145d7b805353a0d94a367739f81214f" }, + "nvim-lspconfig": { "branch": "master", "commit": "85cd2ecacd8805614efe3fb3a5146ac7d0f88a17" }, + "nvim-notify": { "branch": "master", "commit": "bdd647f61a05c9b8a57c83b78341a0690e9c29d7" }, "nvim-scrollbar": { "branch": "main", "commit": "6a2065fbcd032075a06d2ab54508b69842bc4496" }, "nvim-toggleterm.lua": { "branch": "main", "commit": "a54e6c471ce1cd8ef8357e34598a28a955297131" }, - "nvim-tree.lua": { "branch": "master", "commit": "1b13a49f913b58a5f1792ea81c13947a7988db8e" }, - "nvim-treesitter": { "branch": "master", "commit": "8666451879adc60e9ca66d35b84a6375e9128668" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "a8c86f48c1030acee22b9e071e3c531de77bf253" }, + "nvim-tree.lua": { "branch": "master", "commit": "96506fee49542f3aedab76368d400a147fea344e" }, + "nvim-treesitter": { "branch": "master", "commit": "405fe27cd1b81faadd08fd5895dc54a34154103e" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "2fb97bd6c53d78517d2022a0b84422c18ce5686e" }, + "nvim-ts-autotag": { "branch": "main", "commit": "fdefe46c6807441460f11f11a167a2baf8e4534b" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "a0f89563ba36b3bacd62cf967b46beb4c2c29e52" }, "nvim-ufo": { "branch": "main", "commit": "e3528c9b7ca20e9e0d69d588037f484257f0d652" }, - "nvim-web-devicons": { "branch": "master", "commit": "6c38926351372ea87034dec26182b62c835ff3bc" }, + "nvim-web-devicons": { "branch": "master", "commit": "13d06d74afad093d8312fe051633b55f24049c16" }, "persisted.nvim": { "branch": "main", "commit": "325cda4fb406601929fbc2084816dc5e49d5e5aa" }, "plenary.nvim": { "branch": "master", "commit": "1c7e3e6b0f4dd5a174fcea9fda8a4d7de593b826" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, "promise-async": { "branch": "main", "commit": "842dca33e6b1af7bedcefc72cffbc807d54dbfca" }, "sniprun": { "branch": "master", "commit": "79806dad094770a1563ac0227c9692f7592df744" }, "symbols-outline.nvim": { "branch": "master", "commit": "6a3ed24c5631da7a5d418bced57c16b32af7747c" }, - "telescope.nvim": { "branch": "master", "commit": "2f32775405f6706348b71d0bb8a15a22852a61e4" }, + "telescope.nvim": { "branch": "master", "commit": "dce1156ca103b8222e4abbfc63f9c6887abf5ec6" }, + "todo-comments.nvim": { "branch": "main", "commit": "077c59586d9d0726b0696dc5680eb863f4e04bc5" }, "translate.nvim": { "branch": "main", "commit": "7b2fd50c21ecfe536d572d62dcd3fa83acad3743" }, - "trouble.nvim": { "branch": "main", "commit": "83ec606e7065adf134d17f4af6bae510e3c491c1" }, - "ts-node-action": { "branch": "master", "commit": "94df3af2bb49c462c9502d7b2355cb4f7a95e612" }, + "trouble.nvim": { "branch": "main", "commit": "b2a0afac2c319a481f0f0318963a74d672ba5766" }, + "ts-node-action": { "branch": "master", "commit": "88881ab67207b578d5d680b75ef74e59dcc47610" }, "undotree": { "branch": "master", "commit": "1a23ea84bd02c34f50d8e10a8b4bfc89597ffe4e" }, "vim-dadbod": { "branch": "master", "commit": "a09e40664e9cd30cd2b3f8866b796598302070f6" }, "vim-dadbod-ui": { "branch": "master", "commit": "f4ead480930a37dd2b0cf917a8c387ed36c2d86a" }, + "vim-styled-components": { "branch": "main", "commit": "75e178916fc3e61385350933a23055927f5f60b7" }, "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, "which-key.nvim": { "branch": "main", "commit": "e4fa445065a2bb0bbc3cca85346b67817f28e83e" } } \ No newline at end of file diff --git a/configs/nvim/lua/max/configs/gestures.lua b/configs/nvim/lua/max/configs/gestures.lua new file mode 100644 index 0000000..1abf551 --- /dev/null +++ b/configs/nvim/lua/max/configs/gestures.lua @@ -0,0 +1,27 @@ +local gesture = require("gesture") + +vim.keymap.set("n", "", [[]]) +vim.keymap.set("n", "", [[lua require("gesture").draw()]], { silent = true }) +vim.keymap.set("n", "", [[lua require("gesture").finish()]], { silent = true }) + +gesture.register({ + name = "go back", + inputs = { gesture.right() }, + -- map to `` keycode + action = [[lua vim.cmd('sp')]], +}) + + +gesture.register({ + name = "go back", + inputs = { gesture.down() }, + -- map to `` keycode + action = [[lua vim.cmd('vsp')]], +}) + +-- gesture.register({ +-- name = "scroll to bottom", +-- inputs = { gesture.right() }, +-- action = "normal! G", +-- }) + diff --git a/configs/nvim/lua/max/configs/lsp-glsl.lua b/configs/nvim/lua/max/configs/lsp-glsl.lua index ff6ac87..8adec49 100644 --- a/configs/nvim/lua/max/configs/lsp-glsl.lua +++ b/configs/nvim/lua/max/configs/lsp-glsl.lua @@ -4,24 +4,20 @@ if not status_ok then return end -local default_capabilities = { - textDocument = { - completion = { - editsNearCursor = true, - }, - }, - offsetEncoding = { 'utf-8', 'utf-16' }, -} +local default_capabilities = vim.lsp.protocol.make_client_capabilities() +default_capabilities.textDocument.completion = false +default_capabilities.textDocument.synchronization.didSave = false; local default_config = { cmd = { 'glslls' }, -- GLSL lsp executable from (https://github.com/svenstaro/glsl-language-server - filetypes = { 'glsl' }, + filetypes = { 'glsl', 'vs', 'fs' }, root_dir = util.root_pattern('compile_commands.json', '.git'), single_file_support = true, capabilities = default_capabilities, } return { + capabilities = default_capabilities, default_configs = default_config, commands = {}, docs = { diff --git a/configs/nvim/lua/max/configs/lsp.lua b/configs/nvim/lua/max/configs/lsp.lua index 6c053ba..3e4be66 100644 --- a/configs/nvim/lua/max/configs/lsp.lua +++ b/configs/nvim/lua/max/configs/lsp.lua @@ -2,18 +2,17 @@ local mason = require("mason") local mason_lsp = require("mason-lspconfig") local lsp = require("lspconfig") - -require("null-ls").setup({ - sources = { - require("null-ls").builtins.formatting.stylua, - require("null-ls").builtins.diagnostics.eslint, - -- require("null-ls").builtins.code_actions.eslint_d, - -- require("null-ls").builtins.completion.spell, - }, -}) +-- local null_ls = require("null-ls") +-- null_ls.setup({ +-- sources = { +-- -- null_ls.builtins.formatting.stylua, +-- -- null_ls.builtins.code_actions.eslint_d, +-- -- null_ls.builtins.formatting.prettierd +-- -- require("null-ls").builtins.completion.spell, +-- }, +-- }) mason.setup() - mason_lsp.setup({ ensure_installed = { "sumneko_lua", "jsonls", "tsserver", "svelte", "cssls" }, }) @@ -23,6 +22,8 @@ table.insert(runtime_path, "lua/?.lua") table.insert(runtime_path, "lua/?/init.lua") local function on_attach(client, bufnr) + + if client.supports_method("textDocument/formatting") then vim.api.nvim_create_autocmd("BufWritePre", { buffer = bufnr, @@ -44,28 +45,24 @@ local function on_attach(client, bufnr) end, }) else - -- vim.notify("Lsp (" .. client.name .. ") doesnt support format") + print("Lsp (" .. client.name .. ") doesnt support format") end end local capabilities = require("cmp_nvim_lsp").default_capabilities() capabilities.textDocument.foldingRange = { dynamicRegistration = false, - lineFoldingOnly = true + lineFoldingOnly = true, } capabilities.textDocument.completion.completionItem.snippetSupport = true -local custom_lsp = {}; +local custom_lsp = {} custom_lsp.tsserver = { - on_attach = on_attach, - capabilities = capabilities, root_dir = lsp.util.root_pattern("tsconfig.json", "package.json", "jsconfig.json", ".git"), } custom_lsp.sumneko_lua = { - on_attach = on_attach, - capabilities = capabilities, settings = { Lua = { runtime = { @@ -90,10 +87,7 @@ custom_lsp.sumneko_lua = { }, } - custom_lsp.jsonls = { - capabilities = capabilities, - on_attach = on_attach, settings = { provideFormatter = false, json = { @@ -131,8 +125,6 @@ custom_lsp.jsonls = { } custom_lsp.intelephense = { - capabilities = capabilities, - on_attach = on_attach, settings = { intelephense = { stubs = { @@ -152,7 +144,6 @@ custom_lsp.intelephense = { } custom_lsp.rust_analyzer = { - on_attach = on_attach, settings = { ["rust-analyzer"] = { imports = { @@ -174,8 +165,6 @@ custom_lsp.rust_analyzer = { } custom_lsp.yamlls = { - capabilities = capabilities, - on_attach = on_attach, settings = { yaml = { schemas = { @@ -188,11 +177,11 @@ custom_lsp.yamlls = { }, } -custom_lsp.glslls = require("max.configs.lsp-glsl") +-- local glslls_config = require("max.configs.lsp-glsl") +-- glslls_config.on_attach = on_attach; +-- lsp.glslls.setup(glslls_config) custom_lsp.ltex = { - capabilities = capabilities, - on_attach = on_attach, settings = { ltex = { language = "de", @@ -209,15 +198,19 @@ custom_lsp.ltex = { }, } -require('mason-lspconfig').setup_handlers({ +mason_lsp.setup_handlers({ function(server_name) + local config = { + on_attach = on_attach, + capabilities = capabilities, + } + if custom_lsp[server_name] ~= nil then - lsp[server_name].setup(custom_lsp[server_name]) - else - lsp[server_name].setup({ - capabilities = capabilities, - on_attach = on_attach, - }) + for k, v in pairs(custom_lsp[server_name]) do + config[k] = v + end end + + lsp[server_name].setup(config) end, }) diff --git a/configs/nvim/lua/max/configs/lualine.lua b/configs/nvim/lua/max/configs/lualine.lua index f16d61b..55801e3 100644 --- a/configs/nvim/lua/max/configs/lualine.lua +++ b/configs/nvim/lua/max/configs/lualine.lua @@ -225,6 +225,7 @@ ins_right({ }) -- Text Progress + ins_right({ "progress", padding = { right = 1 }, diff --git a/configs/nvim/lua/max/configs/telescope.lua b/configs/nvim/lua/max/configs/telescope.lua index fede980..faf26a4 100644 --- a/configs/nvim/lua/max/configs/telescope.lua +++ b/configs/nvim/lua/max/configs/telescope.lua @@ -66,5 +66,5 @@ local default = { } telescope.setup(default) --- telescope.load_extension("git_worktree") +telescope.load_extension("git_worktree") telescope.load_extension("notify") diff --git a/configs/nvim/lua/max/configs/tree.lua b/configs/nvim/lua/max/configs/tree.lua index a360551..d379f70 100644 --- a/configs/nvim/lua/max/configs/tree.lua +++ b/configs/nvim/lua/max/configs/tree.lua @@ -38,5 +38,5 @@ require("nvim-tree").setup({ }, }) -vim.cmd("NvimTreeOpen") -vim.api.nvim_input("") +-- vim.cmd("NvimTreeOpen") +-- vim.api.nvim_input("") diff --git a/configs/nvim/lua/max/configs/treesitter.lua b/configs/nvim/lua/max/configs/treesitter.lua index bc532ea..9f929c4 100644 --- a/configs/nvim/lua/max/configs/treesitter.lua +++ b/configs/nvim/lua/max/configs/treesitter.lua @@ -2,6 +2,9 @@ require("nvim-treesitter.configs").setup({ context_commentstring = { enable = true }, + autotag = { + enable = true, + }, indent = { enable = true, }, diff --git a/configs/nvim/lua/max/configs/ufo.lua b/configs/nvim/lua/max/configs/ufo.lua new file mode 100644 index 0000000..a3d63dc --- /dev/null +++ b/configs/nvim/lua/max/configs/ufo.lua @@ -0,0 +1,41 @@ +return function() + local handler = function(virtText, lnum, endLnum, width, truncate) + local newVirtText = {} + local suffix = ('  %d '):format(endLnum - lnum) + local sufWidth = vim.fn.strdisplaywidth(suffix) + local targetWidth = width - sufWidth + local curWidth = 0 + for _, chunk in ipairs(virtText) do + local chunkText = chunk[1] + local chunkWidth = vim.fn.strdisplaywidth(chunkText) + if targetWidth > curWidth + chunkWidth then + table.insert(newVirtText, chunk) + else + chunkText = truncate(chunkText, targetWidth - curWidth) + local hlGroup = chunk[2] + table.insert(newVirtText, { chunkText, hlGroup }) + chunkWidth = vim.fn.strdisplaywidth(chunkText) + -- str width returned from truncate() may less than 2nd argument, need padding + if curWidth + chunkWidth < targetWidth then + suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth) + end + break + end + curWidth = curWidth + chunkWidth + end + table.insert(newVirtText, { suffix, 'MoreMsg' }) + return newVirtText + end + + require("ufo").setup({ + fold_virt_text_handler = handler, + provider_selector = function(bufnr, filetype, buftype) + return { 'treesitter', 'indent' } + end + }) + + vim.o.foldcolumn = '1' + vim.o.foldlevel = 99 + vim.o.foldlevelstart = 99 + vim.o.foldenable = true +end diff --git a/configs/nvim/lua/max/core/autocommands.lua b/configs/nvim/lua/max/core/autocommands.lua index a5283d6..9c96660 100644 --- a/configs/nvim/lua/max/core/autocommands.lua +++ b/configs/nvim/lua/max/core/autocommands.lua @@ -33,14 +33,17 @@ autocmd("BufWinEnter", { group = save_fold, }) +require("max.theme.statuscolumn"); + autocmd({ "BufWinEnter","BufAdd" }, { desc = 'hide statuscolumn in nvimtree', group = vim.api.nvim_create_augroup('hide_nvimtree_stc', { clear = true }), callback = function(opts) if vim.bo[opts.buf].filetype == 'NvimTree' then - vim.o.statuscolumn = '' + vim.opt.statuscolumn = '' else - vim.o.statuscolumn = '%=%r%s%#FoldColumn#%{foldlevel(v:lnum) > foldlevel(v:lnum - 1) ? (foldclosed(v:lnum) == -1 ? "" : "") : " " } %*' + -- vim.o.statuscolumn = '%=%r%s%#FoldColumn#%{foldlevel(v:lnum) > foldlevel(v:lnum - 1) ? (foldclosed(v:lnum) == -1 ? "" : "") : " " } %*' + vim.opt.statuscolumn = [[%!v:lua.Status.column()]] end end, }) diff --git a/configs/nvim/lua/max/core/keymappings.lua b/configs/nvim/lua/max/core/keymappings.lua index 45676ff..bbd787f 100644 --- a/configs/nvim/lua/max/core/keymappings.lua +++ b/configs/nvim/lua/max/core/keymappings.lua @@ -35,9 +35,12 @@ map("n", "ii", ":Lspsaga incomming_calls", opts) map("n", "io", ":Lspsaga outgoing_calls", opts) map("n", "rn", "lua vim.lsp.buf.rename()", opts) map({ "n", "v" }, "c", "Lspsaga code_action", { silent = true }) +map({ "n", "v" }, "c", "lua vim.lsp.buf.code_action()", { silent = true }) map({ "n", "v" }, "gr", "Lspsaga lsp_finder", opts) map("n", "u", ":UndotreeToggle", opts) +map("n", "wq", ":wqall!", opts) +map("n", "li", ":LspInfo", opts) -- This is my [i]nspect section, [i]nspect [s]ymbols map("n", "is", "SymbolsOutline", opts) @@ -95,7 +98,6 @@ map("n", "m", ":Mason", opts); map("n", "l", ":Lazy", opts); map("n", "so", ":so %", opts); - -- Faster git merge map("n", "gd", ":Gvdiffsplit!", opts) map("n", "gdl", ":diffget //3", opts) diff --git a/configs/nvim/lua/max/core/plugins.lua b/configs/nvim/lua/max/core/plugins.lua index a078801..cecaef5 100644 --- a/configs/nvim/lua/max/core/plugins.lua +++ b/configs/nvim/lua/max/core/plugins.lua @@ -2,15 +2,18 @@ local plugins = { "nvim-lua/plenary.nvim", - - --------------------- -- Theming Section -- --------------------- "rktjmp/fwatch.nvim", -- d to check dark/light theme { "catppuccin/nvim", name = "catppuccin", priority = 1000, lazy = false }, - + -- local plugins need to be explicitly configured with dir + { + dir = "~/Projects/sudoku.nvim", + cmd = "Sudoku", + config = true, + }, { "nvim-lualine/lualine.nvim", lazy = false, @@ -26,7 +29,7 @@ local plugins = { { "stevearc/dressing.nvim", event = "VeryLazy", - config = true + config = true, }, { "folke/which-key.nvim", @@ -68,18 +71,16 @@ local plugins = { end, event = "VimEnter", }, + { + "folke/neodev.nvim", + lazy = false, + config = true, + }, { "kevinhwang91/nvim-ufo", event = "BufReadPost", - dependencies = 'kevinhwang91/promise-async', - config = function() - require("ufo").setup() - - vim.o.foldcolumn = '1' - vim.o.foldlevel = 99 - vim.o.foldlevelstart = 99 - vim.o.foldenable = true - end, + dependencies = "kevinhwang91/promise-async", + config = require("max.configs.ufo"), }, { "kyazdani42/nvim-tree.lua", @@ -98,6 +99,13 @@ local plugins = { require("max.configs.dashboard") end, }, -- startup screen + { + "notomo/gesture.nvim", + lazy = false, + config = function() + require("max.configs.gestures") + end, + }, { "numToStr/Comment.nvim", event = "InsertEnter", @@ -127,15 +135,15 @@ local plugins = { -- Lsp Setup -- --------------- { - 'glepnir/lspsaga.nvim', - event = 'BufRead', + "glepnir/lspsaga.nvim", + event = "BufRead", config = function() - require('lspsaga').setup({ + require("lspsaga").setup({ symbol_in_winbar = { enable = false, }, }) - end + end, }, { "neovim/nvim-lspconfig", @@ -150,7 +158,7 @@ local plugins = { event = "InsertEnter", config = function() require("max.configs.lsp") - end + end, }, { "folke/trouble.nvim", @@ -182,7 +190,7 @@ local plugins = { }, config = function() require("max.configs.autocomplete") - end + end, }, { "nat-418/boole.nvim", @@ -201,26 +209,46 @@ local plugins = { ------------------------- -- Syntax Highlighting -- ------------------------- + { + "norcalli/nvim-colorizer.lua", + config = true, + event = "VeryLazy", + }, + { + "folke/todo-comments.nvim", + config = true, + event = "VeryLazy", + }, + { + "styled-components/vim-styled-components", + lazy = false, + }, { "nvim-treesitter/nvim-treesitter", event = "VeryLazy", dependencies = { "nvim-treesitter/nvim-treesitter-textobjects", - "JoosepAlviste/nvim-ts-context-commentstring" + "JoosepAlviste/nvim-ts-context-commentstring", + "windwp/nvim-ts-autotag", }, config = function() require("max.configs.treesitter") end, - run = ":TSUpdate", + build = ":TSUpdate", }, { - 'ckolkey/ts-node-action', - dependencies = { 'nvim-treesitter' }, + "ckolkey/ts-node-action", + dependencies = { "nvim-treesitter" }, opts = {}, }, -------------------- -- IDE Type Stuff -- -------------------- + { + "ThePrimeagen/git-worktree.nvim", + config = true, + event = "VeryLazy" + }, { "jackMort/ChatGPT.nvim", cmd = "ChatGPT", @@ -254,7 +282,7 @@ local plugins = { config = function() require("max.configs.sniprun") end, - run = "bash ./install.sh", + build = "bash ./install.sh", }, { "uga-rosa/translate.nvim", diff --git a/configs/nvim/lua/max/theme/statuscolumn.lua b/configs/nvim/lua/max/theme/statuscolumn.lua new file mode 100644 index 0000000..c097553 --- /dev/null +++ b/configs/nvim/lua/max/theme/statuscolumn.lua @@ -0,0 +1,32 @@ +local M = {} +_G.Status = M + +---@return {name:string, text:string, texthl:string}[] +function M.get_signs() + local buf = vim.api.nvim_win_get_buf(vim.g.statusline_winid) + return vim.tbl_map(function(sign) + return vim.fn.sign_getdefined(sign.name)[1] + end, vim.fn.sign_getplaced(buf, { group = "*", lnum = vim.v.lnum })[1].signs) +end + +function M.column() + local sign, git_sign + for _, s in ipairs(M.get_signs()) do + if s.name:find("GitSign") then + git_sign = s + else + sign = s + end + end + local components = { + sign and ("%#" .. sign.texthl .. "#" .. sign.text .. "%*") or " ", + [[%=]], + [[%{&nu?(&rnu&&v:relnum?v:relnum:v:lnum):''} ]], + git_sign and ("%#" .. git_sign.texthl .. "#" .. git_sign.text .. "%*") or " ", + } + return table.concat(components, "") +end + +vim.opt.statuscolumn = [[%!v:lua.Status.column()]] + +return M diff --git a/configs/nvim/lua/max/utils/init.lua b/configs/nvim/lua/max/utils/init.lua index c706ae9..84829b8 100644 --- a/configs/nvim/lua/max/utils/init.lua +++ b/configs/nvim/lua/max/utils/init.lua @@ -2,22 +2,22 @@ local M = {} local cmd = vim.cmd function M.create_augroup(autocmds, name) - cmd("augroup " .. name) - cmd("autocmd!") - for _, autocmd in ipairs(autocmds) do - cmd("autocmd " .. table.concat(autocmd, " ")) - end - cmd("augroup END") + cmd("augroup " .. name) + cmd("autocmd!") + for _, autocmd in ipairs(autocmds) do + cmd("autocmd " .. table.concat(autocmd, " ")) + end + cmd("augroup END") end function M.ReloadConfig() - for name, _ in pairs(package.loaded) do - if name:match("^cnull") then - package.loaded[name] = nil - end + for name, _ in pairs(package.loaded) do + if name:match("^cnull") then + package.loaded[name] = nil end + end - dofile(vim.env.MYVIMRC) + dofile(vim.env.MYVIMRC) end local inspect = require("inspect") @@ -27,8 +27,8 @@ function M.dump(o) end function M.has_plugin(pluginName) - local status = pcall(require, pluginName) - return status + local status = pcall(require, pluginName) + return status end return M diff --git a/configs/wezterm/wezterm.lua b/configs/wezterm/wezterm.lua index 104faf0..d880823 100644 --- a/configs/wezterm/wezterm.lua +++ b/configs/wezterm/wezterm.lua @@ -10,11 +10,20 @@ local function scheme_for_appearance(appearance) end end +local wsl_domains = wezterm.default_wsl_domains() + +-- Always use zsh in my WSL. but really: I recommend running `chsh` inside WSL to make it the default! +for _, dom in ipairs(wsl_domains) do + dom.default_cwd = "/home/max" + print(dom.name) +end + return { font = wezterm.font_with_fallback { "FiraCodeNerdFont", "Noto Color Emoji" }, + wsl_domains = wsl_domains, font_size = 13, -- You can specify some parameters to influence the font selection; -- for example, this selects a Bold, Italic font variant. diff --git a/configs/zsh/aliases.sh b/configs/zsh/aliases.sh index 1ca25b7..615eca2 100644 --- a/configs/zsh/aliases.sh +++ b/configs/zsh/aliases.sh @@ -30,6 +30,7 @@ alias dc="docker-compose" alias t="tmux" alias nx="pnpm exec nx" +alias pm="pnpm prisma" if type lsd &> /dev/null; then alias ls="lsd"