__,__
.--. .-" "-. .--.
/ .. \/ .-. .-. \/ .. \
| | '| / Y \ |' | |
| \ \ \ 0 | 0 / / / |
\ '- ,\.-"`` ``"-./, -' /
`'-' /_ ^ ^ _\ '-'`
.--'| \._ _./ |'--.
/` \ \ `~` / / `\
/ '._ '---' _.' \ The more features an application
/ '~---~' | \ provides, the harder will people
/ _. \ \ actually start using it.
/ .'-./`/ .'~'-.|\ \
/ / `\: / `\'. \ - An unknown monkey (2019)
/ | ; | '.`; /
\ \ ; \ \/ /
'. \ ; \ \ ` /
'._'. \ '. | ;/_
/__> '. \_ _ _/ , '--.
.' '. .-~~~~~-. / |--'`~~-. \
// / .---'/ .-~~-._/ / / /---..__.' /
((_(_/ / / (_(_(_(---.__ .'
| | _ `~~`
| | \'.
\ '....' |
'.,___.'
affe is a simple text editor enhanced with some fancy features.
Its goal is to be a user-friendly terminal-based editor.
- 📝 Text editor (wow!)
- 🎨 Syntax highlighting (fancy)
- ⚙️ Fuzzy Auto-Completion (this is aweso
Ctrl+Space) - 🔧 Inline git diff, git blame & git minimap (pretty useful)
- 🔤 Text selection (using mouse or
Shift+Arrow Keys) - ⌨️ Easy to remember keyboard shortcuts (
Escto exit,Ctrl+Cto copy,Ctrl+Ato select all,Ctrl+Sto save) - 🖱️ Mouse support (scrolling, clicking, text selection)
- 🔎 Find-and-replace functionality
Grab the latest binary from affe.sh or build it yourself:
Ubuntu 18.04 or newer:
git clone https://github.com/Leistungsabfall/affe.git
cd affe
./scripts/linux/setup.sh
./scripts/linux/build.shGit Bash for Windows:
Note: You will need admin rights.
Run the following commands in Git Bash for Windows:
git clone https://github.com/Leistungsabfall/affe.git
cd affe
scripts/windows/setup.bat
scripts/windows/build.batAll keyboard shortcuts are designed with the intent to be intuitive. So you may already know most of them from Notepad++ or your favorite IDE.
| Key Combination | Function |
|---|---|
Esc |
Exit |
Ctrl+S |
Save |
Ctrl+Z |
Undo |
Ctrl+Y |
Redo |
Ctrl+C |
Copy (if nothing is selected the whole line is copied) |
Ctrl+V |
Paste |
Ctrl+X |
Cut (if nothing is selected the whole line is cut) |
Ctrl+A |
Select all |
Ctrl+F |
Open Find toolbar |
Ctrl+R |
Open Replace toolbar |
| Key Combination | Function |
|---|---|
Ctrl+Space |
Open Auto-Completion |
Ctrl+K |
Comment/Uncomment |
Tab/Shift+Tab |
Indent/Un-indent selected lines |
Ctrl+Left/Right |
Jump to previous/next word |
Ctrl+Up/Down |
Move line(s) up/down |
Shift+Arrow Key |
Select text |
Ctrl+W |
Select word under cursor |
Ctrl+N |
Jump to beginning of next line |
Ctrl+T |
Toggle upper/lower case |
Ctrl+G |
Reset file to version stored in git |
Ctrl+B |
Toggle inline git blame view |
F7 |
Open menu |
F12 |
Show readme document |
-
What does
affemean?affeis an acronym for A Full- Fledged Editor.
-
Why not use
vim/nano/...?- Their keyboard shortcuts are hard to remember: How do I exit Vim? and many of those editors lack proper syntax highlighting. And no, I don't want to install plugins for those basic features.
-
Why not use a graphical editor?
- Using a graphical editor via Remote Desktop sucks. A terminal-based editor is much more responsive while saving bandwidth and power on the client system.
-
Why yet another text editor?
affeaims to be very user-friendly while still being a terminal-based text editor. It is possible to controlaffecompletely mouse-driven so you can start right away. And keyboard shortcuts are designed to be intuitive.
-
Which programming languages are supported for syntax highlighting?
affeuses the pygments library for syntax highlighting. This means that all languages and file formats supported by pygments (currently ~600) are also supported by affe.
-
What are those blue lines right next to the scrollbar?
- This is the git minimap. It indicates modified lines throughout the whole file. Pretty neat, huh?
-
The default blinking block cursor (
█) feels wrong in an editor. Can it be changed to a line cursor (|)?- Yes, for most terminals this can be changed in the preferences.
Look for a
Cursor Shapeoption and change it accordingly.
- Yes, for most terminals this can be changed in the preferences.
Look for a
-
Why are all lines in my file marked as modified by git?
- I bet your file uses
CRLFline endings (Windows) instead ofLF(everyone else). This confusesaffe.
- I bet your file uses
-
Why are modified lines in my file not highlighted by git?
- Is your file tracked by
git? If yes, then your file probably uses an unsupported encoding. Check the output of this command:file <yourfile>.
- Is your file tracked by
-
Why is Copy/Paste not working when using sudo?
- Run
xhost local:$USER
- Run
-
Why do I see weird
?characters all over the place?- Enable
UTF-8support by running the following command in the terminal:export LC_ALL=C.UTF-8
- Enable
-
How can I use
affeas the default editor, e.g. forgit commitmessages?- Run the following command:
git config --global core.editor "affe"You can also set theEDITORenvironment variable accordingly.
- Run the following command:
-
How can I copy text from
affewhen usinggit bash,PuTTY, ...?- Hold down
Shiftand select text with your mouse. This is far from perfect, so don't forget to remove any line numbers when pasting¯\_(ツ)_/¯
- Hold down
-
How can I paste text into
affewhen usinggit bash,PuTTY, ...?- Press
Ctrl+Shift+V(default for most terminal emulators after disabling the scroll modifier, see below).
- Press
-
What's the best way to use
byobuandgit bashin combination?- Open
Optionsingit bash - Disable the scroll modifier in
Windowsettings - Enable
Ctrl+Shift+Letter shortcutsinKeyssettings - In
byobupressF9and change escape sequence toCtrl+E - Add the following lines to
~/.config/byobu/.tmux.confand~/.config/byobu/keybindings.tmux:
unbind-key -n S-Up unbind-key -n S-Down unbind-key -n S-Left unbind-key -n S-Right unbind-key -n F7 set -g mouse on set -g default-terminal "xterm"(as always, hold down
Shiftto select text with your mouse) - Open
affe is primarily developed and tested on Ubuntu 18.04 and newer.
Some features (especially during installation/setup) may not work as expected on other systems.
affe uses the awesome python-prompt-toolkit library, which offers great customizability at the cost of performance.
On very large files (e.g. > 10,000 lines) some operations may feel sluggish.
Also, startup time may be longer than expected.
This performance impact is especially noticeable when trying to run affe (please don't) on low-end hardware (e.g. Raspberry Pi).
CPU usage is generally higher than one might expect for a terminal-based editor. This is mainly due to the usage of python-prompt-toolkit, but also caused by the convenience features that run continuously in the background:
- Update syntax highlighting
- Check for external file modifications
- Update git inline diff and minimap
Support for Windows using git bash is experimental.
Some features may not work as expected, for example:
- Pressing
Ctrl+Spacedoes not open the auto-completion menu. - Git inline diff is not shown.
- Newline at end of file is not added automatically when saving.
- Whitespace at end of line is not stripped when saving.
Congratulations! You have reached the end of this readme.
Here are two Easter eggs for you:
- Run
affe chess.pyto play a game of chess against the sunfish engine. - Run
affe <file>.paintto open a simple painting application.
