vi dot doesn't work - vim

After I installed YADR, I cannot use vi . command.
If I use vi . command, my macbook's vim just says
"." is a directory
Press ENTER or type command to continue
I want to open netrw browser when I open directory by vim.
I think the problem comes from my vimrc file: https://github.com/skwp/dotfiles/blob/master/vimrc

Related

how to open an empty buffer when vim on directory?

I have nerdtree and ctrlp installed in vim.
I use vim in command line on some directory: vim somedir.
I intend to let vim start with an empty file just as if I only type vim.
But currently, vim will start with nerdtree opened, the root directory is the same as the directory after vim command.
How can let vim start with an empty buffer and afterwards I want to use ctrlp to search files?
You should do it the other way around:
$ cd somedir && vim

Vifm. Edit file in opened gvim

I use Gvim to write code. And use vifm to make file management ( copy, move files, extract tar's ). Sometimes, when navigating in vifm i need to open some file to edit him. Using :e it opened vim in same window. Is there any way to open file to edit in already opened gvim program?
You can use Vim's client-server feature to send the :edit to the existing GVIM instance. In the terminal Vim / vifm, execute:
:!gvim --remote path/to/file
See :help remote.txt for details. You can also open the file in a new tab page with --remote-tab etc.
Partial solution/workaround (I'm using a mac fwiw):
In vfimrc, define
" yank current file path into the clipboard
nnoremap Cf :!echo -n %c:p | pbcopy %i<cr>
To copy filename and dir into system clipboard
Then in vifm, cursor over file and type
Cf
:!gvim "
<cmd-v>
to paste clipboard,
and finish expression with...
"
<enter>
and now that file should open in gvim. It worked for me

Disable or close NERDTree on opening "vim ."

I'm basically working in an environment where I sometimes use ctrlp and sometimes nerdtree. But when I start vim using vim . it always opens NERDTree. I've tried various .vimrc config commands:
let NERDTreeQuitOnOpen=1
let g:nerdtree_tabs_open_on_gui_startup=0
But they all don't work. Is there some whay I can disable the NERDTree directory listing when VIM opens? Note, I don't like just using the vim command by itself because I'm usually opening VIM when I'm in the application directory.
Thanks!
Netrw plugin opens when vim opens a directory. NerdTree takes over netrw and therefore opens when editing a directory.
vim . is equivalent to :e .
Just open vim without the . and you will be good

NERDTree opens by default if opening a directory

If I open a folder in vim like this:
$ mvim . # or vim .
NERDTree opens by default in full width:
How can I prevent this from happening and show default VIM welcome screen instead?
You are explicitly telling vim to start with a listing of the current directory, if you don't want that, just do $ vim.
Run vim to get the Welcome Screen.
If you open vim . you'll get a directory listing of the current working directory (Netrw or NERDTree Directory Listing).
NERDTree overrides the default file browser (netrw).
To disable directory listing by NERDTree at startup, add let g:NERDTreeHijackNetrw=0 to your ".vimrc".
This Option tells NERD tree whether to replace the netrw autocommands for exploring local directories.
Run vim --noplugin . and you see an empty buffer.

how to automatically make new file with mvim

When I run mvim . it opens NERDTree but doesnt open a new file/buffer.
How might I accomplish this? Ideally when you type mvim . from terminal it would open MacVim, close NERDtree, and open a new buffer
I'm not sure if this is possible but is there a way that if I run mvim . from the command line multiple times it wouldn't open vim in a new window each time?
As for your second question, vim allows you to send a file to an already running instance with --remote arguments, if vim is compiled with +clientserver. MacVim should be - if :echo has("clientserver") prints 1 in the command-line, then this should work. This will work for any vim compiled with +clientserver, including vim running within a terminal window.
When vim is using clientserver you can run mvim so that it sends the new file(s) to an already-running instance of vim, e.g.:
$ mvim --remote-silent file2.txt
Make an alias for mvim that always passes --remote-silent.
See :help remote for more details.
1.You are asking it to open your directory viewer, right? If not, why do you start vim passing the current directory (.) as argument? Leave it off and it will start with an empty buffer.
$ mvim
2.Take a look in the vim manual (man vim). You probably want the --remote-silent option.
$ mvim --remote-silent file
I personally use this so often that I've created an alias for it in my .profile:
alias v='mvim --remote-silent'

Resources