From cd89dfb5ae64b704945ce8c95dbc9549efadf730 Mon Sep 17 00:00:00 2001 From: Andre-Philippe Paquet Date: Wed, 18 Sep 2024 08:33:25 -0400 Subject: [PATCH] update + gha check --- .github/workflows/push-check.yaml | 15 +++++++++++++++ README.md | 3 ++- flake.lock | 8 ++++---- home-manager/modules/fish.nix | 19 ++++++++++++++++--- home-manager/modules/git/default.nix | 11 ----------- home-manager/modules/neovim/conf/keymap.vim | 9 +++------ home-manager/modules/neovim/default.nix | 2 +- 7 files changed, 41 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/push-check.yaml diff --git a/.github/workflows/push-check.yaml b/.github/workflows/push-check.yaml new file mode 100644 index 0000000..0a17c86 --- /dev/null +++ b/.github/workflows/push-check.yaml @@ -0,0 +1,15 @@ +name: "Push checker" +on: + pull_request: + push: +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: cachix/install-nix-action@v27 + with: + nix_path: nixpkgs=channel:nixos-unstable + + - run: ./x check diff --git a/README.md b/README.md index 0d00a04..1501b2e 100644 --- a/README.md +++ b/README.md @@ -127,8 +127,9 @@ - `x` to save and then execute current buffer (as long as it's chmod +x) - `z` to execute current visual selection in a shell - `r` to save current buffer and then execute `rsync.sh` in working dir - - `q` to close the current buffer (equivalent to `:q`) - `w` to close the current buffer by trying not to messup the layout +- `o` to close all buffers except the current one + - `q` to quit vim - `` to switch between tab and spaces - `e` to toggle file etree - `p` fuzzy finding file diff --git a/flake.lock b/flake.lock index 2df5a44..bcdd8a1 100644 --- a/flake.lock +++ b/flake.lock @@ -210,11 +210,11 @@ ] }, "locked": { - "lastModified": 1718761797, - "narHash": "sha256-al9VkUX7mAYnk+Wz8ukYCOFgTPPH8FIOCJ2BTh1IePY=", + "lastModified": 1726604389, + "narHash": "sha256-n18XkQQo08HU5xS8XZiQKqS7r5TIDPEvE3kOUhaYaoA=", "ref": "refs/heads/master", - "rev": "e2e98a719affe8ea1e36314e3160ab42528f02db", - "revCount": 12, + "rev": "66710e2e069d5a4ec1a9bdcb611977de6db7a275", + "revCount": 13, "type": "git", "url": "ssh://git@github.com/zia-ai/shared-dotfiles" }, diff --git a/home-manager/modules/fish.nix b/home-manager/modules/fish.nix index f7ef347..f5e2b27 100644 --- a/home-manager/modules/fish.nix +++ b/home-manager/modules/fish.nix @@ -73,12 +73,17 @@ gds = "git diff --staged"; gp = "git pull"; gck = "git checkout"; - gcm = "git commit -m"; + gcm = { + expansion = "git commit -m \"%\""; + setCursor = true; + }; gchm = "git commit -m (git log -1 --pretty=format:%s)"; gpom = "git pull origin master"; gpr = "git pull --rebase --autostash"; + gpf = "git push --force-with-lease"; gca = "git commit --amend"; gr = "git rev-parse --short=7 @"; + grc = "GIT_EDITOR=true git rebase --continue"; grsw = "git restore --staged --worktree"; grws = "git restore --staged --worktree"; grs = "git restore --staged"; @@ -102,8 +107,16 @@ nr = "nix run nixpkgs#(fzf-nix)"; ns = "nix shell nixpkgs#(fzf-nix)"; - ai = "aichat"; - aie = "aichat -e"; + # TODO: Fix it with cursor since need quotes most of the time. See https://github.com/fish-shell/fish-shell/pull/9313 + # https://github.com/nix-community/home-manager/blob/master/modules/programs/fish.nix#L170 + ai = { + expansion = "aichat \"%\""; + setCursor = true; + }; + aie = { + expansion = "aichat -e \"%\""; + setCursor = true; + }; aif = "aichat -f"; }; diff --git a/home-manager/modules/git/default.nix b/home-manager/modules/git/default.nix index 6cada10..9595151 100644 --- a/home-manager/modules/git/default.nix +++ b/home-manager/modules/git/default.nix @@ -11,17 +11,6 @@ fzf ]; - programs.fish.functions.gh-pr-select = '' - set COMMAND 'gh pr list --json number,title,author,headRefName,updatedAt \ - --template "{{tablerow \"Ref\" \"PR\" \"Title\" \"Author\" \"Date\"}}{{range .}}{{tablerow (.headRefName | color \"blue\") (printf \"#%v\" .number | color \"yellow\") (.title | color \"green\") (.author.name | color \"cyan\") (timeago .updatedAt)}}{{end}}"' - GH_FORCE_TTY=100% FZF_DEFAULT_COMMAND=$COMMAND fzf \ - --ansi \ - --header-lines=1 \ - --no-multi \ - --prompt 'Search Open PRs > ' \ - | awk '{print $1}' - ''; - programs.git = { enable = true; userName = "Andre-Philippe Paquet"; diff --git a/home-manager/modules/neovim/conf/keymap.vim b/home-manager/modules/neovim/conf/keymap.vim index 04f6ab0..44658f2 100644 --- a/home-manager/modules/neovim/conf/keymap.vim +++ b/home-manager/modules/neovim/conf/keymap.vim @@ -21,13 +21,12 @@ map ] :bn! map [ :bp! " Cleanly close buffer -map :Bclose -nmap w :Bclose +map w :BufDel +map o :BufDelOthers " Execute current file or selection map x :w:!./% map z :'<,'>w !sh -map r :!./rsync.sh map r :!./rsync.sh " Clipboard @@ -35,11 +34,9 @@ map y :w !pbcopy map p :read !pbpaste " Save & quit -map :w:!./% map :w map s :w -map :q -map q :q +map q :qa " For when you forget to sudo.. Really Write the file. cmap w!! w !sudo tee % >/dev/null diff --git a/home-manager/modules/neovim/default.nix b/home-manager/modules/neovim/default.nix index 14de902..7f1a27d 100644 --- a/home-manager/modules/neovim/default.nix +++ b/home-manager/modules/neovim/default.nix @@ -32,7 +32,7 @@ fzf-vim # :Files (ctrl-p), :Rg (ctrl-f), :History (ctrl-l) Rename # :Rename vim-multiple-cursors # ctrl-n multi cursors - bclose-vim # close buffer cleanly via w + nvim-bufdel # :BufDel, :BufDelOthers (properly close buffers) delimitMate # auto close quotes, parens, etc nerdcommenter # block comment (cc, cu)