0

Say I have following 2 similar files in 2 different workspace on same linux machine.

/user1/ws1/ip/src/ip_main.c 
/user1/ws2/ip/src/ip_main.c 

Now I did,

cd user1/ws1/ 
vim ip/src/ip_main.c 

then I press ESC then executed

:cd ../ws2

which shows my pwd as "user1/ws2" Now I want to open ip/src/ip_main.c in pwd i.e "user1/ws2" using ESC

:vertical diffsplit "some logic to get to ws2/ip/src/ip_main.c" 

note after :cd ../ws2

:pwd command show "user1/ws2" but :echo $PWD command still show "user1/ws1"

How can i do it,Can anyone help ?

Kent
  • 189,393
  • 32
  • 233
  • 301
ypp
  • 141
  • 10

1 Answers1

0

Diffing both files is easily done via shell globbing, e.g. in Bash:

$ vimdiff -O /user1/ws{1,2}/ip/src/ip_main.c

Withing Vim, you have to use relative paths (i.e. prepend ../.., then go down into the other hierarchy). <C-R>% on the command-line (cp. :help c_CTRL-R) inserts the current path; this may avoid retyping much of the similar path, especially when used with the command-line window (:help c_CTRL-F).

With my EditSimilar plugin, you can use this:

:DiffSplitSubstitute 1=2
Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324