Skip to content

Commit

Permalink
Search across multiple files with ripgrep
Browse files Browse the repository at this point in the history
  • Loading branch information
cshuaimin committed May 9, 2024
1 parent bb323ba commit c92501c
Show file tree
Hide file tree
Showing 17 changed files with 1,432 additions and 851 deletions.
31 changes: 19 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,41 @@ jobs:

strategy:
matrix:
nvim: [v0.9.1, nightly]
nvim: [nightly]

env:
RIPGREP_VERSION: "14.1.0"
VIM: ~/.local/share/nvim/share/nvim/runtime

steps:
- uses: actions/checkout@v3

- name: Set Envs
- name: Add PATH
run: |
echo "VIM=~/.local/share/nvim/share/nvim/runtime" >> $GITHUB_ENV
echo "PATH=~/.local/share/nvim/bin:$PATH" >> $GITHUB_ENV
echo "$HOME/.local/share/nvim/bin" >> $GITHUB_PATH
echo "$HOME/.local/share/ripgrep" >> $GITHUB_PATH
- name: Cache Dependencies
id: cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.local/share/nvim
key: ${{ runner.os }}-nvim-${{ matrix.nvim }}
key: ${{ runner.os }}-nvim-${{ matrix.nvim }}-rg-${{ env.RIPGREP_VERSION }}
path: |
~/.local/share/nvim
~/.local/share/ripgrep
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
mkdir -p ~/.local/share/nvim/
mkdir -p ~/.local/share/{nvim,ripgrep}
curl -sL "https://github.com/BurntSushi/ripgrep/releases/download/$RIPGREP_VERSION/ripgrep-$RIPGREP_VERSION-x86_64-unknown-linux-musl.tar.gz" | tar xzf - --strip-components=1 -C ~/.local/share/ripgrep
curl -sL "https://github.com/neovim/neovim/releases/download/${{ matrix.nvim }}/nvim-linux64.tar.gz" | tar xzf - --strip-components=1 -C ~/.local/share/nvim/
git clone --depth 1 https://github.com/nvim-treesitter/nvim-treesitter.git ~/.local/share/nvim/site/pack/vendor/start/nvim-treesitter
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ~/.local/share/nvim/site/pack/vendor/start/plenary.nvim
ln -s $(pwd) ~/.local/share/nvim/site/pack/vendor/start
nvim --headless -c 'TSInstallSync python javascript lua rust go' -c 'q'
ln -s $PWD ~/.local/share/nvim/site/pack/vendor/start
nvim --headless '+TSInstallSync python javascript html lua rust go' +q
- name: Run tests
run: |
nvim --version
nvim --headless -c 'PlenaryBustedDirectory tests/'
nvim --version | head -1 && rg --version | head -1
nvim --headless '+PlenaryBustedDirectory tests/'
20 changes: 20 additions & 0 deletions .neoconf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"neodev": {
"library": {
"enabled": true,
"plugins": ["plenary.nvim"]
}
},
"neoconf": {
"plugins": {
"lua_ls": {
"enabled": true
}
}
},
"lspconfig": {
"lua_ls": {
"Lua.format.enable": false
}
}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ First put your cursor on the structure you want to search and replace (if you
are not sure, select a region instead), then open SSR by pressing `<leader>sr`.

In the SSR float window you can see the placeholder search code, you can
replace part of it with wildcards. A wildcard is an identifier starts with `$`,
like `$name`. A `$name` wildcard in the search pattern will match any AST node
replace part of it with captures. A capture is an identifier starts with `$`,
like `$name`. A `$name` capture in the search pattern will match any AST node
and `$name` will reference it in the replacement.

Press `<leader><cr>` to replace all matches in current buffer, or `<cr>` to
Expand Down
Loading

0 comments on commit c92501c

Please sign in to comment.