• Stars
    star
    380
  • Rank 110,423 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 5 years ago
  • Updated 14 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

a text editor

build status pre-commit.ci status

babi logo

babi

a text editor, eventually...

installation

pip install babi

babi works best in a virtualenv

why is it called babi?

I used to use the text editor nano, frequently I typo this. on a qwerty keyboard, when the right hand is shifted left by one, nano becomes babi.

babi vs. nano

here is a youtube video where I discuss the motivation for creating and using babi instead of nano:

youtube video about babi

quitting babi

currently you can quit babi by using ^X (or via esc + :q).

key combinations

these are all of the current key bindings in babi

  • ^S: save
  • ^O: save as
  • ^X: quit
  • ^P: open file
  • arrow keys: movement
  • ^A / home: move to beginning of line
  • ^E / end: move to end of line
  • ^Y / pageup: move up one page
  • ^V / pagedown: move down one page
  • ^-left / ^-right: jump by word
  • ^-home / ^-end: jump to beginning / end of file
  • M-Up / M-Down: jump to previous / next paragraph
  • ^_: jump to line number
  • selection: shift + ...: extend the current selection
    • arrow keys
    • home / end
    • pageup / pagedown
    • ^-left / ^-right
    • ^-end / ^-home
  • tab / shift-tab: indent or dedent current line (or selection)
  • ^K / ^U: cut and uncut the current line (or selection)
  • M-u / M-U or M-e: undo / redo
  • ^W: search
  • ^\: search and replace
  • ^C: show the current position in the file
  • ^-up / ^-down: scroll screen by a single line
  • M-left / M-right: go to previous / next file
  • ^Z: background
  • ^T: run linter
    • by default, runs pre-commit run --files <filename>
    • outside of a git repo will run flake8 <filename> for python files
    • ^-S-Up, ^-S-Down: navigate to previous / next error
    • M-t focus the linting panel
    • ^C, ^X: clear and close the linting panel
    • Esc, M-t: unfocus the linting panel
    • arrow keys: movement inside the linting panel
  • esc: open the command mode
    • :q: quit
    • :w: write the file
    • :wq: write the file and quit
    • :qall: quit every open file
    • :comment: comment out the current line / selection
    • :reload: reload the file contents
    • :sort: sort the file (or selection)
    • :tabsize X: set the tabsize

in prompts (search, search replace, command):

  • ^C: cancel
  • ^K: cut to end
  • ^R: reverse search

setting up syntax highlighting

syntax highlighting should work out of the box!

if you want a custom theme find a visual studio code theme, convert it to json (if it is not already json) and put it at ~/.config/babi/theme.json. a helper script is provided to make this easier: ./bin/download-theme NAME URL

keyboard shortcuts on macos

