Skip to content

Commit

Permalink
Check if using zsh
Browse files Browse the repository at this point in the history
  • Loading branch information
ellie committed Oct 19, 2023
1 parent a806a0c commit 62dd6e0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 5 additions & 0 deletions atuin-common/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ pub fn get_current_dir() -> String {
}
}

pub fn is_zsh() -> bool {
// only set on zsh
env::var("ZSH_VERSION").is_ok()
}

#[cfg(test)]
mod tests {
use time::Month;
Expand Down
3 changes: 2 additions & 1 deletion atuin/src/command/client/search/interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::{
time::Duration,
};

use atuin_common::utils;
use crossterm::{
event::{
self, DisableMouseCapture, EnableMouseCapture, Event, KeyCode, KeyEvent, KeyModifiers,
Expand Down Expand Up @@ -702,7 +703,7 @@ pub async fn history(

if index < results.len() {
let mut command = results.swap_remove(index).command;
if accept {
if accept && utils::is_zsh() {
command = String::from("__atuin_accept__:") + &command;
}
// index is in bounds so we return that entry
Expand Down
4 changes: 0 additions & 4 deletions atuin/src/command/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ pub struct Cmd {
disable_ctrl_r: bool,

/// Disable the binding of the Up Arrow key to atuin
/// Now the default, but left here to avoid breaking shells
///
/// Originally we bound the up arrow by default, but due to pretty constant questions I'm
/// changing the default
#[clap(long)]
disable_up_arrow: bool,
}
Expand Down

0 comments on commit 62dd6e0

Please sign in to comment.