When I type in terminal something like
mvim ./path/to/my/project
Vim opens this project directory, in my NERDTree I can see files, but when I try to run some CLI command, like
:!touch some/file/in/my/project
It occurs, that my current path is my users home directory
so if I want to create file in my project dir, I must type full path like
:!touch ./path/to/my/project/some/file/in/my/project/name
Is it possible somehow to automatically change dir after vim starts?
I use this in my vimrc:
" Use %% on the command line to expand to the path of the current file
cabbr <expr> %% expand('%:p:h')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With