Skip to content

Commit 2283331

Browse files
authored
Implement tab completion for ~/ (#164)
* Implement tab completion for ~/ Fixes #87. * Fix clippy
1 parent d6c4841 commit 2283331

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

crates/shell/src/completion.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ fn complete_filenames(_is_start: bool, word: &str, matches: &mut Vec<Pair>) {
6262
// Determine the full directory path to search
6363
let search_dir = if dir_path.starts_with('/') {
6464
dir_path.to_string()
65+
} else if let Some(stripped) = dir_path.strip_prefix('~') {
66+
let home_dir = dirs::home_dir().unwrap();
67+
format!("{}{}", home_dir.display(), stripped)
6568
} else {
6669
format!("./{}", dir_path)
6770
};

0 commit comments

Comments
 (0)