Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat branch complete on attach #1579

Merged
merged 55 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
9da4462
chore(mappings): migrate legacy mappings under the hood
kyazdani42 Jul 31, 2022
2df2710
chore(mappings): POC for help and :help on_attach keymaps
alex-courtis Aug 1, 2022
de53d64
chore(mappings): POC for help and :help on_attach keymaps
alex-courtis Aug 1, 2022
a847166
Merge branch 'master' into chore/action_cb_help_poc
alex-courtis Aug 1, 2022
2320d17
chore(mappings): add desc to all mappings, show in help, reformat help
alex-courtis Aug 2, 2022
cd6d295
chore(mappings): add desc to all mappings
alex-courtis Aug 2, 2022
5fac9a1
chore(mappings): add desc to all mappings
alex-courtis Aug 6, 2022
57e055e
Merge branch 'master' into chore/action_cb_help_poc
alex-courtis Sep 4, 2022
420c909
chore(mappings): escape help keys
alex-courtis Sep 4, 2022
b4d8ef2
Merge branch 'chore/migrate-legacy-mappings' into feat-branch-complet…
alex-courtis Sep 4, 2022
3eb5e4c
chore(mappings): migrate legacy mappings under the hood: map keymap t…
alex-courtis Sep 4, 2022
f6f439b
chore(mappings): migrate legacy mappings under the hood: remove dispatch
alex-courtis Sep 4, 2022
adb117a
Revert "chore(mappings): migrate legacy mappings under the hood: remo…
alex-courtis Sep 4, 2022
c5883a1
chore(mappings): migrate legacy mappings under the hood: pass node to…
alex-courtis Sep 4, 2022
a456480
chore(mappings): migrate legacy mappings under the hood: remove dispatch
alex-courtis Sep 4, 2022
3ff5408
chore(mappings): migrate legacy mappings under the hood: replace mapp…
alex-courtis Sep 4, 2022
c97c97b
chore(mappings): generate on_attach from user's legacy mappings
alex-courtis Sep 5, 2022
b2cdee5
chore(mappings): generate on_attach from user's legacy mappings
alex-courtis Sep 5, 2022
13b6c8c
Merge remote-tracking branch 'origin/master' into feat-branch-complet…
alex-courtis Nov 6, 2022
b36b7b4
chore(mappings): merge cleanup
alex-courtis Nov 6, 2022
46010a9
Merge branch 'master' into feat-branch-complete-on-attach
alex-courtis Nov 27, 2022
1978dc1
chore(mappings): use default mappings when on_attach not present, log…
alex-courtis Nov 27, 2022
da6fcd2
on_attach is default or user only, legacy and generation includes def…
alex-courtis Dec 11, 2022
64beb33
Merge branch 'master' into feat-branch-complete-on-attach
alex-courtis Dec 11, 2022
8603a2b
Merge branch 'master' into feat-branch-complete-on-attach
alex-courtis Dec 12, 2022
915d28b
Merge branch 'master' into feat-branch-complete-on-attach
alex-courtis Jan 26, 2023
94634c0
on_attach_default hardcoded
alex-courtis Jan 26, 2023
f495bca
format default_on_attach
alex-courtis Jan 26, 2023
ed23287
source default on_attach directly
alex-courtis Jan 26, 2023
c2b9793
remove human mappings help
alex-courtis Jan 26, 2023
43d1900
simplified on_attach generation
alex-courtis Jan 26, 2023
af6de11
Merge branch 'master' into feat-branch-complete-on-attach
alex-courtis Jan 29, 2023
c35027b
simplified on_attach generation
alex-courtis Jan 29, 2023
7627d21
generate default on_attach
alex-courtis Jan 29, 2023
3455829
generate default on_attach
alex-courtis Jan 29, 2023
00e8d24
Merge branch 'master' into feat-branch-complete-on-attach
alex-courtis Feb 12, 2023
df24c8a
Merge branch 'master' into feat-branch-complete-on-attach
alex-courtis Feb 12, 2023
68096fc
split out keymap_legacy
alex-courtis Feb 12, 2023
24ecf35
add recently introduced mappings
alex-courtis Feb 12, 2023
25dc48d
legacy api.config.mappings.active and default
alex-courtis Feb 12, 2023
e01fa1c
legacy api.config.mappings.active and default
alex-courtis Feb 12, 2023
d26b57a
Merge branch 'master' into feat-branch-complete-on-attach
alex-courtis Feb 20, 2023
4f89a04
on_attach help and readme
alex-courtis Feb 20, 2023
90ea114
legacy generate handles action = ""
alex-courtis Feb 20, 2023
f073cba
legacy generate handles action =
alex-courtis Feb 20, 2023
00be1db
legacy generate gives defaults when no user mappings
alex-courtis Feb 20, 2023
3ca305c
legacy generate handles action = ""
alex-courtis Feb 20, 2023
4ec73bb
legacy generate api handles overrides
alex-courtis Feb 20, 2023
b7b1427
legacy generate handles subsequent setup, on_attach retains deep copi…
alex-courtis Feb 21, 2023
8359ffc
add wiki link to generated on_attach
alex-courtis Feb 21, 2023
7c2d7eb
Merge remote-tracking branch 'origin/master' into feat-branch-complet…
alex-courtis Feb 27, 2023
8810d3c
add opts helper function for on_attach, prefixing 'nvim-tree: '
alex-courtis Feb 27, 2023
3054033
add opts helper function for on_attach, prefixing 'nvim-tree: '
alex-courtis Feb 27, 2023
e68f2e8
more comments in generated on_attach
alex-courtis Feb 27, 2023
9791804
update release date
alex-courtis Feb 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 9 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ Take a look at the [wiki](https://github.com/nvim-tree/nvim-tree.lua/wiki) for S

Existing `*_on_setup*` mechanisms have been removed in favour of [Open At Startup](https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup)

## New Mapping Method 2023-03-01

[:help nvim-tree.view.mappings](doc/nvim-tree-lua.txt) have been deprecated in favour of [:help nvim-tree.on_attach](doc/nvim-tree-lua.txt). Please visit [Migrating To on_attach](https://github.com/nvim-tree/nvim-tree.lua/wiki/Migrating-To-on_attach) to transition.

## Requirements

[neovim >=0.8.0](https://github.com/neovim/neovim/wiki/Installing-Neovim)
Expand Down Expand Up @@ -77,14 +81,6 @@ require("nvim-tree").setup()
-- OR setup with some options
require("nvim-tree").setup({
sort_by = "case_sensitive",
view = {
width = 30,
mappings = {
list = {
{ key = "u", action = "dir_up" },
},
},
},
renderer = {
group_empty = true,
},
Expand All @@ -96,7 +92,7 @@ require("nvim-tree").setup({

For complete list of available configuration options see [:help nvim-tree-setup](doc/nvim-tree-lua.txt)

Each option is documented in `:help nvim-tree.OPTION_NAME`. Nested options can be accessed by appending `.`, for example [:help nvim-tree.view.mappings](doc/nvim-tree-lua.txt)
Each option is documented in `:help nvim-tree.OPTION_NAME`. Nested options can be accessed by appending `.`, for example [:help nvim-tree.filters.dotfiles](doc/nvim-tree-lua.txt)

## Commands

Expand All @@ -114,10 +110,10 @@ Basic commands:

## Mappings

nvim-tree comes with number of mappings; for default mappings please see [:help nvim-tree-default-mappings](doc/nvim-tree-lua.txt), for way of configuring mappings see [:help nvim-tree-mappings](doc/nvim-tree-lua.txt)

`g?` toggles help, showing all the mappings and their actions.

To customise your mappings see [:help nvim-tree.on_attach](doc/nvim-tree-lua.txt) and [:help nvim-tree-mappings](doc/nvim-tree-lua.txt)

## Roadmap

nvim-tree is stable and new major features will not be added. The focus is on existing user experience.
Expand All @@ -133,25 +129,13 @@ Development is focused on:

## API

nvim-tree exposes a public API. This is non breaking, with additions made as necessary.
nvim-tree exposes a public API. This is non breaking, with additions made as necessary. See [:help nvim-tree-api](doc/nvim-tree-lua.txt)

See wiki [Recipes](https://github.com/nvim-tree/nvim-tree.lua/wiki/Recipes) and [Tips](https://github.com/nvim-tree/nvim-tree.lua/wiki/Tips) for ideas and insipration.

Please raise a [feature request](https://github.com/nvim-tree/nvim-tree.lua/issues/new?assignees=&labels=feature+request&template=feature_request.md&title=) if the API is insufficent for your needs. [Contributions](#Contributing) are always welcome.

[:help nvim-tree-api](doc/nvim-tree-lua.txt)

### Events

Users may subscribe to events that nvim-tree will dispatch in a variety of situations.

[:help nvim-tree-events](doc/nvim-tree-lua.txt)

### Actions

Custom actions may be mapped which can invoke API or perform your own actions.

[:help nvim-tree-mappings](doc/nvim-tree-lua.txt)
You may also subscribe to events that nvim-tree will dispatch in a variety of situations, see [:help nvim-tree-events](doc/nvim-tree-lua.txt)

## Contributing

Expand Down
300 changes: 151 additions & 149 deletions doc/nvim-tree-lua.txt

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions lua/nvim-tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ local git = require "nvim-tree.git"
local filters = require "nvim-tree.explorer.filters"
local modified = require "nvim-tree.modified"
local notify = require "nvim-tree.notify"
local keymap_legacy = require "nvim-tree.keymap-legacy"

local _config = {}

Expand Down Expand Up @@ -68,9 +69,6 @@ function M.change_root(filepath, bufnr)
change_dir.fn(vim.fn.fnamemodify(filepath, ":p:h"))
end

---@deprecated
M.on_keypress = require("nvim-tree.actions.dispatch").dispatch

function M.open_replacing_current_buffer(cwd)
if view.is_visible() then
return
Expand Down Expand Up @@ -379,6 +377,7 @@ local function setup_vim_commands()
vim.api.nvim_create_user_command("NvimTreeCollapseKeepBuffers", function()
collapse_all.fn(true)
end, { bar = true })
vim.api.nvim_create_user_command("NvimTreeGenerateOnAttach", keymap_legacy.cmd_generate_on_attach, {})
end

function M.change_dir(name)
Expand Down Expand Up @@ -562,7 +561,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
sync_root_with_cwd = false,
reload_on_bufenter = false,
respect_buf_cwd = false,
on_attach = "disable",
on_attach = "default",
remove_keymaps = false,
select_prompts = false,
view = {
Expand Down Expand Up @@ -862,6 +861,7 @@ function M.setup(conf)
validate_options(conf)

local opts = merge_options(conf)

local netrw_disabled = opts.disable_netrw or opts.hijack_netrw

_config.root_dirs = opts.root_dirs
Expand All @@ -885,6 +885,8 @@ function M.setup(conf)
log.raw("config", "%s\n", vim.inspect(opts))
end

keymap_legacy.generate_legacy_on_attach(opts)

require("nvim-tree.actions").setup(opts)
require("nvim-tree.keymap").setup(opts)
require("nvim-tree.colors").setup()
Expand Down
131 changes: 0 additions & 131 deletions lua/nvim-tree/actions/dispatch.lua

This file was deleted.

Loading