> What'is the fastest soluce to split path and name from filepath ?
I don't know about the "fastest" way, but the following works for me:
:let file_path = 'path/to/some/location/where.txt'
:echo matchlist(file_path, '\(.*\)/\(.*\)')[1:2]
If you need them in variables, you can use
:let [p, f] = matchlist(file_path, '\(.*\)/\(.*\)')[1:2]
:echo p
:echo f
You may have to adjust the path separator from "/" to "\\" on a
Win32/Dos machine.
-tim
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment