Automatic handling different styles of indentation and alignment
Switch branches/tags
Nothing to show
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
rc
LICENSE
README.md

README.md

smarttab.kak

license

smarttab.kak is a plugin for Kakoune editor. It provides three different ways of handling indentation and alignment with tab key.

Installation

With plug.kak (recommended)

Add this to your kakrc:

plug "andreyorst/smarttab.kak"

Source your kakrc or restart Kakoune, and execute :plug-install. Or if you don't want to source configuration file or restart Kakoune, simply run plug-install andreyorst/smarttab.kak. It will be enabled automatically.

Without plugin manager

Clone this repo somewhere

git clone https://github.com/andreyorst/smarttab.kak.git

And source the smarttab.kak script from it.

After that you can use smarttab.kak.

Usage

This plugin adds these three commands to toggle different policy when using Tab and > keys:

  • noexpandtab - use tab for everything.
    Tab will insert \t character, and > will use \t character when indenting.
    Aligning cursors with & uses \t character.
  • expandtab - use space for everything.
    Tab will insert %opt{tabstop} amount of spaces, and > will indent with spaces.
  • smarttab - indent with tab, align with space.
    Tab will insert \t character if your cursor is inside indentation area, e.g. before any
    non-whitespace character, and insert spaces if cursor is after any non-whitespace character. Aligning
    cursors with & uses space.

By default smarttab.kak affects only Tab and > keys. If you want to deindent lines that are being indented with the spaces by hitting Backspace, you can set softtabstop option. This option describes how many spaces should be treated as single tab character when deleting spaces with backspace.

If you've used plug.kak for installation, you can set it within the plug command:

plug "andreyorst/smarttab.kak" %{
    set-option global softtabstop 4 # or other preferred value
}