to get the most out of babi's built in keyboard shortcuts, a few settings must be changed on macos with Terminal.app:

  • in System Preferences: Keyboard > Shortcuts > Mission Control: disable or rebind "Move left a space" and "Move right a space" (the defaults โŒƒ โ†’ and โŒƒ โ† conflict)
  • in Terminal.app: Terminal > Preferences > Profiles > Keyboard:
    • check Use Option as Meta key
    • ensure the following keys are enabled:
      • โŒƒ โ†’: \033[1;5C
      • โŒƒ โ†: \033[1;5D
      • โ‡ง โ†‘: \033[1;2A
      • โ‡ง โ†“: \033[1;2B
      • โ‡ง โ†’: \033[1;2C
      • โ‡ง โ†: \033[1;2D

demos

most things work! here's a few screenshots

file view

this opens the file, displays it, and can be edited and can save! unknown keys are displayed as errors in the status bar. babi will scroll if the cursor goes off screen either from resize events or from movement. babi can edit multiple files. babi has a command mode (so you can quit it like vim :q!). babi also supports syntax highlighting

More Repositories

1

pyupgrade

A tool (and pre-commit hook) to automatically upgrade syntax for newer versions of the language.
Python
3,385
star
2

reorder-python-imports

Rewrites source to reorder python imports
Python
719
star
3

git-code-debt

A dashboard for monitoring code debt in a git repository.
Python
564
star
4

all-repos

Clone all your repositories and apply sweeping changes.
Python
523
star
5

add-trailing-comma

A tool (and pre-commit hook) to automatically add trailing commas to calls and literals.
Python
332
star
6

dead

dead simple python dead code detection
Python
322
star
7

yesqa

Automatically remove unnecessary `# noqa` comments
Python
259
star
8

astpretty

Pretty print the output of python stdlib `ast.parse`.
Python
189
star
9

detect-test-pollution

a tool to detect test pollution
Python
168
star
10

setup-cfg-fmt

apply a consistent format to `setup.cfg` files
Python
151
star
11

setup-py-upgrade

upgrade a setup.py to declarative metadata
Python
146
star
12

scratch

Haphazard things.
Python
117
star
13

importtime-waterfall

Generate waterfalls from `-Ximporttime` tracing.
Python
105
star
14

setuptools-golang

A setuptools extension for building cpython extensions written in golang.
Python
98
star
15

dockerfile

Parse a dockerfile into a high-level representation using the official go parser
Go
95
star
16

re-assert

show where your regex match assertion failed!
Python
81
star
17

gh-perf-review

hackety tool to view github PRs for a period
Python
79
star
18

covdefaults

A coverage plugin to provide sensible default settings
Python
62
star
19

tokenize-rt

A wrapper around the stdlib `tokenize` which roundtrips.
Python
48
star
20

flake8-typing-imports

flake8 plugin which checks that typing imports are properly guarded
Python
48
star
21

cfgv

Validate configuration and produce human readable error messages
Python
44
star
22

recipes

One day IoT will catch up and then I can use CI
26
star
23

classify-imports

Utilities for refactoring imports in python-like syntax.
Python
23
star
24

awshelp

awshelp forwards arguments to `aws` unless `-h` or `--help` are present
Python
20
star
25

setuptools-golang-examples

Example extensions written for https://github.com/asottile/setuptools-golang
Go
19
star
26

nintendo-microcontrollers

control various nintendo consoles with arduino!
Python
18
star
27

watch-plz

Ensure all of your repositories are watched.
Python
17
star
28

workflows

reusable github workflows / actions
17
star
29

onigurumacffi

python cffi bindings for the oniguruma regex engine
Python
16
star
30

color-code

Encodes files as color
Python
16
star
31

ukkonen

Implementation of bounded Levenshtein distance (Ukkonen)
C++
15
star
32

wat

my brain is full of wat
Python
11
star
33

personal-puppet

serverless puppet to manage my machines
Puppet
11
star
34

shiny-pokemon-scraper

automatically detect tera raid events with guaranteed shiny pokemon
Python
10
star
35

set-delete-branch-on-merge

github does not provide a way to set the `delete_branch_on_merge` as a default
Python
8
star
36

babi-grammars

pip installable package to provide syntax grammars for babi
Python
8
star
37

rubyvenv

Create no-hassle ruby "virtualenvs". No .bashrc, no shims, no cd-magic.
Python
7
star
38

tessdata

pip installable versions of tesseract-ocr data
Python
6
star
39

pygments-pre-commit

A pygments lexer for pre-commit output.
Python
6
star
40

setuptools-download

setuptools plugin to download external files
Python
5
star
41

t

haphazard code snippets
Python
4
star
42

markdown-code-blocks

Generate html from markdown with code-block highlighting
Python
4
star
43

asottile.github.io

Python
4
star
44

hiera-eyaml-sshagent

A hiera-eyaml plugin which uses the ssh agent connected to `SSH_AUTH_SOCK` to encrypt / decrypt values.
Ruby
4
star
45

kensquared

Kotlin
2
star
46

.github

centralized github metadata for asottile
2
star
47

itl

Python
2
star
48

asottile

2
star
49

gnome-terminal-broken

rip
1
star