diff --git a/chatgpt.sh b/chatgpt.sh index 70b8a5b..7794be2 100755 --- a/chatgpt.sh +++ b/chatgpt.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash - set -e set -o pipefail @@ -7,12 +6,15 @@ set -o pipefail # API_HOST=api.anthropic.com # API_HOST=api.deepseek.com # API_HOST=api.gptsapi.net -API_HOST=api.xiaoai.plus -# API_KEY=$(cat $HOME/.config/DEEPSEEK_KEY) -# API_KEY=$(cat $HOME/.config/WILDCARD_KEY) -API_KEY=$(cat /home/chengke/.config/XIAOAI_KEY) -TMP_FILE=/tmp/chatgpt-input.txt +# API_HOST=api.xiaoai.plus +API_HOST=api.lingyiwanwu.com +API_KEY=$(cat $HOME/.llmkeys/YI_KEY) + +# MODEL="deepseek-coder" +# MODEL="gpt-4o-mini" +MODEL="yi-lightning" +TMP_FILE=/tmp/chatgpt-input.txt PROMPT_SYSTEM="You are a large language model. Answer as concisely as possible." PROMPT_COMMAND_GENERATION="You are a Command Line Interface expert and your task is to provide functioning shell commands. Return a CLI command and nothing @@ -32,8 +34,6 @@ submission to a top-tier computer science conference. Make the content accessible to most people, use plain word and make it easy to understand. Try to avoid using fancy words. Strengthen the logic and ensure it aligns with academic standards." -# MODEL="deepseek-coder" -MODEL="gpt-4o-mini" function print_help() { cat <gg', 'LspStart') --- In SumatraPDF, --- nvr -c "OpenFileWindows %f %l" -function OpenFileWindows(filename, line) - -- Convert Windows path to WSL path - local wsl_path = filename:gsub("\\", "/"):gsub("^([A-Za-z]):", "/mnt/%1"):lower() - -- Open the file using the WSL path - vim.cmd('e ' .. vim.fn.fnameescape(wsl_path)) - -- Move to the specified line - vim.api.nvim_win_set_cursor(0, { tonumber(line), 0 }) +-- For tex backward jump from SumatraPDF +if vim.fn.has('win32') == 1 then + -- nvr -c "OpenFileWindows %f %l" + function OpenFileWindows(filename, line) + -- Convert Windows path to WSL path + local wsl_path = filename:gsub("\\", "/"):gsub("^([A-Za-z]):", "/mnt/%1"):lower() + -- Open the file using the WSL path + vim.cmd('e ' .. vim.fn.fnameescape(wsl_path)) + -- Move to the specified line + vim.api.nvim_win_set_cursor(0, { tonumber(line), 0 }) + end + + vim.cmd('command! -nargs=+ OpenFileWindows lua OpenFileWindows()') end - -vim.cmd('command! -nargs=+ OpenFileWindows lua OpenFileWindows()') diff --git a/stow-dotfiles/nvim/.config/nvim/lazy-lock.json b/stow-dotfiles/nvim/.config/nvim/lazy-lock.json index 8a2c7e3..b96bf97 100644 --- a/stow-dotfiles/nvim/.config/nvim/lazy-lock.json +++ b/stow-dotfiles/nvim/.config/nvim/lazy-lock.json @@ -1,31 +1,31 @@ { - "avante.nvim": { "branch": "main", "commit": "2a72dfa711386a241f7675eb0acc6e838f4fa344" }, + "avante.nvim": { "branch": "main", "commit": "2863473bbf575bd7ae3836ed385602515e0fab12" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "codeium.nvim": { "branch": "main", "commit": "ed65f0a5262c746b2d69a7ae67af7c1da89f94ab" }, - "dressing.nvim": { "branch": "master", "commit": "1b7921eecc65af1baf8ac1dc06f0794934cbcfb2" }, - "fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" }, - "gitsigns.nvim": { "branch": "main", "commit": "863903631e676b33e8be2acb17512fdc1b80b4fb" }, + "codeium.nvim": { "branch": "main", "commit": "dddaee0d1e9a1d0bcaea66f08a8103b3cdf26604" }, + "dressing.nvim": { "branch": "master", "commit": "fc78a3ca96f4db9f8893bb7e2fd9823e0780451b" }, + "fidget.nvim": { "branch": "main", "commit": "e2a175c2abe2d4f65357da1c98c59a5cfb2b543f" }, + "gitsigns.nvim": { "branch": "main", "commit": "ac5aba6dce8c06ea22bea2c9016f51a2dbf90dc7" }, "gruvbox": { "branch": "master", "commit": "f1ecde848f0cdba877acb0c740320568252cc482" }, "guess-indent.nvim": { "branch": "main", "commit": "6cd61f7a600bb756e558627cd2e740302c58e32d" }, - "lazy.nvim": { "branch": "main", "commit": "1159bdccd8910a0fd0914b24d6c3d186689023d9" }, - "lspkind.nvim": { "branch": "master", "commit": "59c3f419af48a2ffb2320cea85e44e5a95f71664" }, + "lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" }, + "lspkind.nvim": { "branch": "master", "commit": "a700f1436d4a938b1a1a93c9962dc796afbaef4d" }, "marks.nvim": { "branch": "master", "commit": "bb25ae3f65f504379e3d08c8a02560b76eaf91e8" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-bqf": { "branch": "main", "commit": "1b24dc6050c34e8cd377b6b4cd6abe40509e0187" }, - "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, - "nvim-lspconfig": { "branch": "master", "commit": "04680101ff79e99b4e33a4386ec27cbd0d360c75" }, + "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, + "nvim-lspconfig": { "branch": "master", "commit": "f012c1b176f0e3c71f40eb309bdec0316689462e" }, "nvim-osc52": { "branch": "main", "commit": "04cfaba1865ae5c53b6f887c3ca7304973824fb2" }, - "nvim-treesitter": { "branch": "master", "commit": "45e0d66246f31306d890b91301993fa1623e79f1" }, - "nvim-treesitter-context": { "branch": "master", "commit": "78a81c7494e7d1a08dd1200b556933e513fd9f29" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "b91c98afa6c42819aea6cbc1ba38272f5456a5cf" }, - "nvim-web-devicons": { "branch": "master", "commit": "56f17def81478e406e3a8ec4aa727558e79786f3" }, + "nvim-treesitter": { "branch": "master", "commit": "c50981479e4271ec87c5a15ec991472bdec4f1b8" }, + "nvim-treesitter-context": { "branch": "master", "commit": "1147c42cf9477701581d1eb31e1735969e21dd06" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "3e450cd85243da99dc23ebbf14f9c70e9a0c26a4" }, + "nvim-web-devicons": { "branch": "master", "commit": "e87554285f581047b1bf236794b0eb812b444b87" }, "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "tcomment_vim": { "branch": "master", "commit": "48ab639a461d9b8344f7fee06cb69b4374863b13" }, "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, - "which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" } + "which-key.nvim": { "branch": "main", "commit": "68e37e12913a66b60073906f5d3f14dee0de19f2" } } diff --git a/stow-dotfiles/nvim/.config/nvim/lua/plugins/copilot.lua b/stow-dotfiles/nvim/.config/nvim/lua/plugins/copilot.lua index b4fa96a..c375498 100644 --- a/stow-dotfiles/nvim/.config/nvim/lua/plugins/copilot.lua +++ b/stow-dotfiles/nvim/.config/nvim/lua/plugins/copilot.lua @@ -8,55 +8,22 @@ return { "stevearc/dressing.nvim", "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim", - -- The below is optional, make sure to setup it properly if you have lazy=true - -- { - -- 'MeanderingProgrammer/render-markdown.nvim', - -- opts = { - -- file_types = { "markdown", "Avante" }, - -- }, - -- ft = { "markdown", "Avante" }, - -- } }, config = function() - local openai_key_file = vim.fn.expand("$HOME/.config/XIAOAI_KEY") - if vim.fn.filereadable(openai_key_file) == 1 then - vim.env.OPENAI_API_KEY = vim.fn.readfile(openai_key_file)[1] or nil - end - - vim.api.nvim_set_hl(0, 'AvanteDiffText', { bg = "#280000" }) - vim.api.nvim_set_hl(0, 'AvanteDiffAdd', { bg = "#002800" }) + local openai_key_file = vim.fn.expand("$HOME/.llmkeys/YI_KEY") require 'avante'.setup { provider = "openai", openai = { - endpoint = "https://api.xiaoai.plus/v1", - model = "claude-3-5-sonnet-20240620", + -- endpoint = "https://api.xiaoai.plus/v1", + endpoint = "https://api.lingyiwanwu.com/v1", + -- model = "claude-3-5-sonnet-20241022", -- model = "gpt-4o-2024-08-06", + model = "yi-lightning", + api_key_name = "cmd:cat " .. openai_key_file, temperature = 0, max_tokens = 4096, }, - mappings = { - ask = "aa", - edit = "ae", - refresh = "ar", - --- @class AvanteConflictMappings - diff = { - ours = "co", - theirs = "ct", - none = "c0", - both = "cb", - next = "]x", - prev = "[x", - }, - jump = { - next = "]]", - prev = "[[", - }, - toggle = { - debug = "ad", - hint = "ah", - }, - }, hints = { enabled = false }, windows = { wrap = true, -- similar to vim.o.wrap @@ -67,18 +34,11 @@ return { rounded = false, }, }, - highlights = { - diff = { - current = "AvanteDiffText", - incoming = "AvanteDiffAdd", - }, - }, - --- @class AvanteConflictUserConfig - diff = { - autojump = true, - ---@type string | fun(): any - list_opener = "copen", - }, } + + -- vim.api.nvim_set_hl(0, 'AvanteDiffAdd', { bg = "#002800" }) + -- vim.api.nvim_set_hl(0, 'AvanteDiffText', { bg = "#280000" }) + -- vim.api.nvim_set_hl(0, 'AvanteConflictIncoming', { bg = "#400000" }) + -- vim.api.nvim_set_hl(0, 'AvanteConflictCurrent', { bg = "#280000" }) end } diff --git a/stow-dotfiles/nvim/.config/nvim/lua/plugins/whichkey.lua b/stow-dotfiles/nvim/.config/nvim/lua/plugins/whichkey.lua index d705c18..c2bd1b8 100644 --- a/stow-dotfiles/nvim/.config/nvim/lua/plugins/whichkey.lua +++ b/stow-dotfiles/nvim/.config/nvim/lua/plugins/whichkey.lua @@ -19,7 +19,7 @@ return { -- Additional vim.wo and vim.bo options bo = {}, wo = { - winblend = 10, -- value between 0-100 0 for fully opaque and 100 for fully transparent + -- winblend = 10, -- value between 0-100 0 for fully opaque and 100 for fully transparent }, }, }, diff --git a/stow-dotfiles/tmux/.tmux.conf b/stow-dotfiles/tmux/.tmux.conf index e9ed5c8..3afed36 100644 --- a/stow-dotfiles/tmux/.tmux.conf +++ b/stow-dotfiles/tmux/.tmux.conf @@ -86,8 +86,8 @@ set -g display-time 1000 # don't suspend-client unbind C-z -# increase scrollback lines -set -g history-limit 1000000 +# increase scrollback lines (default is 2000) +set -g history-limit 10000 # save the history to a file bind-key P command-prompt -p 'save history to filename:' -I '~/tmux.history' 'capture-pane -S -1000000 ; save-buffer %1 ; delete-buffer'