ked is a text editor. It is purpose-built for myself as a code editor
for use within a terminal multiplexer.
ked is unsupported software and I advise against using it for real.
There are probably a lot of edgecases I have yet to find. You may
encounter bugs, which will cause ked to crash, which will cause you to
lose your buffer modifications irrevocably. I may make minor
bug fixes, modifications, and improvements, but ked will never be much
more than it is now. Presently it works well enough that after
bootstrapping the project with another editor, ked itself has mostly
been with developed with ked using macOS and GNU/Linux.
Presently the only way to change keyboard shortcuts is by editing the code. As ked is built with Go without many dependencies, recompiling is trivial.
The hardcoded keyboard shortcuts are the following:
Ctrl+Xexits the editorCtrl+Ccancel dialogsCtrl+Wsaves the bufferCtrl+Ssearches the buffer (useCtrl+Sto jump through results)Alt+LeftandAlt+Rightjump over wordish thingsCtrl+AandCtrl+Emove cursor to beginning and end of present lineCtrl+Gjumps to a specific linePageUpandPageDownmove, well, a single page up or downCtrl+Kdeletes from cursor to the end of line; also deletes empty linesAlt+Backspacedeletes current wordCtrl+_undos recent actionsTabinserts one tab character to cursor positionShift+Tab(Backtab) removes one level of tabulation from line beginningAlt+UpandAlt+Downjump to the previous or next empty lineCtrl+Pdisplays the buffer selection dialogCtrl+Fdisplays the file-open dialogAlt+Fcloses the current buffer
Depending on your terminal settings, Alt may be mapped to Esc.
We have a very minimalistic approach to buffer handling. You can open
new buffers, close them, save their contents to a file, and change
between them. A single buffer always occupies the available screen
space. I use it within tmux, and if I need to see more than a single
buffer at a time, I will open several panes for that purpose.
Opening files into new buffers is based on the idea of first selecting a
root directory and then fuzzily finding filenames matching your filter.
By default, we ignore certain directories like .git and
node_modules. You may specify these exactly with the -ignoredirs
argument or ignoredir option in the configuration file.
Save hooks are command-lines, which are automatically executed after a
glob-matching buffer is saved to a file. To make the mechanism more
useful, all references to __ABSPATH__ in the command-line will be
replaced with the current buffer's absolute path. If the command returns
successfully, ked will reload the buffer's contents from the file.
Note that the mechanism is fairly limited: We generate the savehook
command by splitting the command-line with spaces. The result is also
not shell-expanded. For more complex invocations, use a wrapper script
such as $HOME/bin/wrapper.sh __ABSPATH__.
ked is mostly configured with a configuration file. See ked -h for
the filepaths it looks from. Command-line argument -config may also be
used to override the default filepaths.
An example configuration file is below. Note that we assume the relevant
programs used in save hooks are found via $PATH.
tabsize=4
tabspaces=false
ignoredir=.git
ignoredir=node_modules
ignoredir=__pycache__
ignoredir=site-packages
maxfiles=50000
worddelims = " \t=&|,./(){}[]#+*%'-:?!'\""
warnfilesize=1048576
[filetype:*.c]
savehook=clang-format -i __ABSPATH__
tabsize=8
[filetype:*.go]
savehook=goimports -w __ABSPATH__
tabsize=4
tabspaces=true
highlight-keyword=bold:type
highlight-keyword=bold:func
highlight-keyword=bold:struct
highlight-keyword=bold:bold
highlight-keyword=underline:return
; highlight string literals
highlight-pattern=255:0:1:dim:"(\\.|[^"\\])*"
highlight-pattern=255:0:1:dim:'(\\.|[^'\\])*'
highlight-pattern=255:0:1:dim:`(\\.|[^`\\])*`
; highlight single-line comments
highlight-pattern=255:0:1:dim://.*
; highlight function calls
highlight-pattern=254:2:3:bold:([-_\w]+)\(
[filetype:*.md]
savehook=pandoc --sandbox --atx-headers -f markdown -t markdown -o __ABSPATH__ __ABSPATH__
highlight-pattern=255:0:1:bold:#.+
highlight-pattern=255:0:1:dim:`(\\.|[^`\\])*`
[filetype:*.py]
savehook=black __ABSPATH__
highlight-keyword=bold:def
highlight-keyword=bold:class
highlight-pattern=255:0:1:dim:#.+
highlight-pattern=254:2:3:bold:([-_\w]+)\(
highlight-pattern=255:0:1:dim:"(\\.|[^"\\])*"
highlight-pattern=255:0:1:dim:'(\\.|[^'\\])*'
[filetype:Makefile*]
tabsize=8
tabspaces=false