summaryrefslogtreecommitdiff
path: root/README.adoc
blob: 3dcc706de95a95d48b6142e72fe9cc3d21c89d0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
sdn
===
:compact-option:

'sdn' is a simple directory navigator that you can invoke while editing shell
commands.  It enables you to:

 * take a quick peek at directory contents without running `ls`
 * browse the filesystem without all the mess that Midnight Commander does:
   there's no need to create a subshell in a new pty.  The current command line
   can be simply forwarded if it is to be edited.  What's more, it will always
   be obvious whether the navigator is running.

Development has just started and the only supported platform is Linux.
I wanted to try a different, simpler approach here.

Building
--------
Build dependencies: CMake and/or make, a C++14 compiler, pkg-config +
Runtime dependencies: ncursesw

 $ git clone https://github.com/pjanouch/sdn.git
 $ mkdir sdn/build
 $ cd sdn/build
 $ cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug
 $ make

To install the application, you can do either the usual:

 # make install

Or you can try telling CMake to make a package for you.  For Debian it is:

 $ cpack -G DEB
 # dpkg -i sdn-*.deb

There is also a Makefile you can use to quickly build a binary to be copied
into the PATH of any machine you want to have 'sdn' on.

zsh
---
To start using this navigator, put the following in your .zshrc:
....
sdn-navigate () {
  # ... possibly zle-line-init
  eval `sdn`
  [ -z "$cd" ] || cd "$cd"
  [ -z "$insert" ] || LBUFFER="$LBUFFER$insert "
  zle reset-prompt
  # ... possibly zle-line-finish
}
zle -N sdn-navigate
bindkey '\eo' sdn-navigate
....

bash
----
Here we can't reset the prompt from within a `bind -x` handler but there is
an acceptable workaround:
....
sdn-navigate () {
  SDN_L=$READLINE_LINE SDN_P=$READLINE_POINT
  READLINE_LINE=

  eval `sdn`
  [[ -z "$cd" ]] || cd "$cd"
  [[ -z "$insert" ]] || {
    SDN_L="${SDN_L:0:$SDN_P}$insert ${SDN_L:$SDN_P}"
    ((SDN_P=SDN_P+${#insert}+1))
  }
}
sdn-restore () {
  READLINE_LINE=$SDN_L READLINE_POINT=$SDN_P
  unset SDN_L SDN_P
}

bind -x '"\200": sdn-navigate'
bind -x '"\201": sdn-restore'
bind '"\eo":"\200\C-m\201"'
....

Colors
------
Here is an example of a '~/.config/sdn/look' file; the format is similar to
that of git, only named colors aren't supported:
....
cursor 231 202
bar 16 255 ul
cwd bold
input
....

Contributing and Support
------------------------
Use this project's GitHub to report any bugs, request features, or submit pull
requests.  If you want to discuss this project, or maybe just hang out with
the developer, feel free to join me at irc://irc.janouch.name, channel #dev.

Bitcoin donations: 12r5uEWEgcHC46xd64tt3hHt9EUvYYDHe9

License
-------
'sdn' is written by Přemysl Janouch <p.janouch@gmail.com>.

You may use the software under the terms of the ISC license, the text of which
is included within the package, or, at your option, you may relicense the work
under the MIT or the Modified BSD License, as listed at the following site:

http://www.gnu.org/licenses/license-list.html