feats: nvim, emacs, shell

* nvim: Add copilot completions
* nvim: grug-far buffer won't show lualine & winbar now
* nvim: remove obsidian.nvim
* nvim: luasnip now works
* emacs: more keymaps in org-mode
* emacs: start customizing leader keys
* shell: Add more ls aliases
* shell: Add apt alias in fish
This commit is contained in:
js0ny 2025-02-10 22:37:58 +00:00
parent da0cc1d6e8
commit a506ee28ad
14 changed files with 120 additions and 31 deletions

4
.gitignore vendored
View file

@ -34,4 +34,8 @@ common/fzfrc
gitconfig
# Lock files
lazy-lock.json
# Emacs
*.elc

View file

@ -16,3 +16,8 @@
:nvom "C-w e" 'evil-window-up
:nvom "C-w i" 'evil-window-right
)
;; Swap ; and :
(map! :leader
";" #'execute-extended-command
":" #'pp-eval-expression)

View file

@ -105,7 +105,7 @@
;;prodigy ; FIXME managing external services & code builders
;;terraform ; infrastructure as code
;;tmux ; an API for interacting with tmux
;;tree-sitter ; syntax and parsing, sitting in a tree...
tree-sitter ; syntax and parsing, sitting in a tree...
;;upload ; map local to remote projects via ssh/ftp
:os
@ -148,7 +148,7 @@
latex ; writing papers in Emacs has never been so fun
;;lean ; for folks with too much to prove
;;ledger ; be audit you can be
;;lua ; one-based indices? one-based indices
lua ; one-based indices? one-based indices
markdown ; writing docs for people to ignore
;;nim ; python + lisp at the speed of c
;;nix ; I hereby declare "nix geht mehr!"

View file

@ -33,7 +33,9 @@
"C-c i" (lambda () (interactive) (my/insert-emphasis-with-zws ?/))
"C-c u" (lambda () (interactive) (my/insert-emphasis-with-zws ?_))
:nvom "N" 'org-next-visible-heading
:nvom "E" 'org-previous-visible-heading)
:nvom "E" 'org-previous-visible-heading
:nvom "M-n" 'org-metadown
:nvom "M-e" 'org-metaup)
(setq org-capture-templates
'(("t" "Task" entry (file+headline "~/OrgFiles/tasks/inbox.org" "Tasks")

View file

@ -22,11 +22,15 @@ alias sn="sudo nvim -u ~/.config/nvim/init.lua"
abbr --add py python3
abbr --add ipy ipython
abbr --add g lazygit
# lsd - modern ls
if command -v lsd > /dev/null
alias ls='lsd -A'
alias ls='lsd'
abbr --add l 'lsd -lah'
abbr --add ll 'lsd -l'
abbr --add la 'lsd -A'
abbr --add l. 'lsd -d .*'
abbr --add tree 'ls --tree'
else
abbr --add l 'ls -lah'
@ -53,6 +57,10 @@ function mt
mkdir -p (dirname $argv[1]) && touch $argv[1]
end
function mtv
mkdir -p (dirname $argv[1]) && touch $argv[1] && nvim $argv[1]
end
# Use neovide as gVim
abbr --add gvi "neovide"
@ -61,6 +69,7 @@ if command -v brew > /dev/null
abbr --add brewu "brew upgrade && brew update"
abbr --add brewr "brew remove"
abbr --add brewc "brew cleanup"
abbr --add brewl "brew list"
end
if command -v pacman > /dev/null
@ -68,6 +77,7 @@ if command -v pacman > /dev/null
abbr --add paci "sudo pacman -S"
abbr --add pacr "sudo pacman -R"
abbr --add pacu "sudo pacman -Syu"
abbr --add pacl "pacman -Q"
if command -v paru > /dev/null
abbr --add pacs "paru -Ss"
else if command -v yay > /dev/null
@ -77,6 +87,15 @@ if command -v pacman > /dev/null
end
end
if command -v apt > /dev/null
abbr --add apt "sudo apt"
abbr --add apti "sudo apt install"
abbr --add aptr "sudo apt remove"
abbr --add aptu "sudo apt update && sudo apt upgrade"
abbr --add apts "apt search"
abbr --add aptl "apt list --installed"
end
if test "$TERM" = "xterm-ghostty" -o "$TERM" = "xterm-kitty"
abbr --add icat "kitten icat"
else if test "$TERM_PROGRAM" = "WezTerm"

View file

@ -43,6 +43,7 @@ local M = {
Event = "",
Operator = "󰆕",
TypeParameter = "󰅲",
Copilot = "",
},
}

View file

@ -0,0 +1,13 @@
--- `map` default for `cmp.mapping`
local map = function(map)
return {
{ keys = "<C-n>", cmd = map.select_next_item(), opts = { desc = "Select next completion item" } },
{ keys = "<C-p>", cmd = map.select_prev_item(), opts = { desc = "Select previous completion item" } },
{ keys = "<C-f>", cmd = map.confirm({ select = true }), opts = { desc = "Confirm completion" } },
{ keys = "<Tab>", cmd = map.confirm({ select = true }), opts = { desc = "Confirm completion" } },
{ keys = "<C-Space>", cmd = map.complete(), opts = { desc = "Trigger completion" } },
{ keys = "<C-b>", cmd = map.abort(), opts = { desc = "Abort completion" } },
}
end
return map

View file

@ -20,17 +20,7 @@ utils.set_keymaps(keymaps_modifier)
M.nvim_tree_keymaps = require("keymaps.nvim-tree").plugin
--- `map` default for `cmp.mapping`
function M.cmp_nvim_keymaps(map)
return {
{ keys = "<C-n>", cmd = map.select_next_item(), opts = { desc = "Select next completion item" } },
{ keys = "<C-p>", cmd = map.select_prev_item(), opts = { desc = "Select previous completion item" } },
{ keys = "<C-y>", cmd = map.confirm({ select = true }), opts = { desc = "Confirm completion" } },
{ keys = "<Tab>", cmd = map.confirm({ select = true }), opts = { desc = "Confirm completion" } },
{ keys = "<C-Space>", cmd = map.complete(), opts = { desc = "Trigger completion" } },
{ keys = "<C-e>", cmd = map.abort(), opts = { desc = "Abort completion" } },
}
end
M.cmp_nvim_keymaps = require("keymaps.cmp_map")
-- local function set_markdown_keymaps(bufnr)
-- local opts = { noremap = true, silent = true, buffer = bufnr }

View file

@ -1,8 +1,24 @@
return {
{ import = "plugins.mod.nvim-cmp" },
{
"saadparwaiz1/cmp_luasnip"
},
{
"L3MON4D3/LuaSnip",
build = "make install_jsregexp",
config = function()
require("luasnip.loaders.from_vscode").load_standalone(
{
path = "~/.config/zed/snippets/c.json" }
)
end,
-- TODO: Remove this, simply delete this will let nvim-cmp not work
dependencies = { "rafamadriz/friendly-snippets" },
},
{ "rafamadriz/friendly-snippets" },
{
"zbirenbaum/copilot-cmp",
config = function()
require("copilot_cmp").setup()
end,
},
}

View file

@ -1,15 +1,37 @@
return {
{ "wakatime/vim-wakatime", lazy = false },
{ "voldikss/vim-floaterm" },
{ "CRAG666/betterTerm.nvim", opts = {
{
"CRAG666/betterTerm.nvim",
opts = {
position = "bot",
size = 15,
} },
}
},
{ "CRAG666/code_runner.nvim", config = true },
{ import = "plugins.mod.obsidian-nvim" },
-- { import = "plugins.mod.obsidian-nvim" },
{ import = "plugins.mod.which-keys-nvim" },
{
"github/copilot.vim",
lazy = false,
"zbirenbaum/copilot.lua",
cmd = "Copilot",
build = ":Copilot auth",
event = "BufReadPost",
opts = {
suggestion = {
enabled = not vim.g.ai_cmp,
auto_trigger = true,
hide_during_completion = vim.g.ai_cmp,
keymap = {
accept = "<M-f>",
next = "<M-]>",
prev = "<M-[>",
},
},
panel = { enabled = false },
filetypes = {
markdown = true,
help = true,
},
},
},
}

View file

@ -14,7 +14,7 @@ Remote | Git Branch | Diagnostics | Command | | MID | | Line:Column | Indent | E
local config = {
options = {
disabled_filetypes = {
statusline = { "NvimTree", "alpha" },
statusline = { "NvimTree", "alpha", "grug-far" },
},
-- Disable sections and component separators
component_separators = { left = "", right = "" },

View file

@ -47,9 +47,9 @@ return {
},
mapping = cmp.mapping.preset.insert(mapped),
sources = cmp.config.sources({
{ name = "copilot", priority = 10 },
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "copilot" },
{ name = "lazydev", group_index = 0 },
}, {
{ name = "buffer" },

View file

@ -33,6 +33,7 @@ return {
"qf",
"floaterm",
"orgagenda",
"grug-far"
},
})
end,

View file

@ -25,14 +25,16 @@ alias python=python3 # Set the default Python version to Python 3
alias py=python
alias ipy=ipython
alias reload="source $ZDOTDIR/.zshrc"
alias g=lazygit
# lsd - modern ls
if command -v lsd > /dev/null; then
alias ls='lsd -A'
alias ls='lsd'
alias l='lsd -lah'
alias ll='lsd -l'
alias la='lsd -A'
alias l.='lsd -d .*'
alias tree='lsd --tree -A'
else
alias l='ls -lah'
@ -56,6 +58,9 @@ tv(){
mt(){
mkdir -p $(dirname $1) && touch $1
}
mtv(){
mkdir -p $(dirname $1) && touch $1 && nvim $1
}
alias update="source $DOTFILES/scripts/update.zsh"
@ -65,20 +70,31 @@ if command -v pacman > /dev/null; then
alias paci="sudo pacman -S"
alias pacr="sudo pacman -R"
alias pacu="sudo pacman -Syu"
alias pacl="pacman -Q"
if command -v paru > /dev/null; then
alias pacs="paru -Ss"
elif command -v yay > /dev/null; then
alias pacs="yay -Ss"
else
alias pacs="pacman -Ss"
fi
fi
if command -v apt > /dev/null; then
alias apt="sudo apt"
alias apti="sudo apt install"
alias aptu="sudo apt update && sudo apt upgrade"
alias aptr="sudo apt remove"
alias aptu="sudo apt update && sudo apt upgrade"
alias apts="apt search"
alias aptl="apt list --installed"
fi
if command -v brew > /dev/null; then
alias brewi="brew install"
alias brewu="brew update && brew upgrade"
alias brewc="brew cleanup"
alias brewr="brew uninstall"
alias brewu="brew update && brew upgrade"
alias brews="brew search"
alias brewl="brew list"
fi