I want to achieve two effects about using the netrw plugin for vim.
EFFECT ONE:
I have a test directory.Here is its directory structure:
MINGW64 ~/test
$ ll
total 1
drwxr-xr-x 1 uooki2 197121 0 一月 18 18:37 dir1/
drwxr-xr-x 1 uooki2 197121 0 一月 18 18:37 dir2/
drwxr-xr-x 1 uooki2 197121 0 一月 18 18:37 dir3/
-rw-r--r-- 1 uooki2 197121 13 一月 18 18:38 file1
I can open the test directory via vim ,And vim displays the directory tree structure of this directory in a window.
$ vim test
Just like this:
" ============================================================================
" Netrw Directory Listing (netrw v156)
" /c/Users/uooki2/test
" Sorted by name
" Sort sequence: [\/]$,\<core\%(\.\d\+\)\=\>,\.h$,\.c$,\.cpp$,\~\=\*$,*,\.o$,\.obj$,\.info$,\.swp
" Quick Help: <F1>:help -:go up dir D:delete R:rename s:sort-by x:special
" ==============================================================================
../
./
dir1/
dir2/
dir3/
file1
~
~
But,i hope that vim can open two windows ,one on the left and one on the right ; and the window on the left shows the directory tree structure of the test directory, and the right side is a blank window. And the width of the left window is 30 percent of the width of the right window. Just like this:
" ==================| 1
" Netrw Directory Li|~
" /c/Users/uooki2/|~
" Sorted by n|~
" Sort sequence: [|~
" Quick Help: <F1>|~
" ==================|~
../ |~
./ |~
dir1/ |~
dir2/ |~
dir3/ |~
file1 |~
~ |~
~ |~
~ |~
~ |~
~ |~
~ |~
~ |~
~ |~
~ |~
~ |~
~ |~
~ |~
~ |~
~ |~
~ |~
~ |~
~ |~
~ |~
~ |~
2 test 0x2> 3 [unnamed] 0x0 0,0-1 <a
what should i do to achieve this effect?
EFFECT TWO:
I opened the file1 file in bash by the command: vim file1.
$ vim file1
Vim open the file1 file in a window. As follows:
1 hello world!
~
~
~
~
~
~
~
~
~
~
~
~
1 file1 0x68 1,1 all
But,this is not what i want. I want that vim can open two windows ,one on the left and one on the right ; and the window on the left shows the directory tree structure of the directory where the file1 file is located, and the right side shows the content of the file1 file. And the width of the left window is 30 percent of the width of the right window. Just like this:
" /c/Users/uooki2/| 1 hello world!
" Sorted by n|~
" Sort sequence: [|~
" Quick Help: <F1>|~
" ==================|~
../ |~
./ |~
dir1/ |~
dir2/ |~
dir3/ |~
.file1.swo |~
file1 |~
.file1.swp |~
~ |~
~ |~
~ |~
~ |~
~ |~
~ |~
~ |~
~ |~
~ |~
2 test 0x2> 4 test/file1 0x68 1,1 >
Should I modify the vimrc file? Or write a vimScript to achieve? Or netrw can do these functions by itself.
What should i do to achieve this effect?
My vim version: vim8.1
UPDATE:
I don't want to depend too heavily on third-party plugins, and I want to be able to use these two features directly on all machines where vim is installed, so I don't want to use nerdtree or any other third party plugins.