Skip to content

Commit

Permalink
add support for code-insiders (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
konradsz authored Aug 1, 2022
1 parent e259b6f commit 9312cde
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ NOTE: `ig` respects `ripgrep`'s [configuration file](https://github.com/BurntSus
| `F5` | Re-run search |

## Specifying text editor
`igrep` supports Vim, Neovim, nano, VS Code, Emacs and EmacsClient.
`igrep` supports Vim, Neovim, nano, VS Code (stable and insiders), Emacs and EmacsClient.
To specify the editor, use one of the following (listed in order of their precedence):
- `--editor` option,
- `$IGREP_EDITOR` variable,
Expand Down
5 changes: 4 additions & 1 deletion src/ui/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub enum Editor {
Nano,
Code,
Vscode,
CodeInsiders,
Emacs,
Emacsclient,
}
Expand Down Expand Up @@ -81,6 +82,7 @@ impl EditorCommand {
Editor::Neovim | Editor::Nvim => "nvim".into(),
Editor::Nano => "nano".into(),
Editor::Code | Editor::Vscode => "code".into(),
Editor::CodeInsiders => "code-insiders".into(),
Editor::Emacs => "emacs".into(),
Editor::Emacsclient => "emacsclient".into(),
}
Expand All @@ -91,7 +93,7 @@ impl EditorCommand {
Editor::Vim | Editor::Neovim | Editor::Nvim | Editor::Nano => {
Box::new([format!("+{line_number}"), file_name.into()].into_iter())
}
Editor::Code | Editor::Vscode => {
Editor::Code | Editor::Vscode | Editor::CodeInsiders => {
Box::new(["-g".into(), format!("{file_name}:{line_number}")].into_iter())
}
Editor::Emacs | Editor::Emacsclient => {
Expand Down Expand Up @@ -170,6 +172,7 @@ mod tests {
#[test_case(Editor::Nano => format!("nano +{LINE_NUMBER} {FILE_NAME}"); "nano command")]
#[test_case(Editor::Code => format!("code -g {FILE_NAME}:{LINE_NUMBER}"); "code command")]
#[test_case(Editor::Vscode => format!("code -g {FILE_NAME}:{LINE_NUMBER}"); "vscode command")]
#[test_case(Editor::CodeInsiders => format!("code-insiders -g {FILE_NAME}:{LINE_NUMBER}"); "code-insiders command")]
#[test_case(Editor::Emacs => format!("emacs -nw +{LINE_NUMBER} {FILE_NAME}"); "emacs command")]
#[test_case(Editor::Emacsclient => format!("emacsclient -nw +{LINE_NUMBER} {FILE_NAME}"); "emacsclient command")]
fn editor_command(editor: Editor) -> String {
Expand Down

0 comments on commit 9312cde

Please sign in to comment.