Skip to content
This repository has been archived by the owner. It is now read-only.
master
Go to file
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
Apr 21, 2019
Jan 2, 2020

README.md

Kakoune Edit or Dir

Deprecated in favour of alexherbo2/explore.kak

@alexherbo2's implementation does the same thing but better 💚


GitHub tagGitHub license

Sometimes, when I use :edit command in Kakoune, I press enter too early. Kakoune complains foo is a directory. I know Kakoune, thank you very much. What if editing directory would show you interactive file browser instead?

GIF time!

GIF

Installation

Source edit-or-dir.kak from your kakrc or use plug.kak.

For convenience I recommend aliasing :edit-or-dir command to :e. I do not recommend aliasing or overriding built-in :edit command, since it might broke other scripts. Replacing :e alias is fine, scripts should not relay on aliases anyway.

unalias global e edit
alias global e edit-or-dir

Usage

edit-or-dir [PATH]

PATH - relative or absolute path to file or directory.
       . means current directory
       .. means parent directory
       If PATH is directory, file browser in temporary buffer *dir* will be opened

When in *dir* buffer you can use following bindings:

  • Return: Open selected files
  • Backspace: Go to parent directory
  • Alt h: Toggle hidden files
  • Escape: Close file browser

You can open multiple files by selecting them with x or other selection method like %sregexReturn

Related plugins

Changelog

  • 0.1 2018-09-26:
  • 0.2 2018-09-27:
    • FIX Replace basename with substitution, PR #1
  • 0.3 2018-09-28:
    • ADD Hidden files toggle, PR #2
    • ADD New bindings, PR #2
    • ADD EditorConfig for developers
    • FIX Remove new line from end of *dir* buffer
    • FIX Apply changes proposed by ShellCheck
  • 0.4 2018-10-13:
    • ADD support to edit multiple files, PR #4
    • ADD CONTRIBUTING document, PR #4
    • ADD edit-or-dir-{forward,back} internal (hidden) commands, PR #4
    • FIX Fix Typos, improve style and formatting of README, PR #4
    • CHANGE rename edit-or-dir-display-dir (internal command, not breaking), PR #4
    • CHANGE refactoring, PR #4
  • 0.5 2018-11-05:
    • Kakoune v2018.10.27
    • ADD issue template
    • CHANGE switch to directory layout with scripts in rc subdirectory (breaking: update source path in kakrc)
    • FIX remove --group-directories-first flag from ls call (MacOS compatibility)
  • 0.6 2019-06-16:
    • ADD expand ~ in :edit-or-dir #11
    • FIX don't show .. in root PR: #12
    • CHANGE refactoring PR: #11 #12
  • 2020-01-02 DEPRECATED