Skip to content

Commit

Permalink
🚀 initial commit for v1.1.0 add, update, and fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
61130061 committed Oct 1, 2022
1 parent 5e436b6 commit 09d49a8
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 65 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ This is all the features that are available and coming soon in the future.
| **Keybinding** | **on Editor** | **on File Explorer** | Note |
|:---:|:---:|:---:|:---:|
| `CTRL + N` | Open and focus on file explorer view. | Close explorer view and change focus to editor view. | If you want to keep file explorer view open all the time, you can change `nerdtree.hideSidebarWhenOpenFile` setting following [here](#configuration). |
| `T` or `ENTER` | - | Open selected `file`. | You can hide File Explorer every time you open a file by changing `nerdtree.alwaysShowSidebar` setting following [here](#configuration). |
| `J`, `K`, `H` and `L` | - | Moving around with VIM keybinding | `J` = `DOWN`, `K` = `UP`, `H` = `LEFT`, `L` = `RIGHT` |
| `Enter` | - | Open selected `file` in current active editor or Expand folder tree | You can hide File Explorer every time you open a file by changing `nerdtree.alwaysShowSidebar` setting following [here](#configuration). |
| `T` | - | Open selected `file` in a new tab | You can hide File Explorer every time you open a file by changing `nerdtree.alwaysShowSidebar` setting following [here](#configuration). |
| `M -> A` | - | Create new `file` at cursor position. | - |
| `M -> F` | - | Create new `folder` at cursor position. | - |
| `M -> D` | - | Move a `file` to trash. | - |
Expand Down
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ We try to bring [NERDTree Vim](https://github.com/preservim/nerdtree) features t
| **Status** | **Feature** |
|:---:|:---:|
| ✅🌟 | Open/Close **File Explorer** view |
| | walk through **File Explorer** |
| | walk through **File Explorer** |
|| CRUD file keybindings |
| 🦙‍ | Extension conflict alert |
| 🦙‍ | Customizable keybindings |
Expand Down
55 changes: 37 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "NERDTree",
"description": "⌨️ NERDTree for Visual Studio Code",
"icon": "docs/icon.png",
"version": "1.0.0",
"version": "1.1.0",
"publisher": "Llam4u",
"keywords": [
"NERDTree",
Expand All @@ -28,14 +28,8 @@
],
"activationEvents": [
"onCommand:nerdtree.unfocusSidebarOrClose",
"onCommand:nerdtree.focusFileView",
"onCommand:nerdtree.openFileNewWindow",
"onCommand:nerdtree.createFile",
"onCommand:nerdtree.moveFileToTrash",
"onCommand:nerdtree.copyFile",
"onCommand:nerdtree.pasteFile",
"onCommand:nerdtree.createFolder",
"onCommand:nerdtree.renameFile"
"onCommand:nerdtree.openFile",
"onCommand:nerdtree.openFileNewWindow"
],
"main": "./dist/extension.js",
"contributes": {
Expand All @@ -62,12 +56,12 @@
},
{
"key": "ctrl+n",
"command": "nerdtree.focusFileView",
"command": "workbench.files.action.focusFilesExplorer",
"when": "sideBarVisible && !filesExplorerFocus"
},
{
"key": "ctrl+n",
"command": "nerdtree.focusFileView",
"command": "workbench.files.action.focusFilesExplorer",
"when": "!sideBarVisible"
},
{
Expand All @@ -77,37 +71,62 @@
},
{
"key": "enter",
"command": "nerdtree.openFileNewWindow",
"command": "nerdtree.openFile",
"when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsFolder && !inputFocus"
},
{
"key": "enter",
"command": "list.select",
"when": "explorerViewletVisible && filesExplorerFocus && explorerResourceIsFolder && !inputFocus"
},
{
"key": "h",
"command": "list.collapse",
"when": "listFocus && !inputFocus"
},
{
"key": "j",
"command": "list.focusDown",
"when": "listFocus && !inputFocus"
},
{
"key": "k",
"command": "list.focusUp",
"when": "listFocus && !inputFocus"
},
{
"key": "l",
"command": "list.select",
"when": "listFocus && !inputFocus"
},
{
"key": "m a",
"command": "nerdtree.createFile",
"command": "workbench.files.action.createFileFromExplorer",
"when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceReadonly && !inputFocus"
},
{
"key": "m d",
"command": "nerdtree.moveFileToTrash",
"command": "moveFileToTrash",
"when": "explorerResourceMoveableToTrash && explorerViewletVisible && filesExplorerFocus && !explorerResourceReadonly && !inputFocus"
},
{
"key": "m c",
"command": "nerdtree.copyFile",
"command": "filesExplorer.copy",
"when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !inputFocus"
},
{
"key": "m v",
"command": "nerdtree.pasteFile",
"command": "filesExplorer.paste",
"when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceReadonly && !inputFocus"
},
{
"key": "m f",
"command": "nerdtree.createFolder",
"command": "workbench.files.action.createFolderFromExplorer",
"when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceReadonly && !inputFocus"
},
{
"key": "m r",
"command": "nerdtree.renameFile",
"command": "renameFile",
"when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
}
]
Expand Down
53 changes: 8 additions & 45 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ export function activate(context: vscode.ExtensionContext) {
})
);

// Focus fille explorer view
// Close current editor and open selected file instead
// Release version: 1.1.0
context.subscriptions.push(
vscode.commands.registerCommand('nerdtree.focusFileView', () => {
vscode.commands.executeCommand('workbench.files.action.focusFilesExplorer');
vscode.commands.registerCommand('nerdtree.openFile', () => {
vscode.commands.executeCommand('workbench.action.closeActiveEditor');
vscode.commands.executeCommand('list.select');
if (vscode.workspace.getConfiguration().get('nerdtree.hideSidebarWhenOpenFile')) {
vscode.commands.executeCommand('workbench.action.toggleSidebarVisibility');
}
})
);

Expand All @@ -31,48 +36,6 @@ export function activate(context: vscode.ExtensionContext) {
}
})
);

// Create new file
context.subscriptions.push(
vscode.commands.registerCommand('nerdtree.createFile', () => {
vscode.commands.executeCommand('workbench.files.action.createFileFromExplorer');
})
);

// Create new folder
context.subscriptions.push(
vscode.commands.registerCommand('nerdtree.createFolder', () => {
vscode.commands.executeCommand('workbench.files.action.createFolderFromExplorer');
})
);

// Move focused file to trash
context.subscriptions.push(
vscode.commands.registerCommand('nerdtree.moveFileToTrash', () => {
vscode.commands.executeCommand('moveFileToTrash');
})
);

// Copy focused file
context.subscriptions.push(
vscode.commands.registerCommand('nerdtree.copyFile', () => {
vscode.commands.executeCommand('filesExplorer.copy');
})
);

// Paste focused file
context.subscriptions.push(
vscode.commands.registerCommand('nerdtree.pasteFile', () => {
vscode.commands.executeCommand('filesExplorer.paste');
})
);

// Paste focused file
context.subscriptions.push(
vscode.commands.registerCommand('nerdtree.renameFile', () => {
vscode.commands.executeCommand('renameFile');
})
);
}

export function deactivate() {}

0 comments on commit 09d49a8

Please sign in to comment.