diff --git a/nvim/lua/filetypes.lua b/nvim/lua/filetypes.lua index ba92ad8..c9ad8f7 100644 --- a/nvim/lua/filetypes.lua +++ b/nvim/lua/filetypes.lua @@ -24,14 +24,10 @@ vim.api.nvim_create_autocmd("Filetype", { vim.api.nvim_create_autocmd("Filetype", { group = vim.api.nvim_create_augroup("webDev", {}), - pattern = { "html", "css", "javascript", "javascriptreact" }, + pattern = { "html", "css", "javascript", "javascriptreact", "json" }, callback = function() vim.cmd [[setlocal tabstop=2 softtabstop=2 shiftwidth=2]] - vim.bo.formatprg = "npx prettier --stdin-filepath %" - - vim.api.nvim_create_autocmd("BufWritePre", { - command = "Format", - buffer = 0 - }) + vim.bo.formatprg = "prettier --stdin-filepath " .. vim.fn.expand("%:p") + require("minimal-format").toggle_autocmd(0) end }) diff --git a/nvim/lua/keymaps.lua b/nvim/lua/keymaps.lua index 998c198..d1d53f7 100644 --- a/nvim/lua/keymaps.lua +++ b/nvim/lua/keymaps.lua @@ -7,6 +7,7 @@ vim.keymap.set("i", "kj", "") vim.keymap.set("", "q", "confirm quit") vim.keymap.set("", "x", "exit") +vim.keymap.set("", "ww", "write") vim.keymap.set("", "x", "writesource %") vim.keymap.set("", "n", "nzz") @@ -39,14 +40,6 @@ window_map("j") window_map("k") window_map("l") -vim.api.nvim_create_user_command("Format", function() - if vim.bo.formatprg ~= "" then - vim.cmd [[normal mzgggqG'zzz]] - else - vim.cmd [[normal mzgg=G'zzz]] - end -end, {}) - ------------------------------------------------------------------------------ -- Plugin Maps -- ------------------------------------------------------------------------------ diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index c26e538..02c1c42 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -48,4 +48,5 @@ return { "tpope/vim-unimpaired", "fladson/vim-kitty", + "cljoly/minimal-format.nvim" } diff --git a/zsh/.gitignore b/zsh/.gitignore new file mode 100644 index 0000000..ac892c1 --- /dev/null +++ b/zsh/.gitignore @@ -0,0 +1 @@ +zsh-secrets diff --git a/zsh/dot-zshenv b/zsh/dot-zshenv index 46f997c..de3aec5 100644 --- a/zsh/dot-zshenv +++ b/zsh/dot-zshenv @@ -15,4 +15,9 @@ path+="$HOME/.local/npm/bin" path+="$HOME/.dotnet/tools" +if [ -f "$ZDOTDIR/zsh-secrets" ]; then + source "$ZDOTDIR/zsh-secrets" +fi + + # vim: filetype=zsh diff --git a/zsh/zsh-functions b/zsh/zsh-functions index eb6164c..f788965 100644 --- a/zsh/zsh-functions +++ b/zsh/zsh-functions @@ -17,7 +17,7 @@ function eik() { } function find-directory() { - FOLDER=$(fd -t d --hidden | fzf --height "50%" --reverse) + FOLDER=$(fd -t d --hidden | fzf --height="~50%" --reverse) if [ -n "$FOLDER" ]; then BUFFER="cd $FOLDER; l" zle .accept-line @@ -27,4 +27,16 @@ function find-directory() { } zle -N find-directory +function forgejo_clone() { + local repo_name + repo_name=$(curl -X GET "https://git.hadeedahmad.xyz/api/v1/user/repos" \ + -H "Authorization: token ${FORGEJO_API_KEY}" \ + --silent | jq -r ".[].name" | fzf --height="~50%" --reverse) + + if [ -n "$repo_name" ]; then + git clone "forgejo:hadeed/$repo_name" + fi +} +zle -N forgejo_clone + # vim: filetype=zsh