Skip to content

Commit

Permalink
add: nvim chatgpt and indent
Browse files Browse the repository at this point in the history
  • Loading branch information
wongsingfo committed Dec 21, 2023
1 parent 7512085 commit 31e2f7a
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ docker run -it -v $(pwd):/work --name box wongsingfo/dotfiles
docker run -it \
-v $(pwd):/work -v $HOME/.ssh:/home/ubuntu/.ssh \
-v $HOME/.cache/nvim/codeium/config.json:/home/ubuntu/.cache/nvim/codeium/config.json \
-v $HOME/.config/OPENAI_API_KEY:/home/ubuntu/.config/OPENAI_API_KEY \
--name box wongsingfo/dotfiles
# Allow gdb to disable the ASLR
Expand Down
2 changes: 2 additions & 0 deletions stow-dotfiles/nvim/.config/nvim/lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
"fidget.nvim": { "branch": "main", "commit": "90c22e47be057562ee9566bad313ad42d622c1d3" },
"git-blame.nvim": { "branch": "master", "commit": "1792125237260dc2a03ba57d31c39179e6049f07" },
"gitsigns.nvim": { "branch": "main", "commit": "5d73da785a3c05fd63ac31769079db05169a6ec7" },
"gp.nvim": { "branch": "main", "commit": "acccba7f7b80f0ada540a75332bb598d47392371" },
"gruvbox": { "branch": "master", "commit": "bf2885a95efdad7bd5e4794dd0213917770d79b7" },
"guard-collection": { "branch": "main", "commit": "41d4e036e350c44316c00eeaa651bb00ac24916f" },
"guard.nvim": { "branch": "main", "commit": "71a5e4861fc65dd6298bdb6e6d3027e81c134708" },
"indent-blankline.nvim": { "branch": "master", "commit": "258b5d899da7c681ce0e0225de32c593f3914c27" },
"lazy.nvim": { "branch": "main", "commit": "16603c6917435d8446f7357cb61095138a417085" },
"lsp_signature.nvim": { "branch": "master", "commit": "58d4e810801da74c29313da86075d6aea537501f" },
"lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
Expand Down
2 changes: 1 addition & 1 deletion stow-dotfiles/nvim/.config/nvim/lua/core/init.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require("core.plugins")
require("core.preference")
require("core.plugins")
require("core.keybindings")

19 changes: 19 additions & 0 deletions stow-dotfiles/nvim/.config/nvim/lua/core/keybindings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,22 @@ function toggle_textmode()
vim.wo.spell = enabled
vim.wo.linebreak = enabled
end

local function keymapOptions(desc)
return {
noremap = true,
silent = true,
nowait = true,
desc = "GPT prompt " .. desc,
}
end
vim.keymap.set({"n", "i"}, "<C-g>c", "<cmd>GpChatNew<cr>", keymapOptions("New Chat"))
vim.keymap.set({"n", "i"}, "<C-g>f", "<cmd>GpChatFinder<cr>", keymapOptions("Chat Finder"))
vim.keymap.set({"n", "i"}, "<C-g>t", "<cmd>GpChatToggle<cr>", keymapOptions("Toggle Chat"))
vim.keymap.set({"n", "i"}, "<C-g>r", "<cmd>GpRewrite<cr>", keymapOptions("Inline Rewrite"))
vim.keymap.set({"n", "i"}, "<C-g>a", "<cmd>GpAppend<cr>", keymapOptions("Append (after)"))
vim.keymap.set({"n", "i"}, "<C-g>b", "<cmd>GpPrepend<cr>", keymapOptions("Prepend (before)"))
vim.keymap.set("v", "<C-g>r", ":<C-u>'<,'>GpRewrite<cr>", keymapOptions("Visual Rewrite"))
vim.keymap.set("v", "<C-g>a", ":<C-u>'<,'>GpAppend<cr>", keymapOptions("Visual Append (after)"))
vim.keymap.set("v", "<C-g>b", ":<C-u>'<,'>GpPrepend<cr>", keymapOptions("Visual Prepend (before)"))
vim.keymap.set("v", "<C-g>i", ":<C-u>'<,'>GpImplement<cr>", keymapOptions("Implement selection"))
27 changes: 27 additions & 0 deletions stow-dotfiles/nvim/.config/nvim/lua/core/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,21 @@ require('lazy').setup({
opts = {},
},
{ "kevinhwang91/rnvimr" },
{
"lukas-reineke/indent-blankline.nvim",
config = function()
vim.opt.list = true
vim.opt.listchars = {
trail = '',
tab = '',
extends = '»',
precedes = '«',
nbsp = '',
}
require("ibl").setup {
}
end
},

-- Completion
{
Expand Down Expand Up @@ -140,6 +155,18 @@ require('lazy').setup({
}
end
},
{
"robitx/gp.nvim",
config = function()
local home = os.getenv("HOME")
local inDockerContainer = os.getenv("USER") == "ubuntu"
local proxy = inDockerContainer and "http://172.17.0.1:7890" or "http://127.0.0.1:7890"
require("gp").setup {
openai_api_key = { "cat", home.."/.config/OPENAI_API_KEY" },
curl_params = {"--proxy", proxy}
}
end
},
{
"zbirenbaum/copilot.lua",
enabled = false,
Expand Down
5 changes: 0 additions & 5 deletions stow-dotfiles/nvim/.config/nvim/lua/core/preference.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,3 @@ vim.cmd([[
syntax enable
" set colorcolumn=80
]])

vim.cmd([[
set listchars=tab:»\ ,trail:•,nbsp:␣,extends:»,precedes:«
set list
]])

0 comments on commit 31e2f7a

Please sign in to comment.