pax_global_header00006660000000000000000000000064146220307320014511gustar00rootroot0000000000000052 comment=1bd50261c8c1c867f76e79f626dc571981f15bfd kakoune-2024.05.18/000077500000000000000000000000001462203073200135515ustar00rootroot00000000000000kakoune-2024.05.18/.builds/000077500000000000000000000000001462203073200151115ustar00rootroot00000000000000kakoune-2024.05.18/.builds/debian-arm64.yml000066400000000000000000000006061462203073200200070ustar00rootroot00000000000000image: debian/unstable arch: arm64 packages: - clang - make - gcc tasks: - clang-build: | cd kakoune make CXX=clang++ -j$(nproc) - clang-test: | cd kakoune LC_ALL=C.utf8 make test - gcc-build: | cd kakoune make clean make CXX=g++ -j$(nproc) - gcc-test: | cd kakoune LC_ALL=C.utf8 make test kakoune-2024.05.18/.builds/debian.yml000066400000000000000000000005701462203073200170600ustar00rootroot00000000000000image: debian/stable packages: - clang - gcc - make tasks: - clang-build: | cd kakoune make CXX=clang++ -j$(nproc) - clang-test: | cd kakoune LC_ALL=C.utf8 make test - gcc-build: | cd kakoune make clean make CXX=g++ -j$(nproc) - gcc-test: | cd kakoune LC_ALL=C.utf8 make test kakoune-2024.05.18/.builds/freebsd.yml000066400000000000000000000006021462203073200172440ustar00rootroot00000000000000image: freebsd/13.x packages: - gcc tasks: - build-clang: | cd kakoune make CXX=clang++ -j$(sysctl -n hw.ncpu) - test-clang: | cd kakoune LC_ALL=en_US.UTF-8 make test - build-gcc: | cd kakoune make clean make CXX=g++ -j$(sysctl -n hw.ncpu) - test-gcc: | cd kakoune LC_ALL=en_US.UTF-8 make test kakoune-2024.05.18/.builds/readme.yml000066400000000000000000000004321462203073200170700ustar00rootroot00000000000000image: archlinux oauth: git.sr.ht/REPOSITORIES:RW git.sr.ht/PROFILE:RO packages: - hut - asciidoctor tasks: - update-readme: | cd kakoune asciidoctor -e README.asciidoc hut git update --readme README.html --repo https://git.sr.ht/~mawww/kakoune kakoune-2024.05.18/.cirrus.yml000066400000000000000000000027731462203073200156720ustar00rootroot00000000000000freebsd_task: freebsd_instance: image_family: freebsd-13-2 matrix: - name: freebsd_clang env: CXX: clang++ - name: freebsd_gcc gcc_script: pkg install -y gcc env: CXX: g++ test_script: make CXX=$CXX -j$(sysctl -n hw.ncpu) test env: LC_ALL: en_US.UTF-8 linux_task: locales_script: - apt-get update && apt-get -y install locales - echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen - locale-gen en_US.UTF-8 matrix: - name: linux_clang container: image: silkeh/clang:13 env: CXX: clang++ - name: linux_gcc container: image: gcc:10 env: CXX: g++ test_script: make CXX=$CXX -j$(nproc) test env: LC_ALL: en_US.UTF-8 macos_task: macos_instance: image: ghcr.io/cirruslabs/macos-ventura-base:latest matrix: - name: macos_clang clang_script: brew install llvm@13 env: CXX: /opt/homebrew/opt/llvm@13/bin/clang++ - name: macos_gcc gcc_script: - /usr/sbin/softwareupdate --install-rosetta --agree-to-license - arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" - arch -x86_64 /usr/local/bin/brew install gcc@10 env: CXX: g++-10 test_script: make CXX=$CXX -j$(sysctl -n hw.ncpu) test kakoune-2024.05.18/.github/000077500000000000000000000000001462203073200151115ustar00rootroot00000000000000kakoune-2024.05.18/.github/ISSUE_TEMPLATE/000077500000000000000000000000001462203073200172745ustar00rootroot00000000000000kakoune-2024.05.18/.github/ISSUE_TEMPLATE/bug_report.yml000066400000000000000000000041661462203073200221760ustar00rootroot00000000000000name: Bug report description: Report an unexpected behaviour with the editor labels: bug title: "[BUG] " body: - type: markdown attributes: value: | Please make sure to [search issues](https://github.com/mawww/kakoune/issues?q=is%3Aissue) before creating a new one, to avoid duplicates and centralise conversations. If you need to have a question about the editor itself (options, behaviour, code…) answered, make sure to check the [documentation](https://github.com/mawww/kakoune/tree/master/doc/pages) (also available via the `doc` command in the editor) or drop by [IRC](https://web.libera.chat/?channels=#kakoune) to get instant feedback. - type: input attributes: label: "Version of Kakoune" description: "If unsure, use the output of command: `kak -version`" placeholder: "v2020.12.31" validations: required: true - type: textarea attributes: label: "Reproducer" description: "What are the steps to follow to reproduce the issue?" placeholder: | If any specific configuration or environment settings are required to reproduce the issue, also describe them here. validations: required: true - type: textarea attributes: label: "Outcome" description: "What is the outcome of the reproducing steps above?" validations: required: true - type: textarea attributes: label: "Expectations" description: "What was the expected outcome of the reproducing steps above?" validations: required: true - type: textarea attributes: label: "Additional information" description: "Any other information that may be relevant to diagnosing the issue should be documented here" placeholder: | Examples of relevant information: * What OS and distribution are you using? * Are you running an experimental branch (i.e. not `master`)? * Is the issue reproducible in other terminals? validations: required: false kakoune-2024.05.18/.github/ISSUE_TEMPLATE/config.yml000066400000000000000000000003111462203073200212570ustar00rootroot00000000000000blank_issues_enabled: true contact_links: - name: IRC channel url: https://web.libera.chat/?channels=#kakoune about: Ask your questions to get real time support on the official channel kakoune-2024.05.18/.github/ISSUE_TEMPLATE/crash_report.yml000066400000000000000000000053251462203073200225170ustar00rootroot00000000000000name: Crash report description: Report a crash of the editor while in-use labels: bug, crash title: "[BUG][CRASH] " body: - type: markdown attributes: value: | Please make sure to [search issues](https://github.com/mawww/kakoune/issues?q=is%3Aissue) before creating a new one, to avoid duplicates and centralise conversations. If you need to have a question about the editor itself (options, behaviour, code…) answered, make sure to check the [documentation](https://github.com/mawww/kakoune/tree/master/doc/pages) (also available via the `doc` command in the editor) or drop by [IRC](https://web.libera.chat/?channels=#kakoune) to get instant feedback. - type: input attributes: label: "Version of Kakoune" description: "If unsure, use the output of command: `kak -version`" placeholder: "v2020.12.31" validations: required: true - type: textarea attributes: label: "Reproducer" description: "What are the steps to follow to reproduce the issue?" placeholder: | If any specific configuration or environment settings are required to reproduce the issue, also describe them here. validations: required: true - type: textarea attributes: label: "Outcome" description: "What is the outcome of the reproducing steps above?" placeholder: | If the editor printed any error messages, or if you managed to obtain a backtrace, also document them here. Make sure to demangle the stacktrace by passing it to the `c++filt` command. Note that triggering the issue in the editor compiled in debug mode will produce more helpful messages, please consider re-building with `make debug=yes` to help us out. validations: required: true - type: textarea attributes: label: "Expectations" description: "What was the expected outcome of the reproducing steps above?" placeholder: | If the reproducing steps are self-evident, the expectations are simply “the editor should not crash”. In that case, you may ignore this field. validations: required: false - type: textarea attributes: label: "Additional information" description: "Any other information that may be relevant to diagnosing the issue should be documented here" placeholder: | Examples of relevant information: * What OS and distribution are you using? * Are you running an experimental branch (i.e. not `master`)? * Is the issue reproducible in other terminals? validations: required: false kakoune-2024.05.18/.github/ISSUE_TEMPLATE/feature_request.yml000066400000000000000000000024531462203073200232260ustar00rootroot00000000000000name: Feature request description: Ask for a feature to be implemented and included in the next release labels: feature request title: "[REQUEST] " body: - type: markdown attributes: value: | Please make sure to [search issues](https://github.com/mawww/kakoune/issues?q=is%3Aissue) before creating a new one, to avoid duplicates and centralise conversations. If you need to have a question about the editor itself (options, behaviour, code…) answered, make sure to check the [documentation](https://github.com/mawww/kakoune/tree/master/doc/pages) (also available via the `doc` command in the editor) or drop by [IRC](https://web.libera.chat/?channels=#kakoune) to get instant feedback. - type: textarea attributes: label: "Feature" description: "What do you want implemented that is not already available in the development version?" validations: required: true - type: textarea attributes: label: "Usecase" description: "What use do you have for the requested feature?" placeholder: | If the feature's usecase is self-evident, such as a hook or an option whose name hints at a functionality unequivocally, you may ignore this field. validations: required: false kakoune-2024.05.18/.github/ISSUE_TEMPLATE/question.yml000066400000000000000000000016011462203073200216640ustar00rootroot00000000000000name: Question description: Couldn't find an answer in the documentation? Ask away! labels: question title: "[QUESTION] " body: - type: markdown attributes: value: | Please make sure to [search issues](https://github.com/mawww/kakoune/issues?q=is%3Aissue) before creating a new one, to avoid duplicates and centralise conversations. If you need to have a question about the editor itself (options, behaviour, code…) answered, make sure to check the [documentation](https://github.com/mawww/kakoune/tree/master/doc/pages) (also available via the `doc` command in the editor) or drop by [IRC](https://web.libera.chat/?channels=#kakoune) to get instant feedback. - type: textarea attributes: label: "Question" description: "Couldn't find an answer in the documentation? Ask away!" validations: required: true kakoune-2024.05.18/.github/PULL_REQUEST_TEMPLATE/000077500000000000000000000000001462203073200203705ustar00rootroot00000000000000kakoune-2024.05.18/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md000066400000000000000000000003531462203073200253320ustar00rootroot00000000000000 kakoune-2024.05.18/.github/workflows/000077500000000000000000000000001462203073200171465ustar00rootroot00000000000000kakoune-2024.05.18/.github/workflows/build-releases-linux.yaml000066400000000000000000000016021462203073200240660ustar00rootroot00000000000000name: Build static binaries for Linux on: release: types: [published, edited] jobs: build: runs-on: ubuntu-latest container: image: alpine:latest steps: - name: Checkout uses: actions/checkout@v3 with: ref: ${{ github.event.release.tag_name }} - name: Prepare run: apk add --no-cache binutils bzip2 g++ git make tar - name: Build run: | mkdir -p kakoune-${{ github.event.release.tag_name }}-linux/ make -j$(nproc) PREFIX=$(pwd)/kakoune-${{ github.event.release.tag_name }}-linux static=yes install strip tar cvjf kakoune-${{ github.event.release.tag_name }}-linux.tar.bz2 kakoune-${{ github.event.release.tag_name }}-linux/ - name: Upload uses: softprops/action-gh-release@v1 with: files: kakoune-${{ github.event.release.tag_name }}-linux.tar.bz2 kakoune-2024.05.18/.gitignore000066400000000000000000000002751462203073200155450ustar00rootroot00000000000000*.o *.d *.pyc *.1-r .*.kak.* *.tar* src/kak src/kak.debug src/kak.debug.san_* src/kak.opt src/kak.opt.san_* src/.version* src/.*.json doc/kak.1.gz doc/manpages/*.gz tags GPATH GRTAGS GTAGS kakoune-2024.05.18/CHANGELOG000077700000000000000000000000001462203073200222512doc/pages/changelog.asciidocustar00rootroot00000000000000kakoune-2024.05.18/CONTRIBUTING000066400000000000000000000014101462203073200153770ustar00rootroot00000000000000The preferred way to contribute would be through GitHub pull requests, as an alternative patches can be discussed on the IRC channel. When contributing your first changes, please include an empty commit for copyright waiver using the following message (replace 'John Doe' with your name or nickname): John Doe Copyright Waiver I dedicate any and all copyright interest in this software to the public domain. I make this dedication for the benefit of the public at large and to the detriment of my heirs and successors. I intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. The command to create an empty commit from the command-line is: git commit --allow-empty kakoune-2024.05.18/Makefile000066400000000000000000000134711462203073200152170ustar00rootroot00000000000000.POSIX: .SUFFIXES: CXX = c++ debug = no static = no gzip_man = yes # to get format compatible with GitHub archive use "gzip -S .gz" here compress_bin = bzip2 compress-suffix-bzip2 = bz2 compress-suffix-zstd = zst CPPFLAGS-debug-yes = -DKAK_DEBUG CXXFLAGS-debug-yes = -O0 -g3 tag-debug-yes = .debug CXXFLAGS-debug-no = -O3 -g3 tag-debug-no = .opt CXXFLAGS-sanitize-address = -fsanitize=address LDFLAGS-sanitize-address = -lasan tag-sanitize-address = .san_a CXXFLAGS-sanitize-undefined = -fsanitize=undefined LDFLAGS-sanitize-undefined = -lubsan tag-sanitize-undefined = .san_u LDFLAGS-static-yes = -static -pthread version = $(shell cat .version 2>/dev/null || git describe --tags HEAD 2>/dev/null | sed s/^v// || echo unknown) version != cat .version 2>/dev/null || ( git describe --tags HEAD 2>/dev/null | sed s/^v// ) || echo unknown PREFIX = /usr/local DESTDIR = # root dir bindir = $(DESTDIR)$(PREFIX)/bin libexecdir = $(DESTDIR)$(PREFIX)/libexec/kak sharedir = $(DESTDIR)$(PREFIX)/share/kak docdir = $(DESTDIR)$(PREFIX)/share/doc/kak mandir = $(DESTDIR)$(PREFIX)/share/man/man1 # Both Cygwin and MSYS2 have "_NT" in their uname. os = $(shell uname | sed 's/.*_NT.*/Windows/') os != uname | sed 's/.*_NT.*/Windows/' CPPFLAGS-os-Darwin = -I/opt/local/include LDFLAGS-os-Darwin = -L/opt/local/lib CPPFLAGS-os-FreeBSD = -I/usr/local/include LDFLAGS-os-FreeBSD = -L/usr/local/lib LIBS-os-Haiku = -lnetwork -lbe CPPFLAGS-os-OpenBSD = -DKAK_BIN_PATH=\"$(bindir)/kak\" -I/usr/local/include LDFLAGS-os-OpenBSD = -L/usr/local/lib mandir-os-OpenBSD = $(DESTDIR)$(PREFIX)/man/man1 LDFLAGS-os-SunOS = -lsocket -rdynamic CPPFLAGS-os-Windows = -D_XOPEN_SOURCE=700 LIBS-os-Windows = -ldbghelp CXXFLAGS-default = -std=c++2a -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-sign-compare compiler = $(shell $(CXX) --version | grep -E -o 'clang|g\+\+|c\+\+' | head -1) compiler != $(CXX) --version | grep -E -o 'clang|g\+\+|c\+\+' | head -1 CXXFLAGS-compiler-clang = -fsized-deallocation CXXFLAGS-compiler-g++ = -Wno-init-list-lifetime -Wno-stringop-overflow CXXFLAGS-compiler-c++ = $(CXXFLAGS-compiler-g++) KAK_CPPFLAGS = \ $(CPPFLAGS-default) \ $(CPPFLAGS-debug-$(debug)) \ $(CPPFLAGS-os-$(os)) \ $(CPPFLAGS) KAK_CXXFLAGS = \ $(CXXFLAGS-default) \ $(CXXFLAGS-debug-$(debug)) \ $(CXXFLAGS-sanitize-$(sanitize)) \ $(CXXFLAGS-compiler-$(compiler)) \ $(CXXFLAGS) KAK_LDFLAGS = \ $(LDFLAGS-default) \ $(LDFLAGS-sanitize-$(sanitize)) \ $(LDFLAGS-static-$(static)) \ $(LDFLAGS-os-$(os)) \ $(LDFLAGS) KAK_LIBS = \ $(LIBS-os-$(os)) \ $(LIBS) tag = $(tag-debug-$(debug))$(tag-sanitize-$(sanitize)) .SUFFIXES: $(tag).o .cc .PHONY: src/kak sources = $(shell find src -type f -name '*.cc' | sed -e '/\.version\.cc/d') sources != find src -type f -name '*.cc' | sed -e '/\.version\.cc/d' objects = $(sources:.cc=$(tag).o) all: src/kak src/kak: src/kak$(tag) ln -sf kak$(tag) $@ src/kak$(tag): src/.version.o $(objects) $(CXX) $(KAK_LDFLAGS) $(KAK_CXXFLAGS) $(KAK_LIBS) $(objects) src/.version.o -o $@ deps = $(shell touch src/.version$(tag).d && find src -type f -name '.*$(tag).d') # Ensure we find one deps for FreeBSD make deps != touch src/.version$(tag).d && find src -type f -name '.*$(tag).d' # Ensure we find one deps for FreeBSD make include $(deps) .cc$(tag).o: $(CXX) $(KAK_CPPFLAGS) $(KAK_CXXFLAGS) -MD -MP -MF $(*D)/.$(*F)$(tag).d -c -o $@ $< src/.version.cc: echo 'namespace Kakoune { const char *version = "$(version)"; }' > $@ src/.version.o: src/.version.cc $(CXX) $(KAK_CPPFLAGS) $(KAK_CXXFLAGS) -c -o $@ src/.version.cc # Generate the man page man: gzip-man-$(gzip_man) gzip-man-yes: doc/kak.1.gz gzip-man-no: doc/kak.1 doc/kak.1.gz: doc/kak.1 gzip -n -9 -f < doc/kak.1 > $@ check: test test: src/kak if [ $(os) = OpenBSD ]; then \ export KAKOUNE_RUNTIME=$$PWD/share/kak; \ fi && \ cd test && ./run TAGS: tags tags: ctags -R clean: rm -f $(objects) $(deps) src/.version* dist: kakoune-$(version).tar.$(compress-suffix-$(compress_bin)) kakoune-$(version).tar.$(compress-suffix-$(compress_bin)): kakoune-$(version).tar $(compress_bin) -f $< kakoune-$(version).tar: @if ! [ -d .git ]; then echo "make dist can only run from a git repo"; false; fi @if git status -s | grep -qEv '^\?\?'; then echo "working tree is not clean"; false; fi git archive --format=tar --prefix=$(@:.tar=)/ HEAD -o $@ echo "$(version)" > .version tar --transform "s,^,$(@:.tar=)/," -rf $@ .version rm -f .version distclean: clean rm -f src/kak src/kak$(suffix) src/.*.d src/*.o find doc -type f -name '*.gz' -exec rm -f '{}' + installdirs: installdirs-debug-$(debug) installdirs-debug-no: mkdir -p \ $(bindir) \ $(libexecdir) \ $(sharedir)/rc \ $(sharedir)/colors \ $(sharedir)/doc \ $(docdir) \ $(mandir) installdirs-debug-yes: installdirs-debug-no mkdir -p $(sharedir)/gdb install: src/kak installdirs install-debug-$(debug) install-gzip-man-$(gzip_man) cp src/kak$(suffix) $(bindir) chmod 0755 $(bindir)/kak ln -sf ../../bin/kak $(libexecdir)/kak cp share/kak/kakrc $(sharedir) chmod 0644 $(sharedir)/kakrc cp -r rc/* $(sharedir)/rc find $(sharedir)/rc -type f -exec chmod 0644 {} + [ -e $(sharedir)/autoload ] || ln -s rc $(sharedir)/autoload cp colors/* $(sharedir)/colors chmod 0644 $(sharedir)/colors/* cp README.asciidoc $(docdir) chmod 0644 $(docdir)/*.asciidoc cp doc/pages/*.asciidoc $(sharedir)/doc chmod 0644 $(sharedir)/doc/*.asciidoc install-gzip-man-yes: gzip-man-yes cp -f doc/kak.1.gz $(mandir) chmod 0644 $(mandir)/kak.1.gz install-gzip-man-no: gzip-man-no cp -f doc/kak.1 $(mandir) chmod 0644 $(mandir)/kak.1 install-debug-yes: installdirs-debug-yes cp -f gdb/kakoune.py $(sharedir)/gdb chmod 0644 $(sharedir)/gdb/kakoune.py install-debug-no: installdirs-debug-no install-strip: install strip -s $(bindir)/kak uninstall: rm -rf \ $(bindir)/kak \ $(libexecdir) \ $(sharedir) \ $(docdir) \ $(mandir)/kak.* kakoune-2024.05.18/README.asciidoc000066400000000000000000000672351462203073200162230ustar00rootroot00000000000000= image:{logo}[K,30,30,link="{website}",title="Kakoune logo by p0nce"] Kakoune image:{cirrus-img}[link="{cirrus-url}"] image:{srht-img}[link="{srht-url}"] image:{irc-img}[link="{irc-url}"] ifdef::env-github,env-browser[:outfilesuffix: .asciidoc] :logo: https://rawgit.com/mawww/kakoune/master/doc/kakoune_logo.svg :website: https://kakoune.org :cirrus-img: https://api.cirrus-ci.com/github/mawww/kakoune.svg :cirrus-url: https://cirrus-ci.com/github/mawww/kakoune :srht-img: https://builds.sr.ht/~mawww/kakoune.svg :srht-url: https://builds.sr.ht/~mawww/kakoune? :irc-img: https://img.shields.io/badge/IRC-%23kakoune-blue.svg :irc-url: https://web.libera.chat/?channels=kakoune :icons: font :toc: right :pp: ++ TL;DR ----- {website} *Modal editor* -- *Faster as in fewer keystrokes* -- *Multiple selections* -- *Orthogonal design* --------------------------------------------- git clone https://github.com/mawww/kakoune.git cd kakoune make ./src/kak --------------------------------------------- See https://github.com/mawww/golf for Kakoune solutions to vimgolf challenges, regularly beating the best Vim solution. See the link:doc/design.asciidoc[design document] for more information on Kakoune's philosophy and design. Introduction ------------ Kakoune is a code editor that implements Vi's "keystrokes as a text editing language" model. As it is also a modal editor, it is somewhat similar to the Vim editor (after which Kakoune was originally inspired). Kakoune can operate in two modes: *normal* and *insertion*. In insertion mode, keys are directly inserted into the current buffer. In normal mode, keys are used to manipulate the current selection and to enter insertion mode. Kakoune has a strong focus on interactivity. Most commands provide immediate and incremental results, while being competitive with Vim in terms of keystroke count. Kakoune works on selections, which are oriented, inclusive ranges of characters. Selections have an anchor and a cursor. Most commands move both of them except when extending selections, where the anchor character stays fixed and the cursor moves around. See https://vimeo.com/82711574 Join us on libera IRC `#Kakoune` Features ~~~~~~~~ * Multiple selections as a central way of interacting * Powerful selection manipulation primitives - Select all regex matches in current selections - Keep selections containing/not containing a match for a given regex - Split current selections with a regex - Text objects (paragraph, sentence, nestable blocks) * Powerful text manipulation primitives - Align selections - Rotate selection contents - Case manipulation - Indentation - Piping each selection to external filter * Client-Server architecture - Multiple clients on the same editing session - Use tmux or your X11 window manager to manage windows * Simple interaction with external programs * Automatic contextual help * Automatic as you type completion * Macros * Hooks * Syntax Highlighting - Supports multiple languages in the same buffer - Highlight a buffer differently in different windows Screenshots ~~~~~~~~~~~ [[screenshot-i3]] .Kakoune in i3 image::doc/screenshot-i3.gif[Kakoune in i3] [[screenshot-tmux]] .Kakoune in tmux image::doc/screenshot-tmux.gif[Kakoune in tmux] Getting started --------------- Building ~~~~~~~~ Kakoune's dependencies are: * A {cpp}20 compliant compiler (GCC >= 10.3 or clang >= 11) along with its associated {cpp} standard library (libstdc{pp} >= 10 or libc{pp}) To build, just type *make* in the src directory. To generate man pages, type *make man* in the src directory. Kakoune can be built on Linux, MacOS, and Cygwin. Due to Kakoune relying heavily on being in a Unix-like environment, no native Windows version is planned. Installing ~~~~~~~~~~ In order to install *kak* on your system, rather than running it directly from its source directory, type *make install*. You can specify the `PREFIX` and `DESTDIR` if needed. [TIP] .Homebrew (macOS) or Linuxbrew ==== --------------------------------- brew install kakoune --------------------------------- ==== [TIP] .MacPorts (macOS) ==== --------------------------------- sudo port selfupdate sudo port install kakoune --------------------------------- ==== [TIP] .Fedora supported versions and Rawhide ==== --------------------------------- dnf install kakoune --------------------------------- ==== [TIP] .Fedora daily builds ==== Use the https://copr.fedoraproject.org/coprs/jkonecny/kakoune/[copr] repository. --------------------------------- dnf copr enable jkonecny/kakoune dnf install kakoune --------------------------------- ==== [TIP] .RHEL/CentOS 8 ==== Kakoune can be found in the https://src.fedoraproject.org/rpms/kakoune/tree/epel8[EPEL8 repositories]. --------------------------------- dnf install kakoune --------------------------------- ==== [TIP] .Arch Linux ==== Kakoune is found in the https://www.archlinux.org/packages/community/x86_64/kakoune/[repositories]. -------------------------------------------------- pacman -S kakoune -------------------------------------------------- ==== [TIP] .Gentoo ==== Kakoune is found in portage as https://packages.gentoo.org/packages/app-editors/kakoune[app-editors/kakoune]. -------------------------------- emerge kakoune -------------------------------- https://wiki.gentoo.org/wiki/Kakoune[Installation and Gentoo specific documentation] is available. ==== [TIP] .Exherbo ==== -------------------------------- cave resolve -x repository/mawww cave resolve -x kakoune -------------------------------- ==== [TIP] .openSUSE ==== Kakoune can be found in the https://software.opensuse.org/package/kakoune[repositories]. --------------------------- sudo zypper install kakoune --------------------------- ==== [TIP] .Ubuntu ==== Kakoune can be found in the Ubuntu repositories. ---------------------------- sudo apt install kakoune ---------------------------- If you want to compile from source on 20.04 or earlier, you must force the build to use GCC 10, which is not the default. Also, make sure you have .local/bin in your path so that kak is available after the installation. ---------------------------------------------------------------- git clone https://github.com/mawww/kakoune.git && cd kakoune/src CXX=g++-10 make make PREFIX=$HOME/.local install ---------------------------------------------------------------- ==== [TIP] .Debian ==== Kakoune can be found in Debian 9 (Stretch) and later releases. --------------------------- sudo apt install kakoune --------------------------- ==== [TIP] .FreeBSD ==== Kakoune is available in the official ports tree as https://www.freshports.org/editors/kakoune[editors/kakoune]. A binary package is also available and can be installed with -------------------------------------------------- pkg install kakoune -------------------------------------------------- ==== [TIP] .OpenBSD ==== Building on OpenBSD 6.7 amd64. -------------------------------------------------- # pkg_add git gmake # git clone https://github.com/mawww/kakoune # cd kakoune # export CXX=clang++ # gmake install -------------------------------------------------- Kakoune is available in the 6.7-current port tree as http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/editors/kakoune/[editors/kakoune] A binary package is also available for -current snapshot and can be installed with -------------------------------------------------- # pkg_add kakoune -------------------------------------------------- Running with support for plugins. -------------------------------------------------- # pkg_add dash $ export KAKOUNE_POSIX_SHELL=/usr/local/bin/dash $ kak -------------------------------------------------- ==== [TIP] .Solus ==== Kakoune is available in the Solus stable repository. It can be installed with --------------------- eopkg install kakoune --------------------- ==== [TIP] .Void ==== Kakoune is available in the repositories. It can be installed with ----------------------- xbps-install -S kakoune ----------------------- ==== [TIP] .Termux ==== Kakoune is available in the repositories. It can be installed with ------------------- pkg install kakoune ------------------- ==== [TIP] .Nix ==== -------------------------------- nix-env -iA nixpkgs.kakoune -------------------------------- ==== Running ~~~~~~~ Running *kak* launches a new kak session with a client on local terminal. Run *kak -help* to discover the valid command line flags. Configuration ^^^^^^^^^^^^^ There are two directories containing Kakoune's scripts: * `runtime`: located in `../share/kak/` relative to the `kak` binary contains the system scripts, installed with Kakoune. * `userconf`: located in `$XDG_CONFIG_HOME/kak/`, which will fallback to `$HOME/.config/kak/` if `$XDG_CONFIG_HOME` is not set, containing the user configuration. Unless `-n` is specified, Kakoune will load its startup script located at `${runtime}/kakrc` relative to the `kak` binary. This startup script is responsible for loading the user configuration. First, Kakoune will search recursively for `.kak` files in the `autoload` directory. It will first look for an `autoload` directory at `${userconf}/autoload` and will fallback to `${runtime}/autoload` if it does not exist. Once all those files are loaded, Kakoune will try to source `${runtime}/kakrc.local`, which is expected to contain distribution provided configuration. Finally, the user configuration will load from `${userconf}/kakrc`. NOTE: If you create a user `autoload` directory in `${userconf}/autoload`, the system one at `${runtime}/autoload` will not load anymore. You can add a symbolic link to it (or to individual scripts) inside `${userconf}/autoload` to keep loading system scripts. Basic Interaction ----------------- Selections ~~~~~~~~~~ The main concept in Kakoune is the selection. A selection is an inclusive, directed range of characters. A selection has two ends, the anchor and the cursor. There is always at least one selection, and a selection is always at least one character (in which case the anchor and cursor of the selection are on the same character). Normal Mode ~~~~~~~~~~~ In normal mode, keys are not inserted directly inside the buffer, but are editing commands. These commands provide ways to manipulate either the selections themselves or the selected text. Insert Mode ~~~~~~~~~~~ When entering insert mode, keys are now directly inserted before each selection's cursor. Some additional keys are recognised in insert mode: * ``: leave insert mode * ``: delete characters before cursors * ``: delete characters under cursors * `, , , `: move cursors in given direction * ``: move cursors to line beginning * ``: move cursors to line ending * ``: select next completion candidate * ``: select previous completion candidate * ``: explicit insert completion query, followed by: - `f`: explicit file completion - `w`: explicit word completion - `l`: explicit line completion * ``: disable automatic completion for this insert session * ``: insert contents of the register given by next key * ``: insert next keystroke directly into the buffer, without interpreting it * ``: commit changes up to now as a single undo group * ``: escape to normal mode for a single command Movement ~~~~~~~~ See <> below for instructions on extending (appending to) the current selection in order to select more text. * `h`: select the character on the left of selection end * `j`: select the character below the selection end * `k`: select the character above the selection end * `l`: select the character on the right of selection end * `w`: select the word and following whitespaces on the right of selection end * `b`: select preceding whitespaces and the word on the left of selection end * `e`: select preceding whitespaces and the word on the right of selection end * ``: same as [wbe], but select WORD instead of word * `f`: select to (including) the next occurrence of the given character * `t`: select until (excluding) the next occurrence of the given character * ``: same as [ft] but in the other direction * `m`: select to matching character * `M`: extend selection to matching character * `x`: expand selections to contain full lines (including end-of-lines) * ``: trim selections to only contain full lines (not including last end-of-line) * `%`: select whole buffer * ``: select to line begin * ``: select to line end * `/`: search (select next match) * ``: search (select previous match) * `?`: search (extend to next match) * ``: search (extend to previous match) * `n`: select next match * `N`: add a new selection with next match * ``: select previous match * ``: add a new selection with previous match * `pageup, `: scroll one page up * `pagedown, `: scroll one page down * ``: scroll half a page up * ``: scroll half a page down * `)`: rotate selections (the main selection becomes the next one) * `(`: rotate selections backwards * `;`: reduce selections to their cursor * ``: flip the selections' direction * ``: ensure selections are in forward direction (cursor after anchor) * ``: repeat last object or `f`/`t` selection command. * `_`: trim selections A word is a sequence of alphanumeric characters or underscore, a WORD is a sequence of non whitespace characters. Appending ~~~~~~~~~ For most <> commands, using `Shift` extends the current selection instead of replacing it. Examples: * `wWW` selects 3 consecutive words: first `w` selects a word, then `WW` extends the selection two words further. * `f/F/` selects up to and including the second `/` character forward. Using Counts ~~~~~~~~~~~~ Most selection commands also support counts, which are entered before the command itself. For example, `3W` selects 3 consecutive words and `3w` select the third word on the right of selection end. Disabling Hooks ~~~~~~~~~~~~~~~ Any normal mode command can be prefixed with `\` which will disable hook execution for the duration for the command (including the duration of modes the command could move to, so `\i` will disable hooks for the whole insert session). As autoindentation is implemented in terms of hooks, this can be used to disable it when pasting text. Changes ~~~~~~~ * `i`: enter insert mode before each selection * `a`: enter insert mode after each selection * `d`: yank and delete each selection * `c`: yank and delete each selection and enter insert mode * `.`: repeat last insert mode change (`i`, `a`, or `c`, including the inserted text) * ``: delete each selection * ``: delete each selection and enter insert mode * `I`: enter insert mode at each selection begin line start * `A`: enter insert mode at each selection end line end * `o`: enter insert mode in one (or given count) new lines below each selection end * `O`: enter insert mode in one (or given count) new lines above each selection begin * ``: add an empty line below each cursor * ``: add an empty line above each cursor * `y`: yank selections * `p`: paste after each selection end * `P`: paste before each selection begin * ``: paste all after each selection end * ``: paste all before each selection begin * `R`: replace each selection with yanked text * ``: replace each selection with every yanked text * `r`: replace each character with the next entered one * ``: join selected lines * ``: join selected lines and select spaces inserted in place of line breaks * ``: merge contiguous selections together (works across lines as well) * ` (>)`: indent selected lines * ``: indent selected lines, including empty lines * ` (<)`: deindent selected lines * ``: deindent selected lines, do not remove incomplete indent (3 leading spaces when indent is 4) * `|`: pipe each selection through the given external filter program and replace the selection with its output. * ``: pipe each selection through the given external filter program and ignore its output * `!`: insert command output before each selection * ``: append command output after each selection * `u`: undo last change * ``: move backward in history * ``: undo selection changes * `U`: redo last change * ``: move forward in history * ``: redo selection changes * `&`: align selections, align the cursor of selections by inserting spaces before the first character of the selection * ``: copy indent, copy the indentation of the main selection (or the count one if a count is given) to all other ones * ```: to lower case * `~`: to upper case * ````: swap case * `@`: convert selected tabs to spaces, uses the buffer tabstop option or the count parameter for tabstop. * ``: convert selected spaces to tabs, uses the buffer tabstop option or the count parameter for tabstop. * ``: rotate selections content, if specified, the count groups selections, so `3` rotate (1, 2, 3) and (4, 5, 6) independently. * ``: rotate selections content backwards Goto Commands ~~~~~~~~~~~~~ Commands beginning with `g` are used to goto certain position and or buffer. If a count is given prior to hitting `g`, `g` will jump to the given line. Using `G` will extend the selection rather than jump. See <>. View commands ~~~~~~~~~~~~~ Commands beginning with `v` permit to center or scroll the current view. Using `V` will lock view mode until `` is hit See <>. Marks ~~~~~ Current selections position can be saved in a register and restored later on. See <>. Jump list ~~~~~~~~~ Some commands, like the goto commands, buffer switch or search commands, push the previous selections to the client's jump list. See <>. Multi Selection ~~~~~~~~~~~~~~~ Kak was designed from the start to handle multiple selections. One way to get a multiselection is via the `s` key. For example, to change all occurrences of word 'roger' to word 'marcel' in a paragraph, here is what can be done: * select the paragraph with `x` then enough `J` * press `s` and enter roger, then enter * now paragraph selection was replaced with multiselection of each roger in the paragraph * press `c` and marcel to replace rogers with marcels A multiselection can also be obtained with `S`, which splits the current selection according to the regex entered. To split a comma separated list, use `S` then ', *' The regex syntax supported by Kakoune is the based on the ECMAScript script syntax and is described at <>. `s` and `S` share the search pattern with `/`, and hence entering an empty pattern uses the last one. As a convenience, `` allows you to split the current selections on line boundaries. To clear multiple selections, use `,`. To keep only the nth selection use `n` followed by `,`, in order to remove a selection, use ``. `` allows you to enter a regex and keep only the selections that contains a match for this regex. Using `` you can keep the selections not containing a match. `C` duplicates selections on the lines that follow them. `` does the same but on the preceding lines. `$` allows you to enter a shell command and pipe each selection to it. Selections whose shell command returns 0 will be kept, other will be dropped. Object Selection ~~~~~~~~~~~~~~~~ Objects are specific portions of text, like sentences, paragraphs, numbers… Kakoune offers many keys allowing you to select various text objects. See <>. Commands -------- When pressing `:` in normal mode, Kakoune will open a prompt to enter a command. Commands are used for non editing tasks, such as opening a buffer, writing the current one, quitting, etc. See <>. Basic Commands ~~~~~~~~~~~~~~ Some commands take an exclamation mark (`!`), which can be used to force the execution of the command (i.e. to quit a modified buffer, the command `q!` has to be used). Commands starting with horizontal whitespace (e.g. a space) will not be saved in the command history. * `cd []`: change the current directory to ``, or the home directory if unspecified * `doc `: display documentation about a topic. The completion list displays the available topics. * `e[dit][!] [ []]`: open buffer on file, go to given line and column. If file is already opened, just switch to this file. Use edit! to force reloading. * `w[rite][!] []`: write buffer to or use its name if filename is not given. If the file is write-protected, its permissions are temporarily changed to allow saving the buffer and restored afterwards when the write! command is used. * `w[rite]a[ll]`: write all buffers that are associated to a file. * `q[uit][!] []`: exit Kakoune, use quit! to force quitting even if there is some unsaved buffers remaining. If specified, the client exit status will be set to . * `w[a]q[!] []`: write the current buffer (or all buffers when `waq` is used) and quit. If specified, the client exit status will be set to . * `kill[!]`: terminate the current session, all the clients as well as the server, use kill! to ignore unsaved buffers * `b[uffer] `: switch to buffer * `b[uffer]n[ext]`: switch to the next buffer * `b[uffer]p[rev]`: switch to the previous buffer * `d[el]b[uf][!] []`: delete the buffer * `source `: execute commands in * `colorscheme `: load named colorscheme. * `rename-client `: set current client name * `rename-buffer `: set current buffer name * `rename-session `: set current session name * `echo [options] `: show in status line, with the following options: ** `-markup`: expand the markup strings in ** `-debug`: print the given text to the `\*debug*` buffer * `nop`: does nothing, but as with every other commands, arguments may be evaluated. So nop can be used for example to execute a shell command while being sure that its output will not be interpreted by kak. `:%sh{ echo echo tchou }` will echo tchou in Kakoune, whereas `:nop %sh{ echo echo tchou }` will not, but both will execute the shell command. * `fail `: raise an error, uses as its description Multiple commands ~~~~~~~~~~~~~~~~~ Multiple commands can be separated either by new lines or by semicolons, as such a semicolon must be escaped with `\;` to be considered as a literal semicolon argument. String syntax and expansions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Values, options and shell context can be interpolated in strings. See <>. Configuration & Autoloading --------------------------- Kakrc ~~~~~ If not launched with the `-n` switch, Kakoune will source the `../share/kak/kakrc` file relative to the `kak` binary, which will source additional files: If the `$XDG_CONFIG_HOME/kak/autoload` directory exists, load every `*.kak` files in it, and load recursively any subdirectory. If it does not exist, falls back to the site wide autoload directory in `../share/kak/autoload/`. After that, if it exists, source the `$XDG_CONFIG_HOME/kak/kakrc` file which should be used for user configuration. In order to continue autoloading site-wide files with a local autoload directory, just add a symbolic link to `../share/kak/autoload/` into your local autoload directory. Color Schemes ~~~~~~~~~~~~~ Kakoune ships with some color schemes that are installed to `../share/kak/colors/`. If `$XDG_CONFIG_HOME/kak/colors/` is present the builtin command `colorscheme` will offer completion for those color schemes. If a scheme is duplicated in userspace, it will take precedence. Options ------- Kakoune can store named and typed values that can be used both to customize the core editor behaviour, and to keep data used by extension scripts. See <>. Advanced topics --------------- Faces ~~~~~ Faces describe how characters are displayed on the screen: color, bold, italic... See <>. Registers ~~~~~~~~~ Registers are named lists of text. They are used for various purposes, like storing the last yanked text, or the captured groups associated with the selections. See <>. Macros ~~~~~~ Kakoune can record and replay a sequence of key presses. See <>. Search selection ~~~~~~~~~~~~~~~~ Using the `*` key, you can set the search pattern to the current selection. See <>. Regex syntax ~~~~~~~~~~~~ Kakoune regex syntax is based on the ECMAScript syntax (ECMA-262 standard). It always runs on Unicode codepoint sequences, not on bytes. See <>. Exec and Eval ~~~~~~~~~~~~~ The `execute-keys` and `evaluate-commands` are useful for scripting in non interactive contexts. See <>. Insert mode completion ~~~~~~~~~~~~~~~~~~~~~~ Kakoune can propose completions while inserting text: filenames, words, lines… See <>. Escape to normal mode ~~~~~~~~~~~~~~~~~~~~~ From insert mode, pressing `` allows you to execute a single normal mode command. This provides a few advantages: * The selections are not modified: when leaving insert mode using `` the selections can change, for example when insert mode was entered with `a` the cursor will go back one char. Or if on an end of line the cursor will go back left (if possible). * The modes are nested: that means the normal mode can enter prompt (with `:`), or any other modes (using `:on-key` or `:menu` for example), and these modes will get back to the insert mode afterwards. This feature is tailored for scripting/macros, as it provides a more predictable behaviour than leaving insert mode with ``, executing normal mode command and entering back insert mode (with which binding ?) See <>. Highlighters ~~~~~~~~~~~~ Manipulation of the displayed text, such as syntax coloration and wrapping is done through highlighters. See <>. Hooks ~~~~~ Commands can be registered to be executed when certain events arise with hooks. See <>. Key Mapping ~~~~~~~~~~~ Custom key shortcuts can be registered through mappings. See <>. Defining Commands and Aliases ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ New commands can be created using `:define-command`. See <>. They can be given additional short names depending of the scope with `:alias`. See <>. Some helper commands are available to define composite commands. See <>. FIFO Buffers ~~~~~~~~~~~ FIFO buffers are very useful for running some commands asynchronously while progressively displaying their result in Kakoune. See <>. Credits ------- Thanks to https://github.com/p0nce[p0nce] for designing the https://github.com/mawww/kakoune/blob/master/doc/kakoune_logo.svg[Kakoune logo]. And thanks to all the https://github.com/mawww/kakoune/graphs/contributors[contributors] who help move the project forward! kakoune-2024.05.18/UNLICENSE000066400000000000000000000022741462203073200150260ustar00rootroot00000000000000This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to kakoune-2024.05.18/VIMTOKAK000066400000000000000000000051611462203073200147240ustar00rootroot00000000000000Vi(m) to Kakoune: ================= Kakoune is inspired heavily by Vim. It strives to be as efficient as Vim, more consistent and simpler. A big difference is that a lot of special features in Vim just become regular interactions of basic features in Kakoune. Operations and moves are reversed in Kakoune. First select whatever text you want to operate on, and then use a modifying operation. That makes things more consistent: Vim needs separate x and d operations because of the operator -> move order, while Kakoune only needs the d operation. Selecting first also allows more complex selections. delete a word: * vim: dw * kak: wd delete a character: * vim: x * kak: d or ;d (; reduces the selection to a single char) copy a line: * vim: yy * kak: xy global replace: * vim: :%s/word/replacement * kak: %swordcreplacement, Explanation: '%' selects the entire buffer, 's' opens a prompt for a regex, validates the regex and replaces the selection with one per match (hence all occurences of "word" are selected). 'c' deletes the selection contents and enters insert mode where "replacement" is typed, and goes back to normal mode. The final ',' gets rid of multiple cursors. Note that the Kakoune version is one key less, and is not a special feature per se, but just a nice way Kakoune features work together. global interactive replace: * vim: :%s/word/replacement/gc and then keep pressing 'y' to accept the change or 'n' to reject. * kak: /wordcreplacement and then press 'n' to search for the next occurence and either '.' to redo the last insert operation (that is replace 'word' with 'replacement') or 'n' to go to the next match. replace in current curly brace block: * vim: viB:s/word/replacement * kak: Bswordcreplacement Here again, Vim had to rely on a special feature, visual mode. join line with next: * vim: J * kak: delete to line end: * vim: d$ * kak: d or Gld Some classic Vim moves are not bound to the same key. Kakoune uses shifted moves to extend the selection, so Vim moves that were bound to shifted characters had to change. * % became m (for "matching"). However, m replaces the selection with the next block. If you want to get a selection from the current point to the next block's end, you should use ;M (; reduces the selection to one character). * 0 and $ became and . Equivalent bindings are gh and gl. :[gv]/re/cmd To emulate :g or :v, use % to select the whole buffer, to get one selection per line, and then or to keep only the selections matching (or not matching) the entered regex. kakoune-2024.05.18/colors/000077500000000000000000000000001462203073200150525ustar00rootroot00000000000000kakoune-2024.05.18/colors/base16.kak000066400000000000000000000052351462203073200166300ustar00rootroot00000000000000## ## base16.kak by lenormf ## evaluate-commands %sh{ black_lighterer='rgb:383838' black_lighter='rgb:2D2D2D' black_light='rgb:1C1C1C' cyan_light='rgb:7CB0FF' green_dark='rgb:A1B56C' grey_dark='rgb:585858' grey_light='rgb:D8D8D8' magenta_dark='rgb:AB4642' magenta_light='rgb:AB4434' orange_dark='rgb:DC9656' orange_light='rgb:F7CA88' purple_dark='rgb:BA8BAF' ## code echo " face global value ${orange_dark}+b face global type ${orange_light} face global variable ${magenta_dark} face global module ${green_dark} face global function ${cyan_light} face global string ${green_dark} face global keyword ${purple_dark}+b face global operator ${cyan_light} face global attribute ${orange_dark} face global comment ${grey_dark} face global documentation comment face global meta ${orange_light} face global builtin default+b " ## markup echo " face global title blue face global header ${cyan_light} face global mono ${green_dark} face global block ${orange_dark} face global link blue face global bullet ${magenta_light} face global list ${magenta_dark} " ## builtin echo " face global Default ${grey_light},${black_lighter} face global PrimarySelection white,blue+fg face global SecondarySelection black,blue+fg face global PrimaryCursor black,white+fg face global SecondaryCursor black,white+fg face global PrimaryCursorEol black,${cyan_light}+fg face global SecondaryCursorEol black,${cyan_light}+fg face global LineNumbers ${grey_light},${black_lighter} face global LineNumberCursor ${grey_light},rgb:282828+b face global MenuForeground ${grey_light},blue face global MenuBackground blue,${grey_light} face global MenuInfo ${cyan_light} face global Information ${black_light},${cyan_light} face global Error ${grey_light},${magenta_light} face global DiagnosticError ${magenta_light} face global DiagnosticWarning ${cyan_light} face global StatusLine ${grey_light},${black_lighterer} face global StatusLineMode ${orange_dark} face global StatusLineInfo ${cyan_light} face global StatusLineValue ${green_dark} face global StatusCursor ${black_lighterer},${cyan_light} face global Prompt ${black_light},${cyan_light} face global MatchingChar ${cyan_light},${black_light}+b face global BufferPadding ${cyan_light},${black_lighter} face global Whitespace ${grey_dark}+f " } kakoune-2024.05.18/colors/black-on-white.kak000066400000000000000000000034311462203073200203470ustar00rootroot00000000000000# Black-on-bright-white colorscheme for minimal distraction & maximal contrast. # Works well with e-ink screens. # For Code face global value black face global type black face global variable black face global module black face global function black face global string black face global keyword black face global operator black face global attribute black face global comment black face global documentation comment face global meta black face global builtin black # For markup face global title black face global header black face global mono black face global block black face global link black face global bullet black face global list black # builtin faces face global Default black,bright-white face global PrimarySelection black,rgb:cccccc+fg face global SecondarySelection black,rgb:e0e0e0+fg face global PrimaryCursor bright-white,black+fg face global SecondaryCursor bright-white,rgb:777777+fg face global PrimaryCursorEol black,rgb:777777+fg face global SecondaryCursorEol black,rgb:aaaaaa+fg face global LineNumbers black,bright-white face global LineNumberCursor bright-white,black face global MenuForeground bright-white,black+fg face global MenuBackground black,rgb:e0e0e0+fg face global MenuInfo black # Overridden by MenuForeground and MenuBackground face global Information black,rgb:e0e0e0 face global Error bright-white,black face global DiagnosticError black face global DiagnosticWarning black face global StatusLine black,bright-white face global StatusLineMode black,bright-white face global StatusLineInfo black,bright-white face global StatusLineValue black,bright-white face global StatusCursor bright-white,black face global Prompt bright-white,black face global MatchingChar black,bright-white+b face global Whitespace black,bright-white+fd face global BufferPadding black,bright-white kakoune-2024.05.18/colors/default.kak000066400000000000000000000030271462203073200171700ustar00rootroot00000000000000# Kakoune default color scheme # For Code face global value red face global type yellow face global variable green face global module green face global function cyan face global string magenta face global keyword blue face global operator yellow face global attribute green face global comment cyan face global documentation comment face global meta magenta face global builtin default+b # For markup face global title blue face global header cyan face global mono green face global block magenta face global link cyan face global bullet cyan face global list yellow # builtin faces face global Default default,default face global PrimarySelection white,blue+fg face global SecondarySelection black,blue+fg face global PrimaryCursor black,white+fg face global SecondaryCursor black,white+fg face global PrimaryCursorEol black,cyan+fg face global SecondaryCursorEol black,cyan+fg face global LineNumbers default,default face global LineNumberCursor default,default+r face global MenuForeground white,blue face global MenuBackground blue,white face global MenuInfo cyan face global Information black,yellow face global Error black,red face global DiagnosticError red face global DiagnosticWarning yellow face global StatusLine cyan,default face global StatusLineMode yellow,default face global StatusLineInfo blue,default face global StatusLineValue green,default face global StatusCursor black,cyan face global Prompt yellow,default face global MatchingChar default,default+b face global Whitespace default,default+fd face global BufferPadding blue,default kakoune-2024.05.18/colors/desertex.kak000066400000000000000000000040141462203073200173640ustar00rootroot00000000000000# desertex theme # Code face global value rgb:fa8072 face global type rgb:dfdfbf face global identifier rgb:87ceeb face global string rgb:fa8072 face global error rgb:c3bf9f+b face global keyword rgb:eedc82 face global operator rgb:87ceeb face global attribute rgb:eedc82 face global comment rgb:7ccd7c+i face global documentation comment # #include <...> face global meta rgb:ee799f # Markup face global title blue face global header cyan face global mono green face global block magenta face global link cyan face global bullet cyan face global list yellow # Builtin # fg,bg+attributes # face global Default default,rgb:262626 <- change the terminal bg color instead face global Default default,default face global PrimarySelection white,blue+fg face global SecondarySelection black,blue+fg face global PrimaryCursor black,white+fg face global SecondaryCursor black,white+fg face global PrimaryCursorEol black,rgb:7ccd7c+fg face global SecondaryCursorEol black,rgb:7ccd7c+fg face global LineNumbers rgb:605958 face global LineNumberCursor yellow,default+b # Bottom menu: # text + background face global MenuBackground black,rgb:c2bfa5+b # selected entry in the menu (use 302028 when true color support is fixed) face global MenuForeground rgb:f0a0c0,magenta # completion menu info face global MenuInfo white,rgb:445599 # assistant, [+] face global Information black,yellow face global Error white,red face global DiagnosticError red face global DiagnosticWarning yellow face global StatusLine cyan,default # Status line modes and prompts: # insert, prompt, enter key... face global StatusLineMode rgb:ffd75f,default # 1 sel face global StatusLineInfo blue,default # param=value, reg=value. ex: "ey face global StatusLineValue green,default face global StatusCursor black,cyan # : face global Prompt blue # (), {} face global MatchingChar cyan+b # EOF tildas (~) face global BufferPadding blue,default # Whitespace characters face global Whitespace default+f kakoune-2024.05.18/colors/github.kak000066400000000000000000000032031462203073200170220ustar00rootroot00000000000000## ## github.kak by lenormf ## v1.0 ## ## code face global value rgb:0086B3+b face global type rgb:795DA3 face global variable rgb:0086B3 face global module rgb:0086B3 face global function rgb:A71D5D face global string rgb:183691 face global keyword rgb:A71D5D+b face global operator yellow face global attribute rgb:A71D5D face global comment rgb:AAAAAA face global documentation comment face global meta rgb:183691 face global builtin default+b ## markup face global title blue face global header cyan face global mono green face global block magenta face global link cyan face global bullet cyan face global list yellow ## builtin face global Default rgb:121213,rgb:F8F8FF face global PrimarySelection rgb:121213,rgb:A6F3A6+fg face global SecondarySelection rgb:121213,rgb:DBFFDB+fg face global PrimaryCursor rgb:121213,rgb:888888+fg face global SecondaryCursor rgb:121213,rgb:AAAAAA+fg face global PrimaryCursorEol rgb:121213,rgb:A71D5D+fg face global SecondaryCursorEol rgb:121213,rgb:A71D5D+fg face global LineNumbers rgb:A0A0A0,rgb:ECECEC face global LineNumberCursor rgb:434343,rgb:DDDDDD face global MenuForeground rgb:434343,rgb:CDCDFD face global MenuBackground rgb:F8F8FF,rgb:808080 face global Information rgb:F8F8FF,rgb:4078C0 face global Error rgb:F8F8FF,rgb:BD2C00 face global DiagnosticError rgb:CF222E face global DiagnosticWarning rgb:9A6700 face global StatusLine rgb:434343,rgb:DDDDDD face global StatusCursor rgb:434343,rgb:CDCDFD face global Prompt rgb:F8F8FF,rgb:4078C0 face global MatchingChar rgb:F8F8FF,rgb:4078C0+b face global Search default,default+u face global BufferPadding rgb:A0A0A0,rgb:F8F8FF face global Whitespace rgb:A0A0A0+f kakoune-2024.05.18/colors/greyscale.kak000066400000000000000000000055131462203073200175240ustar00rootroot00000000000000# Greyscale: monochromatic grey-based light colorscheme evaluate-commands %sh{ grey_light_5="rgb:fafafa" grey_light_4="rgb:f5f5f5" grey_light_3="rgb:eeeeee" grey_light_2="rgb:e0e0e0" grey_light_1="rgb:bdbdbd" grey="rgb:9e9e9e" grey_dark_1="rgb:757575" grey_dark_2="rgb:616161" grey_dark_3="rgb:424242" grey_dark_4="rgb:212121" cat < face global meta $yellow # Markup face global title $blue face global header $cyan face global mono $green face global block $purple face global link $cyan face global bullet $cyan face global list $yellow # Builtin face global Default $white,$black face global PrimarySelection $black,$white+bfg face global SecondarySelection $black,$white+fg face global PrimaryCursor white,$purple+bfg face global SecondaryCursor $black,$purple+fg face global PrimaryCursorEol $black,$green+fg face global SecondaryCursorEol $black,$green+fg face global LineNumbers $gutter_fg_grey face global LineNumberCursor $yellow,default+b # Bottom menu: # text + background face global MenuBackground $black,$white face global MenuForeground $black,$purple # completion menu info face global MenuInfo $menu_grey,default+i # assistant, [+] face global Information $white,$visual_grey face global Error $white,$red face global DiagnosticError $red face global DiagnosticWarning $yellow face global StatusLine $white,$black # Status line face global StatusLineMode $black,$purple # insert, prompt, enter key ... face global StatusLineInfo $white,$visual_grey # 1 sel face global StatusLineValue $visual_grey,$green # param=value, reg=value. ex: \"ey face global StatusCursor white,$purple+bg face global Prompt $purple,$black # : face global MatchingChar $red+b # (), {} face global BufferPadding $gutter_fg_grey,$black # EOF tildas (~) # Whitespace characters face global Whitespace $gutter_fg_grey,$black+fg " } kakoune-2024.05.18/colors/plain.kak000066400000000000000000000026171462203073200166530ustar00rootroot00000000000000 # Kakoune simple colors, mostly default # For default face global value default face global type default face global identifier default face global string blue face global keyword default face global operator default face global attribute default face global comment blue face global documentation comment face global meta default face global builtin default # For default face global title default face global header default face global mono default face global block default face global link blue face global bullet default face global list default # builtin default face global Default default,default face global PrimarySelection white,blue face global SecondarySelection black,blue face global PrimaryCursor black,white face global SecondaryCursor white,blue face global PrimaryCursorEol white,blue face global SecondaryCursorEol default face global LineNumbers default face global LineNumberCursor default face global MenuForeground black,blue face global MenuBackground blue,black face global MenuInfo default face global Information blue,black face global Error default face global DiagnosticError default face global DiagnosticWarning default face global StatusLine default face global StatusLineMode default face global StatusLineInfo default face global StatusLineValue default face global StatusCursor default+r face global Prompt default face global MatchingChar default face global BufferPadding default kakoune-2024.05.18/colors/red-phoenix.kak000066400000000000000000000053371462203073200177740ustar00rootroot00000000000000## ## Red Phoenix (dkeg) - adapted by boj ## evaluate-commands %sh{ black="rgb:000000" blue="rgb:81a2be" orange1="rgb:F2361E" orange2="rgb:ED4B19" orange3="rgb:FA390F" light_orange1="rgb:DF9767" white1="rgb:EDEDED" white2="rgb:E1E1E1" gray1="rgb:6F6F6F" gray2="rgb:D1D1D1" gray3="rgb:2D2D2D" gray4="rgb:909090" tan1="rgb:D2C3AD" tan2="rgb:AAA998" tan3="rgb:DF9767" yellow1="rgb:AAA998" purple1="rgb:4C3A3D" foreground=${white1} background=${black} selection=${purple1} window=${gray3} text=${white2} text_light=${white1} line=${tan1} comment=${gray1} ## code echo " face global value ${orange2} face global type ${gray2} face global variable ${orange1} face global module ${gray2} face global function ${yellow1} face global string ${tan2} face global keyword ${light_orange1} face global operator ${yellow1} face global attribute ${tan1} face global comment ${gray1} face global documentation comment face global meta ${gray2} face global builtin ${tan1} " ## markup echo " face global title blue face global header ${orange1} face global mono ${yellow1} face global block ${tan1} face global link blue face global bullet ${gray1} face global list ${gray1} " ## builtin echo " face global Default ${text},${background} face global PrimarySelection default,${selection}+fg face global SecondarySelection default,${selection}+fg face global PrimaryCursor black,${tan1}+fg face global SecondaryCursor black,${tan2}+fg face global PrimaryCursorEol black,${orange1}+fg face global SecondaryCursorEol black,${orange2}+fg face global LineNumbers ${text_light},${background} face global LineNumberCursor ${text},${gray1}+b face global MenuForeground ${text_light},blue face global MenuBackground ${orange1},${window} face global MenuInfo ${gray1} face global Information white,${window} face global Error white,${gray1} face global DiagnosticError ${orange1} face global DiagnosticWarning ${orange2} face global StatusLine ${text},${window} face global StatusLineMode ${yellow1}+b face global StatusLineInfo ${orange2} face global StatusLineValue ${orange2} face global StatusCursor ${window},${orange2} face global Prompt ${background},${orange2} face global MatchingChar ${orange3},${background}+b face global BufferPadding ${orange2},${background} face global Whitespace default+f " } kakoune-2024.05.18/colors/reeder.kak000066400000000000000000000057041462203073200170160ustar00rootroot00000000000000## ## reeder theme ## a light theme inspired after https://github.com/hyspace/st2-reeder-theme ## evaluate-commands %sh{ white="rgb:f9f8f6" white_light="rgb:f6f5f0" black="rgb:383838" black_light="rgb:635240" grey_dark="rgb:c6b0a4" grey_light="rgb:e8e8e8" brown_dark="rgb:af4609" brown_light="rgb:baa188" brown_lighter="rgb:f0e7df" orange="rgb:fc7302" orange_light="rgb:f88e3b" green="rgb:438047" green_light="rgb:7ba84d" red="rgb:f03c3c" # Base color definitions echo " # then we map them to code face global value ${orange_light}+b face global type ${orange} face global variable default face global module ${green} face global function default face global string ${green} face global keyword ${brown_dark} face global operator default face global attribute ${green} face global comment ${brown_light} face global documentation comment face global meta ${brown_dark} face global builtin default+b # and markup face global title ${orange}+b face global header ${orange}+b face global mono ${green_light} face global block ${green} face global link ${orange} face global bullet ${brown_dark} face global list ${black} # and built in faces face global Default ${black_light},${white} face global PrimarySelection ${black},${brown_lighter}+fg face global SecondarySelection ${black_light},${grey_light}+fg face global PrimaryCursor ${black},${grey_dark}+fg face global SecondaryCursor ${black},${grey_dark}+fg face global PrimaryCursorEol ${black},${brown_dark}+fg face global SecondaryCursorEol ${black},${brown_dark}+fg face global LineNumbers ${grey_dark},${white} face global LineNumberCursor ${grey_dark},${brown_lighter} face global MenuForeground ${orange},${brown_lighter} face global MenuBackground ${black_light},${brown_lighter} face global MenuInfo default,${black} face global Information ${black_light},${brown_lighter} face global Error default,${red} face global DiagnosticError ${red} face global DiagnosticWarning ${orange} face global StatusLine ${black},${grey_light} face global StatusLineMode ${orange} face global StatusLineInfo ${black}+b face global StatusLineValue ${green_light} face global StatusCursor ${orange},${white_light} face global Prompt ${black_light} face global MatchingChar default+b face global BufferPadding ${grey_dark},${white} face global Whitespace ${grey_dark}+f " } kakoune-2024.05.18/colors/solarized-dark-termcolors.kak000066400000000000000000000041741462203073200226520ustar00rootroot00000000000000# Solarized Dark (with termcolors) # Useful if you've set up your terminal with the exact Solarized colors # code face global value cyan face global type yellow face global variable blue face global module cyan face global function blue face global string cyan face global keyword green face global operator green face global attribute bright-magenta face global comment bright-green face global documentation comment face global meta bright-red face global builtin default+b # markup face global title blue+b face global header blue face global mono bright-cyan face global block cyan face global link bright-cyan face global bullet yellow face global list green # builtin face global Default bright-blue,bright-black face global PrimarySelection bright-black,blue+fg face global SecondarySelection bright-green,bright-cyan+fg face global PrimaryCursor bright-black,bright-blue+fg face global SecondaryCursor bright-black,bright-green+fg face global PrimaryCursorEol bright-black,white+fg face global SecondaryCursorEol bright-black,bright-white+fg face global LineNumbers bright-green,black face global LineNumberCursor bright-cyan,black face global LineNumbersWrapped black,black face global MenuForeground bright-black,yellow face global MenuBackground bright-cyan,black face global MenuInfo bright-green face global Information black,bright-cyan face global Error red,default+b face global DiagnosticError red face global DiagnosticWarning yellow face global StatusLine bright-cyan,black+b face global StatusLineMode bright-red face global StatusLineInfo cyan face global StatusLineValue green face global StatusCursor bright-yellow,bright-white face global Prompt yellow+b face global MatchingChar red,bright-green+b face global BufferPadding bright-green,bright-black face global Whitespace blue+f kakoune-2024.05.18/colors/solarized-dark.kak000066400000000000000000000056241462203073200204640ustar00rootroot00000000000000# Solarized Dark evaluate-commands %sh{ base03='rgb:002b36' base02='rgb:073642' base01='rgb:586e75' base00='rgb:657b83' base0='rgb:839496' base1='rgb:93a1a1' base2='rgb:eee8d5' base3='rgb:fdf6e3' yellow='rgb:b58900' orange='rgb:cb4b16' red='rgb:dc322f' magenta='rgb:d33682' violet='rgb:6c71c4' blue='rgb:268bd2' cyan='rgb:2aa198' green='rgb:859900' echo " # code face global value ${cyan} face global type ${yellow} face global variable ${blue} face global module ${cyan} face global function ${blue} face global string ${cyan} face global keyword ${green} face global operator ${green} face global attribute ${violet} face global comment ${base01} face global documentation comment face global meta ${orange} face global builtin default+b # markup face global title ${blue}+b face global header ${blue} face global mono ${base1} face global block ${cyan} face global link ${base1} face global bullet ${yellow} face global list ${green} # builtin face global Default ${base0},${base03} face global PrimarySelection ${base03},${blue}+fg face global SecondarySelection ${base01},${base1}+fg face global PrimaryCursor ${base03},${base0}+fg face global SecondaryCursor ${base03},${base01}+fg face global PrimaryCursorEol ${base03},${base2}+fg face global SecondaryCursorEol ${base03},${base3}+fg face global LineNumbers ${base01},${base02} face global LineNumberCursor ${base1},${base02} face global LineNumbersWrapped ${base02},${base02} face global MenuForeground ${base03},${yellow} face global MenuBackground ${base1},${base02} face global MenuInfo ${base01} face global Information ${base02},${base1} face global Error ${red},default+b face global DiagnosticError ${red} face global DiagnosticWarning ${yellow} face global StatusLine ${base1},${base02}+b face global StatusLineMode ${orange} face global StatusLineInfo ${cyan} face global StatusLineValue ${green} face global StatusCursor ${base00},${base3} face global Prompt ${yellow}+b face global MatchingChar ${red},${base01}+b face global BufferPadding ${base01},${base03} face global Whitespace ${base01}+f " } kakoune-2024.05.18/colors/solarized-light-termcolors.kak000066400000000000000000000041661462203073200230410ustar00rootroot00000000000000# Solarized Light (with termcolors) # Useful if you've set up your terminal with the exact Solarized colors # code face global value cyan face global type red face global variable blue face global module cyan face global function blue face global string cyan face global keyword green face global operator yellow face global attribute bright-magenta face global comment bright-cyan face global documentation comment face global meta bright-red face global builtin default+b # markup face global title blue+b face global header blue face global mono bright-cyan face global block cyan face global link bright-green face global bullet yellow face global list green # builtin face global Default bright-yellow,bright-white face global PrimarySelection bright-white,blue+fg face global SecondarySelection bright-cyan,bright-green+fg face global PrimaryCursor bright-white,bright-yellow+fg face global SecondaryCursor bright-white,bright-cyan+fg face global PrimaryCursorEol bright-white,yellow+fg face global SecondaryCursorEol bright-white,bright-red+fg face global LineNumbers bright-cyan,white face global LineNumberCursor bright-green,white face global LineNumbersWrapped white,white face global MenuForeground bright-white,yellow face global MenuBackground bright-green,white face global MenuInfo bright-cyan face global Information white,bright-cyan face global Error red,default+b face global DiagnosticError red face global DiagnosticWarning yellow face global StatusLine bright-green,white+b face global StatusLineMode bright-red face global StatusLineInfo cyan face global StatusLineValue green face global StatusCursor bright-blue,bright-black face global Prompt yellow+b face global MatchingChar red,white+b face global BufferPadding bright-cyan,bright-white face global Whitespace yellow+f kakoune-2024.05.18/colors/solarized-light.kak000066400000000000000000000054261462203073200206520ustar00rootroot00000000000000# Solarized Light evaluate-commands %sh{ base03='rgb:002b36' base02='rgb:073642' base01='rgb:586e75' base00='rgb:657b83' base0='rgb:839496' base1='rgb:93a1a1' base2='rgb:eee8d5' base3='rgb:fdf6e3' yellow='rgb:b58900' orange='rgb:cb4b16' red='rgb:dc322f' magenta='rgb:d33682' violet='rgb:6c71c4' blue='rgb:268bd2' cyan='rgb:2aa198' green='rgb:859900' echo " # code face global value ${cyan} face global type ${red} face global variable ${blue} face global module ${cyan} face global function ${blue} face global string ${cyan} face global keyword ${green} face global operator ${yellow} face global attribute ${violet} face global comment ${base1} face global documentation comment face global meta ${orange} face global builtin default+b # markup face global title ${blue}+b face global header ${blue} face global mono ${base1} face global block ${cyan} face global link ${base01} face global bullet ${yellow} face global list ${green} # builtin face global Default ${base00},${base3} face global PrimarySelection ${base3},${blue}+fg face global SecondarySelection ${base1},${base01}+fg face global PrimaryCursor ${base3},${base00}+fg face global SecondaryCursor ${base3},${base1}+fg face global PrimaryCursorEol ${base3},${yellow}+fg face global SecondaryCursorEol ${base3},${orange}+fg face global LineNumbers ${base1},${base2} face global LineNumberCursor ${base01},${base2} face global LineNumbersWrapped ${base2},${base2} face global MenuForeground ${base3},${yellow} face global MenuBackground ${base01},${base2} face global MenuInfo ${base1} face global Information ${base2},${base1} face global Error ${red},default+b face global DiagnosticError ${red} face global DiagnosticWarning ${yellow} face global StatusLine ${base01},${base2}+b face global StatusLineMode ${orange} face global StatusLineInfo ${cyan} face global StatusLineValue ${green} face global StatusCursor ${base0},${base03} face global Prompt ${yellow}+b face global MatchingChar ${red},${base2}+b face global BufferPadding ${base1},${base3} face global Whitespace ${base1}+f " } kakoune-2024.05.18/colors/tomorrow-night.kak000066400000000000000000000051711462203073200205450ustar00rootroot00000000000000# ## Tomorrow-night, adapted by nicholastmosher ## evaluate-commands %sh{ foreground="rgb:c5c8c6" # gui05 background="rgb:1d1f21" # gui00 selection="rgb:373b41" # gui02 window="rgb:282a2e" # gui01 comment="rgb:969896" # gui03 red="rgb:cc6666" # gui08 orange="rgb:de935f" # gui09 yellow="rgb:f0c674" # gui0A green="rgb:b5bd68" # gui0B blue="rgb:81a2be" # gui0D aqua="rgb:8abeb7" # gui0C purple="rgb:b294bb" # gui0E ## code echo " face global value ${orange} face global type ${yellow} face global variable ${red} face global module ${blue} face global function ${blue} face global string ${green} face global keyword ${purple} face global operator ${aqua} face global attribute ${purple} face global comment ${comment} face global documentation comment face global meta ${purple} face global builtin ${yellow} " ## markup echo " face global title ${blue} face global header ${aqua} face global mono ${green} face global block ${orange} face global link ${blue} face global bullet ${red} face global list ${red} " ## builtin echo " face global Default ${foreground},${background} face global PrimarySelection ${foreground},${selection}+fg face global SecondarySelection ${foreground},${window}+fg face global PrimaryCursor ${background},${foreground}+fg face global SecondaryCursor ${background},${aqua}+fg face global PrimaryCursorEol ${background},${green}+fg face global SecondaryCursorEol ${background},${green}+fg face global LineNumbers ${comment},${window} face global LineNumberCursor ${yellow},${window}+b face global MenuForeground ${window},${foreground} face global MenuBackground ${foreground},${window} face global MenuInfo ${red} face global Information ${foreground},${window} face global Error ${foreground},${red} face global DiagnosticError ${red} face global DiagnosticWarning ${yellow} face global StatusLine ${foreground},${selection} face global StatusLineMode ${yellow}+b face global StatusLineInfo ${aqua} face global StatusLineValue ${green} face global StatusCursor ${window},${aqua} face global Prompt ${background},${aqua} face global MatchingChar ${yellow},${background}+b face global BufferPadding ${aqua},${background} face global Whitespace ${comment}+f " } kakoune-2024.05.18/colors/zenburn.kak000066400000000000000000000060161462203073200172300ustar00rootroot00000000000000# zenburn theme evaluate-commands %sh{ # define some named colors zentext="rgb:cfcfcf" zenselectionbg="rgb:3f7fcc" zencursor="rgb:2a2a2a,rgb:dfdfbf" zencursoreol="rgb:2a2a2a,rgb:cc9393" zensecondaryfg="rgb:2a2a2a" zendefault="${zentext},rgb:3f3f3f" zenstatus="rgb:efdcbc,rgb:2a2a2a" zenstatuscursor="${zentext},rgb:7f9f7f" zeninfo="rgb:cc9393,rgb:2a2a2a" zenmenubg="rgb:7f9f7f,rgb:4a4a4a" zenmenufg="rgb:8cd0d3,rgb:5b5b5b" zenkeyword="rgb:f0dfaf+b" zenstorageClass="rgb:c3bf9f+b" zennumber="rgb:8cd0d3" zencomment="rgb:7f9f7f" zenconstant="rgb:dca3a3+b" zenspecial="rgb:cfbfaf" zenfunction="rgb:efef8f" zenstatement="rgb:e3ceab" zenvariable="rgb:efdcbc" zentype="rgb:dfdfbf" zenstring="rgb:cc9393" zenmodule="${zenstring}" zenexception="rgb:c3bf9f+b" zenmatching="rgb:3f3f3f,rgb:8cd0d3" zenpadding="rgb:f0dfaf,rgb:343434+b" echo " # then we map them to code face global value ${zenconstant} face global type ${zentype} face global variable ${zenvariable} face global module ${zenstring} face global function ${zenfunction} face global string ${zenstring} face global keyword ${zenkeyword} face global operator ${zenfunction} face global attribute ${zenstatement} face global comment ${zencomment} face global documentation comment face global meta ${zenspecial} face global builtin default+b # and markup face global title ${zenkeyword} face global header ${zenconstant} face global mono ${zennumber} face global block ${zenstatement} face global link ${zenstring} face global bullet ${zenvariable} face global list ${zentype} # and built in faces face global Default ${zendefault} face global PrimarySelection ${zentext},${zenselectionbg}+fg face global SecondarySelection ${zensecondaryfg},${zenselectionbg}+fg face global PrimaryCursor ${zencursor}+fg face global SecondaryCursor ${zencursor}+fg face global PrimaryCursorEol ${zencursoreol}+fg face global SecondaryCursorEol ${zencursoreol}+fg face global LineNumbers ${zendefault} face global LineNumberCursor ${zenstatus} face global MenuForeground ${zenmenufg} face global MenuBackground ${zenmenubg} face global MenuInfo rgb:cc9393 face global Information ${zeninfo} face global Error default,red face global DiagnosticError red face global DiagnosticWarning yellow face global StatusLine ${zenstatus} face global StatusLineMode ${zencomment} face global StatusLineInfo ${zenspecial} face global StatusLineValue ${zennumber} face global StatusCursor ${zenstatuscursor} face global Prompt ${zenconstant} face global MatchingChar default+b face global BufferPadding ${zenpadding} face global Whitespace ${zensecondaryfg}+f " } kakoune-2024.05.18/contrib/000077500000000000000000000000001462203073200152115ustar00rootroot00000000000000kakoune-2024.05.18/contrib/TRAMPOLINE000066400000000000000000000635571462203073200166260ustar00rootroot00000000000000+=----------------------------------------------------------------------------=+ _ _ | | | | | | __ __ _ | | __ ___ _ _ _ __ ___ | |/ / / _` | | |/ / / _ \ | | | | | '_ \ / _ \ | < | (_| | | < | (_) | | |_| | | | | | | __/ |_|\_\ \__,_| |_|\_\ \___/ \__,_| |_| |_| \___| Mawww's experiment for a better code editor +=----------------------------------------------------------------------------=+ This walk-through is an introduction to Kakoune's basic editing capabilities to help new users transition over easily from another editor, or simply learn how to write and edit documents with style. During the learning period, it is useful to activate an automatically displayed contextual help for commands in normal mode: `:set -add global autoinfo normal` In the first section, you will learn about the primitives of the editing language to be able to get to a level of knowledge of the editor that guarantees that you can work with it efficiently. In the second section, for users who've gone through the basics and want to move on to more advanced functionalities, we explain other primitives whose role has a less dominant place in an everyday editing session, but still prove themselves powerful when used on the right occasion. Finally, as this document is in no way an exhaustive list of features, don't hesitate to check out the official documentation to complement your tool-set, ask questions to more seasoned users on IRC, and check the documentation using the built-in `:doc` command. +=--------------------------------=+ BASICS +=--------------------------------=+ =[ MODES Kakoune uses a paradigm called "modal editing" to allow .---, users to either have every single key they type inserted | i | into the file being edited (called "insert mode"), `---' or execute commands that are triggered by the keys hit (the "normal mode"). Aside from arrow keys, most keys .---, described in this document are "editing primitives" that |esc| have to be hit in normal mode, which is the default mode `---' when you start the editor. To enter insert mode, hit the `i` key, and to leave it and return to normal mode, hit the escape key. =[ MOVEMENT .---, | ↑ | Movement in a buffer (the representation of the contents .---'---'---, of a file opened by Kakoune) can be achieved using the arrow | ← | ↓ | → | keys, which will move the cursor up one column/row into `---'---'---` a given direction. However, furthering the tradition of mode-based editors, .---,---,---,---, the `h`, `j`, `k` and `l` keys can be used for the same | h | j | k | l | purpose, and will respectively move the cursor to the `---'---'---'---` left, down, up, right by one, when hit. Using those keys | | | | is the recommended way of moving around in a buffer. .---,---,---,---, If you're not familiar with this concept, the proximity | ← | ↓ | ↑ | → | of those four keys with the rest of the lettered keys `---'---'---'---` on a `qwerty` layout allows faster interaction with the primitives than if the user had to move their hand to .---, reach the arrow keys. | g |_. `---' |`.---, Another way of moving the cursor is the "goto" utility, | | g | invoked by hitting the `g` key. A menu will pop up with a | `---' summary of all the possible keys that can be hit, along with `.---, the location where they will move the cursor to, but the | e | most used ones that we are interested in, for now, are `g` `---' and `e`. The first one will jump to the beginning of the buffer, and the second one to its end. =[ VIEW .---, Displacing the cursor can sometimes move the view into an | v |_. inconvenient configuration, leaving some necessary context `---' |`.---, off-screen, or simply feel uncomfortable to type into. | | t | Kakoune provides a menu (similar to the `goto` menu | `---' mentioned in the previous section) that allows users to |`.---, move the current view in relation to the position of the | | b | cursor. Upon hitting the `v` key, a short menu appears | `---' which allows us to hit a second key according to how the `.---, view should be centered vertically: to leave the cursor | v | respectively on top, at the bottom or in the middle of the `---' current view, hit the `t`, `b` or `v` keys. =[ SEARCH In order to move the cursor to a specific word, the search command is the way to go. This functionality allows .---, the user to jump to the next occurrence of a piece of text. | / | Upon hitting the `/` key, a prompt reading "search" `---' will pop up in the status bar in which you can type your text and validate using the `` (return) key. .---, .---, You'll notice that as you type, the cursor changes location |alt|+| / | to automatically give you a preview of where the cursor `---' `---' would be displaced to if you validated the search. However, this behavior is only a preview, exiting prompt mode with the `` (escape) key will leave the current position .---, of the cursor unchanged. Note that you can also use a | n | regular expression as input. By default the search `---' function will look for results forward, starting from the current location of the cursor, but you can search .---, .---, backwards using `` (alt + `/`). |alt|+| n | `---' `---' Jumping from one match to the other forward can be achieved using the `n` key, and backwards using the `` (alt + `n`) key combination. =[ SELECTIONS You have certainly noticed that when searching for .---, text, the cursor extends to highlight the entire match. | ; | In fact, what we know in other editors as a "cursor" is `---' actually a single character wide selection in Kakoune, and can be expanded using primitives. When "expanded", .---, .---, the selection is an area whose beginning is the "anchor" |alt|+| ; | and the end the "secondary cursor". To switch anchor and `---' `---' cursor, use ``, and to collapse the selection onto its anchor, use `;`. Moreover, not only Kakoune expands the principle of "cursor" by introducing selections, but it also allows .---, multiple selections within the same buffer. This makes | % | it very convenient to modify text in multiple locations `---' at once, as editing primitives apply to all the currently selected text. .---, | s | Example: to remove all occurrences of the word "foo", one `---' would select the entire buffer (`%`), select occurrences of the word (`s`, "\bfoo\b", ``), then remove it (`d`). ==[ SELECTING OBJECTS In addition to allowing text selection using regular .---, .---, expressions, certain objects are defined by default to |alt|+| i | allow easy selection of text. Objects are bits of text `---' `---' in the buffer that are identified according to their structure, rather than their contents, e.g., a paragraph, .---, .---, a sentence, or a word. When the cursor is located within |alt|+| a | the boundaries of an object you want to interact with, `---' `---' several options are available: selecting the contents of an object without its boundaries (``), a part of it (from .---, the anchor to its end or its beginning, respectively `]` | ] | and `[`), or the entire object (``). Those "selection `---' ranges" are the first part of a two stages shortcut, as once you've used the key that dictates what part of .---, the object is to be selected, a menu with a description | [ | of all the object types select-able will be displayed, `---' giving a summary of all the keys you can hit to complete the selection procedure. Example: to select the paragraph in which the anchor lies, invoke the "inner object selection" shortcut (``), locate "paragraph" in the information box that pops up and .---, hit the according key (`p`). The entire two steps sequence | [ |_. is thus: ` p`. `---' |`.---, | | ( | Example: to select everything between the anchor and the | `---' beginning of the current parenthesis pair, use the selection `.---, sequence: `[ (`. Note that common objects that use | r | pairs of opening/closing punctuation signs (brackets, `---' braces, quotes etc) have an alternative second key that is displayed in the information menu that you can use to minimize finger gymnastics. The previous shortcut could thus also be written: `[ b`. ==[ MOVEMENT SELECTIONS If objects are an easy way to select content-agnostic .---, data in a buffer, they can also be seen as a way to move | [ |_. about the buffer. As selecting objects will displace the `---' `.---, anchor into a given direction, you can wrap or move around | p | particular chunks of text without using the conventional `---' means (e.g., arrow keys or jumps), turning them partially into movement primitives. .---, | ] |_. Example: one of the most used object selection combination `---' `.---, is the "object end/begin paragraph" one: using `[` or | p | `]` will displace the anchor into a given direction, and `---' applying that to the paragraph object allows "jumping" from one newline separated block of text to another. The resulting shortcut is thus: `] p` to move forward, or `[ p` to move backward. =[ FILTERING A SELECTION Selecting an entire buffer (`%`) or parts of it (`s`) is a natural and basic operation in a typical editing session, .---, .---, however, there are some cases where we need to be able to |alt|+| k | drop some selections arbitrarily, as opposed to trying `---' `---' to select the ones we need directly. This concept becomes very useful when coming up with a regular expression for .---, .---, the basic selection primitive (`s`) is too tedious (if |alt|+| K | even possible), that's why the editor provides us with a `---' `---' "keep matching" and a "keep not matching" operations, in order to respectively keep exclusively the selections who match or do not match a given regular expression. Example: when parsing a log file whose lines follow the usual log pattern (e.g. "[1484383442] ERROR: some data"), we want to be able to select all the lines individually .---, .---, (`%`, `` to split all the lines), keep those that |alt|+| s | start with a bracketed time-stamp (`^\[`), but `---' `---' exclude the debug messages (`DEBUG`). Of course, it's possible to come up with a regular expression to match those simple requirements, but it would take more work to write it than to organically apply filters on a general selection, individually. =[ SELECTION DUPLICATION .---, Duplicating content can be achieved using a widely | y | implemented concept: yanking and pasting. Yanking the `---' current selection (`y`) into the copy register allows the .---, user to subsequently insert the copied text in the buffer | p | (`p`). `---' .---, Note that the default "paste" primitive will insert the | P | contents of the copy register after the current selection, `---' if you want copied text to be inserted before the current selection then you can use the `P` key. =[ DELETING / REPLACING SELECTIONS Text replacement is a two-step process in Kakoune, which .---, involves selecting text to be replaced, and then erasing it | d | to insert the replacement text. After selections have been `---' made, you can simply hit the deletion primitive (`d`), then .---, either enter insert mode to write down the replacement text | c | (`i`), or stay in command mode to paste the replacement `---' text stored in the copy register. As deleting and entering .---, insert mode can be redundant, a primitive that implements | R | deletion followed by insert mode entrance was implemented: `---' `c`. You can also directly replace the current selection with the content of the copy register using a primitive also implemented for that purpose: `R`. =[ UNDO / REDO Mistakes or wrong decisions can happen while editing. .---, To go back to earlier states of the buffer, you can press | u | the `u` key several times. On the contrary, pressing `U` `---' allows traveling forward in the history tree. +=-------------------------------=+ ADVANCED +=-------------------------------=+ =[ SPLITTING The selection primitive (`s`) is a powerful tool to select chunks of data, but sometimes the format of said data isn't .---, uniform enough to allow creating clear cut selections. In | S | order to avoid having to write overly complicated regular `---' expressions that select precisely the wanted text, the splitting primitive (`S`) allows applying a delimiter to the current selection, splitting it into separate chunks. Example: selecting the items in a CSV-style list (e.g., "1,2,3,4") is as simple as selecting the line, then splitting it using the comma separator (`S,`). Note that more advanced splitting is possible, since the delimiter passed to this primitive is a regular expression. =[ ROTATING Often used in conjunction with the splitting primitive (`S`), the rotation primitive (``) shifts all the selections clock-wise. Note that a count (described after) allows the rotation to take place in sub-groups whose size .---, .---, is given by the count parameter. |alt|+| ) | `---' `---' Example: in a numbered list where all the numbers are selected (e.g., `1 2 3 4 5 6 7 8 9 0`), a rotation using this primitive will shift all the numbers by one selection forward, while leaving the original multiple selections untouched (e.g., `0 1 2 3 4 5 6 7 8 9`). =[ COUNTS .---, In order to pass a count to a primitive, simply type the |0-9|_. number out before hitting the primitive key/combination. `---' |`.---, Counts allow primitives to specialize or extend their | | g | original functionality by using it as a parameter, | `---' acting on their side effect. |`.---, | | G | Example: in order to respectively jump or select up to a | `---' particular line, pass the line number to the `g` or `G` |`.---, primitives (e.g., `42g` or `7G`). | | o | | `---' Example: creating an arbitrary amount of new lines `.---, above or below the current line and spawning a new selection | O | for each of them is achieved by passing the number of lines `---' as a count respectively to the `o` and `O` primitives. =[ REGISTERS Similarly to counts, registers influence the behavior of .---, certain primitives. They are storage structures identified | " |_. by a single character, and are populated by primitives as a `---' `.---, result of a side effect. Although primitives populate a |a-z| specific register by default, it's possible to modify which `---' is going to be populated upon execution using the double quote (`"`) primitive, and subsequently hitting a key that .---, will serve as an identifier. | * | `---' Example: the smart search primitive (`*`) uses the current selection as a search pattern, which will be saved to the .---, `/` register. In order to use this primitive to execute a | " |_. .---, temporary search, one could make this primitive save the `---' `| _ | pattern to a different register, to preserve the default one, `---' e.g., `"m*` to save the pattern to the `m` register, or even `"_*` to save the pattern to a "null" register, which does not store anything written to it. ==[ CAPTURE GROUPS Although registers can pass as mere buffer metadata, .---, .---, they are an integral part of an editing session. The |ctl|+| r | `` key combination allows to insert into the buffer `---' `---' the value of a register, whose identifier is typed right after the combination. .---, .---, Example: inserting the name of the current buffer in insert |ctl|+| r |_. mode can be achieved using the `%` register, which holds `---' `---' `.---, this information: `%`. | % | `---' Other registers that are set automatically are the numbered registers, which hold the values of the groups matched in the last search or select operation (`/` and .---, .---, `s` primitives). |ctl|+| r |_. `---' `---' `.---, Example: when using the search primitive (`/`) with a |0-9| regular expression containing groups to match a list of `---' first and last names (e.g., `(\w+) (\w+)` on `John Doe`), issuing `1` would insert the first name (`John`), and `2` the last name (`Doe`). =[ CUSTOM SELECTIONS Despite the ability to select bits of data using regular expressions, there are times when using them isn't enough, and additional manual editing of the selections is .---, needed. In order to loop through all the selections and | ) | remove the current one, two primitives are available: `---' respectively the parenthesis (`)`), and the alt/comma key combination (``). .---, .---, |alt|+| , | Example: given a list of three numbers all selected `---' `---' individually, (e.g., `1 2 3`), deselecting the second selection would be done by hitting the parenthesis primitive (`)`) until the according selection is the current one, then hitting `` to end up with only the first and third number selected. However, being able to trim out some selections out .---, of a bigger set isn't always convenient, as it doesn't | ^ | allow more advanced constructs such as combining sets of `---' multiple-selections that result from different regular .---, expressions. To allow that, the save mark (`Z`) and append | Z | mark (``) come in handy, as they respectively save `---' the current selection to the mark register (`^`), and show a menu that allows appending the current selection .---, .---, to the mark register upon hitting the `a` key. That way, |alt|+| z |_. it becomes possible to chain and save (append) several `---' `---' `.---, selections made using completely different methods | a | (select, split etc) without being forced to preserve `---' them at all times. .---, | z | Restoring a mark saved to the mark register using those `---' primitives can be achieved by using the restore mark primitive (`z`). =[ LEVERAGING SHELL COMMANDS UNIX systems provide with some tools whose purpose is to interact with raw data, and being a UNIX compliant .---, aspiring tool itself, Kakoune allows leveraging those | | | tools to modify a buffer's contents. Upon invoking the pipe `---' primitive (`|`), an input field pops up which prompts for a shell command, to which the selections will individually be sent through the command's standard input. Example: wrapping a selection can be achieved by invoking the `fold` utility, e.g., `|fold -w80`. You could also want to see a patch of all the modifications made to the buffer since it was last saved: `%|diff -u % -`. Note that the `%` has to be typed interactively, as it will insert the name of the buffer into the command. Another equally useful primitive that doesn't depend on .---, the contents of the current selections is the exclamation | ! | mark primitive (`!`), which simply insert the output of `---' the given shell command before each selection. Example: in order to insert the date of the day at the beginning of the current buffer, one could use `gg` followed with `!date`. But not all shell-related primitives insert data into the current buffer, the `$` key is in fact a way to .---, apply a predicate to all selections, in order to filter | $ | them out. The command passed to this primitive will be `---' executed in a new shell using each individual selection for context, which will either be kept if the command returned a successful exit code (zero) or dropped otherwise (any non-zero value). Example: after selecting all the lines in a buffer and splitting them individually (`%`, ``), keeping every odd-numbered line can be achieved with the following sequence: `$` `[ $((kak_reg_hash)) -ne 0 ]`. =[ REPEATING ACTIONS ==[ PUNCTUAL INTERACTIONS In order to modify text efficiently or insert redundant bits of data, two primitives are available. The dot `.` .---, primitive repeats the last change that was made in insert | . | mode (e.g., writing down text after hitting the insert `---' primitive `i`). Similarly, repeating the last selection (e.g., make with the find primitive `f`) can be achieved using the `` primitive. Example: to select a paragraph to append a newline .---, .---, character to it and cycle through the following paragraphs |alt|+| . | to repeat the same insertion an arbitrary amount of times, `---' `---' one would first select the paragraph with `]p`, append a newline to it `a`, then repeat both operations as needed with `` and `.` respectively. ==[ COMPLEX CHANGES Transforming successive chunks of formatted data can .---, be cumbersome when done manually, and lack hindsight | q | when writing a script for that particular purpose `---' non-interactively. The middle ground between the two .---, solutions is to record the modifications made to one | Q | chunk interactively, and replay the sequence of keys `---' at will. The sequence in question is a macro: the `Q` primitive will create a new one (i.e., record all the keys .---, .---, hit henceforth until the escape key `` is hit), and |ctl|+| r |_. the `q` primitive will replay the keys saved in the macro. `---' `---' `.---, | @ | Notes: macros can easily be translated into a proper `---' script, as they are saved in the `@` register, which you can insert into a buffer using `@`. kakoune-2024.05.18/contrib/Tupfile000066400000000000000000000034241462203073200165470ustar00rootroot00000000000000## ## Tupfile for kakoune ## by lenormf ## ## How to use: ## Initialize a tup database in the main directory with `tup init` ## Create a symlink from `contrib/Tupfile` to `src/Tupfile` ## Start the build with the `tup` command ## .gitignore debug = yes static = no CXX = g++ CXXFLAGS = -pedantic -std=c++17 -g -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-address CPPFLAGS = LDFLAGS = LIBS = ifeq ($(debug),yes) CPPFLAGS += -DKAK_DEBUG CXXFLAGS += -g suffix = .debug else ifeq ($(debug),no) CXXFLAGS += -O3 suffix = .opt else error debug should be either yes or no endif endif ifeq ($(static),yes) PKG_CONFIG_FLAGS += --static LDFLAGS += -static -pthread endif ifneq (@(TUP_PLATFORM),macosx) ifeq (@(TUP_PLATFORM),win32) LIBS += -lncursesw -ldbghelp CPPFLAGS += -D_XOPEN_SOURCE=700 else LDFLAGS += -rdynamic endif endif ifeq ($(CXX),clang++) CXXFLAGS += -frelaxed-template-template-args endif ifeq ($(CXX),g++) CXXFLAGS += -Wno-init-list-lifetime endif !cxx = |> ^ CC %f^ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -MD -MP -MF %O.d -c %f -o %o |> !ld = |> ^ LD %o^ $(CXX) $(LDFLAGS) %f $(LIBS) -o %o |> !ln = |> ^ LN %o^ ln -sf %f %o |> : foreach *.cc |> !cxx |> .%B$(suffix).o | .%B$(suffix).d {objs} : |> ^ MK %o^ printf "%%s" "namespace Kakoune { const char* version = \"`if [ -f .version ]; then cat .version; elif [ -d ../.git ]; then git describe --tags HEAD; else echo \"unknown\"; fi`\"; }" > .version.cc.tmp; if cmp -s .version.cc.tmp .version.cc; then rm .version.cc.tmp; else mv .version.cc.tmp .version.cc; fi |> .version.cc : .version.cc |> ^ CC %f^ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c %f -o %o |> %B.o : {objs} .version.o |> !ld |> kak$(suffix) : kak$(suffix) |> !ln |> kak kakoune-2024.05.18/contrib/describe_sessions.sh000077500000000000000000000047331462203073200212650ustar00rootroot00000000000000#!/bin/sh ## ## describe_sessions.sh for kakoune ## by lenormf ## readonly KAK_SCRIPT=' { echo printf "Session: %s\n" "${kak_session}" printf "Current working directory: %s\n" "${PWD}" eval set -- "${kak_buflist}" printf "Buffers (%d):\n" $# for bufname in "$@"; do printf "\t%s\n" "${bufname}" done eval set -- "${kak_client_list}" printf "Clients (%d):\n" $# for clientname in "$@"; do printf "\t%s\n" "${clientname}" done } >>{{outfile}} rm -rf {{sentinel}} ' main() { outfile=$(mktemp "${TMPDIR:-/tmp}"/kak-describe_sessions.XXXXXXXX) nb_sessions=0 nb_dead_sessions=0 nb_suspended_sessions=0 if ! command -v socat >/dev/null 2>&1; then echo "Unmet dependency: socat" >&2 exit 1 fi script=$(printf 'nop %%sh{ %s }' "${KAK_SCRIPT}" | sed "s,{{outfile}},\"${outfile}\",g") sessions_dir="${TMPDIR:-/tmp}/kakoune/${USER}" if [ -n "${XDG_RUNTIME_DIR}" ]; then sessions_dir="${XDG_RUNTIME_DIR}/kakoune" fi for session in "${sessions_dir}"/*; do name_session="${session##*/}" if printf '' | socat - UNIX-CONNECT:"${session}",connect-timeout=1 2>/dev/null; then sentinel=$(mktemp -d "${TMPDIR:-/tmp}"/kak-sentinel.XXXXXXXX) script_session=$(printf %s "${script}" | sed "s,{{sentinel}},\"${sentinel}\",g") if ! printf %s "${script_session}" | kak -p "${name_session}"; then printf '\nSession "%s" dead\n' "${name_session}" >> "${outfile}" nb_dead_sessions=$((nb_dead_sessions + 1)) continue fi wait_limit=2 while ! mkdir "${sentinel}" 2>/dev/null && [ "${wait_limit}" -gt 0 ]; do wait_limit=$((wait_limit - 1)) sleep 1 done rm -rf "${sentinel}" if [ "${wait_limit}" -gt 0 ]; then nb_sessions=$((nb_sessions + 1)) else printf '\nSession "%s" suspended\n' "${name_session}" >> "${outfile}" nb_suspended_sessions=$((nb_suspended_sessions + 1)) fi else nb_dead_sessions=$((nb_dead_sessions + 1)) fi done printf 'Running sessions: %d\nSuspended sessions: %d\nDead sessions: %d\n' \ "${nb_sessions}" "${nb_suspended_sessions}" "${nb_dead_sessions}" cat "${outfile}" rm -f "${outfile}" } main "$@" kakoune-2024.05.18/contrib/kakmap.rb000077500000000000000000000034551462203073200170140ustar00rootroot00000000000000#!/usr/bin/env ruby # Generate a reference sheet for Kakoune's normal mode # Use: ./kakmap.rb ../src/normal.cc require 'markaby' # Relies on the keymap HashMap assignment ending with }; raw = ARGF.read.split( /const\s+HashMap\s+keymap\s*{/ ).last.split( /^};$/ ).first commands = {} raw.split( /\n+/ ).each{ |line| # skip empty or comment line line = line.strip if line.empty? or /^\/\// =~ line next end # match key mapping line /^\{\s*\{(?[^}]+)\}\s*,\s*\{\s*"(?[^"]+)"/.match(line) do |m| modAndKey = m['mdky'] des = m['dsc'] modAndKey.gsub!(/\s*\/\*[^*]+\*\/\s*/, '') # remove comment in key definition # match key and modifier /Key::(?\w+)|(?alt|ctrl)\('\\?(?.+?)'\)|'\\?(?.+?)'$/.match(modAndKey) do |sm| key = sm['key'] mod = (sm['mod'] || 'none').to_sym key = 'Space' if key == ' ' commands[key] ||= {} commands[key][mod] = des end end } # sort, showing single characters first, symbols next and spelled out keys last commands = commands.sort_by{ |key, _| case key when /^\w$/ key.upcase + key.swapcase when /^\W$/ '_' + key else '~~' + key end } puts Markaby::Builder.new { html do head do title "Kakoune default keymap" end body do table :style => "border-collapse: collapse" do thead do tr do th "Key" th "Description" th "ALT + key" th "CTRL + key" end end tbody do for key, binding in commands tr :style => "border-bottom: 1px solid #fbfbfb" do th key td binding[:none] td binding[:alt] td binding[:ctrl] end end end end end end } kakoune-2024.05.18/contrib/kakoune.spec000066400000000000000000000072711462203073200175310ustar00rootroot00000000000000%bcond_without tests # Enable LTO. Profit ~8% %global optflags %{optflags} -flto %global build_ldflags %{build_ldflags} -flto Name: kakoune Version: 2020.09.01 Release: 2%{?dist} Summary: Code editor heavily inspired by Vim License: Unlicense URL: https://kakoune.org/ Source0: https://github.com/mawww/kakoune/archive/v%{version}/%{name}-%{version}.tar.gz BuildRequires: asciidoc BuildRequires: gcc-c++ >= 7 BuildRequires: glibc-langpack-en BuildRequires: pkgconfig(ncurses) >= 5.3 %description - Modal editor - Faster as in fewer keystrokes  - Multiple selections - Orthogonal design Kakoune is a code editor that implements Vi’s "keystrokes as a text editing language" model. As it’s also a modal editor, it is somewhat similar to the Vim editor (after which Kakoune was originally inspired). Kakoune can operate in two modes, normal and insertion. In insertion mode, keys are directly inserted into the current buffer. In normal mode, keys are used to manipulate the current selection and to enter insertion mode. Kakoune has a strong focus on interactivity, most commands provide immediate and incremental results, while still being competitive (as in keystroke count) with Vim. Kakoune works on selections, which are oriented, inclusive ranges of characters. Selections have an anchor and a cursor. Most commands move both of them except when extending selections, where the anchor character stays fixed and the cursor moves around. %prep %autosetup -p1 # Use default Fedora build flags sed -i '/CXXFLAGS += -O3/d' src/Makefile # Install doc files in proper location sed -i 's|$(PREFIX)/share/doc/kak|$(PREFIX)/share/doc/%{name}|' src/Makefile %build %set_build_flags pushd src %make_build popd %install pushd src %make_install PREFIX=%{_prefix} popd %if %{with tests} %check %set_build_flags pushd src LANG=en_US.utf8 %make_build test popd %endif %files %license UNLICENSE %doc README.asciidoc CONTRIBUTING VIMTOKAK %{_bindir}/kak %{_datadir}/kak/ %{_mandir}/man1/* %{_libexecdir}/kak/ %changelog * Fri Jan 1 2021 Jiri Konecny - 2020.09.01-2 - Add new libexec dir to the spec file * Wed Sep 2 2020 Jiri Konecny - 2020.09.01-1 - Update to 2020.09.01 * Tue Aug 4 2020 Jiri Konecny - 2020.08.04-1 - Update to 2020.08.04 * Thu Jan 16 2020 Artem Polishchuk - 2020.01.16-1 - Update to 2020.01.16 * Tue Dec 10 2019 Artem Polishchuk - 2019.12.10-1 - Update to 2019.12.10 * Tue Nov 26 2019 Artem Polishchuk - 2019.07.01-4 - Add patch to pass tests with default Fedora build flags * Fri Nov 22 2019 Artem Polishchuk - 2019.07.01-2 - Packaging fixes * Wed Apr 24 2019 Jiri Konecny - v2019.01.20-1 - Add a new build dependency (glibc-langpack-en) required for Fedora 30 and later - Update version * Fri Oct 12 2018 Jiri Konecny - v2018.09.04-1 - Update spec file to a new release * Sat May 5 2018 Łukasz Jendrysik - v2018.04.13 - Use tagged release * Wed May 11 2016 jkonecny - 0-208.20160511git84f62e6f - Add LANG=en_US.UTF-8 to fix tests - Update to git: 84f62e6f * Thu Feb 11 2016 jkonecny - 0-158.20160210git050484eb - Add new build requires asciidoc - Use new man pages * Sat Mar 28 2015 jkonecny - 0-5.20150328gitd1b81c8f - Automated git update by dgroc script new hash: d1b81c8f * Tue Mar 24 2015 Jiri Konecny 0-1.7eaa697git - Add tests * Tue Mar 17 2015 Jiri Konecny 0-1.12a732dgit - Create first rpm for kakoune kakoune-2024.05.18/contrib/tmux-256color.terminfo000066400000000000000000000053151462203073200213300ustar00rootroot00000000000000tmux-256color|tmux with 256 color and palette setting, am, hs, km, mir, msgr, xenl, colors#256, cols#80, it#8, lines#24, pairs#32767, acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, ccc, civis=\E[?25l, clear=\E[H\E[J, cnorm=\E[34h\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, cvvis=\E[34l, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, dsl=\E]0;\007, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, flash=\Eg, fsl=^G, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\n, indn=\E[%p1%dS, initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\, invis=\E[8m, is2=\E)0, kDC=\E[3;2~, kEND=\E[1;2F, kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D, kNXT=\E[6;2~, kPRV=\E[5;2~, kRIT=\E[1;2C, kbs=^H, kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[1;2P, kf14=\E[1;2Q, kf15=\E[1;2R, kf16=\E[1;2S, kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~, kf25=\E[1;5P, kf26=\E[1;5Q, kf27=\E[1;5R, kf28=\E[1;5S, kf29=\E[15;5~, kf3=\EOR, kf30=\E[17;5~, kf31=\E[18;5~, kf32=\E[19;5~, kf33=\E[20;5~, kf34=\E[21;5~, kf35=\E[23;5~, kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q, kf39=\E[1;6R, kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~, kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~, kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~, kf48=\E[24;6~, kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q, kf51=\E[1;3R, kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~, kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~, kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~, kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, kind=\E[1;2B, kmous=\E[M, knp=\E[6~, kpp=\E[5~, kri=\E[1;2A, nel=\EE, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, ritm=\E[23m, rmacs=^O, rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, rs2=\Ec\E[?1000l\E[?25h, sc=\E7, setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m, setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m, sgr=\E[0%?%p6%t;1%;%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t; 5%;%?%p5%t;2%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, sitm=\E[3m, smacs=^N, smcup=\E[?1049h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, tsl=\E]0;, vpa=\E[%i%p1%dd, kakoune-2024.05.18/doc/000077500000000000000000000000001462203073200143165ustar00rootroot00000000000000kakoune-2024.05.18/doc/autoedit.asciidoc000066400000000000000000000074371462203073200176470ustar00rootroot00000000000000Edition auto insertion in Kakoune ================================= It is a quite common feature for a code editor to help the programmer by automatically inserting some text in certain contexts. This document goal is to explain how this is done in Kakoune. There is no special support in Kakoune for this task, hooks are expected to be used in order to manage that, and the normal Kakoune editing command are expected to be expressive enough so that relatively complex indentation can be written concisely. The main hook is *InsertChar*, which gets called immediately _after_ a character has been inserted in insertion mode due to the user pressing the corresponding key. Previous line indentation ------------------------- Let's see a simple indent hook: preserving the previous line indentation. Here is the Kakoune normal mode key list in order to do that: ---------------------------------------------------------------- k # 1. go to previous line and select it s^\h+y # 2. select the leading spaces and copy them jP # 3. go back to next line start and paste the spaces ---------------------------------------------------------------- Note that if nothing gets selected on phase *2.*, an error will be raised. We want to do that each time the user jumps a line, just after the new line is inserted. So the hook would be: -------------------------------------------------------- :hook InsertChar \n %{ exec k s^\h+y jP } -------------------------------------------------------- (exec concatenates the keys for all argument, so the spaces will be ignored, allowing for clearer separation. either use or quote the argument to use a space key) That works, however if the phase *2.* raises an error, the +:exec+ will stop and the user will get its selections on the previous line. The solution is to use a *draft* context, instead of the one the user is interacting with. --------------------------------------------------------------- :hook InsertChar \n %{ exec -draft k s^\h+y jP } --------------------------------------------------------------- That way, exec is executed in a *copy* of the user's context, which means it manipulates a *copy* of the user's selections. Increasing indentation ---------------------- A little bit more complicated is to increase indentation whenever we insert a new line after a +{+ or a +(+. The complexity arises from the presence of a condition. We want to increase the indentation *only* if the previous line ends with +{+ or +(+. Fortunately, Kakoune provides us with a command for that: the ++ command, which keeps selections where a certain regex can be found. Here is how we can do that: ------------------------------------------------------------------------------- k # 1. select the previous line [{(]\h*$ # 2. keep selections that end with { or ( followed by blanks j # 3. go back to next line and indent it even if it is empty ------------------------------------------------------------------------------- Note that if no previous line ends with a +{+ or +(+, the ++ command will raise an error, and stop the execution. This is what we want: it is similar to what would happen if we would continue with no selections; the following commands would have no effects. However, the error would end up being caught by the hook execution code, and it will write information about it in the debug buffer, which we do not want, as this is actually expected. In order to prevent that, the exec should be wrapped in a try command. So we would have: ------------------------------------------------------------------------------- :hook InsertChar \n %[ try %[ exec -draft k [{(]\h*$ j ] ] ------------------------------------------------------------------------------- kakoune-2024.05.18/doc/coding-style.asciidoc000066400000000000000000000021051462203073200204150ustar00rootroot00000000000000C++ Coding Style ================ Kakoune is written in C++14, here are the main coding style points: * Avoid external dependencies besides posix/stdc++ * 4 spaces for indentation, no tabs * public interface before private methods/data when defining a class * use +override+ keyword for overridden virtual methods * opening brackets on their own lines by default, except when declaring an object where the opening bracket follows the equal sign. * use alternative logical operator names (and, or, not instead of &&, ||, !) ----- int func() { if (condition) { ... } else statement; } int array[] = { ... }; ----- * End lines with an operator when continuing on the next line ---- if (condition1 or condition2) ---- * Try to keep under 80 columns, even though this is not a strict limit. * CamelCase for types, snake_case for variables/function names * prefix fields with m_, static ones with ms_ except for dumb structs (struct with every field public) where these prefixes can be dropped. * use const and constexpr liberally kakoune-2024.05.18/doc/design.asciidoc000066400000000000000000000140741462203073200172750ustar00rootroot00000000000000Kakoune design ============== This document describes the design goals for Kakoune, including rationale. Interactivity ------------- Unlike Vim, Kakoune does not have an underlying line-oriented editor. It is always expected to be used in an interactive fashion, displaying edited text in real time. That should not prevent Kakoune from being used non-interactively (executing a macro for example), but priority should be given to ease of interactive use. Limited scope ------------- Kakoune is a code editor. It is not an IDE, not a file browser, not a word processor and not a window manager. It should be very efficient at editing code. As a side effect, it should be very efficient at editing text in general. Composability ------------- Being limited in scope to code editing should not isolate Kakoune from its environment. On the contrary, Kakoune is expected to run on a Unix-like system alongside a lot of text-based tools, and should make it easy to interact with these tools. For example, sorting lines should be done using the Unix sort command, not with an internal implementation. Kakoune should make it easy to do that, hence the +|+ command for piping selected text through a filter. The modern Unix environment is not limited to text filters. Most people use a graphical interface nowadays, and Kakoune should be able to take advantage of that without hindering text mode support. For example, Kakoune enables multiple windows by supporting many clients on the same editing session, not by reimplementing tiling and tabbing. Those responsibilities are left to the system window manager. Orthogonality ------------- Kakoune features should be as orthogonal as possible. For example, in Vim, there are many ways to modify the buffer: Through normal/insert mode, command mode, and Vim scripts. In Kakoune, modifying the buffer is only the job of normal/insert mode. That means there should be clear separation of concerns between modes: * normal mode is for manipulating the selection and the selection contents. * insert mode is for interactive insertion into the buffer. * command mode is for non-editing features (opening a file, setting options...). Orthogonality is an ideal; it should not forbid common sense pragmatism. The +gf+ and +ga+ commands are not strictly selection manipulation commands, but they do fit nicely with other +goto+ commands, so they are acceptable in normal mode even though they could arguably be moved to command mode. Modes should be orthogonal, as should commands within modes. For example, Vim uses both +d+ and +x+ to delete text, with minor differences. In Kakoune only +d+ exists, and the design ensures that +x+ is not needed. Speed ----- Kakoune should be fast -- fast to use, as in a lot of editing in a few keystrokes, and fast to execute. * Vim is the benchmark here. Most editing tasks should be doable in fewer or the same number of keystrokes as Vim. * Kakoune is designed with asynchronicity in mind. Launching a background process and using its result when available should not block the editor. * Kakoune should be implemented with speed in mind. A slow editor is a useless one. Simplicity ---------- Simplicity is nice. Simplicity correlates with orthogonality and speed. It makes things easier to understand, bugs easier to fix, and code easier to change. * *No threading*: multithreading is a hard problem and is not well suited to a text editor: - When we want a direct result, we need to be synchronous with the user. A 4x speed improvement is meaningless; we need to have an algorithm which appears instantaneous to the user. - When we want an asynchronous result, the processing is best left to a helper command which can be reused with other Unix tools. * *No binary plugins*: shared objects by themselves add a lot of complexity. Plugins add another interface to Kakoune and go against orthogonality. The +%sh{ ... }+ and socket interfaces should be made good enough for most plugin use cases. - Rather than writing a plugin for intelligent code completion or source code navigation, it is better to write an independent helper tool that can interact with Kakoune through the shell. * *No integrated scripting language*: for the same reason as binary plugins. * *Limited smartness*: Kakoune should not try to be too smart. Being smart is often unpredictable for the user and makes things context-dependent. When Kakoune tries to be smart, it should provide the alternative, 'non-smart' version. For instance, +\*+ tries to detect word boundaries on the selection, but +alt-*+ opts out of this behavior. Unified interactive use and scripting ------------------------------------- As an effect of both Orthogonality and Simplicity, normal mode is not a layer of keys bound to a text editing language layer. Normal mode *is* the text editing language. That means there is no +delete-selected-text+ command that +d+ is bound to. +d+ *is* the +delete selected text+ command. This permits both scripting and interactive use cases to share the same text editing language. Both use normal mode to express complex editing. Besides promoting simplicity by avoiding the introduction of another layer, this helps ensure the interactive editing language is expressive enough to handle complex use cases, such as indentation hooks. Language-agnostic ----------------- Kakoune should not be tailored for writing in a specific programming language. Support for different languages should be provided by a kak script file. Built-in language support should be avoided. Self-documenting ---------------- Kakoune should be able to document its features. Live documentation, along with an extensive suggestion/completion system, provides the discoverability which is often lacking in non-GUI tools. As much as possible, documentation should be integrated with the code so that it stays up to date. Vim compatibility ----------------- Kakoune is inspired by Vim and should try to keep its commands similar to Vim's if there are no compelling reasons to deviate. However, self-consistency is more important than Vim compatibility. kakoune-2024.05.18/doc/interfacing.asciidoc000066400000000000000000000116021462203073200203070ustar00rootroot00000000000000Interfacing Kakoune with external programs ========================================== In order to interact with the external world, Kakoune uses the shell, mainly through the +%sh{ ... }+ string type, and its control socket. Basic interaction ----------------- For synchronous operations, +%sh{ ... }+ blocks are easy to use, they behave similarly to +$( ... )+ shell construct. For example, one can echo the current time in Kakoune's status line using: [source,bash] ---- :echo %sh{ date } ---- For asynchronous operations, the Kakoune Unix stream socket can be used. This is the same socket that Kakoune clients connect to. It is available through the +kak_session+ environment variable: the socket is +/tmp/kakoune/${username}/${kak_session}+ For example, we can echo a message in Kakoune in 10 seconds with: [source,bash] ---- :nop %sh{ { sleep 10 echo "eval -client '$kak_client' 'echo sleep ended'" | kak -p ${kak_session} } > /dev/null 2>&1 < /dev/null & } ---- * The +nop+ command is used so that any eventual output from the +%sh{ ... }+ is not interpreted by Kakoune * When writing to the socket, Kakoune has no way to guess in which client's context the command should be evaluated. A temporary context is used, which does not have any user interface, so if we want to interact with the user, we need to use the +eval+ command, with its +-client+ option to send commands to a specific client. * For the command to run asynchronously, we wrap it in a sub shell with braces, redirect its +std{in,err,out}+ to +/dev/null+, and run it in background with +&+. Using this pattern, the shell does not wait for this sub shell to finish before quitting. Interactive output ------------------ It is a frequent interaction mode to run a program and display its output in a Kakoune buffer. The common pattern to do that is to use a fifo buffer: [source,bash] ----- evaluate-commands %sh{ # Create a temporary fifo for communication output=$(mktemp -d -t kak-temp-XXXXXXXX)/fifo mkfifo ${output} # run command detached from the shell { run command here > ${output} } > /dev/null 2>&1 < /dev/null & # Open the file in Kakoune and add a hook to remove the fifo echo "edit! -fifo ${output} *buffer-name* hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output})} }" } ----- This is a very simple example, most of the time, the echo command will as well contain ----- set buffer filetype <...> ----- and some hooks for this filetype will have been written Completion candidates --------------------- Filetype specific completion should be provided by external programs. External completions are provided using an option to store completion, which have the following format. ---- line.column[+len]@timestamp candidate1|select1|menu1 candidate2|select2|menu2 ... ---- the first element of this string list specify where and when this completion applies, the others are a triplet `|