Skip to content

Commit

Permalink
fix: zoxide zsh bug and using gemini for avante
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham-cpp committed Nov 18, 2024
1 parent 60a9341 commit 0292217
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 81 deletions.
4 changes: 2 additions & 2 deletions .config/X11/profile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export PATH
export EDITOR=nvim
export VISUAL=nvim

export TERMINAL=/usr/bin/alacritty
export TERMINAL=alacritty
export FILE_BROWSER=thunar
export BROWSER=zen-browser
export BROWSER=brave
export READER=zathura

if [ $DESKTOP_SESSION != "plasma" ]; then
Expand Down
1 change: 0 additions & 1 deletion .config/fish/conf.d/rustup.fish

This file was deleted.

4 changes: 4 additions & 0 deletions .config/fish/config.fish
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ bind -M insert \b backward-kill-word
bind -M insert \cl 'history merge; commandline -f clear-screen'
bind -M visual \cl 'history merge; commandline -f clear-screen'
complete -c dnf5 -w dnf

# bun
set --export BUN_INSTALL "$HOME/.local/share/bun"
set --export PATH $BUN_INSTALL/bin $PATH
7 changes: 6 additions & 1 deletion .config/hypr/autostart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ waybar &
swaync &
nm-applet &
swaybg --image ~/.config/wall.png --mode stretch &
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &
if test -f /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1; then
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &
fi
if test -f /usr/lib/polkit-kde-authentication-agent-1; then
/usr/lib/polkit-kde-authentication-agent-1 &
fi
systemctl --user reload-or-restart xdg-desktop-portal.service xdg-desktop-portal-hyprland.service &
hyprshade auto &
3 changes: 3 additions & 0 deletions .config/nvim-vscode/after/plugin/theme.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ if vim.g.vscode == nil then
})
vim.cmd.colorscheme "tokyodark"
end
if vim.fn.isdirectory(vim.fn.stdpath('data') .. '/plugged/mono-jade') == 1 then
vim.cmd("colo mono-jade")
end
end
2 changes: 1 addition & 1 deletion .config/nvim-vscode/init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Plug 'folke/flash.nvim'
Plug 'monaqa/dial.nvim'
Plug 'tpope/vim-abolish'
if !exists('g:vscode')
Plug 'tiagovla/tokyodark.nvim'
Plug 'masar3141/mono-jade'
Plug 'windwp/nvim-autopairs'
endif

