From 8e0e3005c520d6bfc545f8a1a3f2e3a96a789287 Mon Sep 17 00:00:00 2001 From: sam rolfe Date: Thu, 20 Nov 2025 12:45:22 +1100 Subject: [PATCH] fix add xclip scrript and nvim osc52 support --- .zshrc | 12 ++++++ install.sh | 6 +-- nushell/env.nu | 9 +++++ nvim/lazy-lock.json | 54 +++++++++++++------------ nvim/lua/sam/options.lua | 35 +++++++++++++++-- nvim/lua/sam/plugins/avante.lua | 70 +++++++++++++++++++++++++++++++++ nvim/lua/sam/plugins/vimtex.lua | 15 +++++++ 7 files changed, 168 insertions(+), 33 deletions(-) create mode 100644 nvim/lua/sam/plugins/avante.lua create mode 100644 nvim/lua/sam/plugins/vimtex.lua diff --git a/.zshrc b/.zshrc index 6c206a1..5aa9b1a 100644 --- a/.zshrc +++ b/.zshrc @@ -1,5 +1,9 @@ export PATH="$HOME/.cargo/bin:$HOME/.atuin/bin:$HOME/.local/bin:$HOME/.fzf/bin:$PATH" +export OPENAI_API_KEY="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" + +export TAVILY_API_KEY="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" + export EDITOR="nvim" export VISUAL="nvim" @@ -69,3 +73,11 @@ source <(carapace-bin _carapace zsh) [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh alias cat='batcat --color=always --paging=never' + +export ANDROID_HOME=$HOME/android-sdk +export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools +# Source ESP-IDF environment +# IMPORTANT: Adjust path if your ESP-IDF installation moves +if [ -d "/home/sam/esp/esp-idf" ]; then + . "/home/sam/esp/esp-idf/export.sh" +fi diff --git a/install.sh b/install.sh index f92ff0d..45a2f18 100755 --- a/install.sh +++ b/install.sh @@ -4,9 +4,10 @@ echo "--- Starting Environment Setup ---" # 1. Install core packages with apt +# Added: xclip, jq, pandoc echo "--> Installing core packages with apt..." sudo apt update -sudo apt install -y build-essential curl git zsh ripgrep btop bat zoxide eza fuse3 sshfs gh +sudo apt install -y build-essential curl git zsh ripgrep btop bat zoxide eza fuse3 sshfs gh xclip jq pandoc # 2. Install Oh My Zsh and required plugins if [ ! -d "$HOME/.oh-my-zsh" ]; then @@ -46,6 +47,3 @@ if ! command -v lazygit &> /dev/null; then fi echo "--- Software installation complete! ---" -echo "Next steps:" -echo "1. Run './manage_configs.sh' to symlink your configuration files." -echo "2. Log out and log back in for all changes to take effect." diff --git a/nushell/env.nu b/nushell/env.nu index bc216e6..f7e77e5 100644 --- a/nushell/env.nu +++ b/nushell/env.nu @@ -1,4 +1,7 @@ # This file is for environment variables only. +let-env OPENAI_API_KEY = "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" + +let-env TAVILY_API_KEY="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" # 1. Add binary paths to the PATH environment variable. # We prepend so they are found before system defaults. @@ -8,5 +11,11 @@ $env.PATH = ($env.PATH | prepend '/snap/bin' ) + + + # 2. Source the Cargo environment to add its bin directory to the PATH. source $"($nu.home-path)/.cargo/env.nu" + +$env.ANDROID_HOME = ($env.HOME | path join "android-sdk") +$env.PATH = ($env.PATH | prepend ($env.ANDROID_HOME | path join "cmdline-tools" "latest" "bin") ($env.ANDROID_HOME | path join "platform-tools")) diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 9f0cbc0..d286c69 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,38 +1,42 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, - "LuaSnip": { "branch": "master", "commit": "73813308abc2eaeff2bc0d3f2f79270c491be9d7" }, - "catppuccin": { "branch": "main", "commit": "c89184526212e04feffbddda9d06b041a8fca416" }, + "LuaSnip": { "branch": "master", "commit": "3732756842a2f7e0e76a7b0487e9692072857277" }, + "avante.nvim": { "branch": "main", "commit": "ca95e0386433da2077184719886fa658257261a3" }, + "catppuccin": { "branch": "main", "commit": "234fc048de931a0e42ebcad675bf6559d75e23df" }, "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "conform.nvim": { "branch": "master", "commit": "9d6f881a4047a51c7709223dcf24e967633c6523" }, - "dracula.nvim": { "branch": "main", "commit": "041d923368d540a1e438989ce8f915628081a56a" }, - "everforest-nvim": { "branch": "main", "commit": "d2936185a6d266def29fd7b523d296384580ef08" }, - "gitsigns.nvim": { "branch": "main", "commit": "1ee5c1fd068c81f9dd06483e639c2aa4587dc197" }, + "conform.nvim": { "branch": "master", "commit": "cde4da5c1083d3527776fee69536107d98dae6c9" }, + "dracula.nvim": { "branch": "main", "commit": "ae752c13e95fb7c5f58da4b5123cb804ea7568ee" }, + "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, + "everforest-nvim": { "branch": "main", "commit": "557bce922401e247a596583679bc181d4d688554" }, + "gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" }, "gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" }, - "kanagawa.nvim": { "branch": "master", "commit": "27f1e119f3a7e6d11d435a59e3262e6affda1f83" }, - "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "live-preview.nvim": { "branch": "main", "commit": "35ddc5a99499d1d2f4adefb7e92d0c537353fdec" }, - "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "155eac5d8609a2f110041f8ac3491664cc126354" }, - "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, - "nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" }, - "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, - "nvim-dap": { "branch": "master", "commit": "48570d8372f63c9e9ba399a16606f9553034a9b2" }, + "kanagawa.nvim": { "branch": "master", "commit": "aef7f5cec0a40dbe7f3304214850c472e2264b10" }, + "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, + "live-preview.nvim": { "branch": "main", "commit": "a1bb1b3a851df5276e53908276f5ae1d724d4812" }, + "lualine.nvim": { "branch": "master", "commit": "3946f0122255bc377d14a59b27b609fb3ab25768" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "b1d9a914b02ba5660f1e272a03314b31d4576fe2" }, + "mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-autopairs": { "branch": "master", "commit": "7a2c97cccd60abc559344042fefb1d5a85b3e33b" }, + "nvim-cmp": { "branch": "main", "commit": "106c4bcc053a5da783bf4a9d907b6f22485c2ea0" }, + "nvim-dap": { "branch": "master", "commit": "b38f7d30366d9169d0a623c4c85fbcf99d8d58bb" }, "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, - "nvim-lint": { "branch": "master", "commit": "335a6044be16d7701001059cba9baa36fbeef422" }, - "nvim-lspconfig": { "branch": "master", "commit": "db8fef885009fdec0daeff3e5dda92e1f539611e" }, + "nvim-lint": { "branch": "master", "commit": "2536f1b18ea389e6b078b3a47a5e273c74a46a34" }, + "nvim-lspconfig": { "branch": "master", "commit": "cc3d02065593d74b2fa7c0ff337c3e8b087fd788" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, - "nvim-tree.lua": { "branch": "master", "commit": "87d096a39cb2d5d43e6771563575ff042a79f48b" }, + "nvim-tree.lua": { "branch": "master", "commit": "1eda2569394f866360e61f590f1796877388cb8a" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" }, - "onedark.nvim": { "branch": "master", "commit": "de495fabe171d48aed5525f002d14414efcecbb2" }, + "nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" }, + "onedark.nvim": { "branch": "master", "commit": "6c10964f91321c6a0f09bcc41dd64e7a6602bc4f" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "tabular": { "branch": "master", "commit": "12437cd1b53488e24936ec4b091c9324cafee311" }, "telescope-themes": { "branch": "main", "commit": "65721365bd7a04a6c9679e76b6387b60320fd5f3" }, - "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, - "tokyonight.nvim": { "branch": "main", "commit": "4d159616aee17796c2c94d2f5f87d2ee1a3f67c7" }, - "vim-markdown": { "branch": "master", "commit": "8f6cb3a6ca4e3b6bcda0730145a0b700f3481b51" }, - "which-key.nvim": { "branch": "main", "commit": "904308e6885bbb7b60714c80ab3daf0c071c1492" } + "telescope.nvim": { "branch": "master", "commit": "3a12a853ebf21ec1cce9a92290e3013f8ae75f02" }, + "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" }, + "vim-markdown": { "branch": "master", "commit": "1bc9d0cd8e1cc3e901b0a49c2b50a843f1c89397" }, + "vimtex": { "branch": "master", "commit": "32bcb3922c20588e00de68f73c86312eda2141ad" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } } diff --git a/nvim/lua/sam/options.lua b/nvim/lua/sam/options.lua index da6b872..ca2e337 100644 --- a/nvim/lua/sam/options.lua +++ b/nvim/lua/sam/options.lua @@ -6,6 +6,28 @@ vim.g.maplocalleader = " " -- Set the local leader key to the space bar. vim.opt.number = true -- Absolute numbers on all lines vim.opt.relativenumber = true -- Relative numbers (hybrid when both enabled) +-- =================================================================== +-- Clipboard Settings (Added) +-- =================================================================== + +-- Sync with system clipboard +vim.opt.clipboard = "unnamedplus" + +-- OSC 52 Support for SSH (Copy from Remote Nvim -> Local Computer) +if vim.env.SSH_TTY then + vim.g.clipboard = { + name = 'OSC 52', + copy = { + ['+'] = require('vim.ui.clipboard.osc52').copy('+'), + ['*'] = require('vim.ui.clipboard.osc52').copy('*'), + }, + paste = { + ['+'] = require('vim.ui.clipboard.osc52').paste('+'), + ['*'] = require('vim.ui.clipboard.osc52').paste('*'), + }, + } +end + -- =================================================================== -- Search Settings -- =================================================================== @@ -15,8 +37,6 @@ vim.opt.incsearch = true -- Show search results incrementally as you type vim.opt.ignorecase = true -- Ignore case in search patterns vim.opt.smartcase = true -- Override ignorecase if search pattern contains uppercase letters - - -- =================================================================== -- Essential Keybindings -- =================================================================== @@ -33,7 +53,15 @@ local keymap = function(mode, lhs, rhs, opts) vim.api.nvim_set_keymap(mode, lhs, rhs, options) end --- --- General --V- +vim.api.nvim_create_autocmd("BufWritePost", { + group = vim.api.nvim_create_augroup("VimtexCompile", { clear = true }), + pattern = "*.tex", + callback = function() + vim.cmd("VimtexCompile") + end, +}) + +-- --- General --- -- Save the current file keymap("n", "w", ":w", { desc = "Write (Save) File" }) @@ -62,4 +90,3 @@ keymap("n", "", ":bnext", { desc = "Next Buffer" }) keymap("n", "", ":bprevious", { desc = "Previous Buffer" }) vim.keymap.set({'n', 'i', 'v'}, '', '', { desc = 'Enter Visual Block' }) vim.keymap.set({'n', 'i'}, '', 'V', { desc = 'Enter Visual Line' }) - diff --git a/nvim/lua/sam/plugins/avante.lua b/nvim/lua/sam/plugins/avante.lua new file mode 100644 index 0000000..05bbdd3 --- /dev/null +++ b/nvim/lua/sam/plugins/avante.lua @@ -0,0 +1,70 @@ +return { + "yetone/avante.nvim", + dependencies = { + "nvim-treesitter/nvim-treesitter", + "nvim-lua/plenary.nvim", + "stevearc/dressing.nvim", + "MunifTanjim/nui.nvim", + "folke/which-key.nvim", -- For keymaps + }, + event = "VeryLazy", + config = function() + require("avante").setup({ + provider = "openai", + providers = { + openai = { + api_key_name = "OPENAI_API_KEY", + endpoint = "https://api.openai.com/v1", + model = "gpt-4o-mini", -- Your paid model + timeout = 30000, + extra_request_body = { + temperature = 0.1, + max_completion_tokens = 8192, + }, + }, + }, + behaviour = { + auto_suggestions = true, -- Inline completion + auto_set_highlight_group = true, -- Hints on hover + auto_apply_diff_after_generation = false, -- No auto-insert + }, + mappings = { + normal = { + ["gq"] = "AvanteAsk", + }, + insert = { + [""] = "AvanteToggleAutoSuggestions", + }, + visual = { + ["gq"] = "AvanteAsk", + }, + }, + hints = { enabled = true }, + }) + + -- Your keymap style + local keymap = function(mode, lhs, rhs, opts) + local options = { noremap = true, silent = true } + if opts then options = vim.tbl_extend("force", options, opts) end + vim.api.nvim_set_keymap(mode, lhs, rhs, options) + end + + keymap("n", "ai", ":AvanteAsk", { desc = "Avante Chat" }) + keymap("v", "ae", ":AvanteAsk explain simply", { desc = "Explain Selected" }) + keymap("v", "af", ":AvanteAsk fix: optimize", { desc = "Fix Selected" }) + keymap("i", "", "AvanteToggleAutoSuggestions", { desc = "Toggle Inline" }) + + -- Which-key + vim.schedule(function() + local status_ok, wk = pcall(require, "which-key") + if status_ok then + wk.add({ + { "a", group = "AI (Avante)" }, + { "ai", "AvanteAsk", desc = "Open Chat", mode = "n" }, + { "ae", desc = "Explain Selected", mode = "v" }, + { "af", desc = "Fix Selected", mode = "v" }, + }) + end + end) + end, +} diff --git a/nvim/lua/sam/plugins/vimtex.lua b/nvim/lua/sam/plugins/vimtex.lua new file mode 100644 index 0000000..dc71737 --- /dev/null +++ b/nvim/lua/sam/plugins/vimtex.lua @@ -0,0 +1,15 @@ +-- In your plugins configuration file +return { + -- ... other plugins + + { + "lervag/vimtex", + lazy = false, -- Or ft = "tex" to load it only for tex files + config = function() + -- Use Zathura as the PDF viewer + vim.g.vimtex_view_method = "zathura" + end, + }, + + -- ... other plugins +}