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

Improve key mappings example #18

Merged
merged 3 commits into from
Jan 10, 2022
Merged

Improve key mappings example #18

merged 3 commits into from
Jan 10, 2022

Conversation

mickael-menu
Copy link
Member

Clarify the key mappings example, including the basic LSP ones.

See #17

@mickael-menu mickael-menu requested a review from kabouzeid January 7, 2022 12:09
README.md Outdated Show resolved Hide resolved
@kabouzeid
Copy link
Collaborator

Looks good overall. I have some thoughts, but have no time right now. I'll let you know in the evening.

@mickael-menu
Copy link
Member Author

@kabouzeid Do you want to address some stuff with this PR?

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@kabouzeid
Copy link
Collaborator

Some mappings, like for example ZkNotes, ZkNew, ZkTags, ZkMatch, are also very useful outside of a notebook context.
In my experience, many (most?) users just copy and paste from the README.
It might not be the best experience to have them all only available when the buffer is a zk note.
Maybe first list the mappings, then below that, as a "pro tip", add that if one wants certain mappings to only be availabe in a zk note buffer, one could move them to a ftplugin and check for require("zk.util").notebook_root?

In the case of ZkNew, it wouldn't be a problem to overwrite with a more specific mapping when inside of a zk note buffer.

--- in main config
vim.api.nvim_set_keymap("n", "<leader>zn", "<Cmd>ZkNew { title = vim.fn.input('Title: ') }<CR>", opts)

--- ~/.config/nvim/ftplugin/markdown.lua
if require("zk.util").notebook_root(vim.fn.expand('%:p')) ~= nil then
  -- overwrite with a more specific mapping
  vim.api.nvim_buf_set_keymap(0, "n", "<leader>zn", "<Cmd>ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>", opts)
end

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@mickael-menu
Copy link
Member Author

Some mappings, like for example ZkNotes, ZkNew, ZkTags, ZkMatch, are also very useful outside of a notebook context.

You're perfectly right, I updated the README and fixed your other comments as well. Thanks!

@mickael-menu mickael-menu requested a review from kabouzeid January 9, 2022 21:46
@kabouzeid
Copy link
Collaborator

lgtm :)

@mickael-menu mickael-menu merged commit 73db7e5 into main Jan 10, 2022
@mickael-menu mickael-menu deleted the readme-bindings branch January 10, 2022 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants