Updated config

This commit is contained in:
Eduard Urbach 2024-02-01 23:59:16 +01:00
parent 973894cfab
commit 7face48c6f
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
8 changed files with 42 additions and 12 deletions

View File

@ -8,12 +8,18 @@ alias gs "git status"
alias home "git --git-dir=$HOME/.home/ --work-tree=$HOME"
# Go
alias gob "go build -v"
alias got "go test -v"
alias gb "go build -v"
alias gt "go test -v"
# Hyperfine
alias bench "hyperfine --shell=none"
# List
alias l "ls"
alias ll "ls -1"
alias lu "ls -l --total-size --sort=size --reverse --no-permissions --no-user --no-time"
alias lp "ls -l --no-filesize --no-time"
# Neovim
alias e "nvim"
alias n "nvim"
@ -23,6 +29,10 @@ alias p "pacman"
alias pi "sudo pacman -S"
alias pr "sudo pacman -Rs"
alias pu "sudo pacman -Syu"
alias pl "pacman -Q"
alias po "pacman -Qo"
alias pc "sudo pacman -Sc"
alias porphan "pacman -Qtdq"
# Tmux
alias t "tmux"
@ -35,16 +45,19 @@ alias tk "tmux kill-server"
alias s "systemctl"
alias s+ "systemctl start"
alias s- "systemctl stop"
alias sr "systemctl restart"
alias ss "systemctl status"
alias sl "systemctl list-units --type=service --state=running"
alias sld "systemctl list-unit-files --type=service --state=disabled"
alias sle "systemctl list-unit-files --type=service --state=enabled"
alias slt "systemctl list-timers"
alias ss "systemctl status"
# ...
alias cdp "cd ~/projects"
alias cfg "config"
alias cls "clear"
alias hex "hexdump -C"
alias log "journalctl"
# Close all windows
alias closeall "wmctrl -l | awk '{print $1}' | xargs -rn1 wmctrl -ic"

View File

@ -0,0 +1,3 @@
function config
$EDITOR $HOME/.config/$argv
end

View File

@ -1,3 +0,0 @@
function ll
ls -l $argv
end

View File

@ -1,7 +1,7 @@
function ls
if command -q exa
exa -1 --icons=auto $argv
if command -q eza
eza --group-directories-first --time-style relative $argv
else
command ls $argv
end
end
end

View File

@ -11,7 +11,7 @@
"nvim-lspconfig": { "branch": "master", "commit": "ac530dfb97e51d82e3b0a7cddbf7a4a7c4c10ff8" },
"nvim-notify": { "branch": "master", "commit": "80b67b265530632505193553d05127ae7fe09ddd" },
"nvim-tree.lua": { "branch": "master", "commit": "f39f7b6fcd3865ac2146de4cb4045286308f2935" },
"nvim-treesitter": { "branch": "master", "commit": "5fca7ae4960c415af0b038e89a2d84ef6e16d28d" },
"nvim-treesitter": { "branch": "master", "commit": "e7ea07e42c478cb466cf96124693b447add84011" },
"nvim-web-devicons": { "branch": "master", "commit": "aaec87dbdaa776bfa0a13c8694bec9bcb7454719" },
"onedark.nvim": { "branch": "master", "commit": "1230aaf2a427b2c5b73aba6e4a9a5881d3e69429" },
"plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" },

View File

@ -16,12 +16,24 @@ on({ "BufNewFile", "BufRead" }, {
on({ "VimEnter" }, {
callback = function()
-- Change file to its directory if needed
local file = vim.api.nvim_buf_get_name(0)
if vim.fn.isdirectory(file) == 0 then
file = vim.fs.dirname(file)
end
-- Switch to root directory of the project
local root_patterns = { ".git", "go.mod", "init.lua" }
local root_dir = vim.fs.dirname(vim.fs.find(root_patterns, { upward = true })[1])
local root_dir = vim.fs.dirname(vim.fs.find(root_patterns, {
upward = true,
path = file,
})[1])
if root_dir then
vim.api.nvim_set_current_dir(root_dir)
else
vim.api.nvim_set_current_dir(file)
end
-- Open file explorer if we have enough space

View File

@ -10,7 +10,9 @@ local function on_attach(bufnr)
-- navigation
vim.keymap.set("n", "<C-Up>", api.tree.change_root_to_parent, opts("Up"))
vim.keymap.set("n", "<C-Enter>", api.tree.change_root_to_node, opts("Enter"))
vim.keymap.set("n", "<C-Left>", api.tree.change_root_to_parent, opts("Up"))
vim.keymap.set("n", "<C-Down>", api.tree.change_root_to_node, opts("Enter"))
vim.keymap.set("n", "<C-Right>", api.tree.change_root_to_node, opts("Enter"))
-- open folders with a single click
vim.keymap.set("n", "<LeftRelease>", function()

View File

@ -18,6 +18,9 @@ bind d detach
# kill pane using q
bind q kill-pane
# restart pane using r
bind r respawn-pane -k
# split panes using arrow keys
bind Right split-window -h
bind Down split-window -v