summaryrefslogtreecommitdiffstats
path: root/src/utils.rs
diff options
context:
space:
mode:
authorqkzk <qu3nt1n@gmail.com>2023-11-14 22:17:50 +0100
committerqkzk <qu3nt1n@gmail.com>2023-11-14 22:17:50 +0100
commitfd4e95b9bbd38e1ee262cb6b95a5d43baebec892 (patch)
treeb82bfbaa17de92038181e2e0620ea13573ed82d7 /src/utils.rs
parente8cc0f010e47548f8731fada91ef15fef993a33e (diff)
various fixes. Fix neovim server adress won't update if neovim is restarted while fm is running
Diffstat (limited to 'src/utils.rs')
-rw-r--r--src/utils.rs16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/utils.rs b/src/utils.rs
index 3bb2306..7e67eae 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -13,6 +13,7 @@ use tuikit::term::Term;
use crate::constant_strings_paths::{CALC_PDF_PATH, THUMBNAIL_PATH};
use crate::content_window::ContentWindow;
use crate::fileinfo::human_size;
+use crate::log_line;
use crate::nvim::nvim;
use crate::users::Users;
@@ -155,10 +156,19 @@ pub fn is_sudo_command(executable: &str) -> bool {
/// Open the path in neovim.
pub fn open_in_current_neovim(path: &Path, nvim_server: &str) {
let command = &format!(
- "<esc>:e {path_str}<cr><esc>:set number<cr><esc>:close<cr>",
- path_str = path.display()
+ "<esc>:e {path}<cr><esc>:set number<cr><esc>:close<cr>",
+ path = path.display()
);
- let _ = nvim(nvim_server, command);
+ match nvim(nvim_server, command) {
+ Ok(()) => log_line!(
+ "Opened {path} in neovim at {nvim_server}",
+ path = path.display()
+ ),
+ Err(error) => log_line!(
+ "Couldn't open {path} in neovim. Error {error:?}",
+ path = path.display()
+ ),
+ }
}
/// Creates a random string.