diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 07b68a9..39fa46f 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,95 +1,6 @@ vim.loader.enable() - -local g = vim.g - ------------------------------------------------------------- --- Disable unused builtins ------------------------------------------------------------- --- g.loaded_gzip = 1 --- g.loaded_zip = 1 --- g.loaded_zipPlugin = 1 --- g.loaded_tar = 1 --- g.loaded_tarPlugin = 1 - -g.loaded_getscript = 1 -g.loaded_getscriptPlugin = 1 -g.loaded_vimball = 1 -g.loaded_vimballPlugin = 1 -g.loaded_2html_plugin = 1 - --- g.loaded_matchit = 1 --- g.loaded_matchparen = 1 -g.loaded_logiPat = 1 -g.loaded_rrhelper = 1 - -g.loaded_netrw = 1 -g.loaded_netrwPlugin = 1 -g.loaded_netrwSettings = 1 -g.loaded_netrwFileHandlers = 1 - -g.loaded_perl_provider = 0 -g.loaded_ruby_provider = 0 - ------------------------------------------------------------- --- NVIM settings ------------------------------------------------------------- -vim.g.mapleader = " " - -local o = vim.o -o.autoindent = true -o.cb = "unnamed" -o.copyindent = true --- o.cursorline = true -o.backup = false -o.expandtab = true -o.foldmethod = "expr" -o.foldexpr = "nvim_treesitter#foldexpr()" -o.foldenable = false -o.grepprg = "rg --color=never" -o.guicursor = "a:blinkon0,i:ver25-iCursor" -o.ignorecase = true -o.laststatus = 3 -o.cmdheight = 0 -o.linebreak = true -o.mouse = "a" -o.number = true -o.shiftround = true -o.shiftwidth = 2 -o.shortmess = o.shortmess .. "c" -o.shortmess = o.shortmess .. "I" -o.showcmd = false -o.swapfile = false -o.syntax = true -o.signcolumn = "number" -o.smartcase = true -o.softtabstop = 2 -o.tabstop = 2 -o.termguicolors = true -o.ttimeoutlen = 1 -o.wildignore = ".DS_Store" -o.wildmode = "list:longest,full" -o.writebackup = false - -vim.cmd([[set t_vb=]]) -vim.g.loaded_python_provider = 1 -vim.g.python3_host_prog = "/Users/nathan/.local/share/zinit/plugins/pyenv---pyenv/shims/python" -vim.g.python_host_skip_check = 1 -vim.g.python3_host_skip_check = 1 -o.pyxversion = 3 - -vim.diagnostic.config({ - virtual_text = false, - signs = true, - underline = false, - update_in_insert = false, - severity_sort = false, -}) - --- Nord colorscheme settings -g.nord_contrast = true -g.nord_borders = true -g.nord_enable_sidebar_background = true -g.nord_italic = false +require("config.options") +require("config.keymaps") local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then @@ -98,323 +9,24 @@ if not vim.loop.fs_stat(lazypath) then "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release + "--branch=stable", lazypath, }) end vim.opt.rtp:prepend(lazypath) -require("lazy").setup({ - - -- Measure startup time - { "dstein64/vim-startuptime", cmd = "StartupTime" }, - -- Close tab, buffer, or neovim - { "ojroques/nvim-bufdel" }, - -- tmux navigation - { "numToStr/Navigator.nvim", config = require("config.nav") }, - -- Comment mgmt - { "tpope/vim-commentary", event = "BufEnter" }, - -- HTML tag managment using Treesitter - { "windwp/nvim-ts-autotag", event = { "BufEnter" } }, - -- Key help - { "folke/which-key.nvim", config = require("config.whichkey") }, - -- Indent guides - { "lukas-reineke/indent-blankline.nvim", ft = { "python" } }, - -- Cross-project find / replace - { "ray-x/sad.nvim", dependencies = "ray-x/guihua.lua", cmd = "Sad" }, - -- Synatx highlighting / awareness - { - "nvim-treesitter/nvim-treesitter", - event = { "BufReadPre", "BufNewFile" }, - config = require("config.treesitter"), - }, - -- Treesitter syntax preview - { "nvim-treesitter/playground", lazy = true }, - - -- Edit surrounds - { - "kylechui/nvim-surround", - event = "VeryLazy", - config = function() - require("nvim-surround").setup({}) - end, - }, - - -- Faster insert exit - { - "max397574/better-escape.nvim", - event = "InsertEnter", - config = function() - require("better_escape").setup({ mapping = { "jk" } }) - end, - }, - - -- Close surrounds - { - "windwp/nvim-autopairs", - config = function() - require("nvim-autopairs").setup() - end, - }, - - -- Testing - { - "nvim-neotest/neotest", - lazy = true, - dependencies = { - "antoinemadec/FixCursorHold.nvim", - }, - }, - -- Debugging - { "rcarriga/nvim-dap-ui", lazy = true, dependencies = { "mfussenegger/nvim-dap" } }, - - -- Colorscheme - { "nordtheme/vim", as = "nord", config = require("config.color") }, - - -- "Easymotion" - { - "phaazon/hop.nvim", - event = "BufEnter", - branch = "v1", - cmd = { "HopWord", "HopWordAC", "HopWordBC" }, - config = require("config.hop"), - }, - - ------------------------------------------------------------ - -- UI components / utilities - ------------------------------------------------------------ - - -- Colorize hex codes - { - "norcalli/nvim-colorizer.lua", - cmd = "ColorizerToggle", - }, - - -- File / Directory tree - { - "nvim-neo-tree/neo-tree.nvim", - branch = "v2.x", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", - "MunifTanjim/nui.nvim", - }, - cmd = "Neotree", - config = require("config.neotree"), - }, - - -- git - { - "lewis6991/gitsigns.nvim", - event = "VeryLazy", - config = function() - require("gitsigns").setup({ signcolumn = false }) - end, +require("lazy").setup("plugins", { + disabled_plugins = { + "getscript", + "getscriptPlugin", + "vimball", + "vimballPlugin", + "2html_plugin", + "logiPat", + "rrhelper", + "netrw", + "netrwPlugin", + "netrwSettings", + "netrwFileHandlers", }, - - -- Symbol browser - { - "simrat39/symbols-outline.nvim", - cmd = { "SymbolsOutline" }, - dependencies = { "VonHeikemen/lsp-zero.nvim" }, - config = function() - require("symbols-outline").setup() - end, - }, - - -- Buffer bar - { - "willothy/nvim-cokeline", - event = "BufEnter", - dependencies = { "nvim-tree/nvim-web-devicons", "nordtheme/vim" }, - config = require("config.cokeline"), - }, - - -- Status bar - { - "freddiehaddad/feline.nvim", - dependencies = { "nvim-tree/nvim-web-devicons", "nordtheme/vim" }, - event = "BufEnter", - config = require("config.feline"), - }, - - -- Quickfix / Problem viewer - { - "folke/trouble.nvim", - cmd = "TroubleToggle", - dependencies = { "nvim-tree/nvim-web-devicons" }, - }, - - -- fzf/CtrlP - { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, - { - "nvim-telescope/telescope.nvim", - dependencies = { - "VonHeikemen/lsp-zero.nvim", - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", - }, - cmd = { "Telescope" }, - config = require("config.telescope"), - }, - - -- Highlight and search for todo tags - { - "folke/todo-comments.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - cmd = { "TodoTrouble", "TodoTelescope" }, - config = require("config.todo_comments"), - }, - - ------------------------------------------------------------ - -- LSP / language intelligence - ------------------------------------------------------------ - -- Simplified LSP / completion config - { - "VonHeikemen/lsp-zero.nvim", - branch = "v2.x", - event = { "BufReadPre", "BufNewFile" }, - dependencies = { - { "neovim/nvim-lspconfig" }, - { - "williamboman/mason.nvim", - build = function() - pcall(vim.cmd, "MasonUpdate") - end, - }, - { "williamboman/mason-lspconfig.nvim" }, - { "jay-babu/mason-null-ls.nvim", dependencies = "jose-elias-alvarez/null-ls.nvim" }, - { "hrsh7th/nvim-cmp" }, - }, - }, - -- autocomplete - { - "hrsh7th/nvim-cmp", - lazy = true, - dependencies = { - { "saadparwaiz1/cmp_luasnip", dependencies = "L3MON4D3/LuaSnip" }, - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", - "onsails/lspkind.nvim", - }, - config = require("config.cmp"), - }, - - -- Github AI - { - "zbirenbaum/copilot.lua", - cmd = "Copilot", - event = "InsertEnter", - config = function() - require("copilot").setup({ - auto_refresh = true, - suggestion = { - auto_trigger = true, - }, - }) - end, - }, - - -- LSP for CLI tools - { - "jose-elias-alvarez/null-ls.nvim", - lazy = true, - dependencies = { "nvim-lua/plenary.nvim" }, - }, - - -- LSP configs - { - "neovim/nvim-lspconfig", - lazy = true, - dependencies = { - "jose-elias-alvarez/null-ls.nvim", - "hrsh7th/nvim-cmp", - "lukas-reineke/lsp-format.nvim", - }, - config = require("config.lsp"), - }, - - ------------------------------------------------------------ - -- Languges (alaphabetical) - ------------------------------------------------------------ - { "ray-x/go.nvim", ft = { "go" } }, - -- Javascript / Typescript - { - "yuezk/vim-js", - ft = { - "javascript", - "javascriptreact", - "typescript", - "typescriptreact", - }, - }, - -- JSX / TSX - { - "maxmellon/vim-jsx-pretty", - ft = { - "javascript", - "javascriptreact", - "typescript", - "typescriptreact", - }, - }, - -- Jinja - { "Glench/Vim-Jinja2-Syntax", ft = { "jinja", "html.jinja" } }, - -- Markdown - { - "preservim/vim-markdown", - dependencies = "godlygeek/tabular", - ft = { "markdown" }, - }, - -- Nginx - { "chr4/nginx.vim", ft = { "nginx" } }, - -- Robot - { "mfukar/robotframework-vim", ft = { "robot" } }, - -- Rust - { - "simrat39/rust-tools.nvim", - ft = { "rust" }, - dependencies = { - "neovim/nvim-lspconfig", - "simrat39/rust-tools.nvim", - "nvim-lua/plenary.nvim", - "mfussenegger/nvim-dap", - }, - }, - -- Terraform - { "hashivim/vim-terraform", ft = { "terraform" } }, }) - ------------------------------------------------------------- --- Keybindings ------------------------------------------------------------- - -local k = vim.keymap --- j/k for wrapped text -k.set({ "n", "v" }, "j", "gj", { silent = true }) -k.set({ "n", "v" }, "k", "gk", { silent = true }) - --- Save -k.set({ "n", "i" }, "w", "write", { silent = true }) --- Exit -k.set({ "n", "i" }, "", "BufDel", { silent = true }) --- Undo -k.set({ "n", "i" }, "z", "undo") --- One window -k.set("n", "wo", "only") --- Copilot -k.set({ "n", "i" }, "c", "Copilot panel") - --- Buffer navigation -k.set("n", "]", "bnext") -k.set("n", "[", "bprev") -k.set("n", "L", "bnext") -k.set("n", "H", "bprev") -k.set({ "n", "i" }, "n", "bnext") -k.set({ "n", "i" }, "p", "bprev") - --- Incremental search -k.set("n", "", "noh") -k.set("n", "\\", "noh") diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index b959c3e..0d64610 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,5 +1,6 @@ { "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, + "LazyVim": { "branch": "main", "commit": "2e7ad2b8257b7d25df0264a5b193da7af35f5a53" }, "LuaSnip": { "branch": "master", "commit": "a13af80734eb28f744de6c875330c9d3c24b5f3b" }, "Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" }, "Vim-Jinja2-Syntax": { "branch": "master", "commit": "2c17843b074b06a835f88587e1023ceff7e2c7d1" }, @@ -10,14 +11,14 @@ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, "copilot.lua": { "branch": "master", "commit": "77e3a4907928f0813024e573b882dc879dfc0c6b" }, + "dressing.nvim": { "branch": "master", "commit": "f16d7586fcdd8b2e3850d0abb7e46f944125cc25" }, "feline.nvim": { "branch": "main", "commit": "c63983da180595339163d8b7185dd43ddc31e70e" }, + "flash.nvim": { "branch": "main", "commit": "4a753f0b1d9b671a04d931d7e9fbb5ba5ad1cba0" }, "gitsigns.nvim": { "branch": "main", "commit": "4bbfb06cf706d14912fd1962a40280c1b1138965" }, "go.nvim": { "branch": "master", "commit": "a8095eb334495caec3099b717cc7f5b1fbc3e628" }, "guihua.lua": { "branch": "master", "commit": "ab8b1f09603cc268770efd057115035dc6cfa83d" }, - "hop.nvim": { "branch": "v1", "commit": "75f73d3959a0df7ef3642fd5138acdb1ce50fdc8" }, "indent-blankline.nvim": { "branch": "master", "commit": "7075d7861f7a6bbf0de0298c83f8a13195e6ec01" }, "lazy.nvim": { "branch": "main", "commit": "10d4371745f88837c78c8daab00c5be6e48abea4" }, - "lsp-format.nvim": { "branch": "master", "commit": "ca0df5c8544e51517209ea7b86ecc522c98d4f0a" }, "lsp-zero.nvim": { "branch": "v2.x", "commit": "cf38e6034f2d776ebd16304a334b79543d1ffa60" }, "lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "d381fcb78d7a562c3244e1c8f76406954649db36" }, @@ -26,7 +27,7 @@ "neo-tree.nvim": { "branch": "v2.x", "commit": "d883632bf8f92f1d5abea4a9c28fb2f90aa795aa" }, "neotest": { "branch": "master", "commit": "0207e4025e5558fdd0b3951f250689eede5c75b2" }, "nginx.vim": { "branch": "master", "commit": "8a42e93c9f004fbc5b32bb2e4940107fb7b70a42" }, - "nui.nvim": { "branch": "main", "commit": "de6644476702ba39344f1b28900b74381bc8c4c9" }, + "nui.nvim": { "branch": "main", "commit": "9e7739e9dd2dc852a498478649cd10848e6e7b79" }, "null-ls.nvim": { "branch": "main", "commit": "a138b14099e9623832027ea12b4631ddd2a49256" }, "nvim-autopairs": { "branch": "master", "commit": "59df87a84c80a357ca8d8fe86e451b93ac476ccc" }, "nvim-bufdel": { "branch": "main", "commit": "96c4f7ab053ddab0025bebe5f7c71e4795430e47" }, @@ -37,7 +38,7 @@ "nvim-dap-ui": { "branch": "master", "commit": "c020f660b02772f9f3d11f599fefad3268628a9e" }, "nvim-lspconfig": { "branch": "master", "commit": "fefba589c56a5568a089299e36a4c8242502faaa" }, "nvim-surround": { "branch": "main", "commit": "10b20ca7d9da1ac8df8339e140ffef94f9ab3b18" }, - "nvim-treesitter": { "branch": "master", "commit": "2847aac9d40516c8fc29ab4864e665da09fe14d6" }, + "nvim-treesitter": { "branch": "master", "commit": "150be01d47579ba70137813348a2f0a5be7a7866" }, "nvim-ts-autotag": { "branch": "main", "commit": "40615e96075c743ef47aaf9de966dc348bec6459" }, "nvim-web-devicons": { "branch": "master", "commit": "2a125024a137677930efcfdf720f205504c97268" }, "playground": { "branch": "master", "commit": "2b81a018a49f8e476341dfcb228b7b808baba68b" }, @@ -45,9 +46,11 @@ "robotframework-vim": { "branch": "master", "commit": "75d5b371a4da2a090a2872d55bd0dead013f334e" }, "rust-tools.nvim": { "branch": "master", "commit": "71d2cf67b5ed120a0e31b2c8adb210dd2834242f" }, "sad.nvim": { "branch": "master", "commit": "869c7f3ca3dcd28fd78023db6a7e1bf8af0f4714" }, - "symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" }, + "smart-open.nvim": { "branch": "0.2.x", "commit": "e67d3cc01cfa863f7d5e16b2b2f0bf2bf46f6283" }, + "sqlite.lua": { "branch": "master", "commit": "b7e28c8463254c46a8e61c52d27d6a2040492fc3" }, "tabular": { "branch": "master", "commit": "339091ac4dd1f17e225fe7d57b48aff55f99b23a" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" }, + "telescope-fzy-native.nvim": { "branch": "master", "commit": "282f069504515eec762ab6d6c89903377252bf5b" }, "telescope.nvim": { "branch": "master", "commit": "00cf15074a2997487813672a75f946d2ead95eb0" }, "todo-comments.nvim": { "branch": "main", "commit": "09b0b17d824d2d56f02ff15967e8a2499a89c731" }, "trouble.nvim": { "branch": "main", "commit": "2af0dd9767526410c88c628f1cbfcb6cf22dd683" }, diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua new file mode 100644 index 0000000..e69de29 diff --git a/.config/nvim/lua/config/cmp.lua b/.config/nvim/lua/config/cmp.lua deleted file mode 100644 index e79bc8a..0000000 --- a/.config/nvim/lua/config/cmp.lua +++ /dev/null @@ -1,74 +0,0 @@ -return function() - local cmp = require("cmp") - local cmp_autopairs = require("nvim-autopairs.completion.cmp") - local luasnip = require("luasnip") - local lspkind = require("lspkind") - - local function has_words_before() - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil - end - - cmp.setup({ - formatting = { - format = lspkind.cmp_format({ - mode = "symbol", - maxwidth = 50, - ellipsis_char = "...", - before = function(_, vim_item) - return vim_item - end, - }), - }, - view = { - entries = "native", - }, - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "luasnip" }, - }, { - { name = "buffer" }, - }), - mapping = { - -- https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings#super-tab-like-mapping - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { "i", "s" }), - - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - }, - [""] = cmp.mapping({ - i = function(fallback) - if cmp.visible() and cmp.get_active_entry() then - cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }) - else - fallback() - end - end, - s = cmp.mapping.confirm({ select = true }), - c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), - }), - }) - cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) -end diff --git a/.config/nvim/lua/config/cokeline.lua b/.config/nvim/lua/config/cokeline.lua deleted file mode 100644 index 033f337..0000000 --- a/.config/nvim/lua/config/cokeline.lua +++ /dev/null @@ -1,95 +0,0 @@ -return function() - local get_hex = require("cokeline/utils").get_hex - local C = { - active = { - fg = "#d8dee9", - bg = "#434c5e", - }, - inactive = { - fg = "#d8dee9", - bg = "#2e3440", - }, - bg = "#2e3440", - fg = "#d8dee9", - } - require("cokeline").setup({ - show_if_buffers_are_at_least = 2, - buffers = { - -- filter_valid = function(buffer) -> true | false, - -- filter_visible = function(buffer) -> true | false, - -- focus_on_delete = 'prev' | 'next', - -- new_buffers_position = 'last' | 'next' | 'directory' | 'number', - -- delete_on_right_click = true | false, - }, - -- rendering = { - -- max_buffer_width = 999, - -- }, - - default_hl = { - fg = function(buf) - return buf.is_focused and C.active.fg or C.inactive.fg - end, - bg = function(buf) - return buf.is_focused and C.active.bg or C.inactive.bg - end, - style = "NONE", - }, - - components = { - { - text = "", - fg = function(buf) - return buf.is_focused and C.active.bg or C.inactive.bg - end, - bg = C.bg, - }, - { - text = function(buf) - return " " .. buf.devicon.icon - end, - fg = function(buf) - return buf.devicon.color - end, - }, - { - text = function(buf) - return buf.filename .. " " - end, - style = function(buf) - return buf.is_focused and "italic" or "none" - end, - }, - { - text = "󰅖", - delete_buffer_on_left_click = true, - }, - { - text = " ", - }, - - { - text = "", - fg = function(buf) - return buf.is_focused and C.active.bg or C.inactive.bg - end, - bg = C.bg, - }, - { - text = " ", - bg = C.bg, - }, - }, - - sidebar = { - filetype = "neo-tree", - components = { - { - text = " NeoTree", - fg = get_hex("NeoTreeNormal", "fg"), - bg = get_hex("NeoTeeNormal", "bg"), - style = "bold", - }, - }, - }, - }) -end diff --git a/.config/nvim/lua/config/color.lua b/.config/nvim/lua/config/color.lua deleted file mode 100644 index d0b3ec3..0000000 --- a/.config/nvim/lua/config/color.lua +++ /dev/null @@ -1,57 +0,0 @@ --- Nord colors - --- NordNight --- #2E3440 --- #3B4252 --- #434C5E --- #4C566A - --- NordSnow --- #D8DEE9 --- #E5E9F0 --- #ECEFF4 - --- NordFrost --- #8FBCBB --- #88C0D0 --- #81A1C1 --- #5E81AC - --- NordAura --- #BF616A --- #D08770 --- #EBCB8B --- #A3BE8C --- #B48EAD - -return function() - vim.cmd.colorscheme("nord") - - vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) - - -- General visibility - vim.api.nvim_set_hl(0, "Comment", { fg = "#616e88", italic = 1 }) - vim.api.nvim_set_hl(0, "Keyword", { fg = "#B48EAD" }) - vim.api.nvim_set_hl(0, "Number", { fg = "#D08770" }) - vim.api.nvim_set_hl(0, "Float", { link = "Number" }) - vim.api.nvim_set_hl(0, "Boolean", { link = "Number" }) - - -- CursorLine - vim.api.nvim_set_hl(0, "CursorLine", { bg = "#282E39", fg = "#282E39" }) - vim.api.nvim_set_hl(0, "CursorLineNr", { bg = "#282E39", fg = "#282E39" }) - - -- SymbolBrowser - vim.api.nvim_set_hl(0, "FocusedSymbol", { fg = "#D08770", bold = 1 }) - - -- Neotree - vim.api.nvim_set_hl(0, "NeoTreeCursorLine", { bg = "#3B4252" }) - vim.api.nvim_set_hl(0, "NeoTreeNormal", { bg = "#282E39" }) - vim.api.nvim_set_hl(0, "NeoTreeNormalNC", { bg = "#282E39" }) - vim.api.nvim_set_hl(0, "NeoTreeWinSeparator", { fg = "#2E3440", bg = "#2E3440" }) - - -- Trouble - vim.api.nvim_set_hl(0, "TroubleNormal", { bg = "#282E39" }) - - -- Cokeline - vim.api.nvim_set_hl(0, "TabLine", { bg = "#2E3440" }) -end diff --git a/.config/nvim/lua/config/feline.lua b/.config/nvim/lua/config/feline.lua deleted file mode 100644 index 0c42a5d..0000000 --- a/.config/nvim/lua/config/feline.lua +++ /dev/null @@ -1,270 +0,0 @@ -return function() - local vi_mode = require("feline.providers.vi_mode") - local lsp = require("feline.providers.lsp") - local git = require("feline.providers.git") - local function get_color(group, attr) - local hl = vim.api.nvim_get_hl_by_name(group, true) - if hl and hl[attr] then - return string.format("#%06x", hl[attr]) - end - end - local c = { - pri = { - bg = get_color("StatusLineNC", "background"), - fg = get_color("StatusLineNC", "foreground"), - }, - sec = { - bg = get_color("StatusLine", "background"), - fg = get_color("StatusLine", "foreground"), - }, - diag = { - error = get_color("DiagnosticError", "foreground"), - warning = get_color("DiagnosticWarn", "foreground"), - info = get_color("DiagnosticInfo", "foreground"), - hint = get_color("DiagnosticHint", "foreground"), - }, - git = { - add = get_color("DiffAdd", "foreground"), - change = get_color("DiffChange", "foreground"), - remove = get_color("DiffDelete", "foreground"), - }, - } - - local sep = { - block = "█", - left = "", - right = "", - pri = " ", - sec = " ", - } - - local comps = {} - -- VIM mode - comps.left = { - provider = sep.left, - hl = { bg = "Normal", fg = c.pri.bg }, - } - comps.right = { - provider = sep.right, - hl = { bg = "Normal", fg = c.pri.bg }, - } - comps.mode = { - provider = function() - return string.lower(string.sub(vi_mode.get_vim_mode(), 1, 2)) - end, - hl = function() - return { - fg = vi_mode.get_mode_color(), - style = "bold,italic", - } - end, - left_sep = sep.sec, - priority = 90, - } - - -- File info - comps.file = { - folder = { - provider = function() - return vim.fn.fnamemodify(vim.fn.getcwd(), ":t") - end, - icon = { str = " ", hl = { fg = get_color("Comment", "foreground") } }, - left_sep = sep.sec, - priority = 50, - }, - filename = { - provider = { - name = "file_info", - opts = { - case = "lowercase", - filetype_icon = true, - file_readonly_icon = " ", - type = "relative", - }, - }, - short_provider = { - name = "file_info", - opts = { - case = "lowercase", - filetype_icon = true, - file_readonly_icon = " ", - }, - }, - hl = { style = "italic" }, - left_sep = { str = " / ", hl = { fg = get_color("Comment", "foreground") } }, - priority = 50, - }, - } - - -- Git - comps.git = { - branch = { - provider = "git_branch", - left_sep = sep.pri .. sep.left .. sep.block, - hl = { bg = c.sec.bg }, - truncate_hide = true, - priority = 10, - }, - add = { - provider = "git_diff_added", - icon = "+", - hl = { fg = c.git.add, bg = c.sec.bg }, - left_sep = sep.block, - truncate_hide = true, - priority = 10, - }, - change = { - provider = "git_diff_changed", - icon = "~", - hl = { fg = c.git.change, bg = c.sec.bg }, - left_sep = sep.block, - truncate_hide = true, - priority = 10, - }, - remove = { - provider = "git_diff_removed", - icon = "-", - hl = { fg = c.git.remove, bg = c.sec.bg }, - left_sep = sep.block, - truncate_hide = true, - priority = 10, - }, - sep = { - provider = function() - if git.git_info_exists() then - return sep.block .. sep.right - end - return "" - end, - hl = { fg = c.sec.bg }, - truncate_hide = true, - priority = 10, - }, - } - - -- Diagnostics - comps.diag = { - status = { - provider = function() - if lsp.is_lsp_attached() then - return " " - end - return "" - end, - hl = { bg = c.sec.bg }, - right_sep = sep.block, - left_sep = sep.left .. sep.block, - truncate_hide = true, - priority = 20, - }, - error = { - provider = "diagnostic_errors", - hl = { fg = c.diag.error, bg = c.sec.bg }, - right_sep = sep.block, - truncate_hide = true, - priority = 20, - }, - warning = { - provider = "diagnostic_warnings", - hl = { fg = c.diag.warning, bg = c.sec.bg }, - right_sep = sep.block, - truncate_hide = true, - priority = 20, - }, - info = { - provider = "diagnostic_info", - hl = { fg = c.diag.info, bg = c.sec.bg }, - right_sep = sep.block, - truncate_hide = true, - priority = 20, - }, - hint = { - provider = "diagnostic_hints", - hl = { fg = c.diag.hint, bg = c.sec.bg }, - right_sep = sep.block, - truncate_hide = true, - priority = 20, - }, - sep = { - provider = function() - if lsp.is_lsp_attached() then - return sep.right .. sep.pri - end - return "" - end, - hl = { fg = c.sec.bg }, - truncate_hide = true, - priority = 20, - }, - } - - comps.filetype = { - provider = { - name = "file_type", - opts = { - case = "lowercase", - }, - }, - hl = { fg = get_color("Number", "foreground") }, - right_sep = sep.pri, - priority = 80, - } - - -- Location information - comps.location = { - percentage = { - provider = "line_percentage", - right_sep = sep.sec, - priority = 90, - }, - location = { - provider = { - name = "position", - opts = { padding = true }, - }, - right_sep = sep.sec, - priority = 90, - }, - } - - require("feline").setup({ - theme = { - bg = c.pri.bg, - fg = c.pri.fg, - }, - components = { - active = { - { - comps.left, - -- Mode - -- comps.mode, - -- File info - comps.file.folder, - comps.file.filename, - -- Git - comps.git.branch, - comps.git.change, - comps.git.add, - comps.git.remove, - comps.git.sep, - }, - { - -- Diag - comps.diag.status, - comps.diag.error, - comps.diag.warning, - comps.diag.info, - comps.diag.hint, - comps.diag.sep, - -- Filetype - comps.filetype, - -- Location - comps.location.percentage, - comps.location.location, - comps.right, - }, - }, - inactive = {}, - }, - }) -end diff --git a/.config/nvim/lua/config/hop.lua b/.config/nvim/lua/config/hop.lua deleted file mode 100644 index 7732bfd..0000000 --- a/.config/nvim/lua/config/hop.lua +++ /dev/null @@ -1,4 +0,0 @@ -local k = vim.keymap -k.set("n", "w", "HopWord") -k.set("n", "j", "HopWordAC") -k.set("n", "k", "HopWordBC") diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua new file mode 100644 index 0000000..fbba0ae --- /dev/null +++ b/.config/nvim/lua/config/keymaps.lua @@ -0,0 +1,57 @@ +local k = vim.keymap + +-- Copilot: move these keybindings into ./lua/plugins/whichkey.lua +-- Move them into the whichkey configuration + +-- Search +k.set("n", "", "Telescope find_files") +k.set("n", "fa", "Telescope") +k.set("n", "fb", "Telescope buffers") + +-- j/k for wrapped text +k.set({ "n", "v" }, "j", "gj", { silent = true }) +k.set({ "n", "v" }, "k", "gk", { silent = true }) + +-- Save +k.set({ "n", "i" }, "w", "write", { silent = true }) +-- Exit +k.set({ "n", "i" }, "", "BufDel", { silent = true }) +-- Undo +k.set({ "n", "i" }, "z", "undo") + +-- Navigation +k.set({ "n", "i" }, "h", "NavigatorLeft") +k.set({ "n", "i" }, "j", "NavigatorDown") +k.set({ "n", "i" }, "k", "NavigatorUp") +k.set({ "n", "i" }, "l", "NavigatorRight") +k.set({ "n", "i" }, "", "NavigatorLeft") +k.set({ "n", "i" }, "", "NavigatorDown") +k.set({ "n", "i" }, "", "NavigatorUp") +k.set({ "n", "i" }, "", "NavigatorRight") +k.set("n", "wo", "only") +-- Copilot +k.set({ "n", "i" }, "c", "Copilot panel") + +-- Buffer navigation +k.set("n", "]", "bnext") +k.set("n", "[", "bprev") +k.set("n", "L", "bnext") +k.set("n", "H", "bprev") +k.set({ "n", "i" }, "n", "bnext") +k.set({ "n", "i" }, "p", "bprev") + +-- Incremental search +k.set("n", "", "noh") +k.set("n", "\\", "noh") + +k.set({ "n", "i" }, "b", "Neotree toggle") +k.set("n", "ob", "Neotree toggle buffers") + +-- Diagnostics +k.set({ "n", "i" }, "j", "TroubleToggle", { silent = true }) +k.set("n", "oj", "TroubleToggle") +k.set("n", "j", "lua vim.diagnostic.goto_next()") +k.set("n", "k", "lua vim.diagnostic.goto_prev()") +k.set({ "n", "i" }, "k", "SymbolsOutline", { silent = true }) +k.set("n", "[d", vim.diagnostic.goto_prev, { noremap = true, silent = true }) +k.set("n", "]d", vim.diagnostic.goto_next, { noremap = true, silent = true }) diff --git a/.config/nvim/lua/config/lsp.lua b/.config/nvim/lua/config/lsp.lua deleted file mode 100644 index ba83157..0000000 --- a/.config/nvim/lua/config/lsp.lua +++ /dev/null @@ -1,106 +0,0 @@ -local k = vim.keymap - -k.set({ "n", "i" }, "j", "TroubleToggle", { silent = true }) -k.set("n", "oj", "TroubleToggle") -k.set("n", "j", "lua vim.diagnostic.goto_next()") -k.set("n", "k", "lua vim.diagnostic.goto_prev()") -k.set({ "n", "i" }, "k", "SymbolsOutline", { silent = true }) -k.set("n", "[d", vim.diagnostic.goto_prev, { noremap = true, silent = true }) -k.set("n", "]d", vim.diagnostic.goto_next, { noremap = true, silent = true }) - -return function() - -- Sign column icons - local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " } - for type, icon in pairs(signs) do - local hl = "DiagnosticSign" .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) - end - - local lsp = require("lsp-zero").preset({}) - -- Buffer attach function - lsp.on_attach(function(_, bufnr) - lsp.default_keymaps({ buffer = bufnr }) - end) - - lsp.format_on_save({ - format_opts = { - async = false, - timeout_ms = 10000, - }, - servers = { - ["ansiblels"] = { "ansible" }, - ["html"] = { "html" }, - ["null-ls"] = { - "go", - "jenkins", - "json", - "lua", - "python", - "rust", - "terraform", - }, - ["robotframework_ls"] = { "robot" }, - ["rome"] = { - "css", - "javascript", - "typescript", - }, - }, - }) - - local lspconfig = require("lspconfig") - lspconfig.lua_ls.setup({ - settings = { - Lua = { - runtime = { - version = "LuaJIT", - }, - diagnostics = { - globals = { "vim", "hs" }, - }, - }, - }, - }) - - lsp.setup() - local null_ls = require("null-ls") - require("mason-null-ls").setup({ - ensure_installed = { - "golines", - "revive", - }, - automatic_installation = true, - handlers = {}, - }) - null_ls.setup({ - sources = { - -- Diagnostics - null_ls.builtins.diagnostics.ansiblelint, -- Ansible - null_ls.builtins.diagnostics.curlylint, -- Jinja, etc - null_ls.builtins.diagnostics.flake8, -- Python - null_ls.builtins.diagnostics.hadolint, -- Dockerfile - null_ls.builtins.diagnostics.npm_groovy_lint, -- Jenkinsfile - -- null_ls.builtins.diagnostics.revive, -- Go - - -- Formatting - null_ls.builtins.formatting.black, -- Python - null_ls.builtins.formatting.fixjson, -- JSON - -- null_ls.builtins.formatting.golines, -- Go - null_ls.builtins.formatting.isort, -- Python - null_ls.builtins.formatting.npm_groovy_lint, -- Jenkinsfile - null_ls.builtins.formatting.prettierd.with({ - filetypes = { - "markdown", - "yaml", - }, - }), - null_ls.builtins.formatting.rustfmt, -- Rust - null_ls.builtins.formatting.shfmt, -- Shell - null_ls.builtins.formatting.stylua, -- Lua - null_ls.builtins.formatting.terraform_fmt, -- Terraform - null_ls.builtins.formatting.trim_newlines, - null_ls.builtins.formatting.trim_whitespace, - null_ls.builtins.formatting.xmllint, -- XML - }, - }) -end diff --git a/.config/nvim/lua/config/nav.lua b/.config/nvim/lua/config/nav.lua deleted file mode 100644 index 0dc4c38..0000000 --- a/.config/nvim/lua/config/nav.lua +++ /dev/null @@ -1,18 +0,0 @@ -return function() - require("Navigator").setup() - local k = vim.keymap - -- local nav = require("nvim-tmux-navigation") - - k.set("n", "wh", "NavigatorLeft") - k.set("n", "wj", "NavigatorDown") - k.set("n", "wk", "NavigatorUp") - k.set("n", "wl", "NavigatorRight") - k.set({ "n", "i" }, "h", "NavigatorLeft") - k.set({ "n", "i" }, "j", "NavigatorDown") - k.set({ "n", "i" }, "k", "NavigatorUp") - k.set({ "n", "i" }, "l", "NavigatorRight") - k.set({ "n", "i" }, "", "NavigatorLeft") - k.set({ "n", "i" }, "", "NavigatorDown") - k.set({ "n", "i" }, "", "NavigatorUp") - k.set({ "n", "i" }, "", "NavigatorRight") -end diff --git a/.config/nvim/lua/config/neotree.lua b/.config/nvim/lua/config/neotree.lua deleted file mode 100644 index c61ceb1..0000000 --- a/.config/nvim/lua/config/neotree.lua +++ /dev/null @@ -1,16 +0,0 @@ -local k = vim.keymap -k.set({ "n", "i" }, "b", "Neotree toggle") -k.set("n", "ob", "Neotree toggle buffers") - -return function() - require("neo-tree").setup({ - filesystem = { - follow_current_file = true, - }, - default_component_configs = { - name = { - use_git_status_colors = false, - }, - }, - }) -end diff --git a/.config/nvim/lua/config/options.lua b/.config/nvim/lua/config/options.lua new file mode 100644 index 0000000..86749ad --- /dev/null +++ b/.config/nvim/lua/config/options.lua @@ -0,0 +1,46 @@ +local g = vim.g +g.mapleader = " " + +g.loaded_perl_provider = 0 +g.loaded_ruby_provider = 0 +g.loaded_python_provider = 1 +g.python3_host_prog = "/Users/nathan/.local/share/zinit/plugins/pyenv---pyenv/shims/python" +g.python_host_skip_check = 1 +g.python3_host_skip_check = 1 + +local o = vim.o +o.autoindent = true +o.backup = false +o.cb = "unnamed" +o.cmdheight = 0 +o.copyindent = true +o.expandtab = true +o.foldenable = false +o.foldexpr = "nvim_treesitter#foldexpr()" +o.foldmethod = "expr" +o.grepprg = "rg --color=never" +o.guicursor = "a:blinkon0,i:ver25-iCursor" +o.ignorecase = true +o.laststatus = 3 +o.linebreak = true +o.mouse = "a" +o.number = true +o.pyxversion = 3 +o.shiftround = true +o.shiftwidth = 2 +o.shortmess = o.shortmess .. "I" +o.shortmess = o.shortmess .. "c" +o.showcmd = false +o.signcolumn = "number" +o.smartcase = true +o.softtabstop = 2 +o.swapfile = false +o.syntax = true +o.tabstop = 2 +o.termguicolors = true +o.ttimeoutlen = 1 +o.wildignore = ".DS_Store" +o.wildmode = "list:longest,full" +o.writebackup = false + +vim.cmd([[set t_vb=]]) diff --git a/.config/nvim/lua/config/telescope.lua b/.config/nvim/lua/config/telescope.lua deleted file mode 100644 index f572f90..0000000 --- a/.config/nvim/lua/config/telescope.lua +++ /dev/null @@ -1,31 +0,0 @@ -local k = vim.keymap - -k.set("n", "", "Telescope find_files") -k.set("n", "fa", "Telescope") -k.set("n", "fb", "Telescope buffers") -k.set("n", "ft", "Telescope tags") -k.set("n", "fb", "Telescope buffers") -k.set("n", "ff", "Telescope find_files") -k.set("n", "fg", "Telescope live_grep") -k.set("n", "fc", "Telescope commands") -k.set("n", "fa", "Telescope") - -return function() - require("telescope.actions") - local trouble = require("trouble.providers.telescope") - - require("telescope").setup({ - defaults = { - mappings = { - i = { ["j"] = trouble.open_with_trouble }, - n = { ["j"] = trouble.open_with_trouble }, - }, - }, - pickers = { - buffers = { - theme = "dropdown", - }, - }, - }) - require("telescope").load_extension("fzf") -end diff --git a/.config/nvim/lua/config/todo_comments.lua b/.config/nvim/lua/config/todo_comments.lua deleted file mode 100644 index dfddb49..0000000 --- a/.config/nvim/lua/config/todo_comments.lua +++ /dev/null @@ -1,12 +0,0 @@ -return function() - require("todo-comments").setup({ - -- signs = false, - highlight = { - pattern = [[<(KEYWORDS)>]], - -- pattern = "NONE", - }, - search = { - pattern = [[\b(KEYWORDS)\b]], - }, - }) -end diff --git a/.config/nvim/lua/config/treesitter.lua b/.config/nvim/lua/config/treesitter.lua deleted file mode 100644 index a8dbf0d..0000000 --- a/.config/nvim/lua/config/treesitter.lua +++ /dev/null @@ -1,13 +0,0 @@ -return function() - require("nvim-treesitter.configs").setup({ - highlight = { - enable = true, - }, - playground = { - enable = true, - }, - autotag = { - enable = true, - }, - }) -end diff --git a/.config/nvim/lua/config/whichkey.lua b/.config/nvim/lua/config/whichkey.lua deleted file mode 100644 index 21b0b87..0000000 --- a/.config/nvim/lua/config/whichkey.lua +++ /dev/null @@ -1,23 +0,0 @@ -return function() - require("which-key").setup({ - icons = { - breadcrumb = "»", - separator = "  ", - group = "+", - }, - hidden = { - "", - "", - "", - "", - "call", - "lua", - "^:", - "^ ", - }, - triggers_blacklist = { - i = { "j", "k" }, - v = { "j", "k" }, - }, - }) -end diff --git a/.config/nvim/lua/disabled/hop.lua b/.config/nvim/lua/disabled/hop.lua new file mode 100644 index 0000000..632bbbc --- /dev/null +++ b/.config/nvim/lua/disabled/hop.lua @@ -0,0 +1,6 @@ +return { + "phaazon/hop.nvim", + event = "BufEnter", + branch = "v1", + cmd = { "HopWord", "HopWordAC", "HopWordBC" }, +} diff --git a/.config/nvim/lua/disabled/noise.lua b/.config/nvim/lua/disabled/noise.lua new file mode 100644 index 0000000..4320dc9 --- /dev/null +++ b/.config/nvim/lua/disabled/noise.lua @@ -0,0 +1,9 @@ +return { + "folke/noice.nvim", + event = "VeryLazy", + opts = {}, + dependencies = { + "MunifTanjim/nui.nvim", + "rcarriga/nvim-notify", + }, +} diff --git a/.config/nvim/lua/plugins/autopairs.lua b/.config/nvim/lua/plugins/autopairs.lua new file mode 100644 index 0000000..2621d48 --- /dev/null +++ b/.config/nvim/lua/plugins/autopairs.lua @@ -0,0 +1,6 @@ +return { + "windwp/nvim-autopairs", + config = function() + require("nvim-autopairs").setup() + end, +} diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua new file mode 100644 index 0000000..38d0be7 --- /dev/null +++ b/.config/nvim/lua/plugins/cmp.lua @@ -0,0 +1,86 @@ +return { + "hrsh7th/nvim-cmp", + lazy = true, + dependencies = { + { "saadparwaiz1/cmp_luasnip", dependencies = "L3MON4D3/LuaSnip" }, + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "onsails/lspkind.nvim", + }, + config = function() + local cmp = require("cmp") + local cmp_autopairs = require("nvim-autopairs.completion.cmp") + local luasnip = require("luasnip") + local lspkind = require("lspkind") + + local function has_words_before() + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + + cmp.setup({ + formatting = { + format = lspkind.cmp_format({ + mode = "symbol", + maxwidth = 50, + ellipsis_char = "...", + before = function(_, vim_item) + return vim_item + end, + }), + }, + view = { + entries = "native", + }, + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + }, { + { name = "buffer" }, + }), + mapping = { + -- https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings#super-tab-like-mapping + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }, + [""] = cmp.mapping({ + i = function(fallback) + if cmp.visible() and cmp.get_active_entry() then + cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }) + else + fallback() + end + end, + s = cmp.mapping.confirm({ select = true }), + c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), + }), + }) + cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) + end, +} diff --git a/.config/nvim/lua/plugins/cokeline.lua b/.config/nvim/lua/plugins/cokeline.lua new file mode 100644 index 0000000..f51198d --- /dev/null +++ b/.config/nvim/lua/plugins/cokeline.lua @@ -0,0 +1,100 @@ +return { + "willothy/nvim-cokeline", + event = "BufEnter", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + local get_hex = require("cokeline/utils").get_hex + local C = { + active = { + fg = "#d8dee9", + bg = "#434c5e", + }, + inactive = { + fg = "#d8dee9", + bg = "#2e3440", + }, + bg = "#2e3440", + fg = "#d8dee9", + } + require("cokeline").setup({ + show_if_buffers_are_at_least = 2, + buffers = { + -- filter_valid = function(buffer) -> true | false, + -- filter_visible = function(buffer) -> true | false, + -- focus_on_delete = 'prev' | 'next', + -- new_buffers_position = 'last' | 'next' | 'directory' | 'number', + -- delete_on_right_click = true | false, + }, + -- rendering = { + -- max_buffer_width = 999, + -- }, + + default_hl = { + fg = function(buf) + return buf.is_focused and C.active.fg or C.inactive.fg + end, + bg = function(buf) + return buf.is_focused and C.active.bg or C.inactive.bg + end, + style = "NONE", + }, + + components = { + { + text = "", + fg = function(buf) + return buf.is_focused and C.active.bg or C.inactive.bg + end, + bg = C.bg, + }, + { + text = function(buf) + return " " .. buf.devicon.icon + end, + fg = function(buf) + return buf.devicon.color + end, + }, + { + text = function(buf) + return buf.filename .. " " + end, + style = function(buf) + return buf.is_focused and "italic" or "none" + end, + }, + { + text = "󰅖", + delete_buffer_on_left_click = true, + }, + { + text = " ", + }, + + { + text = "", + fg = function(buf) + return buf.is_focused and C.active.bg or C.inactive.bg + end, + bg = C.bg, + }, + { + text = " ", + bg = C.bg, + }, + }, + + sidebar = { + filetype = "neo-tree", + components = { + { + text = " NeoTree", + fg = get_hex("NeoTreeNormal", "fg"), + bg = get_hex("NeoTeeNormal", "bg"), + style = "bold", + }, + }, + }, + }) + end, +} diff --git a/.config/nvim/lua/plugins/colorscheme.lua b/.config/nvim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..0c69ef0 --- /dev/null +++ b/.config/nvim/lua/plugins/colorscheme.lua @@ -0,0 +1,71 @@ +-- Nord colors + +-- NordNight +-- #2E3440 +-- #3B4252 +-- #434C5E +-- #4C566A + +-- NordSnow +-- #D8DEE9 +-- #E5E9F0 +-- #ECEFF4 + +-- NordFrost +-- #8FBCBB +-- #88C0D0 +-- #81A1C1 +-- #5E81AC + +-- NordAura +-- #BF616A +-- #D08770 +-- #EBCB8B +-- #A3BE8C +-- #B48EAD + +return { + "nordtheme/vim", + lazy = false, + priority = 1000, + init = function() + vim.g.nord_contrast = true + vim.g.nord_borders = true + vim.g.nord_enable_sidebar_background = true + vim.g.nord_italic = false + end, + config = function() + vim.cmd.colorscheme("nord") + + vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + + -- General visibility + vim.api.nvim_set_hl(0, "Comment", { fg = "#616e88", italic = 1 }) + vim.api.nvim_set_hl(0, "Keyword", { fg = "#B48EAD" }) + vim.api.nvim_set_hl(0, "Number", { fg = "#D08770" }) + vim.api.nvim_set_hl(0, "Float", { link = "Number" }) + vim.api.nvim_set_hl(0, "Boolean", { link = "Number" }) + + -- CursorLine + vim.api.nvim_set_hl(0, "CursorLine", { bg = "#282E39", fg = "#282E39" }) + vim.api.nvim_set_hl(0, "CursorLineNr", { bg = "#282E39", fg = "#282E39" }) + + -- SymbolBrowser + vim.api.nvim_set_hl(0, "FocusedSymbol", { fg = "#D08770", bold = 1 }) + + -- Neotree + vim.api.nvim_set_hl(0, "NeoTreeCursorLine", { bg = "#3B4252" }) + vim.api.nvim_set_hl(0, "NeoTreeNormal", { bg = "#282E39" }) + vim.api.nvim_set_hl(0, "NeoTreeNormalNC", { bg = "#282E39" }) + vim.api.nvim_set_hl(0, "NeoTreeWinSeparator", { fg = "#2E3440", bg = "#2E3440" }) + + -- Trouble + vim.api.nvim_set_hl(0, "TroubleNormal", { bg = "#282E39" }) + + -- Cokeline + vim.api.nvim_set_hl(0, "TabLine", { bg = "#2E3440" }) + + -- NvimNotify + vim.api.nvim_set_hl(0, "NotifyBackground", { bg = "#434c5e" }) + end, +} diff --git a/.config/nvim/lua/plugins/copilot.lua b/.config/nvim/lua/plugins/copilot.lua new file mode 100644 index 0000000..a2c3238 --- /dev/null +++ b/.config/nvim/lua/plugins/copilot.lua @@ -0,0 +1,13 @@ +return { + "zbirenbaum/copilot.lua", + cmd = "Copilot", + event = "InsertEnter", + config = function() + require("copilot").setup({ + auto_refresh = true, + suggestion = { + auto_trigger = true, + }, + }) + end, +} diff --git a/.config/nvim/lua/plugins/dap.lua b/.config/nvim/lua/plugins/dap.lua new file mode 100644 index 0000000..1fdd49d --- /dev/null +++ b/.config/nvim/lua/plugins/dap.lua @@ -0,0 +1 @@ +return { "rcarriga/nvim-dap-ui", lazy = true, dependencies = { "mfussenegger/nvim-dap" } } diff --git a/.config/nvim/lua/plugins/dressing.lua b/.config/nvim/lua/plugins/dressing.lua new file mode 100644 index 0000000..6736d6a --- /dev/null +++ b/.config/nvim/lua/plugins/dressing.lua @@ -0,0 +1,4 @@ +return { + "stevearc/dressing.nvim", + lazy = true, +} diff --git a/.config/nvim/lua/plugins/feline.lua b/.config/nvim/lua/plugins/feline.lua new file mode 100644 index 0000000..ac87cfd --- /dev/null +++ b/.config/nvim/lua/plugins/feline.lua @@ -0,0 +1,275 @@ +return { + "freddiehaddad/feline.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + event = "BufEnter", + config = function() + local vi_mode = require("feline.providers.vi_mode") + local lsp = require("feline.providers.lsp") + local git = require("feline.providers.git") + local function get_color(group, attr) + local hl = vim.api.nvim_get_hl_by_name(group, true) + if hl and hl[attr] then + return string.format("#%06x", hl[attr]) + end + end + local c = { + pri = { + bg = get_color("StatusLineNC", "background"), + fg = get_color("StatusLineNC", "foreground"), + }, + sec = { + bg = get_color("StatusLine", "background"), + fg = get_color("StatusLine", "foreground"), + }, + diag = { + error = get_color("DiagnosticError", "foreground"), + warning = get_color("DiagnosticWarn", "foreground"), + info = get_color("DiagnosticInfo", "foreground"), + hint = get_color("DiagnosticHint", "foreground"), + }, + git = { + add = get_color("DiffAdd", "foreground"), + change = get_color("DiffChange", "foreground"), + remove = get_color("DiffDelete", "foreground"), + }, + } + + local sep = { + block = "█", + left = "", + right = "", + pri = " ", + sec = " ", + } + + local comps = {} + -- VIM mode + comps.left = { + provider = sep.left, + hl = { bg = "Normal", fg = c.pri.bg }, + } + comps.right = { + provider = sep.right, + hl = { bg = "Normal", fg = c.pri.bg }, + } + comps.mode = { + provider = function() + return string.lower(string.sub(vi_mode.get_vim_mode(), 1, 2)) + end, + hl = function() + return { + fg = vi_mode.get_mode_color(), + style = "bold,italic", + } + end, + left_sep = sep.sec, + priority = 90, + } + + -- File info + comps.file = { + folder = { + provider = function() + return vim.fn.fnamemodify(vim.fn.getcwd(), ":t") + end, + icon = { str = " ", hl = { fg = get_color("Comment", "foreground") } }, + left_sep = sep.sec, + priority = 50, + }, + filename = { + provider = { + name = "file_info", + opts = { + case = "lowercase", + filetype_icon = true, + file_readonly_icon = " ", + type = "relative", + }, + }, + short_provider = { + name = "file_info", + opts = { + case = "lowercase", + filetype_icon = true, + file_readonly_icon = " ", + }, + }, + hl = { style = "italic" }, + left_sep = { str = " / ", hl = { fg = get_color("Comment", "foreground") } }, + priority = 50, + }, + } + + -- Git + comps.git = { + branch = { + provider = "git_branch", + left_sep = sep.pri .. sep.left .. sep.block, + hl = { bg = c.sec.bg }, + truncate_hide = true, + priority = 10, + }, + add = { + provider = "git_diff_added", + icon = "+", + hl = { fg = c.git.add, bg = c.sec.bg }, + left_sep = sep.block, + truncate_hide = true, + priority = 10, + }, + change = { + provider = "git_diff_changed", + icon = "~", + hl = { fg = c.git.change, bg = c.sec.bg }, + left_sep = sep.block, + truncate_hide = true, + priority = 10, + }, + remove = { + provider = "git_diff_removed", + icon = "-", + hl = { fg = c.git.remove, bg = c.sec.bg }, + left_sep = sep.block, + truncate_hide = true, + priority = 10, + }, + sep = { + provider = function() + if git.git_info_exists() then + return sep.block .. sep.right + end + return "" + end, + hl = { fg = c.sec.bg }, + truncate_hide = true, + priority = 10, + }, + } + + -- Diagnostics + comps.diag = { + status = { + provider = function() + if lsp.is_lsp_attached() then + return " " + end + return "" + end, + hl = { bg = c.sec.bg }, + right_sep = sep.block, + left_sep = sep.left .. sep.block, + truncate_hide = true, + priority = 20, + }, + error = { + provider = "diagnostic_errors", + hl = { fg = c.diag.error, bg = c.sec.bg }, + right_sep = sep.block, + truncate_hide = true, + priority = 20, + }, + warning = { + provider = "diagnostic_warnings", + hl = { fg = c.diag.warning, bg = c.sec.bg }, + right_sep = sep.block, + truncate_hide = true, + priority = 20, + }, + info = { + provider = "diagnostic_info", + hl = { fg = c.diag.info, bg = c.sec.bg }, + right_sep = sep.block, + truncate_hide = true, + priority = 20, + }, + hint = { + provider = "diagnostic_hints", + hl = { fg = c.diag.hint, bg = c.sec.bg }, + right_sep = sep.block, + truncate_hide = true, + priority = 20, + }, + sep = { + provider = function() + if lsp.is_lsp_attached() then + return sep.right .. sep.pri + end + return "" + end, + hl = { fg = c.sec.bg }, + truncate_hide = true, + priority = 20, + }, + } + + comps.filetype = { + provider = { + name = "file_type", + opts = { + case = "lowercase", + }, + }, + hl = { fg = get_color("Number", "foreground") }, + right_sep = sep.pri, + priority = 80, + } + + -- Location information + comps.location = { + percentage = { + provider = "line_percentage", + right_sep = sep.sec, + priority = 90, + }, + location = { + provider = { + name = "position", + opts = { padding = true }, + }, + right_sep = sep.sec, + priority = 90, + }, + } + + require("feline").setup({ + theme = { + bg = c.pri.bg, + fg = c.pri.fg, + }, + components = { + active = { + { + comps.left, + -- Mode + -- comps.mode, + -- File info + comps.file.folder, + comps.file.filename, + -- Git + comps.git.branch, + comps.git.change, + comps.git.add, + comps.git.remove, + comps.git.sep, + }, + { + -- Diag + comps.diag.status, + comps.diag.error, + comps.diag.warning, + comps.diag.info, + comps.diag.hint, + comps.diag.sep, + -- Filetype + comps.filetype, + -- Location + comps.location.percentage, + comps.location.location, + comps.right, + }, + }, + inactive = {}, + }, + }) + end, +} diff --git a/.config/nvim/lua/plugins/flash.lua b/.config/nvim/lua/plugins/flash.lua new file mode 100644 index 0000000..2d0c245 --- /dev/null +++ b/.config/nvim/lua/plugins/flash.lua @@ -0,0 +1,21 @@ +return { + "folke/flash.nvim", + event = "VeryLazy", + opts = {}, + keys = { + { + "s", + mode = { "n", "x", "o" }, + function() + require("flash").jump() + end, + }, + { + "S", + mode = { "o", "x" }, + function() + require("flash").treesitter() + end, + }, + }, +} diff --git a/.config/nvim/lua/plugins/git.lua b/.config/nvim/lua/plugins/git.lua new file mode 100644 index 0000000..1645ba3 --- /dev/null +++ b/.config/nvim/lua/plugins/git.lua @@ -0,0 +1,7 @@ +return { + "lewis6991/gitsigns.nvim", + event = "VeryLazy", + config = function() + require("gitsigns").setup({ signcolumn = false }) + end, +} diff --git a/.config/nvim/lua/plugins/go.lua b/.config/nvim/lua/plugins/go.lua new file mode 100644 index 0000000..265e71f --- /dev/null +++ b/.config/nvim/lua/plugins/go.lua @@ -0,0 +1 @@ +return { "ray-x/go.nvim", ft = { "go" } } diff --git a/.config/nvim/lua/plugins/init.lua b/.config/nvim/lua/plugins/init.lua new file mode 100644 index 0000000..2133ab2 --- /dev/null +++ b/.config/nvim/lua/plugins/init.lua @@ -0,0 +1,27 @@ +return { + -- Enable LazyVim plugins + { "LazyVim/LazyVim" }, + -- Close tab, buffer, or neovim + { "ojroques/nvim-bufdel" }, + -- Comment mgmt + { "tpope/vim-commentary", event = "BufEnter" }, + -- HTML tag managment using Treesitter + { "windwp/nvim-ts-autotag", event = { "BufEnter" } }, + -- Indent guides + { "lukas-reineke/indent-blankline.nvim", ft = { "python" } }, + -- Cross-project find / replace + { "ray-x/sad.nvim", dependencies = "ray-x/guihua.lua", cmd = "Sad" }, + -- Faster insert exit + { + "max397574/better-escape.nvim", + event = "InsertEnter", + config = function() + require("better_escape").setup({ mapping = { "jk" } }) + end, + }, + -- Colorize hex codes + { + "norcalli/nvim-colorizer.lua", + cmd = "ColorizerToggle", + }, +} diff --git a/.config/nvim/lua/plugins/jinja.lua b/.config/nvim/lua/plugins/jinja.lua new file mode 100644 index 0000000..a22bbc3 --- /dev/null +++ b/.config/nvim/lua/plugins/jinja.lua @@ -0,0 +1 @@ +return { "Glench/Vim-Jinja2-Syntax", ft = { "jinja", "html.jinja" } } diff --git a/.config/nvim/lua/plugins/js.lua b/.config/nvim/lua/plugins/js.lua new file mode 100644 index 0000000..cbf7079 --- /dev/null +++ b/.config/nvim/lua/plugins/js.lua @@ -0,0 +1,12 @@ +return { + "yuezk/vim-js", + ft = { + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + }, + dependencies = { + "maxmellon/vim-jsx-pretty", + }, +} diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..4854394 --- /dev/null +++ b/.config/nvim/lua/plugins/lsp.lua @@ -0,0 +1,142 @@ +return { + "VonHeikemen/lsp-zero.nvim", + branch = "v2.x", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "neovim/nvim-lspconfig", + { + "williamboman/mason.nvim", + build = function() + pcall(vim.cmd, "MasonUpdate") + end, + }, + "williamboman/mason-lspconfig.nvim", + { + "jay-babu/mason-null-ls.nvim", + dependencies = { + "jose-elias-alvarez/null-ls.nvim", + dependencies = "nvim-lua/plenary.nvim", + }, + }, + "hrsh7th/nvim-cmp", + }, + init = function() + vim.diagnostic.config({ + virtual_text = false, + signs = true, + underline = false, + update_in_insert = false, + severity_sort = false, + }) + end, + config = function() + -- Sign column icons + local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " } + for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) + end + + local lsp = require("lsp-zero").preset({}) + -- Buffer attach function + lsp.on_attach(function(_, bufnr) + lsp.default_keymaps({ buffer = bufnr }) + vim.keymap.set("n", "rn", vim.lsp.buf.rename, { buffer = bufnr }) + end) + + lsp.format_on_save({ + format_opts = { + async = false, + timeout_ms = 10000, + }, + servers = { + ["ansiblels"] = { "ansible" }, + ["html"] = { "html" }, + ["null-ls"] = { + "go", + "jenkins", + "json", + "lua", + "python", + "rust", + "terraform", + "css", + "javascript", + "typescript", + "javascriptreact", + "typescriptreact", + }, + ["robotframework_ls"] = { "robot" }, + }, + }) + -- require("mason").setup() + -- require("mason-lspconfig").setup() + + local lspconfig = require("lspconfig") + lspconfig.lua_ls.setup({ + settings = { + Lua = { + runtime = { + version = "LuaJIT", + }, + diagnostics = { + globals = { "vim", "hs" }, + }, + }, + }, + }) + + lsp.setup() + local null_ls = require("null-ls") + require("mason-null-ls").setup({ + ensure_installed = { + "golines", + "revive", + }, + automatic_installation = true, + handlers = {}, + }) + null_ls.setup({ + sources = { + -- Diagnostics + null_ls.builtins.diagnostics.ansiblelint, -- Ansible + null_ls.builtins.diagnostics.curlylint, -- Jinja, etc + null_ls.builtins.diagnostics.flake8, -- Python + null_ls.builtins.diagnostics.hadolint, -- Dockerfile + null_ls.builtins.diagnostics.npm_groovy_lint, -- Jenkinsfile + -- null_ls.builtins.diagnostics.revive, -- Go + + -- Formatting + null_ls.builtins.formatting.black, -- Python + null_ls.builtins.formatting.fixjson, -- JSON + -- null_ls.builtins.formatting.golines, -- Go + null_ls.builtins.formatting.isort, -- Python + null_ls.builtins.formatting.npm_groovy_lint, -- Jenkinsfile + null_ls.builtins.formatting.prettierd.with({ + filetypes = { + "markdown", + "yaml", + }, + }), + null_ls.builtins.formatting.rustfmt, -- Rust + null_ls.builtins.formatting.shfmt, -- Shell + null_ls.builtins.formatting.stylua, -- Lua + null_ls.builtins.formatting.terraform_fmt, -- Terraform + null_ls.builtins.formatting.trim_newlines, + null_ls.builtins.formatting.trim_whitespace, + null_ls.builtins.formatting.xmllint, -- XML + }, + }) + end, +} + +-- { +-- "neovim/nvim-lspconfig", +-- lazy = true, +-- dependencies = { +-- "jose-elias-alvarez/null-ls.nvim", +-- "hrsh7th/nvim-cmp", +-- "lukas-reineke/lsp-format.nvim", +-- }, +-- config = require("config.lsp"), +-- }, diff --git a/.config/nvim/lua/plugins/markdown.lua b/.config/nvim/lua/plugins/markdown.lua new file mode 100644 index 0000000..113158b --- /dev/null +++ b/.config/nvim/lua/plugins/markdown.lua @@ -0,0 +1,5 @@ +return { + "preservim/vim-markdown", + dependencies = "godlygeek/tabular", + ft = { "markdown" }, +} diff --git a/.config/nvim/lua/plugins/navigator.lua b/.config/nvim/lua/plugins/navigator.lua new file mode 100644 index 0000000..d526504 --- /dev/null +++ b/.config/nvim/lua/plugins/navigator.lua @@ -0,0 +1,6 @@ +return { + "numToStr/Navigator.nvim", + config = function() + require("Navigator").setup() + end, +} diff --git a/.config/nvim/lua/plugins/neotest.lua b/.config/nvim/lua/plugins/neotest.lua new file mode 100644 index 0000000..bf14bb8 --- /dev/null +++ b/.config/nvim/lua/plugins/neotest.lua @@ -0,0 +1,7 @@ +return { + "nvim-neotest/neotest", + lazy = true, + dependencies = { + "antoinemadec/FixCursorHold.nvim", + }, +} diff --git a/.config/nvim/lua/plugins/neotree.lua b/.config/nvim/lua/plugins/neotree.lua new file mode 100644 index 0000000..34fc092 --- /dev/null +++ b/.config/nvim/lua/plugins/neotree.lua @@ -0,0 +1,22 @@ +return { + "nvim-neo-tree/neo-tree.nvim", + branch = "v2.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + "MunifTanjim/nui.nvim", + }, + cmd = "Neotree", + config = function() + require("neo-tree").setup({ + filesystem = { + follow_current_file = true, + }, + default_component_configs = { + name = { + use_git_status_colors = false, + }, + }, + }) + end, +} diff --git a/.config/nvim/lua/plugins/nginx.lua b/.config/nvim/lua/plugins/nginx.lua new file mode 100644 index 0000000..43b38da --- /dev/null +++ b/.config/nvim/lua/plugins/nginx.lua @@ -0,0 +1 @@ +return { "chr4/nginx.vim", ft = { "nginx" } } diff --git a/.config/nvim/lua/plugins/robot.lua b/.config/nvim/lua/plugins/robot.lua new file mode 100644 index 0000000..cad12e2 --- /dev/null +++ b/.config/nvim/lua/plugins/robot.lua @@ -0,0 +1 @@ +return { "mfukar/robotframework-vim", ft = { "robot" } } diff --git a/.config/nvim/lua/plugins/rust.lua b/.config/nvim/lua/plugins/rust.lua new file mode 100644 index 0000000..4e5a6a2 --- /dev/null +++ b/.config/nvim/lua/plugins/rust.lua @@ -0,0 +1,10 @@ +return { + "simrat39/rust-tools.nvim", + ft = { "rust" }, + dependencies = { + "neovim/nvim-lspconfig", + "simrat39/rust-tools.nvim", + "nvim-lua/plenary.nvim", + "mfussenegger/nvim-dap", + }, +} diff --git a/.config/nvim/lua/plugins/smart_open.lua b/.config/nvim/lua/plugins/smart_open.lua new file mode 100644 index 0000000..fa8d1ce --- /dev/null +++ b/.config/nvim/lua/plugins/smart_open.lua @@ -0,0 +1,12 @@ +return { + "danielfalk/smart-open.nvim", + branch = "0.2.x", + config = function() + require("telescope").load_extension("smart_open") + end, + dependencies = { + "kkharji/sqlite.lua", + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + { "nvim-telescope/telescope-fzy-native.nvim" }, + }, +} diff --git a/.config/nvim/lua/plugins/startuptime.lua b/.config/nvim/lua/plugins/startuptime.lua new file mode 100644 index 0000000..78aa864 --- /dev/null +++ b/.config/nvim/lua/plugins/startuptime.lua @@ -0,0 +1,7 @@ +return { + "dstein64/vim-startuptime", + cmd = "StartupTime", + init = function() + vim.g.startuptime_tries = 10 + end, +} diff --git a/.config/nvim/lua/plugins/surround.lua b/.config/nvim/lua/plugins/surround.lua new file mode 100644 index 0000000..1064898 --- /dev/null +++ b/.config/nvim/lua/plugins/surround.lua @@ -0,0 +1,7 @@ +return { + "kylechui/nvim-surround", + event = "VeryLazy", + config = function() + require("nvim-surround").setup({}) + end, +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..6629802 --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,30 @@ +return { + "nvim-telescope/telescope.nvim", + dependencies = { + "VonHeikemen/lsp-zero.nvim", + "nvim-lua/plenary.nvim", + "folke/trouble.nvim", + "nvim-tree/nvim-web-devicons", + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + }, + cmd = { "Telescope" }, + config = function() + require("telescope.actions") + local trouble = require("trouble.providers.telescope") + + require("telescope").setup({ + defaults = { + mappings = { + i = { ["j"] = trouble.open_with_trouble }, + n = { ["j"] = trouble.open_with_trouble }, + }, + }, + pickers = { + buffers = { + theme = "dropdown", + }, + }, + }) + require("telescope").load_extension("fzf") + end, +} diff --git a/.config/nvim/lua/plugins/terraform.lua b/.config/nvim/lua/plugins/terraform.lua new file mode 100644 index 0000000..b4d4442 --- /dev/null +++ b/.config/nvim/lua/plugins/terraform.lua @@ -0,0 +1 @@ +return { "hashivim/vim-terraform", ft = { "terraform" } } diff --git a/.config/nvim/lua/plugins/todo_comments.lua b/.config/nvim/lua/plugins/todo_comments.lua new file mode 100644 index 0000000..f901650 --- /dev/null +++ b/.config/nvim/lua/plugins/todo_comments.lua @@ -0,0 +1,17 @@ +return { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + cmd = { "TodoTrouble", "TodoTelescope" }, + config = function() + require("todo-comments").setup({ + -- signs = false, + highlight = { + pattern = [[<(KEYWORDS)>]], + -- pattern = "NONE", + }, + search = { + pattern = [[\b(KEYWORDS)\b]], + }, + }) + end, +} diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..d07a001 --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,22 @@ +return { + "nvim-treesitter/nvim-treesitter", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + + { "nvim-treesitter/playground", lazy = true }, + }, + + config = function() + require("nvim-treesitter.configs").setup({ + highlight = { + enable = true, + }, + playground = { + enable = true, + }, + autotag = { + enable = true, + }, + }) + end, +} diff --git a/.config/nvim/lua/plugins/trouble.lua b/.config/nvim/lua/plugins/trouble.lua new file mode 100644 index 0000000..c440ffe --- /dev/null +++ b/.config/nvim/lua/plugins/trouble.lua @@ -0,0 +1,5 @@ +return { + "folke/trouble.nvim", + cmd = "TroubleToggle", + dependencies = { "nvim-tree/nvim-web-devicons" }, +} diff --git a/.config/nvim/lua/plugins/whichkey.lua b/.config/nvim/lua/plugins/whichkey.lua new file mode 100644 index 0000000..d62ee6c --- /dev/null +++ b/.config/nvim/lua/plugins/whichkey.lua @@ -0,0 +1,54 @@ +return { + "folke/which-key.nvim", + config = function() + require("which-key").setup({ + icons = { + breadcrumb = "»", + separator = "  ", + group = "+", + }, + hidden = { + "", + "", + "", + "", + "call", + "lua", + "^:", + "^ ", + }, + triggers_blacklist = { + i = { "j", "k" }, + v = { "j", "k" }, + }, + }) + local wk = require("which-key") + wk.register({ + [""] = { + [""] = { + name = "Easymotion", + w = { "HopWord", "Hop line" }, + j = { "HopWordAC", "Word down" }, + k = { "HopWordBC", "Word up" }, + }, + f = { + name = "Find", + a = { "Telescope", "Find all" }, + b = { "Telescope buffers", "Find buffers" }, + c = { "Telescope commands", "Find commands" }, + f = { "Telescope find_files", "Find files" }, + g = { "Telescope live_grep", "Find in files" }, + t = { "Telescope tags", "Find tags" }, + s = { "Telescope lsp_document_symbols", "Find symbols" }, + }, + w = { + name = "Window", + h = { "NavigatorLeft", "Window left" }, + j = { "NavigatorDown", "Window down" }, + k = { "NavigatorUp", "Window up" }, + l = { "NavigatorRight", "Window right" }, + }, + }, + }) + end, +} diff --git a/.config/wezterm/colors.lua b/.config/wezterm/colors.lua new file mode 100644 index 0000000..9456d7c --- /dev/null +++ b/.config/wezterm/colors.lua @@ -0,0 +1,12 @@ +return { + active = { + fg = "#d8dee9", + bg = "#434c5e", + }, + inactive = { + fg = "#d8dee9", + bg = "#2e3440", + }, + bg = "#2a2e38", + fg = "#d8dee9", +} diff --git a/.config/wezterm/key_tables.lua b/.config/wezterm/key_tables.lua deleted file mode 100644 index 3e58f4d..0000000 --- a/.config/wezterm/key_tables.lua +++ /dev/null @@ -1,96 +0,0 @@ -local w = require("wezterm") -local a = w.action - -return { - -- added new shortcuts to the end - copy_mode = { - { key = "c", mods = "CTRL", action = a.CopyMode("Close") }, - { key = "g", mods = "CTRL", action = a.CopyMode("Close") }, - { key = "q", mods = "NONE", action = a.CopyMode("Close") }, - { key = "Escape", mods = "NONE", action = a.CopyMode("Close") }, - - { key = "h", mods = "NONE", action = a.CopyMode("MoveLeft") }, - { key = "j", mods = "NONE", action = a.CopyMode("MoveDown") }, - { key = "k", mods = "NONE", action = a.CopyMode("MoveUp") }, - { key = "l", mods = "NONE", action = a.CopyMode("MoveRight") }, - - { key = "LeftArrow", mods = "NONE", action = a.CopyMode("MoveLeft") }, - { key = "DownArrow", mods = "NONE", action = a.CopyMode("MoveDown") }, - { key = "UpArrow", mods = "NONE", action = a.CopyMode("MoveUp") }, - { key = "RightArrow", mods = "NONE", action = a.CopyMode("MoveRight") }, - - { key = "RightArrow", mods = "ALT", action = a.CopyMode("MoveForwardWord") }, - { key = "f", mods = "ALT", action = a.CopyMode("MoveForwardWord") }, - { key = "Tab", mods = "NONE", action = a.CopyMode("MoveForwardWord") }, - { key = "w", mods = "NONE", action = a.CopyMode("MoveForwardWord") }, - - { key = "LeftArrow", mods = "ALT", action = a.CopyMode("MoveBackwardWord") }, - { key = "b", mods = "ALT", action = a.CopyMode("MoveBackwardWord") }, - { key = "Tab", mods = "SHIFT", action = a.CopyMode("MoveBackwardWord") }, - { key = "b", mods = "NONE", action = a.CopyMode("MoveBackwardWord") }, - - { key = "0", mods = "NONE", action = a.CopyMode("MoveToStartOfLine") }, - { key = "Enter", mods = "NONE", action = a.CopyMode("MoveToStartOfNextLine") }, - - { key = "$", mods = "NONE", action = a.CopyMode("MoveToEndOfLineContent") }, - { key = "$", mods = "SHIFT", action = a.CopyMode("MoveToEndOfLineContent") }, - { key = "^", mods = "NONE", action = a.CopyMode("MoveToStartOfLineContent") }, - { key = "^", mods = "SHIFT", action = a.CopyMode("MoveToStartOfLineContent") }, - { key = "m", mods = "ALT", action = a.CopyMode("MoveToStartOfLineContent") }, - - { key = " ", mods = "NONE", action = a.CopyMode({ SetSelectionMode = "Cell" }) }, - { key = "v", mods = "NONE", action = a.CopyMode({ SetSelectionMode = "Cell" }) }, - { key = "V", mods = "NONE", action = a.CopyMode({ SetSelectionMode = "Line" }) }, - { key = "V", mods = "SHIFT", action = a.CopyMode({ SetSelectionMode = "Line" }) }, - { key = "v", mods = "CTRL", action = a.CopyMode({ SetSelectionMode = "Block" }) }, - - { key = "G", mods = "NONE", action = a.CopyMode("MoveToScrollbackBottom") }, - { key = "G", mods = "SHIFT", action = a.CopyMode("MoveToScrollbackBottom") }, - { key = "g", mods = "NONE", action = a.CopyMode("MoveToScrollbackTop") }, - - { key = "H", mods = "NONE", action = a.CopyMode("MoveToViewportTop") }, - { key = "H", mods = "SHIFT", action = a.CopyMode("MoveToViewportTop") }, - { key = "M", mods = "NONE", action = a.CopyMode("MoveToViewportMiddle") }, - { key = "M", mods = "SHIFT", action = a.CopyMode("MoveToViewportMiddle") }, - { key = "L", mods = "NONE", action = a.CopyMode("MoveToViewportBottom") }, - { key = "L", mods = "SHIFT", action = a.CopyMode("MoveToViewportBottom") }, - - { key = "o", mods = "NONE", action = a.CopyMode("MoveToSelectionOtherEnd") }, - { key = "O", mods = "NONE", action = a.CopyMode("MoveToSelectionOtherEndHoriz") }, - { key = "O", mods = "SHIFT", action = a.CopyMode("MoveToSelectionOtherEndHoriz") }, - - { key = "PageUp", mods = "NONE", action = a.CopyMode("PageUp") }, - { key = "PageDown", mods = "NONE", action = a.CopyMode("PageDown") }, - - { key = "b", mods = "CTRL", action = a.CopyMode("PageUp") }, - { key = "f", mods = "CTRL", action = a.CopyMode("PageDown") }, - - -- Enter y to copy and quit the copy mode. - { - key = "y", - mods = "NONE", - action = a.Multiple({ - a.CopyTo("ClipboardAndPrimarySelection"), - a.CopyMode("Close"), - }), - }, - -- Enter search mode to edit the pattern. - -- When the search pattern is an empty string the existing pattern is preserved - { key = "/", mods = "NONE", action = a({ Search = { CaseSensitiveString = "" } }) }, - { key = "?", mods = "NONE", action = a({ Search = { CaseInSensitiveString = "" } }) }, - { key = "n", mods = "CTRL", action = a({ CopyMode = "NextMatch" }) }, - { key = "p", mods = "CTRL", action = a({ CopyMode = "PriorMatch" }) }, - }, - - search_mode = { - { key = "Escape", mods = "NONE", action = a({ CopyMode = "Close" }) }, - -- Go back to copy mode when pressing enter, so that we can use unmodified keys like "n" - -- to navigate search results without conflicting with typing into the search area. - { key = "Enter", mods = "NONE", action = "ActivateCopyMode" }, - { key = "c", mods = "CTRL", action = "ActivateCopyMode" }, - { key = "n", mods = "CTRL", action = a({ CopyMode = "NextMatch" }) }, - { key = "p", mods = "CTRL", action = a({ CopyMode = "PriorMatch" }) }, - { key = "r", mods = "CTRL", action = a.CopyMode("CycleMatchType") }, - { key = "u", mods = "CTRL", action = a.CopyMode("ClearPattern") }, - }, -} diff --git a/.config/wezterm/keys.lua b/.config/wezterm/keys.lua new file mode 100644 index 0000000..d344b5a --- /dev/null +++ b/.config/wezterm/keys.lua @@ -0,0 +1,94 @@ +local w = require("wezterm") +local a = w.action + +local function map(key, mods, action) + local res = { key = key } + if mods then + res["mods"] = mods + end + if action then + res["action"] = action + end + return res +end + +local function send(...) + local arg = { ... } + local res = {} + for _, v in ipairs(arg) do + if type(v) == "table" then + table.insert(res, a.SendKey(v)) + elseif type(v) == "string" then + table.insert(res, a.SendKey({ key = v })) + end + end + if #res == 1 then + return res[1] + elseif #res > 1 then + return a.Multiple(res) + end +end + +-- nvim +local ctrl_o = { key = "o", mods = "CTRL" } +-- tmux/nvim window mgmt +local ctrl_w = { key = "w", mods = "CTRL" } +-- tmux +local ctrl_a = { key = "a", mods = "CTRL" } + +return { + -- Save + map("s", "CMD", send(ctrl_o, "w")), + -- Preferences + map(",", "CMD", a.SendString("vi ~/.config/wezterm/wezterm.lua\r")), + -- Window Mgmt + map("n", "CMD", a.SpawnWindow), + map("m", "CMD", a.Hide), + map("h", "CMD", a.HideApplication), + map("f", "CMD|SHIFT", a.ToggleFullScreen), + map("w", "CMD", send(map("d", "CTRL"))), + + -- Font size + map("=", "CMD", a.IncreaseFontSize), + map("-", "CMD", a.DecreaseFontSize), + map("0", "CMD", a.ResetFontSize), + + -- Clipboard + map("c", "CMD", a.CopyTo("Clipboard")), + map("v", "CMD", a.PasteFrom("Clipboard")), + + -- Wezterm command palette + map("Space", "CTRL|SHIFT", a.ActivateCommandPalette), + + -- Find/search + map("p", "CMD", send(map("p", "CTRL"))), + map("p", "CMD|SHIFT", send(ctrl_o, "f", "a")), + + -- Window management + map("d", "CMD", send(ctrl_w, "s")), + map("d", "CMD|SHIFT", send(ctrl_w, "S")), + + -- Vim/tmux nav + map("h", "CMD|SHIFT", send(ctrl_w, "h")), + map("j", "CMD|SHIFT", send(ctrl_w, "j")), + map("k", "CMD|SHIFT", send(ctrl_w, "k")), + map("l", "CMD|SHIFT", send(ctrl_w, "l")), + + -- Tmux pane management + map("r", "CMD", send(ctrl_a, "r")), -- Rotate + map("y", "CMD", send(ctrl_a, "y")), -- Mirror + map("t", "CMD", send(ctrl_a, "n")), -- Tab + + -- Tmux tab nav + map("}", "CMD|SHIFT", send(ctrl_a, "]")), + map("{", "CMD|SHIFT", send(ctrl_a, "[")), + + -- "Ctrl-A" for tmux + map("a", "CMD", send(ctrl_a)), + + -- Mirror VSCode panels + map("b", "CMD", send(ctrl_o, "b")), + map("e", "CMD|SHIFT", send(ctrl_o, "b")), + map("j", "CMD", send(ctrl_o, "j")), + map("k", "CMD", send(ctrl_o, "k")), +} diff --git a/.config/wezterm/nvim-navigator.lua b/.config/wezterm/nvim-navigator.lua deleted file mode 100644 index a43a28a..0000000 --- a/.config/wezterm/nvim-navigator.lua +++ /dev/null @@ -1,36 +0,0 @@ -local w = require("wezterm") -local a = w.action - -local function isViProcess(pane) - return pane:get_foreground_process_name():find("vi") ~= nil -end - -local function conditionalActivatePane(window, pane, pane_direction, vim_direction) - if isViProcess(pane) then - window:perform_action( - -- This should match the keybinds you set in Neovim. - a.SendMultiple({ - a.SendKey({ key = "w", mods = "CTRL" }), - a.SendKey({ key = vim_direction }), - }), - pane - ) - else - window:perform_action(a.ActivatePaneDirection(pane_direction), pane) - end -end - -return function() - w.on("ActivatePaneDirection-right", function(window, pane) - conditionalActivatePane(window, pane, "Right", "l") - end) - w.on("ActivatePaneDirection-left", function(window, pane) - conditionalActivatePane(window, pane, "Left", "h") - end) - w.on("ActivatePaneDirection-up", function(window, pane) - conditionalActivatePane(window, pane, "Up", "k") - end) - w.on("ActivatePaneDirection-down", function(window, pane) - conditionalActivatePane(window, pane, "Down", "j") - end) -end diff --git a/.config/wezterm/tabs.lua b/.config/wezterm/tabs.lua new file mode 100644 index 0000000..9feb823 --- /dev/null +++ b/.config/wezterm/tabs.lua @@ -0,0 +1,51 @@ +local w = require("wezterm") +local c = require("colors") +local sep = { + left = "", + right = "", +} + +-- tab, tabs, panes, config, hover, max_width +w.on("format-tab-title", function(tab, _, _, _, _, max_width) + local title = string.gmatch(tab.active_pane.title, "([^/]+)$")() + local width = max_width - 9 + if #title > width then + title = string.sub(title, #title - width, #title) + end + if tab.is_active then + return { + { Background = { Color = c.bg } }, + { Text = " " }, + { Background = { Color = c.bg } }, + { Foreground = { Color = c.active.bg } }, + { Text = sep.left }, + { Background = { Color = c.active.bg } }, + { Foreground = { Color = "#8fbcbb" } }, + { Text = "  " }, + { Foreground = { Color = c.active.fg } }, + { Text = " " .. title .. " " }, + { Background = { Color = c.bg } }, + { Foreground = { Color = c.active.bg } }, + { Text = sep.right }, + { Background = { Color = c.bg } }, + { Text = " " }, + } + else + return { + { Background = { Color = c.bg } }, + { Text = " " }, + { Background = { Color = c.bg } }, + { Foreground = { Color = c.inactive.bg } }, + { Text = sep.left }, + { Background = { Color = c.inactive.bg } }, + { Foreground = { Color = c.inactive.fg } }, + { Text = "  " }, + { Text = " " .. title .. " " }, + { Background = { Color = c.bg } }, + { Foreground = { Color = c.inactive.bg } }, + { Text = sep.right }, + { Background = { Color = c.bg } }, + { Text = " " }, + } + end +end) diff --git a/.config/wezterm/wezterm.lua b/.config/wezterm/wezterm.lua index 005fe16..6f04ab2 100644 --- a/.config/wezterm/wezterm.lua +++ b/.config/wezterm/wezterm.lua @@ -1,137 +1,23 @@ local w = require("wezterm") -local a = w.action -local function map(key, mods, action) - local res = { key = key } - if mods then - res["mods"] = mods - end - if action then - res["action"] = action - end - return res -end +local c = require("colors") -local function send(...) - local arg = { ... } - local res = {} - for _, v in ipairs(arg) do - if type(v) == "table" then - table.insert(res, a.SendKey(v)) - elseif type(v) == "string" then - table.insert(res, a.SendKey({ key = v })) - end - end - if #res == 1 then - return res[1] - elseif #res > 1 then - return a.Multiple(res) - end -end - --- nvim -local ctrl_o = { key = "o", mods = "CTRL" } --- tmux -local ctrl_a = { key = "a", mods = "CTRL" } --- cross-tool window mgmt -local ctrl_w = { key = "w", mods = "CTRL" } - -local C = { - active = { - fg = "#d8dee9", - bg = "#434c5e", - }, - inactive = { - fg = "#d8dee9", - bg = "#2e3440", - }, - bg = "#2a2e38", - -- bg = "#000000", - fg = "#d8dee9", -} --- local sep = { --- left = "", --- right = "", --- } - --- tab, tabs, panes, config, hover, max_width --- w.on("format-tab-title", function(tab, _, _, _, _, max_width) --- local title = string.gmatch(tab.active_pane.title, "([^/]+)$")() --- local width = max_width - 9 --- if #title > width then --- title = string.sub(title, #title - width, #title) --- end --- if tab.is_active then --- return { --- { Foreground = { Color = "#8fbcbb" } }, --- { Text = "  " }, --- { Foreground = { Color = C.active.fg } }, --- { Text = " " .. title .. " " }, --- } --- else --- return { --- { Foreground = { Color = C.inactive.fg } }, --- { Text = "  " }, --- { Text = " " .. title .. " " }, --- } --- end --- -- if tab.is_active then --- -- return { --- -- { Background = { Color = C.bg } }, --- -- { Text = " " }, --- -- { Background = { Color = C.bg } }, --- -- { Foreground = { Color = C.active.bg } }, --- -- { Text = sep.left }, --- -- { Background = { Color = C.active.bg } }, --- -- { Foreground = { Color = "#8fbcbb" } }, --- -- { Text = "  " }, --- -- { Foreground = { Color = C.active.fg } }, --- -- { Text = " " .. title .. " " }, --- -- { Background = { Color = C.bg } }, --- -- { Foreground = { Color = C.active.bg } }, --- -- { Text = sep.right }, --- -- { Background = { Color = C.bg } }, --- -- { Text = " " }, --- -- } --- -- else --- -- return { --- -- { Background = { Color = C.bg } }, --- -- { Text = " " }, --- -- { Background = { Color = C.bg } }, --- -- { Foreground = { Color = C.inactive.bg } }, --- -- { Text = sep.left }, --- -- { Background = { Color = C.inactive.bg } }, --- -- { Foreground = { Color = C.inactive.fg } }, --- -- { Text = "  " }, --- -- { Text = " " .. title .. " " }, --- -- { Background = { Color = C.bg } }, --- -- { Foreground = { Color = C.inactive.bg } }, --- -- { Text = sep.right }, --- -- { Background = { Color = C.bg } }, --- -- { Text = " " }, --- -- } --- -- end --- end) +-- require("tabs") return { - -- window_background_image = "/Users/nathan/Pictures/dancer.jpeg", - -- Font font = w.font("RobotoMono Nerd Font", { weight = "Medium" }), font_size = 15.0, harfbuzz_features = { "calt=0", "clig=0", "liga=0" }, line_height = 0.90, - -- color_scheme = "nord", check_for_updates = false, window_decorations = "RESIZE", - disable_default_key_bindings = true, native_macos_fullscreen_mode = true, - enable_tab_bar = false, - use_fancy_tab_bar = false, - show_tabs_in_tab_bar = true, + disable_default_key_bindings = true, + show_tabs_in_tab_bar = false, show_new_tab_button_in_tab_bar = false, + hide_tab_bar_if_only_one_tab = true, tab_max_width = 32, - default_prog = { "zsh", "-c", "tmux" }, window_padding = { left = 8, right = 8, @@ -139,91 +25,25 @@ return { bottom = 8, }, window_frame = { - active_titlebar_bg = C.bg, - inactive_titlebar_bg = C.bg, + active_titlebar_bg = c.bg, + inactive_titlebar_bg = c.bg, font = w.font({ family = "Roboto Mono", weight = "Bold" }), font_size = 14.0, }, colors = { tab_bar = { - background = C.bg, + background = c.bg, active_tab = { - bg_color = C.active.bg, - fg_color = C.active.fg, + bg_color = c.active.bg, + fg_color = c.active.fg, }, inactive_tab = { - bg_color = C.inactive.bg, - fg_color = C.inactive.fg, + bg_color = c.inactive.bg, + fg_color = c.inactive.fg, }, }, }, + default_prog = { "zsh", "-c", "tmux" }, scrollback_lines = 3500, - keys = { - -- MacOS default - map("s", "CMD", send(ctrl_o, "w")), - map("w", "CMD", send(map("d", "CTRL"))), - map(",", "CMD", a.SendString("vi ~/.config/wezterm/wezterm.lua\r")), - map("z", "CMD", send(ctrl_a, "z")), - map("c", "CMD", a.CopyTo("Clipboard")), - map("v", "CMD", a.PasteFrom("Clipboard")), - map("m", "CMD", a.Hide), - map("h", "CMD", a.HideApplication), - -- map("h", "CMD|SHIFT", a.Hide) - map("n", "CMD", a.SpawnWindow), - map("f", "CMD|SHIFT", a.ToggleFullScreen), - map("=", "CMD", a.IncreaseFontSize), - map("-", "CMD", a.DecreaseFontSize), - map("0", "CMD", a.ResetFontSize), - map("Space", "CTRL|SHIFT", a.ActivateCommandPalette), - - -- Split - -- map("d", "CMD", a.SplitVertical({ domain = "CurrentPaneDomain" })), - -- map("d", "CMD|SHIFT", a.SplitHorizontal({ domain = "CurrentPaneDomain" })), - map("d", "CMD", send(ctrl_w, "s")), - map("d", "CMD|SHIFT", send(ctrl_w, "S")), - -- Vim/tmux nav - map("h", "CMD|SHIFT", send(ctrl_w, "h")), - map("j", "CMD|SHIFT", send(ctrl_w, "j")), - map("k", "CMD|SHIFT", send(ctrl_w, "k")), - map("l", "CMD|SHIFT", send(ctrl_w, "l")), - -- "CtrlP" - map("p", "CMD", send(map("p", "CTRL"))), - - -- "Ctrl-A" for tmux - map("a", "CMD", send(ctrl_a)), - - -- Find/search - map("p", "CMD", send(map("p", "CTRL"))), - map("o", "CMD", send(ctrl_o, "f", "b")), - map("p", "CMD|SHIFT", send(ctrl_o, "f", "a")), - map("f", "CMD", send(ctrl_a, "c")), - - -- Splits / windows - map("Enter", "CMD", send(ctrl_a, "z")), - map("Enter", "CMD|SHIFT", send(ctrl_o, "c")), - - -- Rotate - map("r", "CMD", send(ctrl_a, "r")), - -- Mirror - map("y", "CMD", send(ctrl_a, "y")), - -- Tab - map("t", "CMD", send(ctrl_a, "n")), - - -- Vim tab nav - map("]", "CMD", send(ctrl_o, "n")), - map("[", "CMD", send(ctrl_o, "p")), - - -- Tmux tab nav - map("}", "CMD|SHIFT", send(ctrl_a, "]")), - map("{", "CMD|SHIFT", send(ctrl_a, "[")), - map("]", "CMD|SHIFT", send(ctrl_a, "]")), - map("[", "CMD|SHIFT", send(ctrl_a, "[")), - - -- Mirror VSCode panels - map("b", "CMD", send(ctrl_o, "b")), - map("e", "CMD|SHIFT", send(ctrl_o, "b")), - map("j", "CMD", send(ctrl_o, "j")), - map("k", "CMD", send(ctrl_o, "k")), - }, - -- }, + keys = require("keys"), } diff --git a/.skhdrc b/.skhdrc index 9262d5b..60d4378 100644 --- a/.skhdrc +++ b/.skhdrc @@ -45,15 +45,15 @@ alt - 0x1B : yabai -m space --gap rel:8;\ yabai -m space --padding rel:8:8:8:8 -alt - h : yabai -m window --focus west -alt - j : yabai -m window --focus south -alt - k : yabai -m window --focus north -alt - l : yabai -m window --focus east +shift + alt - h : yabai -m window --focus west +shift + alt - j : yabai -m window --focus south +shift + alt - k : yabai -m window --focus north +shift + alt - l : yabai -m window --focus east -shift + alt - h : yabai -m window --warp west -shift + alt - j : yabai -m window --warp south -shift + alt - k : yabai -m window --warp north -shift + alt - l : yabai -m window --warp east +# shift + alt - h : yabai -m window --warp west +# shift + alt - j : yabai -m window --warp south +# shift + alt - k : yabai -m window --warp north +# shift + alt - l : yabai -m window --warp east # Follow windows when throwing to a new space shift + alt - n : wid="$(yabai -m query --windows --window | jq -r '.id')" \ @@ -64,7 +64,7 @@ shift + alt - p : wid="$(yabai -m query --windows --window | jq -r '.id')" \ && yabai -m window --focus "${wid}" -alt - return : yabai -m window --toggle zoom-fullscreen +alt - z : yabai -m window --toggle zoom-fullscreen alt - u : yabai -m window --toggle zoom-parent alt - i : yabai -m window --toggle split diff --git a/.yabairc b/.yabairc index 3807948..e63a4d6 100755 --- a/.yabairc +++ b/.yabairc @@ -38,5 +38,7 @@ yabai -m config right_padding 0 yabai -m config window_gap 0 # app exclusions -# yabai -m rule --add app="^Tomato 2$" manage=off sticky=on layer=above # yabai -m rule --add app="^System Settings$" manage=off sticky=on layer=above + +yabai -m signal --add event=window_created action='yabai -m query --windows --window $YABAI_WINDOW_ID | jq -er ".\"can-resize\" or .\"is-floating\"" || yabai -m window $YABAI_WINDOW_ID --toggle float' + diff --git a/.zshrc b/.zshrc index 1c410f8..8296f12 100644 --- a/.zshrc +++ b/.zshrc @@ -138,3 +138,7 @@ n () # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh (( ! ${+functions[p10k]} )) || p10k finalize + +# if [[ "$TERM_PROGRAM" == "WezTerm" ]]; then +# source /Applications/WezTerm.app/Contents/Resources/wezterm.sh +# fi