Problem: when a symlink target path contains a newline character, the
rendered line passed to nvim_buf_set_lines includes that newline,
causing the error "'replacement string' item contains newlines".
Solution: apply the same gsub("\n", "") sanitization to meta.link in
get_link_text that is already used for entry names at line 791.
Resolves: stevearc/oil.nvim#673
Problem: when Neovim is started with -R (read-only), all buffers get
readonly=true. Oil's render_buffer toggles modifiable to write directory
listings, which triggers "W10: Warning: Changing a readonly file" on
every directory navigation.
Solution: clear readonly on oil buffers during initialization. Oil
buffers are buftype=acwrite — readonly has no meaning for them since
writes go through BufWriteCmd, not the filesystem.
Resolves: stevearc/oil.nvim#642
Problem: executable files were visually indistinguishable from regular
files in oil buffers.
Solution: add OilExecutable highlight group (linked to DiagnosticOk)
that detects executables via Unix permission bits (S_IXUSR|S_IXGRP|
S_IXOTH) and Windows executable extensions (.exe, .bat, .cmd, .com,
.ps1). Applied to both regular files and symlink targets.
Based on: stevearc/oil.nvim#698Closesstevearc/oil.nvim#679
Problem: the is_hidden_file and is_always_hidden config callbacks
only received (name, bufnr), making it impossible to filter by entry
type, permissions, or other metadata without reimplementing entry
lookup.
Solution: pass the full oil.Entry as a third argument to both
callbacks. Existing configs that only accept (name, bufnr) are
unaffected since Lua silently ignores extra arguments. The internal
should_display function signature changes from (name, bufnr) to
(bufnr, entry) to reflect its new contract.
Cherry-picked from: stevearc/oil.nvim#644
Problem: third-party plugins like oil-git-status.nvim had no way to
know when an oil buffer was re-rendered after a filesystem change,
causing their decorations to be cleared with no signal to refresh.
Solution: emit a User OilReadPost autocmd after every successful
render_buffer_async call. Also document all oil user events
(OilEnter, OilReadPost, OilMutationComplete) in oil.txt since none
were previously documented.
Cherry-picked from: stevearc/oil.nvim#723
* feat: add support for column text alignment
* refactor(util): replace rpad with pad_align
* refactor(columns): whitespace handling in parse_col
* refactor: small changes
* doc: add align option to doc generation
* refactor: replace lpad with pad_align
---------
Co-authored-by: Steven Arcangeli <stevearc@stevearc.com>
* fix: support natural ordering for numbers with >12 digits
Changes the column ordering code when `view_options.natural_order`
is enabled, so that it can support larger numbers.
The previous 12-digit padding approach breaks for numbers above 12
digits.
This length-prefixed approach can scale to much higher numbers.
I picked %03 (padding 3 digits) because most filesystems don't allow
more than 255 bytes in a path segment, and "255" is 3 digits long.
* add memoization to natural order sorting
* remove call to unpack
* pass bufnr to the constrain_cursor
* return early if the oil buffer is not the current buffer
---------
Co-authored-by: Steven Arcangeli <506791+stevearc@users.noreply.github.com>
* feat: hidden highlights
* feat: OilHidden for hidden highlights instead of Comment
* fix: add the new combinatoric highlight groups
* perf: get rid of a call to is_hidden_file
* fix: tweak the default highlight group links
* fix: update function call in unit tests
---------
Co-authored-by: Steven Arcangeli <stevearc@stevearc.com>
* Added check for filetype before setting win_options in initialize
* refactor: use nvim_buf_call to set window options
---------
Co-authored-by: Steven Arcangeli <506791+stevearc@users.noreply.github.com>
Some architectures don't support LuaJIT.
Remove the goto's from the code to be compatible
with Neovim built without LuaJIT.
Signed-off-by: Julian Ruess <julianonline+github@posteo.de>
* Return from delete_hidden_buffers when win type is command
* lint: apply stylua formatting
---------
Co-authored-by: Steven Arcangeli <stevearc@stevearc.com>
For posterity: this was a very painful lesson. Turns out "BufDelete"
doesn't mean "buffer was deleted", it means "buffer was deleted from the
buffer list". If you set nobuflisted, BufDelete will be triggered even
though the buffer is still loaded and active.
* wip: skeleton code for trash adapter
* refactor: split trash implementation for mac and linux
* fix: ensure we create the .Trash/$uid dir
* feat: code complete linux trash implementation
* doc: write up trash features
* feat: code complete mac trash implementation
* cleanup: remove previous, terrible, undocumented trash feature
* fix: always disabled trash
* feat: show original path of trashed files
* doc: add a note about calling actions directly
* fix: bugs in trash implementation
* fix: schedule_wrap in mac trash
* doc: fix typo and line wrapping
* fix: parsing of arguments to :Oil command
* doc: small documentation tweaks
* doc: fix awkward wording in the toggle_trash action
* fix: warning on Windows when delete_to_trash = true
* feat: :Oil --trash can open specific trash directories
* fix: show all trash files in device root
* fix: trash mtime should be sortable
* fix: shorten_path handles optional trailing slash
* refactor: overhaul the UI
* fix: keep trash original path vtext from stacking
* refactor: replace disable_changes with an error filter
* fix: shorten path names in home directory relative to root
* doc: small README format changes
* cleanup: remove unnecessary preserve_undo logic
* test: add a functional test for the freedesktop trash adapter
* test: more functional tests for trash
* fix: schedule a callback to avoid main loop error
* refactor: clean up mutator logic
* doc: some comments and type annotations