Skip to content

Commit

Permalink
feat(nvim-tree): add key mappings for file explorer (#108)
Browse files Browse the repository at this point in the history
* fix(nvim-tree): add key mappings for toggling file explorer

- fix delayed <C-b> and <leader>e key mappings to toggle nvim-tree

* feat(copilot-chat): add detailed input format examples for git diff

- added examples for adding, deleting, modifying, moving, and renaming files
- updated the input format section to include detailed descriptions of each example
- improved the clarity of the documentation by providing concrete examples of git diff output

this change enhances the documentation by providing users with clear and practical examples of how to format their input for the copilot-chat plugin
  • Loading branch information
dgokcin authored Aug 25, 2024
1 parent 3174d0f commit 73b1643
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 5 deletions.
38 changes: 38 additions & 0 deletions nvim/lua/plugins/copilot-chat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,44 @@ return {
- Escape any backticks within the command using backslashes. i.e. \` text with backticks \`
- Wrap the entire command in a code block for easy copy-pasting.
Input Format:
The expected input format is command line output from git diff that compares all the changes of the current branch with the main repository branch. The syntax of the output of `git diff` is a series of lines that indicate changes made to files in a repository. Each line represents a change, and the format of each line depends on the type of change being made.
Examples:
Adding a file:
+++ b/newfile.txt
@@ -0,0 +1 @@
+This is the contents of the new file.
Deleting a file:
--- a/oldfile.txt
+++ b/deleted
@@ -1 +0,0 @@
-This is the contents of the old file.
Modifying a file:
--- a/oldfile.txt
+++ b/newfile.txt
@@ -1,3 +1,4 @@
This is an example of how to modify a file.
-The first line of the old file contains this text.
The second line contains this other text.
+This is the contents of the new file.
Moving a file:
--- a/oldfile.txt
+++ b/newfile.txt
@@ -1 +1 @@
This is an example of how to move a file.
Renaming a file:
--- a/oldfile.txt
+++ b/newfile.txt
@@ -1 +1,2 @@
This is an example of how to rename a file.
+This is the contents of the new file.
Example Output:
```sh
gh pr create --base main --title 'commitzen style title' --body 'hello
Expand Down
16 changes: 11 additions & 5 deletions nvim/lua/plugins/nvim-tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ return {
dependencies = {
"nvim-tree/nvim-web-devicons",
},
event = "VeryLazy",
keys = {
{ "<C-b>", "<cmd>NvimTreeToggle<cr>", desc = "Toggle file explorer" },
{ "<leader>e", "<cmd>NvimTreeToggle<cr>", desc = "Explorer NvimTree (root dir)" },
},
config = function()
local status_ok, tree = pcall(require, "nvim-tree")
local api = require("nvim-tree.api")
Expand Down Expand Up @@ -34,11 +37,14 @@ return {
timeout = 500,
},
})
-- File Explorer Keymaps
vim.keymap.set("n", "<C-b>", ":NvimTreeToggle<CR>",

-- Override the existing <C-b> mapping
vim.keymap.set("n", "<C-b>", "<cmd>NvimTreeToggle<CR>",
{ noremap = true, silent = true, desc = "Toggle file explorer" })
vim.keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>",

-- Keep <leader>e as an alternative
vim.keymap.set("n", "<leader>e", "<cmd>NvimTreeToggle<CR>",
{ noremap = true, silent = true, desc = "Explorer NvimTree (root dir)" })
end,
},
}
}

0 comments on commit 73b1643

Please sign in to comment.