Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feat/improve-close-…
Browse files Browse the repository at this point in the history
…action
  • Loading branch information
chrisbellboy committed Nov 29, 2024
2 parents a3a2b89 + 3c2de37 commit 84b557a
Show file tree
Hide file tree
Showing 23 changed files with 703 additions and 154 deletions.
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export VIRTUAL_ENV=venv
layout python
python -c 'import pyparsing' 2>/dev/null || pip install -r scripts/requirements.txt
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ luac.out
*.zip
*.tar.gz

# python bytecode
__pycache__

# Object files
*.o
*.os
Expand Down Expand Up @@ -41,6 +44,10 @@ luac.out

.direnv/
.testenv/
venv/
doc/tags
scripts/nvim_doc_tools
scripts/nvim-typecheck-action
scripts/benchmark.nvim
perf/tmp/
profile.json
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## [2.13.0](https://github.com/stevearc/oil.nvim/compare/v2.12.2...v2.13.0) (2024-11-11)


### Features

* config option to customize floating window title ([#482](https://github.com/stevearc/oil.nvim/issues/482)) ([5d2dfae](https://github.com/stevearc/oil.nvim/commit/5d2dfae655b9b689bd4017b3bdccd52cbee5b92f))
* config option to disable lsp file methods ([#477](https://github.com/stevearc/oil.nvim/issues/477)) ([f60bb7f](https://github.com/stevearc/oil.nvim/commit/f60bb7f793477d99ef1acf39e920bf2ca4e644de))


### Bug Fixes

* actions.preview accepts options ([#497](https://github.com/stevearc/oil.nvim/issues/497)) ([cca1631](https://github.com/stevearc/oil.nvim/commit/cca1631d5ea450c09ba72f3951a9e28105a3632c))
* add trailing slash to directories on yank_entry ([#504](https://github.com/stevearc/oil.nvim/issues/504)) ([42333bb](https://github.com/stevearc/oil.nvim/commit/42333bb46e34dd47e13927010b1dcd30e6e4ca96))
* don't deep merge keymaps ([#510](https://github.com/stevearc/oil.nvim/issues/510)) ([709403c](https://github.com/stevearc/oil.nvim/commit/709403ccd6f22d859c2e42c780ab558ae89284d9))
* guard against nil keymaps ([621f8ba](https://github.com/stevearc/oil.nvim/commit/621f8ba4fa821724e9b646732a26fb2e795fe008))
* only map ~ for normal mode ([#484](https://github.com/stevearc/oil.nvim/issues/484)) ([ccab9d5](https://github.com/stevearc/oil.nvim/commit/ccab9d5e09e2d0042fbbe5b6bd05e82426247067))
* sort keymap help entries by description ([#506](https://github.com/stevearc/oil.nvim/issues/506)) ([52cc8a1](https://github.com/stevearc/oil.nvim/commit/52cc8a1fb35ea6ce1df536143add7ce7215c63c0)), closes [#376](https://github.com/stevearc/oil.nvim/issues/376)

## [2.12.2](https://github.com/stevearc/oil.nvim/compare/v2.12.1...v2.12.2) (2024-09-10)


Expand Down
53 changes: 46 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,66 @@
.PHONY: all doc test lint fastlint clean
## help: print this help message
.PHONY: help
help:
@echo 'Usage:'
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'

## all: generate docs, lint, and run tests
.PHONY: all
all: doc lint test

doc: scripts/nvim_doc_tools
python scripts/main.py generate
python scripts/main.py lint
venv:
python3 -m venv venv
venv/bin/pip install -r scripts/requirements.txt

## doc: generate documentation
.PHONY: doc
doc: scripts/nvim_doc_tools venv
venv/bin/python scripts/main.py generate
venv/bin/python scripts/main.py lint

## test: run tests
.PHONY: test
test:
./run_tests.sh

## lint: run linters and LuaLS typechecking
.PHONY: lint
lint: scripts/nvim-typecheck-action fastlint
./scripts/nvim-typecheck-action/typecheck.sh --workdir scripts/nvim-typecheck-action lua

fastlint: scripts/nvim_doc_tools
python scripts/main.py lint
## fastlint: run only fast linters
.PHONY: fastlint
fastlint: scripts/nvim_doc_tools venv
venv/bin/python scripts/main.py lint
luacheck lua tests --formatter plain
stylua --check lua tests

## profile: use LuaJIT profiler to profile the plugin
.PHONY: profile
profile: scripts/benchmark.nvim
nvim --clean -u perf/bootstrap.lua -c 'lua jit_profile()'

## flame_profile: create a trace in the chrome profiler format
.PHONY: flame_profile
flame_profile: scripts/benchmark.nvim
nvim --clean -u perf/bootstrap.lua -c 'lua flame_profile()'

## benchmark: benchmark performance opening directory with many files
.PHONY: benchmark
benchmark: scripts/benchmark.nvim
nvim --clean -u perf/bootstrap.lua -c 'lua benchmark()'
@cat perf/tmp/benchmark.txt

scripts/nvim_doc_tools:
git clone https://github.com/stevearc/nvim_doc_tools scripts/nvim_doc_tools

scripts/nvim-typecheck-action:
git clone https://github.com/stevearc/nvim-typecheck-action scripts/nvim-typecheck-action

scripts/benchmark.nvim:
git clone https://github.com/stevearc/benchmark.nvim scripts/benchmark.nvim

## clean: reset the repository to a clean state
.PHONY: clean
clean:
rm -rf scripts/nvim_doc_tools scripts/nvim-typecheck-action
rm -rf scripts/nvim_doc_tools scripts/nvim-typecheck-action venv .testenv perf/tmp profile.json
36 changes: 26 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,16 @@ require("oil").setup({
show_hidden = false,
-- This function defines what is considered a "hidden" file
is_hidden_file = function(name, bufnr)
return vim.startswith(name, ".")
local m = name:match("^%.")
return m ~= nil
end,
-- This function defines what will never be shown, even when `show_hidden` is set
is_always_hidden = function(name, bufnr)
return false
end,
-- Sort file names in a more intuitive order for humans. Is less performant,
-- so you may want to set to false if you work with large directories.
natural_order = true,
-- Sort file names with numbers in a more intuitive order for humans.
-- Can be "fast", true, or false. "fast" will turn it off for large directories.
natural_order = "fast",
-- Sort file and directory names case insensitive
case_insensitive = false,
sort = {
Expand All @@ -231,6 +232,10 @@ require("oil").setup({
{ "type", "asc" },
{ "name", "asc" },
},
-- Customize the highlight group for the file name
highlight_filename = function(entry, is_hidden, is_link_target, is_link_orphan)
return nil
end,
},
-- Extra arguments to pass to SCP when moving/copying files over SSH
extra_scp_args = {},
Expand Down Expand Up @@ -267,8 +272,21 @@ require("oil").setup({
return conf
end,
},
-- Configuration for the actions floating preview window
preview = {
-- Configuration for the file preview window
preview_win = {
-- Whether the preview window is automatically updated when the cursor is moved
update_on_cursor_moved = true,
-- How to open the preview window "load"|"scratch"|"fast_scratch"
preview_method = "fast_scratch",
-- A function that returns true to disable preview on a file e.g. to avoid lag
disable_preview = function(filename)
return false
end,
-- Window-local options to use for preview window buffers
win_options = {},
},
-- Configuration for the floating action confirmation window
confirmation = {
-- Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
-- min_width and max_width can be a single value or a list of mixed integer/float types.
-- max_width = {100, 0.8} means "the lesser of 100 columns or 80% of total"
Expand All @@ -289,8 +307,6 @@ require("oil").setup({
win_options = {
winblend = 0,
},
-- Whether the preview window is automatically updated when the cursor is moved
update_on_cursor_moved = true,
},
-- Configuration for the floating progress window
progress = {
Expand Down Expand Up @@ -356,8 +372,8 @@ Note that at the moment the ssh adapter does not support Windows machines, and i
- [open_float(dir)](doc/api.md#open_floatdir)
- [toggle_float(dir)](doc/api.md#toggle_floatdir)
- [open(dir)](doc/api.md#opendir)
- [close()](doc/api.md#close)
- [open_preview(opts)](doc/api.md#open_previewopts)
- [close(opts)](doc/api.md#closeopts)
- [open_preview(opts, callback)](doc/api.md#open_previewopts-callback)
- [select(opts, callback)](doc/api.md#selectopts-callback)
- [save(opts, cb)](doc/api.md#saveopts-cb)
- [setup(opts)](doc/api.md#setupopts)
Expand Down
57 changes: 31 additions & 26 deletions doc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
- [open_float(dir)](#open_floatdir)
- [toggle_float(dir)](#toggle_floatdir)
- [open(dir)](#opendir)
- [close()](#close)
- [open_preview(opts)](#open_previewopts)
- [close(opts)](#closeopts)
- [open_preview(opts, callback)](#open_previewopts-callback)
- [select(opts, callback)](#selectopts-callback)
- [save(opts, cb)](#saveopts-cb)
- [setup(opts)](#setupopts)
Expand Down Expand Up @@ -119,49 +119,54 @@ Open oil browser for a directory
| ----- | ------------- | ------------------------------------------------------------------------------------------- |
| dir | `nil\|string` | When nil, open the parent of the current buffer, or the cwd if current buffer is not a file |

## close()
## close(opts)

`close()` \
`close(opts)` \
Restore the buffer that was present when oil was opened

| Param | Type | Desc |
| ----------------- | -------------------- | --------------------------------------------------- |
| opts | `nil\|oil.CloseOpts` | |
| >exit_if_last_buf | `nil\|boolean` | Exit vim if this oil buffer is the last open buffer |

## open_preview(opts)
## open_preview(opts, callback)

`open_preview(opts)` \
`open_preview(opts, callback)` \
Preview the entry under the cursor in a split

| Param | Type | Desc | |
| ----- | ------------ | -------------------------------------------------- | ------------------------------------- |
| opts | `nil\|table` | | |
| | vertical | `boolean` | Open the buffer in a vertical split |
| | horizontal | `boolean` | Open the buffer in a horizontal split |
| | split | `"aboveleft"\|"belowright"\|"topleft"\|"botright"` | Split modifier |
| Param | Type | Desc |
| ----------- | ------------------------------------------------------- | ---------------------------------------------- |
| opts | `nil\|oil.OpenPreviewOpts` | |
| >vertical | `nil\|boolean` | Open the buffer in a vertical split |
| >horizontal | `nil\|boolean` | Open the buffer in a horizontal split |
| >split | `nil\|"aboveleft"\|"belowright"\|"topleft"\|"botright"` | Split modifier |
| callback | `nil\|fun(err: nil\|string)` | Called once the preview window has been opened |

## select(opts, callback)

`select(opts, callback)` \
Select the entry under the cursor

| Param | Type | Desc | |
| -------- | ---------------------------- | ------------------------------------------------------- | ---------------------------------------------------- |
| opts | `nil\|oil.SelectOpts` | | |
| | vertical | `nil\|boolean` | Open the buffer in a vertical split |
| | horizontal | `nil\|boolean` | Open the buffer in a horizontal split |
| | split | `nil\|"aboveleft"\|"belowright"\|"topleft"\|"botright"` | Split modifier |
| | tab | `nil\|boolean` | Open the buffer in a new tab |
| | close | `nil\|boolean` | Close the original oil buffer once selection is made |
| callback | `nil\|fun(err: nil\|string)` | Called once all entries have been opened | |
| Param | Type | Desc |
| ----------- | ------------------------------------------------------- | ---------------------------------------------------- |
| opts | `nil\|oil.SelectOpts` | |
| >vertical | `nil\|boolean` | Open the buffer in a vertical split |
| >horizontal | `nil\|boolean` | Open the buffer in a horizontal split |
| >split | `nil\|"aboveleft"\|"belowright"\|"topleft"\|"botright"` | Split modifier |
| >tab | `nil\|boolean` | Open the buffer in a new tab |
| >close | `nil\|boolean` | Close the original oil buffer once selection is made |
| callback | `nil\|fun(err: nil\|string)` | Called once all entries have been opened |

## save(opts, cb)

`save(opts, cb)` \
Save all changes

| Param | Type | Desc | |
| ----- | ---------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------- |
| opts | `nil\|table` | | |
| | confirm | `nil\|boolean` | Show confirmation when true, never when false, respect skip_confirm_for_simple_edits if nil |
| cb | `nil\|fun(err: nil\|string)` | Called when mutations complete. | |
| Param | Type | Desc |
| -------- | ---------------------------- | ------------------------------------------------------------------------------------------- |
| opts | `nil\|table` | |
| >confirm | `nil\|boolean` | Show confirmation when true, never when false, respect skip_confirm_for_simple_edits if nil |
| cb | `nil\|fun(err: nil\|string)` | Called when mutations complete. |

**Note:**
<pre>
Expand Down
Loading

0 comments on commit 84b557a

Please sign in to comment.