Expand Down
109 changes: 43 additions & 66 deletions .config/nvim/lua/plugins/avante.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,77 +3,54 @@ return {
'yetone/avante.nvim',
event = 'VeryLazy',
version = false, -- set this if you want to always pull the latest change
-- keys = function(_, keys)
-- ---@type avante.Config
-- local opts =
-- require('lazy.core.plugin').values(require('lazy.core.config').spec.plugins['avante.nvim'], 'opts', false)
--
-- local mappings = {
-- {
-- opts.mappings.ask,
-- function()
-- require('avante.api').ask()
-- end,
-- desc = 'avante: ask',
-- mode = { 'n', 'v' },
-- },
-- {
-- opts.mappings.refresh,
-- function()
-- require('avante.api').refresh()
-- end,
-- desc = 'avante: refresh',
-- mode = 'v',
-- },
-- {
-- opts.mappings.edit,
-- function()
-- require('avante.api').edit()
-- end,
-- desc = 'avante: edit',
-- mode = { 'n', 'v' },
-- },
-- }
-- mappings = vim.tbl_filter(function(m)
-- return m[1] and #m[1] > 0
-- end, mappings)
-- return vim.list_extend(mappings, keys)
-- end,
opts = {
-- add any opts here
---@alias Provider "claude" | "openai" | "azure" | "gemini" | "cohere" | "copilot" | string
provider = 'ollama',
vendors = {
---@type AvanteProvider
ollama = {
['local'] = true,
endpoint = '127.0.0.1:11434/v1',
model = 'llama3.2',
parse_curl_args = function(opts, code_opts)
return {
url = opts.endpoint .. '/chat/completions',
headers = {
['Accept'] = 'application/json',
['Content-Type'] = 'application/json',
},
body = {
model = opts.model,
messages = require('avante.providers').copilot.parse_message(code_opts), -- you can make your own message, but this is very advanced
max_tokens = 2048,
stream = true,
},
}
end,
parse_response_data = function(data_stream, event_state, opts)
require('avante.providers').openai.parse_response(data_stream, event_state, opts)
end,
opts = function()
local identity = vim.fn.expand '$HOME/.config/age/identity.txt'
local secret = vim.fn.expand '$HOME/.config/age/gemini_api.age'
vim.env.GEMINI_API_KEY = require('age').get(secret, identity) -- Get secret
local ollama_setup = {
-- add any opts here
---@alias Provider "claude" | "openai" | "azure" | "gemini" | "cohere" | "copilot" | string
provider = 'gemini',
vendors = {
---@type AvanteProvider
ollama = {
['local'] = true,
endpoint = '127.0.0.1:11434/v1',
model = 'llama3.2',
parse_curl_args = function(opts, code_opts)
return {
url = opts.endpoint .. '/chat/completions',
headers = {
['Accept'] = 'application/json',
['Content-Type'] = 'application/json',
},
body = {
model = opts.model,
messages = require('avante.providers').copilot.parse_message(code_opts), -- you can make your own message, but this is very advanced
max_tokens = 2048,
stream = true,
},
}
end,
parse_response_data = function(data_stream, event_state, opts)
require('avante.providers').openai.parse_response(data_stream, event_state, opts)
end,
},
},
},
},
}
if not vim.env.GEMINI_API_KEY then
return ollama_setup
end
return {
---@type "claude" | "openai" | "azure" | "gemini" | "cohere" | "copilot" | string
provider = 'gemini',
}
end,
-- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
build = 'make',
-- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
dependencies = {
'KingMichaelPark/age.nvim', -- Add age dependency
'nvim-treesitter/nvim-treesitter',
{
'stevearc/dressing.nvim',
Expand Down
4 changes: 2 additions & 2 deletions .config/nvim/lua/plugins/theme.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ return {
'catppuccin/nvim',
name = 'catppuccin',
event = 'VimEnter',
enabled = false,
enabled = true,
config = function()
require 'plugins.config.catppuccin'
end,
Expand Down Expand Up @@ -49,7 +49,7 @@ return {
},
{
'AlexvZyl/nordic.nvim',
enabled = true,
enabled = false,
event = 'VimEnter',
config = function()
require 'plugins.config.nordic'
Expand Down
12 changes: 4 additions & 8 deletions .config/zsh/.zshrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.config/zsh/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
# if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
# source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
# fi

# Set the directory we want to store zinit and plugins
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
# Download Zinit, if it's not there yet
Expand Down Expand Up @@ -45,7 +38,7 @@ zinit ice trigger-load!man wait'0' lucid; zinit snippet OMZP::colored-man-pages
zinit ice wait"2" as"command" from"gh-r" lucid \
mv"zoxide*/zoxide -> zoxide" \
atclone"./zoxide init zsh > zo_init.zsh" \
atpull"%atclone" src"zo_init.sh"
atpull"%atclone" src"zo_init.zsh"
zinit light ajeetdsouza/zoxide
# zinit ice wait"2" as"command" from"gh-r" lucid \
# atclone"./fnm env --use-on-cd > fnmenv.zsh" \
Expand Down Expand Up @@ -104,3 +97,6 @@ zinit snippet ~/Documents/dotfiles/.config/zsh/mfunctions.zsh

# Ensure unique path
typeset -gU cdpath fpath mailpath path

# bun completions
[ -s "/home/shubham/.local/share/bun/_bun" ] && source "/home/shubham/.local/share/bun/_bun"
3 changes: 3 additions & 0 deletions .config/zsh/bindings.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ bindkey -M viins '^J' autosuggest-accept
# bindkey -M vicmd "b" backward-word
# bindkey -M vicmd "w" forward-word

# C-x a to expand alias
bindkey "^Xa" _expand_alias

# Change cursor shape for different vi modes.
function zle-keymap-select {
if [[ ${KEYMAP} == vicmd ]] ||
Expand Down

0 comments on commit 0292217

Please sign in to comment.