0%

vim下文件路径

:help filename-modifiers
:help fnamemodify
:help extend

examples

Examples, when the file name is "src/version.c", current dir                  
"/home/mool/vim":                                                             

    :p                    /home/mool/vim/src/version.c                          
    :p:.                                 src/version.c                          
    :p:~                           ~/vim/src/version.c                          
    :h                                   src                                    
    :p:h                  /home/mool/vim/src                                    
    :p:h:h                /home/mool/vim                                        
    :t                                       version.c                          
    :p:t                                     version.c                          
    :r                                   src/version                            
    :p:r                  /home/mool/vim/src/version                            
    :t:r                                     version                            
    :e                                               c                          
    :s?version?main?                     src/main.c                                                                                  
    :s?version?main?:p    /home/mool/vim/src/main.c                             
    :p:gs?/?\\?           \home\mool\vim\src\version.c      
Examples, when the file name is "src/version.c.gz":                           

    :p                    /home/mool/vim/src/version.c.gz                       
    :e                                                 gz                       
    :e:e                                             c.gz                       
    :e:e:e                                           c.gz                       
    :e:e:r                                           c                          
    :r                                   src/version.c                          
    :r:e                                             c                          
    :r:r                                 src/version                                                                                 
    :r:r:r                               src/version