macvim - How to create and delete files in Vim
PHP中文网
PHP中文网 2017-05-16 16:40:48
0
9
1270

vim is a very powerful editor, and when used with NERDTree, you can easily open files, search for files, etc. However, files cannot be created or deleted, which is somewhat inconvenient.

vim has a simple command line function and can perform touch/rm operations.
Is there a way that when NERDTreeC goes to a certain directory, the vim terminal can also automatically cd to the directory, so that when using the vim command line to create and delete files, it will not Need to write a long path

Thank you everyone for your answers, it made me realize that I asked such a SB question

PHP中文网
PHP中文网

认证0级讲师

reply all(9)
阿神

-_-

巴扎黑

= =
Sir, do you know that in command mode, add in front of! Can execute shell commands

For example:! mkdir www to create a new folder.
! rm to delete the file

Of course, if you use Windows, just pretend I didn’t say anything

伊谢尔伦

vim is a very powerful editor. When used with NERDTree, you can easily open files, search for files, etc. However, files cannot be created or deleted, which is somewhat inconvenient.
1. Create a new file. Isn’t it equivalent to creating a new file by adding a file name suffix in vim and saving it? Or as someone above said:!touch, but this is a command to call the operating system. Linux has it, but I don’t know about windows. Deleting files is similar

vim has a simple command line function and can perform touch/rm operations.
Is there a way that when NERDTreeC goes to a certain directory, the vim terminal can also automatically cd to the directory, so that when using the vim command line to create and delete files, there is no need to write a long path
2. Does NerdTree have this function? See the help information given above

某草草

Give you a simple cheatsheet

https://gist.github.com/ldong/f05bbae89079f52cca0e

習慣沉默

C-x, C-f

某草草

Incorrect, m reported an error
And the NERDTree created with the command is not updated in real time

漂亮男人

https://github.com/tpope/vim-eunuch

  • :Remove: Delete a buffer and the file on disk simultaneously.
  • :Unlink: Like :Remove, but keeps the now empty buffer.
  • :Move: Rename a buffer and the file on disk simultaneously.
  • :Rename: Like :Move, but relative to the current file's containing directory.
  • :Chmod: Change the permissions of the current file.
  • :Mkdir: Create a directory, defaulting to the parent of the current file.
  • :Find: Run find and load the results into the quickfix list.
  • :Locate: Run locate and load the results into the quickfix list.
  • :Wall: Write every open window. Handy for kicking off tools like guard.
  • :SudoWrite: Write a privileged file with sudo.
  • :SudoEdit: Edit a privileged file with sudo.
世界只因有你

Windows users can tell you that it can also be used in gvim! Add cmd command to operate the file, but the cmd window will pop up during the command execution...

By the way, after using commands to operate files, NERDTree cannot automatically refresh the directory...

巴扎黑

Newcomers would like to add: NERDTree cannot automatically refresh the directory...you can use shift+R to refresh manually.
Also, just read the answer given on the 1st floor carefully. After the cursor points to the file, press m and four file operations will appear. At this time, you can create, delete, copy and other operations.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template