简体   繁体   中英

How to create file in current explorer directory in vs code using only keys?

Like in vim nerd tree plugin, when you push 'm' then 'a' button in vim nerd tree you can add file in current directory where cursor on Nerd tree. Is it possible do it in vs code? Maybe some plugins?

Unfortunately there is no such plugin yet but you could define some customized keybindings which resembles NERDTree to some extent ( File > Preferences > Keyboard Shortcuts and click on the link keybindings.json ):

[
  {
    "key": "f",
    "command": "explorer.newFile",
    "when": "explorerViewletFocus && !inputFocus"
  },
  {
    "key": "d",
    "command": "explorer.newFolder",
    "when": "explorerViewletFocus && !inputFocus"
  },
  {
    "key": "x",
    "command": "deleteFile",
    "when": "explorerViewletFocus && !inputFocus"
  },
  {
    "key": "r",
    "command": "renameFile",
    "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
  },
  {
    "key": "enter",
    "command": "list.select",
    "when": "listFocus && !inputFocus"
  },
  {
    "key": "o",
    "command": "list.select",
    "when": "listFocus && !inputFocus"
  }
]

You could change the key s freely and commands are self explanatory. i. e: hitting f in explorer will add a file in selected directory and ... ).

Fortunately we also have j and k movements in explorer via vscodevim plugin.

The only missing part is searching the tree; and of course there is a promise to be added by January 2019 ( see issue #10026 )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM