- `nnn` is all about navigational convenience so the user doesn't have to type - the binary size increases due to readline linkage - alternative workflow: ^G, cd, `nnn` - readline required using the prompt and the history would stay after quitmaster
@@ -8,7 +8,6 @@ INSTALL ?= install | |||
CFLAGS ?= -O3 | |||
CFLAGS += -Wall -Wextra -Wno-unused-parameter | |||
LDLIBS = -lreadline | |||
ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1) | |||
CFLAGS += $(shell $(PKG_CONFIG) --cflags ncursesw) | |||
@@ -65,7 +65,6 @@ Have fun with it! Missing a feature? Want to contribute? Head to the rolling [To | |||
- [sample scripts](#sample-scripts) | |||
- [change dir color](#change-dir-color) | |||
- [file copy, move, delete](#file-copy-move-delete) | |||
- [boost chdir prompt](#boost-chdir-prompt) | |||
- [work faster at rename prompt](#work-faster-at-rename-prompt) | |||
- [set idle timeout](#set-idle-timeout) | |||
- [show hot plugged drives](#show-hot-plugged-drives) | |||
@@ -137,7 +136,7 @@ Intrigued? Find out [HOW](https://github.com/jarun/nnn/wiki/performance-factors) | |||
#### Dependencies | |||
`nnn` needs libreadline, libncursesw (on Linux or ncurses on OS X) and standard libc. | |||
`nnn` needs libncursesw (on Linux or ncurses on OS X) and standard libc. | |||
#### From a package manager | |||
@@ -164,7 +163,7 @@ Packages for Arch Linux, CentOS, Debian, Fedora and Ubuntu are available with th | |||
To cook yourself, download the [latest stable release](https://github.com/jarun/nnn/releases/latest) or clone this repository (*risky*). Then install the dependencies and compile (e.g. on Ubuntu 16.04): | |||
$ sudo apt-get install libncursesw5-dev libreadline6-dev | |||
$ sudo apt-get install libncursesw5-dev | |||
$ make | |||
$ sudo make install | |||
@@ -480,10 +479,6 @@ Any other value disables colored directories. | |||
In addition, `nnn` integrates with vidir. vidir supports batch file move and delete. | |||
#### boost chdir prompt | |||
`nnn` uses libreadline for the chdir prompt input. So all the fantastic features of readline (e.g. case insensitive tab completion, history, reverse-i-search) are available to you based on your readline [configuration](https://wiki.archlinux.org/index.php/Readline). | |||
#### work faster at rename prompt | |||
The rename prompt supports some bash-like command-line shortcuts - <kbd>^A</kbd>, <kbd>^E</kbd>, <kbd>^U</kbd>. <kbd>^L</kbd> clears the name. | |||
@@ -73,8 +73,6 @@ | |||
#include <string.h> | |||
#include <time.h> | |||
#include <unistd.h> | |||
#include <readline/history.h> | |||
#include <readline/readline.h> | |||
#ifndef __USE_XOPEN_EXTENDED | |||
#define __USE_XOPEN_EXTENDED 1 | |||
#endif | |||
@@ -849,25 +847,6 @@ xchartohex(char c) | |||
return c; | |||
} | |||
/* Trim all whitespace from both ends, / from end */ | |||
static char * | |||
strstrip(char *s) | |||
{ | |||
if (!s || !*s) | |||
return s; | |||
size_t len = strlen(s) - 1; | |||
while (len != 0 && (isspace(s[len]) || s[len] == '/')) | |||
--len; | |||
s[len + 1] = '\0'; | |||
while (*s && isspace(*s)) | |||
++s; | |||
return s; | |||
} | |||
static char * | |||
getmime(const char *file) | |||
{ | |||
@@ -2625,44 +2604,11 @@ nochange: | |||
break; | |||
case SEL_CD: | |||
{ | |||
char *input; | |||
int truecd; | |||
/* Save the program start dir */ | |||
tmp = getcwd(newpath, PATH_MAX); | |||
if (tmp == NULL) { | |||
printwarn(); | |||
goto nochange; | |||
} | |||
/* Switch to current path for readline(3) */ | |||
if (chdir(path) == -1) { | |||
printwarn(); | |||
goto nochange; | |||
} | |||
int truecd = 0; | |||
exitcurses(); | |||
tmp = readline("cd: "); | |||
refresh(); | |||
/* Change back to program start dir */ | |||
if (chdir(newpath) == -1) | |||
printwarn(); | |||
if (tmp[0] == '\0') | |||
break; | |||
/* Add to readline(3) history */ | |||
add_history(tmp); | |||
input = tmp; | |||
tmp = strstrip(tmp); | |||
if (tmp[0] == '\0') { | |||
free(input); | |||
tmp = xreadline(NULL, "cd: "); | |||
if (tmp == NULL || tmp[0] == '\0') | |||
break; | |||
} | |||
truecd = 0; | |||
if (tmp[0] == '~') { | |||
/* Expand ~ to HOME absolute path */ | |||
@@ -2671,30 +2617,23 @@ nochange: | |||
if (home) | |||
snprintf(newpath, PATH_MAX, "%s%s", home, tmp + 1); | |||
else { | |||
free(input); | |||
printmsg(messages[STR_NOHOME_ID]); | |||
goto nochange; | |||
} | |||
} else if (tmp[0] == '-' && tmp[1] == '\0') { | |||
if (lastdir[0] == '\0') { | |||
free(input); | |||
if (lastdir[0] == '\0') | |||
break; | |||
} | |||
/* Switch to last visited dir */ | |||
xstrlcpy(newpath, lastdir, PATH_MAX); | |||
truecd = 1; | |||
} else if ((r = all_dots(tmp))) { | |||
if (r == 1) { | |||
if (r == 1) | |||
/* Always in the current dir */ | |||
free(input); | |||
break; | |||
} | |||
/* Show a message if already at / */ | |||
if (istopdir(path)) { | |||
free(input); | |||
/* Continue in navigate-as-you-type mode, if enabled */ | |||
if (cfg.filtermode) | |||
presel = FILTER; | |||
@@ -2716,7 +2655,6 @@ nochange: | |||
dir = xdirname(dir); | |||
if (access(dir, R_OK) == -1) { | |||
printwarn(); | |||
free(input); | |||
goto nochange; | |||
} | |||
} | |||
@@ -2735,8 +2673,6 @@ nochange: | |||
} else | |||
mkpath(path, tmp, newpath, PATH_MAX); | |||
free(input); | |||
if (!xdiraccess(newpath)) | |||
goto nochange; | |||
@@ -14,17 +14,14 @@ packages: | |||
- pkg-config | |||
deps: | |||
- ncurses | |||
- readline | |||
centos7.2: | |||
builddeps: | |||
- make | |||
- gcc | |||
- pkgconfig | |||
- ncurses-devel | |||
- readline-devel | |||
deps: | |||
- ncurses | |||
- readline | |||
commands: | |||
pre: | |||
- yum install epel-release | |||
@@ -34,10 +31,8 @@ packages: | |||
- gcc | |||
- pkgconfig | |||
- ncurses-devel | |||
- readline-devel | |||
deps: | |||
- ncurses | |||
- readline | |||
commands: | |||
pre: | |||
- yum install epel-release | |||
@@ -47,67 +42,53 @@ packages: | |||
- gcc | |||
- pkg-config | |||
- libncursesw5-dev | |||
- libreadline-dev | |||
deps: | |||
- libncursesw5 | |||
- readline-common | |||
fedora25: | |||
builddeps: | |||
- make | |||
- gcc | |||
- pkgconfig | |||
- ncurses-devel | |||
- readline-devel | |||
deps: | |||
- ncurses | |||
- readline | |||
fedora26: | |||
builddeps: | |||
- make | |||
- gcc | |||
- pkg-config | |||
- ncurses-devel | |||
- readline-devel | |||
deps: | |||
- ncurses | |||
- readline | |||
fedora27: | |||
builddeps: | |||
- make | |||
- gcc | |||
- pkg-config | |||
- ncurses-devel | |||
- readline-devel | |||
deps: | |||
- ncurses | |||
- readline | |||
# opensuse42.3: | |||
# builddeps: | |||
# - make | |||
# - gcc | |||
# - pkg-config | |||
# - ncurses-devel | |||
# - readline-devel | |||
# deps: | |||
# - ncurses | |||
# - readline | |||
ubuntu16.04: | |||
builddeps: | |||
- make | |||
- gcc | |||
- pkg-config | |||
- libncursesw5-dev | |||
- libreadline6-dev | |||
deps: | |||
- libncursesw5 | |||
- libreadline6 | |||
ubuntu18.04: | |||
builddeps: | |||
- make | |||
- gcc | |||
- pkg-config | |||
- libncursesw5-dev | |||
- libreadline-dev | |||
deps: | |||
- libncursesw5 | |||
- libreadline7 |