From 1a924cb0b24ba5799b3c4d5b550d940cfeb1a9df Mon Sep 17 00:00:00 2001 From: Alec Goncharow Date: Sun, 9 Feb 2025 10:54:12 -0500 Subject: many things. --- .config/nvim/init.lua | 2 ++ .config/nvim/lazy-lock.json | 7 +++-- .config/nvim/lua/autocomplete.lua | 16 ++++++----- .config/nvim/lua/lsp.lua | 13 ++++++++- .config/nvim/lua/lspsaga_conf.lua | 2 +- .config/nvim/lua/mappings.lua | 58 +++++++++++++++++++++++++++++++-------- .config/nvim/lua/plugins.lua | 32 ++++++++++++++++++++- .config/nvim/lua/treesitter.lua | 2 +- .config/sway/config | 46 ++++++++++++++++--------------- .config/zls.json | 4 +++ .gitignore | 3 ++ .zshrc | 2 +- bin/clamshell-toggle | 4 +-- bin/screenshot | 6 ++-- 14 files changed, 146 insertions(+), 51 deletions(-) create mode 100644 .config/zls.json create mode 100644 .gitignore diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index ce6583c..08d4c48 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -33,3 +33,5 @@ require('neorg_conf') -- note taking if vim.g.neovide then require('neovide_conf') end + +require('leap').create_default_mappings() diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index b23d43c..829401d 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -12,10 +12,12 @@ "go.nvim": { "branch": "master", "commit": "cde0c7a110c0f65b9e4e6baf342654268efff371" }, "jai.vim": { "branch": "master", "commit": "72c09c5f803b8ab2e708a3ad2b7c3704e2b4b3d8" }, "lazy.nvim": { "branch": "main", "commit": "b02c9eae6a250f98908c146d1dc1a891f5019f0a" }, + "leap.nvim": { "branch": "main", "commit": "c6bfb191f1161fbabace1f36f578a20ac6c7642c" }, "lspsaga.nvim": { "branch": "main", "commit": "6f920cfabddb9b7de5a3a4d0b7cd4f0774ae23e2" }, "lua-utils.nvim": { "branch": "main", "commit": "e565749421f4bbb5d2e85e37c3cef9d56553d8bd" }, "lualine.nvim": { "branch": "master", "commit": "6a40b530539d2209f7dc0492f3681c8c126647ad" }, "luarocks.nvim": { "branch": "main", "commit": "1db9093915eb16ba2473cfb8d343ace5ee04130a" }, + "marks.nvim": { "branch": "master", "commit": "bb25ae3f65f504379e3d08c8a02560b76eaf91e8" }, "neorg": { "branch": "main", "commit": "ace80b05771b65d6633f3c64b8d930b5787f20d0" }, "nerdcommenter": { "branch": "master", "commit": "7bb1f72e802a80e37bdda5f6906c69b5a93de1eb" }, "netrw.nvim": { "branch": "master", "commit": "c64f60b8a613900aad82ef1c285b892eb43e9e15" }, @@ -28,6 +30,7 @@ "nvim-nio": { "branch": "master", "commit": "7969e0a8ffabdf210edd7978ec954a47a737bbcc" }, "nvim-treesitter": { "branch": "master", "commit": "ebdffa78bdb16af84fb76ff6a75978496d4dcbec" }, "nvim-web-devicons": { "branch": "master", "commit": "c0cfc1738361b5da1cd0a962dd6f774cc444f856" }, + "odin.vim": { "branch": "master", "commit": "e7ce5f9d1804273986c661132de19798b0b2b267" }, "oil.nvim": { "branch": "master", "commit": "10fbfdd37b6904c0776c5db1a27ab47eecba335e" }, "pathlib.nvim": { "branch": "main", "commit": "7a5a6facd29e306bc73a37719fa67c0d2226f852" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, @@ -37,6 +40,7 @@ "templ.vim": { "branch": "main", "commit": "5cc48b93a4538adca0003c4bc27af844bb16ba24" }, "text-case.nvim": { "branch": "main", "commit": "ec9925b27dd54809653cc766b8673acd979a888e" }, "tmuxline.vim": { "branch": "master", "commit": "4119c553923212cc67f4e135e6f946dc3ec0a4d6" }, + "todo-comments.nvim": { "branch": "main", "commit": "8f45f353dc3649cb9b44cecda96827ea88128584" }, "vim-cool": { "branch": "master", "commit": "662e7b11064cbeedad17c45d2fe926e78d3cd0b6" }, "vim-dadbod": { "branch": "master", "commit": "7888cb7164d69783d3dce4e0283decd26b82538b" }, "vim-ember-hbs": { "branch": "master", "commit": "777095c1b25f334cef9db5504c7d409d52843aa9" }, @@ -48,9 +52,8 @@ "vim-matchup": { "branch": "master", "commit": "1535a769d5dca851fe7d41b0be95f7c7203a4bef" }, "vim-radical": { "branch": "master", "commit": "aca8992a25d317a4c6fa42e263e8506ea3e355d8" }, "vim-repeat": { "branch": "master", "commit": "5bd4c87a1417a7187d0329e81eb83514ee481250" }, - "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, "vim-visual-multi": { "branch": "master", "commit": "38b0e8d94a5499ccc17d6159763d32c79f53417b" }, "vim-vsnip": { "branch": "master", "commit": "02a8e79295c9733434aab4e0e2b8c4b7cea9f3a9" }, "zen-mode.nvim": { "branch": "main", "commit": "21976479c7a0146b05a42707cf91c86b1e510945" }, "zig.vim": { "branch": "master", "commit": "54c216e5306a5c3878a60596aacb94dca8652ab9" } -} \ No newline at end of file +} diff --git a/.config/nvim/lua/autocomplete.lua b/.config/nvim/lua/autocomplete.lua index 1de4271..7746750 100644 --- a/.config/nvim/lua/autocomplete.lua +++ b/.config/nvim/lua/autocomplete.lua @@ -1,6 +1,7 @@ -- Set up nvim-cmp. local cmp = require 'cmp' + cmp.setup({ snippet = { -- REQUIRED - you must specify a snippet engine @@ -11,11 +12,12 @@ cmp.setup({ -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. end, }, - experimental = { - ghost_text = { - hl_group = "CmpGhostText", - }, - }, + -- can't figure this out, could be cool if ghost text actually took on different color + -- experimental = { + -- ghost_text = { + -- hl_group = "CmpGhostText", + -- }, + -- }, window = { completion = cmp.config.window.bordered({ border = 'none' }), documentation = cmp.config.window.bordered({ border = 'none' }), @@ -24,7 +26,7 @@ cmp.setup({ [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - [''] = cmp.mapping.abort(), + [''] = cmp.mapping.complete(), }), sources = cmp.config.sources({ { name = 'nvim_lsp' }, @@ -37,7 +39,7 @@ cmp.setup({ { name = 'buffer' }, }), completion = { - autocomplete = false + autocomplete = false, } }) diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua index e70ce07..3178a5d 100644 --- a/.config/nvim/lua/lsp.lua +++ b/.config/nvim/lua/lsp.lua @@ -58,7 +58,6 @@ local lspconfig = require('lspconfig') lspconfig.zls.setup({ on_attach = on_attach, capabilities = capabilities, - }) lspconfig.bashls.setup({ @@ -160,6 +159,18 @@ end lspconfig.jails.setup({}) vim.filetype.add({ extension = { jai = "jai", } }) +lspconfig.ols.setup({ + on_attach = on_attach, + capabilities = capabilities, + init_options = { + enable_references = true, + enable_rename = true, + enable_semantic_tokens = true, + enable_checker_only_saved = true, + enable_inlay_hints = true, + } +}) + vim.api.nvim_create_autocmd('BufWritePre', { pattern = '*.go', callback = function() diff --git a/.config/nvim/lua/lspsaga_conf.lua b/.config/nvim/lua/lspsaga_conf.lua index 73d5695..b31aeff 100644 --- a/.config/nvim/lua/lspsaga_conf.lua +++ b/.config/nvim/lua/lspsaga_conf.lua @@ -88,7 +88,7 @@ require('lspsaga').setup({ }, }) -Nmap('', ':Lspsaga outline') +Nmap('', ':Lspsaga outline') -- Nmap('', ':Lspsaga show_buf_diagnostics') Nmap('', ':Lspsaga show_buf_diagnostics') Nmap('', ':Lspsaga code_action') diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua index 838ba4f..e6c34ca 100644 --- a/.config/nvim/lua/mappings.lua +++ b/.config/nvim/lua/mappings.lua @@ -25,20 +25,56 @@ function Tmap(shortcut, command) Map('t', shortcut, command) end ---- pane nav -Nmap("", ":wincmd k") -Nmap("", ":wincmd j") -Nmap("", ":wincmd h") -Nmap("", ":wincmd l") +-- pane nav +Nmap("u", ":wincmd k") +Nmap("e", ":wincmd j") +Nmap("n", ":wincmd h") +Nmap("i", ":wincmd l") ---- pane resize -Nmap("_", ":resize -1") -Nmap("+", ":resize +1") +-- -- pane resize +-- Nmap("_", ":resize -1") +-- Nmap("+", ":resize +1") -- pane spawn -Nmap("t", ':split:wincmd j:term') -Nmap("s", ':vs:wincmd l') -Nmap("", ':only') +Nmap("t", ':split:wincmd j:term') +Nmap("s", ':vs:wincmd l') +Nmap("wo", ':only') -- escape terminal mode easier Tmap('', '') + + +-- yoinked from https://github.com/dycw/dotfiles/blob/master/nvim/lua/keymaps.lua +local function merge_tables(t1, t2) + local result = {} + for key, value in pairs(t1) do + result[key] = value + end + for key, value in pairs(t2) do + result[key] = value + end + return result +end + +local keymap_opts = { noremap = true, silent = true } + +local keymap_set = function(mode, lhs, rhs, desc) + vim.keymap.set(mode, lhs, rhs, merge_tables(keymap_opts, { desc = desc })) +end +-- command +keymap_set("n", ";", ":", "Command") + +-- global marks +local prefixes = "m'" +local letters = "abcdefghijklmnopqrstuvwxyz" +for i = 1, #prefixes do + local prefix = prefixes:sub(i, i) + for j = 1, #letters do + local lower_letter = letters:sub(j, j) + local upper_letter = string.upper(lower_letter) + keymap_set({ "n", "v" }, prefix .. lower_letter, prefix .. upper_letter, "Mark " .. upper_letter) + end +end + +-- paste in insert mode +keymap_set("i", "", "p", "Paste") diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 44a7294..0a72469 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -46,7 +46,7 @@ return require('lazy').setup({ 'scrooloose/nerdcommenter', -- commenting shortcuts 'tpope/vim-eunuch', -- wrappers UNIX commands - 'tpope/vim-surround', -- surround characters shortcuts + --'tpope/vim-surround', -- surround characters shortcuts 'tpope/vim-endwise', -- wisely add 'tpope/vim-repeat', -- repeat for plugins -- 'tpope/vim-vinegar', -- make explore better @@ -88,6 +88,9 @@ return require('lazy').setup({ -- jai 'rluba/jai.vim', + -- Odin + 'Tetralux/odin.vim', + 'johmsalas/text-case.nvim', -- integer base conversions @@ -116,5 +119,32 @@ return require('lazy').setup({ vim.g.lsp_zero_extend_cmp = 0 vim.g.lsp_zero_extend_lspconfig = 0 end, + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { + keywords = { + FIX = { + icon = " ", -- icon used for the sign, and in search results + color = "error", -- can be a hex color, or a named color (see below) + alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords + -- signs = false, -- configure signs for some keywords individually + }, + TODO = { icon = " ", color = "info", alt = { "nocheckin" } }, + HACK = { icon = " ", color = "warning" }, + WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } }, + PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, + NOTE = { icon = " ", color = "hint", alt = { "INFO" } }, + TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, + }, + } + }, + + -- movement + 'ggandor/leap.nvim', + { + "chentoast/marks.nvim", + event = "VeryLazy", + opts = { + }, }, }) diff --git a/.config/nvim/lua/treesitter.lua b/.config/nvim/lua/treesitter.lua index cbf7d0c..ce17c70 100644 --- a/.config/nvim/lua/treesitter.lua +++ b/.config/nvim/lua/treesitter.lua @@ -1,6 +1,6 @@ require 'nvim-treesitter.configs'.setup { -- A list of parser names, or "all" - ensure_installed = { "rust", "c", "lua", "vim", "zig", "go" }, + ensure_installed = { "rust", "c", "lua", "vim", "zig", "go", "odin" }, -- Install parsers synchronously (only applied to `ensure_installed`) sync_install = false, diff --git a/.config/sway/config b/.config/sway/config index fdb7f28..cca2994 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -29,7 +29,7 @@ floating_modifier $mod set $my-term ghostty bindsym $mod+Return exec --no-startup-id $my-term bindsym $mod+t exec --no-startup-id $my-term -bindsym $mod+n exec --no-startup-id neovide '+Notes' +bindsym $mod+m exec --no-startup-id neovide '+Notes' # kill focused window bindsym $mod+Shift+q exec --no-startup-id ~/bin/safequit @@ -38,10 +38,10 @@ bindsym $mod+Shift+q exec --no-startup-id ~/bin/safequit bindsym $mod+d exec --no-startup-id fuzzel # change focus -bindsym $mod+h focus left -bindsym $mod+j focus down -bindsym $mod+k focus up -bindsym $mod+l focus right +bindsym $mod+n focus left +bindsym $mod+e focus down +bindsym $mod+u focus up +bindsym $mod+i focus right # alternatively, you can use the cursor keys: #bindsym $mod+Left focus left @@ -50,10 +50,10 @@ bindsym $mod+l focus right #bindsym $mod+Right focus right # move focused window -bindsym $mod+Shift+h move left -bindsym $mod+Shift+j move down -bindsym $mod+Shift+k move up -bindsym $mod+Shift+l move right +bindsym $mod+Shift+n move left +bindsym $mod+Shift+e move down +bindsym $mod+Shift+u move up +bindsym $mod+Shift+i move right # alternatively, you can use the cursor keys: #bindsym $mod+Shift+Left move left @@ -70,7 +70,7 @@ bindsym $mod+f fullscreen toggle # change container layout (stacked, tabbed, toggle split) bindsym $mod+s layout stacking bindsym $mod+w layout tabbed -bindsym $mod+e layout toggle split +bindsym $mod+Shift+w layout toggle split # toggle tiling / floating bindsym $mod+Shift+space floating toggle @@ -145,7 +145,7 @@ bindsym $mod+Shift+0 move container to workspace $ws10; workspace $ws10 # reload the configuration file bindsym $mod+Shift+c reload -bindsym $mod+Shift+e exec "swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway?' -B 'Yes, exit sway' 'swaymsg exit'" +bindsym $mod+Shift+k exec "swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway?' -B 'Yes, exit sway' 'swaymsg exit'" # resize window (you can also use the mouse for that) mode "resize" { @@ -176,7 +176,7 @@ bindsym $mod+r mode "resize" mode "game" { bindsym $mod+Shift+o mode "default" } -bindsym $mod+o mode "game" +bindsym $mod+g mode "game" # Walpaper # exec --no-startup-id feh --bg-fill ~/Pictures/wallpaper.png @@ -253,7 +253,7 @@ client.unfocused "#2c2c2c" "#2b2b2b" "#888888" "#000000" "#2c2c2c" set $notify dunstify --timeout 1500 # Set your laptop screen name -set $laptop_screen 'eDP-1' +set $laptop_screen 'eDP-2' # Clamshell mode or lock & sleep # This is a if/else statement: [ outputs_count == 1 ] && true || false @@ -261,30 +261,32 @@ bindswitch --reload --locked lid:on exec '[ $(swaymsg -t get_outputs | grep name exec_always ~/bin/clamshell-toggle bindswitch --reload --locked lid:off output $laptop_screen enable -workspace 1 output 'LG Electronics LG ULTRAGEAR 107NTDVCR242' eDP-1 -workspace 2 output 'Dell Inc. DELL P2723QE 3940MP3' eDP-1 bindsym --release Print exec ~/bin/screenshot bindsym --release Scroll_Lock exec ~/bin/memezoom bindsym --release XF86AudioMedia exec ~/bin/memezoom # Sway display things -output 'LG Electronics LG ULTRAGEAR 107NTDVCR242' { - position 1440,640 +output 'Dell Inc. Dell AW3821DW #G7QYMxgwAA+/' { + #position 0,0 + #position 3840,0 + position 2048,0 scale 1.0 + mode 3840x1600@144Hz } -output 'Dell Inc. DELL P2723QE 3940MP3' { - position 0,0 - scale 1.5 - transform 270 -} output eDP-1 { position 4000,640 scale 1.25 } +output eDP-2 { + #position 3840,0 + position 0,0 + scale 1.25 +} + input type:touchpad { tap enabled natural_scroll enabled diff --git a/.config/zls.json b/.config/zls.json new file mode 100644 index 0000000..c6eeade --- /dev/null +++ b/.config/zls.json @@ -0,0 +1,4 @@ +{ + "enable_build_on_save": true, + "build_on_save_step": "check" +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..140b962 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +bin/odinfmt +bin/ols +bin/jails diff --git a/.zshrc b/.zshrc index 63eb35d..037cb09 100644 --- a/.zshrc +++ b/.zshrc @@ -143,7 +143,7 @@ alias cat=bat alias find=fd alias open=xdg-open alias pls='sudo $(history -p !!)' -alias jai="~/jai/bin/jai" +alias jai=~/jai/bin/jai-linux export PATH=~/bin:$PATH export PATH=~/go/bin:$PATH export PATH=~/.local/bin:$PATH diff --git a/bin/clamshell-toggle b/bin/clamshell-toggle index 12997e9..54496e0 100755 --- a/bin/clamshell-toggle +++ b/bin/clamshell-toggle @@ -1,6 +1,6 @@ #!/usr/bin/bash if grep -q open /proc/acpi/button/lid/LID0/state; then - swaymsg output eDP-1 enable + swaymsg output eDP-2 enable else - swaymsg output eDP-1 disable + swaymsg output eDP-2 disable fi diff --git a/bin/screenshot b/bin/screenshot index 94e3bd3..3852fa5 100755 --- a/bin/screenshot +++ b/bin/screenshot @@ -12,11 +12,13 @@ FOCUSED=$(swaymsg -t get_tree | jq '.. | (.nodes? // empty)[] | select(.focused) main() { rect="$(slurp)" if [ $? -eq 0 ]; then - grim -g "$rect" -t png - | wl-copy -t image/png + grim -g "$rect" ~/screenshot.png else - grim -g "$(eval echo "$FOCUSED")" -t png - | wl-copy -t image/png + grim -g "$(eval echo "$FOCUSED")" ~/screenshot.png + fi + cat ~/screenshot.png | wl-copy -t image/png } main "$@" -- cgit v1.2.3-70-g09d2