mirror of
https://gittea.dev/nova/th.git
synced 2025-10-21 10:20:15 -04:00
yank_name now implemented
This commit is contained in:
4
config.h
4
config.h
@@ -60,6 +60,8 @@ static const binding key_binding[] = {
|
||||
{ "r", rename_hovered, NULL, "rename hovered file" }, /* renames currently hovered file/directory */
|
||||
{ "dD", delete, NULL, "delete file" }, /* deletes currently hovered OR selected file/directory
|
||||
* this means that it does not delete the hovered files if files are already selected */
|
||||
{ "yn", yank_text, "name", "yank filename of hovered file" },
|
||||
{ "yp", yank_text, "path", "yank path of hovered file" },
|
||||
{ "yy", yank_file, "copy", "copy/yank file/directory" },
|
||||
{ "dd", yank_file, "cut", "cut file/directory" },
|
||||
{ "pp", paste, NULL, "paste" },
|
||||
@@ -101,6 +103,7 @@ static const binding key_binding[] = {
|
||||
|
||||
static const char size_unit[] = { 'B', 'K', 'M', 'G', 'T', 'P' }; /* this defines the maximum size unit, deleting everything except B results in all sizes being displayed in byte */
|
||||
|
||||
static const char clipboard_cmd[] = "xsel -ib --trim"; /* assembles the following shell cmd: echo "hovered_file" | clipboard_cmd */
|
||||
static const char ui_btm_text_storage_left[] = "total free";
|
||||
static const char ui_btm_current_dir_size[] = "sum of dir";
|
||||
|
||||
@@ -110,6 +113,7 @@ static const unsigned long mimetype_default_count = sizeof(mimetype_default_cmd)
|
||||
static const unsigned long file_extension_default_count = sizeof(file_extension_default_cmd) / sizeof(extension);
|
||||
static const char size_unit_count = (sizeof(size_unit) / sizeof(size_unit[0])) - 1;
|
||||
#else
|
||||
static const char clipboard_cmd[];
|
||||
static const mimetype mimetype_default_cmd[];
|
||||
static const extension file_extension_default_cmd[];
|
||||
static const binding key_binding[];
|
||||
|
@@ -703,6 +703,27 @@ void cmd_on_selected(int passes, int index){
|
||||
free(file_str);
|
||||
}
|
||||
}
|
||||
void yank_text(int passes, int index){
|
||||
(void)passes;
|
||||
char *cmd;
|
||||
if (strncmp((char*)key_binding[index].black_magic, "path", 4) == 0) {
|
||||
char *path=getcwd(NULL, 0);
|
||||
cmd = concat("echo \"", path);
|
||||
cmd = concat(cmd, "/");
|
||||
cmd = concat(cmd, mid_content[selected_file_current].file_name);
|
||||
cmd = concat(cmd, "\" | ");
|
||||
cmd = concat(cmd, clipboard_cmd);
|
||||
free(path);
|
||||
} else {
|
||||
cmd = concat("echo \"", mid_content[selected_file_current].file_name);
|
||||
cmd = concat(cmd, "\" | ");
|
||||
cmd = concat(cmd, clipboard_cmd);
|
||||
}
|
||||
if (system(cmd) == -1) {
|
||||
/*do nothing*/
|
||||
}
|
||||
free(cmd);
|
||||
}
|
||||
void yank_file(int passes, int index){
|
||||
(void)passes;
|
||||
|
||||
|
@@ -26,6 +26,7 @@ void not_implemented(int passes, int index);
|
||||
void jump_to_dir(int passes, int index);
|
||||
void order_by(int passes, int index);
|
||||
void cmd_on_selected(int passes, int index);
|
||||
void yank_text(int passes, int index);
|
||||
void yank_file(int passes, int index);
|
||||
void paste();
|
||||
void search();
|
||||
|
Reference in New Issue
Block a user