From 79c088ba97a0df387a3bf05870d618c43e244c17 Mon Sep 17 00:00:00 2001 From: Max Richter Date: Mon, 24 Oct 2022 15:24:37 +0200 Subject: [PATCH] feat: lazyload all the things --- configs/.zshrc | 13 +- configs/nvim/ftplugin/qf.lua | 10 +- configs/nvim/init.lua | 10 -- configs/nvim/lua/configs/autocomplete.lua | 40 ++--- configs/nvim/lua/configs/autoformat.lua | 20 --- configs/nvim/lua/configs/dashboard.lua | 2 +- configs/nvim/lua/configs/lsp.lua | 10 +- configs/nvim/lua/configs/sniprun.lua | 4 + configs/nvim/lua/configs/telescope.lua | 111 +++++++------ configs/nvim/lua/configs/treesitter.lua | 64 ++++--- configs/nvim/lua/core/keymappings.lua | 24 +-- configs/nvim/lua/core/options.lua | 6 +- configs/nvim/lua/core/plugins.lua | 194 ++++++++++++++++------ configs/nvim/lua/core/theme.lua | 2 +- configs/wezterm/wezterm-old.lua | 30 ++++ configs/wezterm/wezterm.lua | 166 +++++++++++++++--- configs/zsh/functions/fx.zsh | 2 +- 17 files changed, 462 insertions(+), 246 deletions(-) delete mode 100644 configs/nvim/lua/configs/autoformat.lua create mode 100644 configs/nvim/lua/configs/sniprun.lua create mode 100644 configs/wezterm/wezterm-old.lua diff --git a/configs/.zshrc b/configs/.zshrc index e89c231..77f4714 100644 --- a/configs/.zshrc +++ b/configs/.zshrc @@ -6,6 +6,13 @@ if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]] source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi +if [ -d "$HOME/.asdf" ] ; then + . "$HOME/.asdf/asdf.sh" +fi + +# Enable vim mode in zsh +bindkey -v + ZSH_THEME="powerlevel10k/powerlevel10k" # ZSH_TMUX_AUTOSTART=true ZSH_TMUX_AUTOCONNECT=false @@ -13,8 +20,9 @@ ZSH_TMUX_AUTOCONNECT=false plugins=( git docker - tmux asdf + tmux + nx-completion zsh-autosuggestions ) @@ -60,9 +68,6 @@ if [ -d "$HOME/.local/bin" ] ; then PATH="$HOME/.local/bin:$PATH" fi -if [ -d "$HOME/.asdf" ] ; then - . "$HOME/.asdf/asdf.sh" -fi if type go &> /dev/null ; then export PATH="$PATH:$(go env GOPATH)/bin" diff --git a/configs/nvim/ftplugin/qf.lua b/configs/nvim/ftplugin/qf.lua index a929253..569541f 100644 --- a/configs/nvim/ftplugin/qf.lua +++ b/configs/nvim/ftplugin/qf.lua @@ -1,7 +1,7 @@ -- Automatically close the goto definition buffer after leaving local buffer_id = vim.api.nvim_win_get_buf(0) -vim.api.nvim_create_autocmd({ "bufwinleave", "bufleave" }, { - pattern = "*", - once = true, - command = "bdelete " .. buffer_id, -}) +-- vim.api.nvim_create_autocmd({ "bufwinleave", "bufleave" }, { +-- pattern = "*", +-- once = true, +-- command = "bdelete " .. buffer_id, +-- }) diff --git a/configs/nvim/init.lua b/configs/nvim/init.lua index f3c7e44..5ffd5e6 100644 --- a/configs/nvim/init.lua +++ b/configs/nvim/init.lua @@ -7,17 +7,7 @@ require("core.autocommands") require("core.theme") require("core.keymappings") -require("configs.autocomplete") require("configs.dashboard") --- require("configs.dap") -require("configs.command-center") -require("configs.notify") require("configs.lsp") -require("configs.telescope") -require("configs.tree") -require("configs.treesitter") -require("configs.autocomplete") -require("configs.neotest") -require("configs.snippets") require("overlays") diff --git a/configs/nvim/lua/configs/autocomplete.lua b/configs/nvim/lua/configs/autocomplete.lua index 6d5c7aa..565da18 100644 --- a/configs/nvim/lua/configs/autocomplete.lua +++ b/configs/nvim/lua/configs/autocomplete.lua @@ -1,17 +1,13 @@ -- luasnip setup local luasnip = require("luasnip") + local lspkind = require("lspkind") local cmp = require("cmp") local cmp_autopairs = require("nvim-autopairs.completion.cmp") --- local tabnine = require("cmp_tabnine.config") -local source_mapping = { - buffer = "[Buffer]", - nvim_lsp = "[LSP]", - nvim_lua = "[Lua]", - cmp_tabnine = "[TN]", - path = "[Path]", -} +require("nvim-autopairs").setup() +require("copilot").setup() +require("copilot_cmp").setup() cmp.setup({ window = { @@ -50,28 +46,21 @@ cmp.setup({ }), }, formatting = { - format = function(entry, vim_item) - vim_item.kind = lspkind.presets.default[vim_item.kind] - local menu = source_mapping[entry.source.name] - if entry.source.name == "cmp_tabnine" then - if entry.completion_item.data ~= nil and entry.completion_item.data.detail ~= nil then - menu = entry.completion_item.data.detail .. " " .. menu - end - vim_item.kind = "" - end - vim_item.menu = menu - return vim_item - end, + format = lspkind.cmp_format({ + mode = "symbol", + max_width = 50, + symbol_map = { Copilot = "" }, + }), }, sources = { + { name = "copilot" }, { name = "nvim_lua" }, { name = "nvim_lsp" }, -- { name = "cmp_tabnine", max_item_count = 3 }, { name = "luasnip" }, { name = "path" }, - { name = "buffer", max_item_count = 3 }, + { name = "buffer" }, { name = "calc" }, - -- { name = 'copilot' } }, }) @@ -91,11 +80,4 @@ cmp.setup.cmdline(":", { }), }) --- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers.. --- Setup lspconfig. -local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) -require("lspconfig").html.setup({ - capabilities = capabilities, -}) - cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } })) diff --git a/configs/nvim/lua/configs/autoformat.lua b/configs/nvim/lua/configs/autoformat.lua deleted file mode 100644 index e5d3e32..0000000 --- a/configs/nvim/lua/configs/autoformat.lua +++ /dev/null @@ -1,20 +0,0 @@ -local prettier = require("prettier") - -prettier.setup({ - bin = "prettier", -- or `prettierd` - filetypes = { - "css", - "graphql", - "html", - "svelte", - "javascript", - "javascriptreact", - "json", - "less", - "markdown", - "scss", - "typescript", - "typescriptreact", - "yaml", - }, -}) diff --git a/configs/nvim/lua/configs/dashboard.lua b/configs/nvim/lua/configs/dashboard.lua index bbc8600..c38095f 100644 --- a/configs/nvim/lua/configs/dashboard.lua +++ b/configs/nvim/lua/configs/dashboard.lua @@ -12,7 +12,7 @@ end local dashboard = require("alpha.themes.dashboard") -- Remove These ~ ~ ~ -vim.opt.fillchars:append { eob = " " } +vim.opt.fillchars:append({ eob = " " }) -- Disable Status Line so that alpha dashboard look nice -- vim.cmd [[ au User AlphaReady if winnr('$') == 1 | set laststatus=1 ]] diff --git a/configs/nvim/lua/configs/lsp.lua b/configs/nvim/lua/configs/lsp.lua index 9dd9353..74281c5 100644 --- a/configs/nvim/lua/configs/lsp.lua +++ b/configs/nvim/lua/configs/lsp.lua @@ -74,7 +74,7 @@ lsp.sumneko_lua.setup({ }, }) -local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) +local capabilities = require("cmp_nvim_lsp").default_capabilities(); capabilities.textDocument.completion.completionItem.snippetSupport = true @@ -173,10 +173,10 @@ lsp.rust_analyzer.setup({ }, }) --- lsp.remark_ls.setup { --- filetypes = { "markdown" }, --- on_attach = on_attach --- } +lsp.gopls.setup { + capabilities = capabilities, + on_attach = on_attach +} lsp.ltex.setup({ capabilities = capabilities, diff --git a/configs/nvim/lua/configs/sniprun.lua b/configs/nvim/lua/configs/sniprun.lua new file mode 100644 index 0000000..001dc3e --- /dev/null +++ b/configs/nvim/lua/configs/sniprun.lua @@ -0,0 +1,4 @@ +require('sniprun').setup({ + selected_interpreters = { "JS_TS_deno" }, + repl_enable = { "JS_TS_deno" } +}) diff --git a/configs/nvim/lua/configs/telescope.lua b/configs/nvim/lua/configs/telescope.lua index 0088765..205e7dc 100644 --- a/configs/nvim/lua/configs/telescope.lua +++ b/configs/nvim/lua/configs/telescope.lua @@ -1,65 +1,68 @@ local telescope = require("telescope") -local trouble = require("trouble.providers.telescope") - telescope.setup({ - defaults = {}, + defaults = {}, }) + +local function open_with_trouble() + require("trouble.providers.telescope").open_with_trouble() +end + local default = { - defaults = { - vimgrep_arguments = { - "rg", - "--color=never", - "--no-heading", - "--with-filename", - "--line-number", - "--column", - "--smart-case", - "--ignore-file", - "workerMain.js", - }, - prompt_prefix = "  ", - selection_caret = " ", - entry_prefix = " ", - initial_mode = "insert", - selection_strategy = "reset", - sorting_strategy = "ascending", - layout_strategy = "horizontal", - layout_config = { - horizontal = { - prompt_position = "top", - preview_width = 0.55, - results_width = 0.8, - }, - vertical = { - mirror = false, - }, - width = 0.87, - height = 0.80, - preview_cutoff = 120, - }, - file_sorter = require("telescope.sorters").get_fuzzy_file, - file_ignore_patterns = { "node_modules" }, - generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, - path_display = { "truncate" }, - winblend = 0, - border = {}, - mappings = { - i = { [""] = trouble.open_with_trouble }, - n = { [""] = trouble.open_with_trouble }, - }, - borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, - color_devicons = true, - use_less = true, - set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil, - file_previewer = require("telescope.previewers").vim_buffer_cat.new, - grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, - qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, - }, + defaults = { + vimgrep_arguments = { + "rg", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--smart-case", + "--ignore-file", + "workerMain.js", + }, + prompt_prefix = "  ", + selection_caret = " ", + entry_prefix = " ", + initial_mode = "insert", + selection_strategy = "reset", + sorting_strategy = "ascending", + layout_strategy = "horizontal", + layout_config = { + horizontal = { + prompt_position = "top", + preview_width = 0.55, + results_width = 0.8, + }, + vertical = { + mirror = false, + }, + width = 0.87, + height = 0.80, + preview_cutoff = 120, + }, + file_sorter = require("telescope.sorters").get_fuzzy_file, + file_ignore_patterns = { "node_modules" }, + generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, + path_display = { "truncate" }, + winblend = 0, + border = {}, + mappings = { + i = { [""] = open_with_trouble }, + n = { [""] = open_with_trouble }, + }, + borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, + color_devicons = true, + use_less = true, + set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil, + file_previewer = require("telescope.previewers").vim_buffer_cat.new, + grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, + qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, + }, } telescope.setup(default) -- telescope.load_extension("themes"); -- telescope.load_extension("harpoon") -telescope.load_extension("command_center") +-- telescope.load_extension("command_center") telescope.load_extension("notify") diff --git a/configs/nvim/lua/configs/treesitter.lua b/configs/nvim/lua/configs/treesitter.lua index 5d09b70..3c599c1 100644 --- a/configs/nvim/lua/configs/treesitter.lua +++ b/configs/nvim/lua/configs/treesitter.lua @@ -1,22 +1,6 @@ --- local parser_configs = require("nvim-treesitter.parsers").get_parser_configs() - --- parser_configs.http = { --- install_info = { --- url = "https://github.com/NTBBloodbath/tree-sitter-http", --- files = {"src/parser.c"}, --- branch = "main" --- } --- } - --- parser_configs.glsl = { --- filetype = "vert", --- filetypes = {"vert", "frag"} --- } --- - -require "nvim-treesitter.configs".setup { +require("nvim-treesitter.configs").setup({ indent = { - enable = true + enable = true, }, ensure_installed = { "bash", @@ -31,7 +15,45 @@ require "nvim-treesitter.configs".setup { "go", "lua", "yaml", - "prisma" + "prisma", }, - highlight = { enable = true, disable = { "tsx" } } -} + highlight = { enable = true, disable = { "tsx" } }, + + textobjects = { + select = { + enable = true, + + -- Automatically jump forward to textobj, similar to targets.vim + lookahead = true, + + keymaps = { + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = "@class.inner", + }, + -- You can choose the select mode (default is charwise 'v') + -- + -- Can also be a function which gets passed a table with the keys + -- * query_string: eg '@function.inner' + -- * method: eg 'v' or 'o' + -- and should return the mode ('v', 'V', or '') or a table + -- mapping query_strings to modes. + selection_modes = { + ["@parameter.outer"] = "v", -- charwise + ["@function.outer"] = "V", -- linewise + ["@class.outer"] = "", -- blockwise + }, + -- If you set this to `true` (default is `false`) then any textobject is + -- extended to include preceding or succeeding whitespace. Succeeding + -- whitespace has priority in order to act similarly to eg the built-in + -- `ap`. + -- + -- Can also be a function which gets passed a table with the keys + -- * query_string: eg '@function.inner' + -- * selection_mode: eg 'v' + -- and should return true of false + include_surrounding_whitespace = true, + }, + }, +}) diff --git a/configs/nvim/lua/core/keymappings.lua b/configs/nvim/lua/core/keymappings.lua index 5d0b96e..aee8955 100644 --- a/configs/nvim/lua/core/keymappings.lua +++ b/configs/nvim/lua/core/keymappings.lua @@ -3,23 +3,6 @@ local map = vim.keymap.set local g = vim.g local saga = require("lspsaga") -local truezen = require("true-zen") -truezen.setup({ - ataraxis = { - minimum_writing_area = { -- minimum size of main window - width = 250, - height = 100, - }, - padding = { - left = 10, - right = 10, - } - }, - integrations = { - tmux = true, -- hide tmux status bar in (minimalist, ataraxis) - lualine = true, -- hide nvim-lualine (ataraxis) - }, -}) saga.init_lsp_saga() local options = { noremap = true, silent = true } @@ -29,7 +12,7 @@ g.mapleader = " " map("n", "", ":Telescope find_files", options) map("n", "", ":lua require'telescope.builtin'.live_grep{ cwd = vim.fn.getcwd() }", options) -map("n", "", ":Telescope command_center", options) +-- map("n", "", ":Telescope command_center", options) map("n", "", "za", remap) -- LSP Functionality @@ -55,6 +38,9 @@ map("n", "b", ":lua require('dap').toggle_breakpoint()", options) map("n", "tt", ":lua require('neotest').run.run()", options) map("n", "to", ":lua require('neotest').summary.open()", options) +map({ "n", "v" }, "+", ":Boole increment", options) +map({ "n", "v" }, "-", ":Boole decrement", options) + -- Navigate Buffers map("n", "", "h", options) map("n", "", "j", options) @@ -102,7 +88,6 @@ map("v", "", ":m '>+1gv=gv", options) map("v", "", ":m '<-2gv=gv", options) map("n", "", "YP", options) map("n", "", "Yp", options) -map({ "v", "n" }, "z", truezen.ataraxis, options) -- Faster git merge map("n", "gd", ":Gvdiffsplit!", options) @@ -123,6 +108,7 @@ map("n", "", ":echo 'No Down for you'", options) -- Run Requests map("n", "r", ":SnipRun", options) +map("v", "r", ":'<,'>SnipRun", options) -- Close on q map("n", "q", ":q", options) diff --git a/configs/nvim/lua/core/options.lua b/configs/nvim/lua/core/options.lua index 70d3c14..f95d789 100644 --- a/configs/nvim/lua/core/options.lua +++ b/configs/nvim/lua/core/options.lua @@ -28,6 +28,10 @@ set.foldexpr = "nvim_treesitter#foldexpr()" -- use treesitter for folding vim.wo.foldlevel = 99 -- feel free to decrease the value vim.wo.foldenable = true +vim.cmd([[set wildmode=list:longest,full]]) -- Command-line completion mode +vim.cmd([[let loaded_netrw = 1]]) -- Command-line completion mode +vim.cmd([[let loaded_netrwPlugin = 1]]) -- Command-line completion mode + --------------- -- Neovim UI -- --------------- @@ -52,7 +56,7 @@ vim.cmd("syntax sync minlines=256") set.mousescroll = "ver:1,hor:1" set.shiftwidth = 2 -- Change the number of space characters inserted for indentation set.showtabline = 1 -- Always show tabs -set.cmdheight = 1 -- More space for displaying messages +set.cmdheight = 0 -- More space for displaying messages vim.cmd([[set nowrap]]) -- Display long lines as just one line vim.cmd([[set noshowmode]]) -- We don't need to see things like -- INSERT -- anymore vim.cmd([[syntax enable]]) -- Enables syntax highlighing diff --git a/configs/nvim/lua/core/plugins.lua b/configs/nvim/lua/core/plugins.lua index 0ca086c..4d71a81 100644 --- a/configs/nvim/lua/core/plugins.lua +++ b/configs/nvim/lua/core/plugins.lua @@ -2,7 +2,7 @@ local fn = vim.fn local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" local packer_bootstrap = false if fn.empty(fn.glob(install_path)) > 0 then - packer_bootstrap = + packer_bootstrap = true fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path }) vim.cmd("packadd packer.nvim") end @@ -16,48 +16,87 @@ packer.init({ }, }) +print("eeey") + return packer.startup(function(use) -- Let packer manage itself use("wbthomason/packer.nvim") - use("lewis6991/impatient.nvim") -- General Helper Functions + use("lewis6991/impatient.nvim") use("nvim-lua/plenary.nvim") - -- Theming Section + --------------------- + -- Theming Section -- + --------------------- + use("rktjmp/fwatch.nvim") -- Used to check dark/light theme - -- use("EdenEast/nightfox.nvim") use({ "catppuccin/nvim", as = "catppuccin" }) use("nvim-lualine/lualine.nvim") - -- use("sam4llis/nvim-tundra") - -- Layout Plugins + -------------------- + -- Layout Plugins -- + -------------------- + use("dstein64/nvim-scrollview") -- ScrollBars use("akinsho/nvim-toggleterm.lua") - use("rcarriga/nvim-notify") - use("kyazdani42/nvim-web-devicons") - use("kyazdani42/nvim-tree.lua") - use("nvim-lua/popup.nvim") - use("goolord/alpha-nvim") -- startup screen - use("Pocco81/true-zen.nvim") + use({ - "terrortylor/nvim-comment", + "rcarriga/nvim-notify", config = function() - require("nvim_comment").setup() + require("configs.notify") + end, + event = "VimEnter", + }) + + use({ + "kyazdani42/nvim-tree.lua", + requires = { "kyazdani42/nvim-web-devicons" }, + cmd = "NvimTreeToggle", + config = function() + require("configs.tree") end, }) - use("gfeiyou/command-center.nvim") - use("glepnir/lspsaga.nvim") + use("nvim-lua/popup.nvim") + use("goolord/alpha-nvim") -- startup screen + -- use("Pocco81/true-zen.nvim") + use({ + "numToStr/Comment.nvim", + event = "BufReadPre", + config = function() + require("Comment").setup() + end, + }) + -- use("gfeiyou/command-center.nvim") + use("glepnir/lspsaga.nvim") -- better windows for lsp replace, goto definition etc... + + --------------------- + -- Code Navigation -- + --------------------- - -- Code Navigation use("junegunn/fzf") - use("nvim-telescope/telescope.nvim") + use({ + "nvim-telescope/telescope.nvim", + cmd = "Telescope", + config = function() + require("configs.telescope") + end, + }) + use("ThePrimeagen/harpoon") - -- Lsp Errors + --------------- + -- Lsp Setup -- + --------------- + + use("neovim/nvim-lspconfig") + use("williamboman/mason.nvim") + use("williamboman/mason-lspconfig.nvim") + use("jose-elias-alvarez/null-ls.nvim") use("folke/lsp-colors.nvim") use("kosayoda/nvim-lightbulb") use({ "folke/trouble.nvim", + event = "BufRead", requires = "kyazdani42/nvim-web-devicons", config = function() require("trouble").setup({}) @@ -66,64 +105,119 @@ return packer.startup(function(use) use("onsails/lspkind.nvim") use({ "https://git.sr.ht/~whynothugo/lsp_lines.nvim", + event = "BufReadPre", config = function() require("lsp_lines").setup() end, }) - -- Syntax / Autocomplete + ------------------- + -- Autocomplete -- + ------------------- + use("tpope/vim-surround") - use("neovim/nvim-lspconfig") - use("hrsh7th/nvim-cmp") use({ - "windwp/nvim-autopairs", + "hrsh7th/nvim-cmp", + requires = { + + "rafamadriz/friendly-snippets", + "saadparwaiz1/cmp_luasnip", + "L3MON4D3/LuaSnip", + "windwp/nvim-autopairs", + + "zbirenbaum/copilot.lua", + "zbirenbaum/copilot-cmp", + }, + event = { "BufReadPre", "CmdlineChanged" }, config = function() - require("nvim-autopairs").setup() + require("configs.autocomplete") + require("configs.snippets") end, }) - use("hrsh7th/cmp-nvim-lsp") - use("hrsh7th/cmp-path") - -- use("hrsh7th/cmp-calc") - use("hrsh7th/cmp-buffer") - use("hrsh7th/cmp-cmdline") - use("rafamadriz/friendly-snippets") - use("L3MON4D3/LuaSnip") - use("saadparwaiz1/cmp_luasnip") - use({ "williamboman/mason.nvim" }) - use({ "williamboman/mason-lspconfig.nvim" }) - use({ "jose-elias-alvarez/null-ls.nvim" }) - use("MunifTanjim/prettier.nvim") - use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }) + use({ + "hrsh7th/cmp-nvim-lsp", + after = "nvim-cmp", + config = function() + local capabilities = require("cmp_nvim_lsp").default_capabilities() + require("lspconfig").html.setup({ + capabilities = capabilities, + }) + end, + }) + use({ "hrsh7th/cmp-cmdline", after = "nvim-cmp" }) + use({ "hrsh7th/cmp-path", after = "nvim-cmp" }) + use({ "hrsh7th/cmp-nvim-lua", after = "nvim-cmp" }) + use({ "hrsh7th/cmp-calc", after = "nvim-cmp" }) + use({ "hrsh7th/cmp-emoji", after = "nvim-cmp" }) + + use({ + "https://github.com/nat-418/boole.nvim", + event = "BufReadPre", + config = function() + require("boole").setup() + end, + }) + use({ + "gaoDean/autolist.nvim", + event = "BufReadPre", + config = function() + require("autolist").setup({}) + end, + }) + + ------------------------- + -- Syntax Highlighting -- + ------------------------- + + use({ + "nvim-treesitter/nvim-treesitter", + event = "BufReadPost", + requires = { + "nvim-treesitter/nvim-treesitter-textobjects", + }, + config = function() + require("configs.treesitter") + end, + run = ":TSUpdate", + }) + + -------------------- + -- IDE Type Stuff -- + -------------------- -- Dap Debugger -- Have not yet been able to set this up -- use({ "mfussenegger/nvim-dap" }) - -- use({ "rcarriga/nvim-dap-ui" }) - use { 'michaelb/sniprun', run = 'bash ./install.sh' } - - -- FIle Navigation - use({ "ThePrimeagen/harpoon" }) - - -- More IDE like features + -- use({ "rcarriga/nvim-dap-ui" free use("editorconfig/editorconfig-vim") use({ - "iamcco/markdown-preview.nvim", - run = function() - vim.fn["mkdp#util#install"]() + "michaelb/sniprun", + event = "BufReadPost", + config = function() + require("configs.sniprun") + end, + run = "bash ./install.sh", + }) + use({ + "uga-rosa/translate.nvim", + event = "InsertEnter", + config = function() + require("translate").setup({ default = { command = "deepl_free", output = "replace" } }) end, }) use({ "nvim-neotest/neotest", + cmd = "NeoTest", + config = function() + require("configs.neotest") + end, requires = { "haydenmeade/neotest-jest", "KaiSpencer/neotest-vitest", - "nvim-lua/plenary.nvim", - "nvim-treesitter/nvim-treesitter", "antoinemadec/FixCursorHold.nvim", }, }) - -- Database Feature use("tpope/vim-dadbod") use("kristijanhusak/vim-dadbod-ui") diff --git a/configs/nvim/lua/core/theme.lua b/configs/nvim/lua/core/theme.lua index d69cd48..e0a159d 100644 --- a/configs/nvim/lua/core/theme.lua +++ b/configs/nvim/lua/core/theme.lua @@ -15,7 +15,7 @@ cat.setup({ integrations = { gitsigns = true, telescope = true, - treesitter = true, + -- treesitter = true, cmp = true, lsp_saga = true, notify = true, diff --git a/configs/wezterm/wezterm-old.lua b/configs/wezterm/wezterm-old.lua new file mode 100644 index 0000000..f945e56 --- /dev/null +++ b/configs/wezterm/wezterm-old.lua @@ -0,0 +1,30 @@ +local wezterm = require("wezterm") + +local padding = 30 + +local function scheme_for_appearance(appearance) + if appearance:find("Dark") then + return "3024 Night" + else + return "Catppuccin Latte" + end +end + +return { + font = wezterm.font("FiraCodeNerdFont"), + font_size = 13, + -- You can specify some parameters to influence the font selection; + -- for example, this selects a Bold, Italic font variant. + -- color_scheme = "Batman", + use_fancy_tab_bar = false, + hide_tab_bar_if_only_one_tab = true, + alternate_buffer_wheel_scroll_speed = 1, + color_scheme = scheme_for_appearance(wezterm.gui.get_appearance()), + window_close_confirmation = "AlwaysPrompt", + window_padding = { + left = padding, + right = padding, + top = padding, + bottom = padding, + }, +} diff --git a/configs/wezterm/wezterm.lua b/configs/wezterm/wezterm.lua index f945e56..f076776 100644 --- a/configs/wezterm/wezterm.lua +++ b/configs/wezterm/wezterm.lua @@ -1,30 +1,146 @@ -local wezterm = require("wezterm") +local wezterm = require 'wezterm' +local act = wezterm.action -local padding = 30 +local default_prog +local default_cwd +local font_size +local tab_font_size +local initial_rows +local inital_cols -local function scheme_for_appearance(appearance) - if appearance:find("Dark") then - return "3024 Night" - else - return "Catppuccin Latte" - end +if string.find(wezterm.target_triple, "windows") then + default_prog = { "wsl.exe" }; + default_cwd = os.getenv("HOME"); + tab_font_size = 9.0; + font_size = 10.7; + initial_rows = 43; + initial_cols = 180; end -return { - font = wezterm.font("FiraCodeNerdFont"), - font_size = 13, - -- You can specify some parameters to influence the font selection; - -- for example, this selects a Bold, Italic font variant. - -- color_scheme = "Batman", - use_fancy_tab_bar = false, - hide_tab_bar_if_only_one_tab = true, - alternate_buffer_wheel_scroll_speed = 1, - color_scheme = scheme_for_appearance(wezterm.gui.get_appearance()), - window_close_confirmation = "AlwaysPrompt", - window_padding = { - left = padding, - right = padding, - top = padding, - bottom = padding, - }, +if string.find(wezterm.target_triple, "darwin") then + tab_font_size = 15.0; + font_size = 16; + initial_rows = 38; + initial_cols = 120; +end + +local keys = { + -- Keyboard Navigation + --- delete words backwards + { key = "Backspace", mods = "CTRL", action = { SendKey = { key = "U", mods = "CTRL" } } }, + { key = "Backspace", mods = "CMD", action = { SendKey = { key = "U", mods = "CTRL" } } }, + { key = "Backspace", mods = "ALT", action = { SendKey = { key = "W", mods = "CTRL" } } }, + + --- home and end + { key = "LeftArrow", mods = "CTRL", action = { SendKey = { key = "Home" } } }, + { key = "LeftArrow", mods = "CMD", action = { SendKey = { key = "Home" } } }, + { key = "RightArrow", mods = "CTRL", action = { SendKey = { key = "End" } } }, + { key = "RightArrow", mods = "CMD", action = { SendKey = { key = "End" } } }, + + --- move one word + { key = "LeftArrow", mods = "ALT", action = { SendKey = { key = "LeftArrow", mods = "CTRL" } } }, + { key = "RightArrow", mods = "ALT", action = { SendKey = { key = "RightArrow", mods = "CTRL" } } }, + + --- ctrl + jk keyboard navigation + { key = "k", mods = "ALT", action = { SendKey = { key = "UpArrow" } } }, + { key = "k", mods = "CMD", action = { SendKey = { key = "UpArrow" } } }, + { key = "j", mods = "ALT", action = { SendKey = { key = "DownArrow" } } }, + { key = "j", mods = "CMD", action = { SendKey = { key = "DownArrow" } } }, + + --- accept completion on ctrl|alt|cmd + . + { key = ".", mods = "CTRL", action = { SendKey = { key = "RightArrow" } } }, + { key = ".", mods = "ALT", action = { SendKey = { key = "RightArrow" } } }, + { key = ".", mods = "CMD", action = { SendKey = { key = "RightArrow" } } }, + + -- Fullscreen + { key = "Enter", mods = "CTRL", action = "ToggleFullScreen" }, + { key = "Enter", mods = "CMD", action = "ToggleFullScreen" }, + { key = "Enter", mods = "ALT", action = "ToggleFullScreen" }, + + -- Clear Screen + { key = "l", mods = "CMD", action = { SendKey = { key = "l", mods = "CTRL" } } }, + { key = "l", mods = "ALT", action = { SendKey = { key = "l", mods = "CTRL" } } }, + { key = "k", mods = "CMD", action = { SendKey = { key = "l", mods = "CTRL" } } }, + + -- Copy/Paste + { key = "c", mods = "ALT", action = "Copy" }, + { key = "c", mods = "CMD", action = "Copy" }, + { key = "v", mods = "ALT", action = "Paste" }, + { key = "v", mods = "CMD", action = "Paste" }, + + -- Open New Window + { key = "t", mods = "CMD", action = { SpawnTab = "CurrentPaneDomain" } }, + { key = "t", mods = "ALT", action = { SpawnTab = "CurrentPaneDomain" } }, + { key = "n", mods = "CMD", action = "SpawnWindow" }, + { key = "n", mods = "ALT", action = "SpawnWindow" }, + { key = "w", mods = "ALT", action = { EmitEvent = "CloseCurrentTab" } }, + { key = "w", mods = "CMD", action = { EmitEvent = "CloseCurrentTab" } }, + + -- Open the config + { key = ",", mods = "ALT", action = { SendString = "vim ~/.config/wezterm/wezterm.lua\r\n" } }, + { key = ",", mods = "CMD", action = { SendString = "vim ~/.config/wezterm/wezterm.lua\r\n" } }, +}; + +-- ALT-Tab +for i = 1, 9 do + table.insert(keys, { key = tostring(i), mods = "ALT", action = wezterm.action { ActivateTab = i - 1 } }) + table.insert(keys, { key = tostring(i), mods = "CTRL", action = wezterm.action { ActivateTab = i - 1 } }); +end + +-- Delegate close confirmation to some apps such as VIM, etc. +wezterm.on("CloseCurrentTab", function(window, pane) + function is_vim() + local current_process = pane:get_title():upper() + return current_process:sub(- #"NVIM") == "NVIM" or current_process:sub(1, #"NVIM") == "NVIM" or + current_process:sub(- #"VIM") == "VIM" or current_process:sub(1, #"VIM") == "VIM" or + current_process:sub(- #"VI") == "VI" or current_process:sub(1, #"VI") == "VI" + end + + if is_vim() then + window:perform_action(wezterm.action { + SendKey = { key = "Z", mods = "CTRL" } + }, pane) + else + window:perform_action(wezterm.action { + CloseCurrentTab = { confirm = false } + }, pane) + end +end) + +-- Colors +local colors = { + -- Tab Bar Ayu Mirage } + +local color_schemes = { + ["Ayu"] = { + background = "#0f1419", + } +}; + +return { + -- General + default_prog = default_prog, + default_cwd = default_cwd, + exit_behavior = "Close", + + -- Key Bindings + keys = keys, + + -- Window + initial_rows = initial_rows, + initial_cols = initial_cols, + window_padding = { left = 1, right = 1, top = 0, bottom = 0 }, + + -- Appearance and Colors + color_scheme = "Ayu", + colors = colors, + color_schemes = color_schemes, + window_decorations = "RESIZE", + default_cursor_style = "SteadyBlock", + audible_bell = "Disabled", + font_size = font_size, + harfbuzz_features = { "calt=0", "clig=0", "liga=0" }, + window_frame = { font_size = tab_font_size, } +} + diff --git a/configs/zsh/functions/fx.zsh b/configs/zsh/functions/fx.zsh index 1e0a2a8..c8482e1 100644 --- a/configs/zsh/functions/fx.zsh +++ b/configs/zsh/functions/fx.zsh @@ -22,7 +22,7 @@ function fx(){ fi if [ "$1" = "v" ]; then - nvim . + nvim fi if [ "$1" = "o" ]; then