Skip to content

mushRoom0785/vim-wend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vim-wend

v0.5.4

edit-driven file navigation plugin for vim.

features

edit-driven navigation

the navigation window is a live ls -lai listing:

# e.g.

total 128
986 drwxr-xr-x 1 mush mush   12 Jun  8 11:45 .
957 drwxr-xr-x 1 mush mush  124 Jun 20 11:11 ..
958 drwxr-xr-x 2 mush mush 4096 Jun 22 12:00 sub
959 -rw-r--r-- 1 mush mush   12 Jun 22 12:00 foo.c
960 -rwxr--r-- 1 mush mush    8 Jun 22 12:00 foo

# ...

and this window can be edited like a regular file, just like what you do in vim.

vim-liked operations

the cursor auto fails on the name column on each row. which channel you commit with decides what an edit means:

  • gf : navigate: jump to the dir or file under the cursor -- a listed row, or a path you typed on a line, as long as it already exists. works in normal and visual mode; a missing path is an error and is never created here.
  • :w : commit every change in the listing to disk at once. rows are matched by inode, so a change tracks the real on-disk entry, not fragile line text:
    • create: type a NEW bare name in the current dir (a trailing / makes a directory) -> mkdir / touch on :w;
    • delete: remove a row (e.g. dd) -> deletes that file/folder;
    • rename: edit a name in place -> renames it (content preserved);
    • chmod: edit the mode column -> runs chmod;
    • go there or create: type a full path (e.g. a/b/c.c) on a line, then :w jumps there, creating it if missing -> land inside the target.
  • <C-o> : go back to your previous wend position (buffer-local; ordinary buffers' <C-o> is untouched). every time you land on a new line or a new directory the spot is pushed, so <C-o> walks back line by line and across directory hops. opening a real file resets this history; use :Wend to reopen a listing.

default navigator

wend replaces netrw as the default file navigator: a bare vim opens the listing at the current directory, vim <dir> opens that directory, and :edit <dir> does the same on the fly. netrw is disabled unless g:wend_keep_netrw is set to 1 before wend is loaded.

quick start

use auto-script (recommended)

cd scripts && ./init.sh

follow the prompts. the script copies plugin/wend.vim into vim's runtimepath (user-level ~/.vim/ or system-level /usr/share/vim/vimfiles/) and writes the necessary config to ~/.vimrc.

manually install

copy plugin/wend.vim under a plugin/ directory in your runtimepath:

mkdir -p ~/.vim/plugin
cp plugin/wend.vim ~/.vim/plugin/

then add these lines to ~/.vimrc:

augroup wend_startup
  autocmd!
  autocmd VimEnter * ++nested if argc() == 0 | execute 'Wend' | endif
augroup END

to keep netrw, set let g:wend_keep_netrw = 1 before wend is loaded.

ref

the following projects inspired wend.

vim - text editor.

dired - an emacs plugin.

vim-dirvish - what i used in person before wend.

known issues

  • sudo vim <dir> will led to netrw instead of wend, for vim won't read ~/.vim or ~/.vimrc under sudo.
  • "random" error: Error detected while processing function <SNR>12_Open: line 6:E37: No write since last change (add ! to override).

TODO List

  • fix known bugs.
  • add config flags (e.g. to toggle optional behaviours on/off).
  • add test scripts for the plugin and the init workflow.
  • support macOS & windows.
  • add & support themes.

About

edit-driven file navigation plugin for vim.

Topics

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors