Find the answer to your Linux question:
Results 1 to 8 of 8
I have some files in some directory and some other in some other directory.. Is there a way to open files these as if all of them are present in ...
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    19

    Directories and files in vim

    I have some files in some directory and some other in some other directory..
    Is there a way to open files these as if all of them are present in the same directory..

    I mean say 2 files are in ~/Desktop/folder1
    2 files are in home/user

    i opened terminal and am in home/user

    But i need to open the files from folder1 without doing cd to the folder1 directory..

  2. #2
    Linux Guru techieMoe's Avatar
    Join Date
    Aug 2004
    Location
    Texas
    Posts
    9,496
    Yes. Use the file's path. For instance, say you have 2 directories called "dirA" and "dirB", each with a file in them. From your root directory (in this case it's /home/) you can access either file by giving it's path:

    Code:
    cat /dirA/file1 /dirB/file2
    This example uses both files from inside your home directory without having to change directories.
    Registered Linux user #270181
    TechieMoe's Tech Rants

  3. #3
    Just Joined!
    Join Date
    Sep 2007
    Posts
    19

    hii

    I dont want them to get printed on terminal ...
    I want to open the files on after the other in vim without cding to other directory...

  4. #4
    Linux Guru techieMoe's Avatar
    Join Date
    Aug 2004
    Location
    Texas
    Posts
    9,496
    Quote Originally Posted by yuva View Post
    I dont want them to get printed on terminal ...
    I want to open the files on after the other in vim without cding to other directory...
    I don't understand what you're asking. You're in vim and you want to open one file after another? The path should work.
    Registered Linux user #270181
    TechieMoe's Tech Rants

  5. #5
    Just Joined!
    Join Date
    Sep 2007
    Posts
    19

    yeah

    let me in home/user/folder1 in terminal ...


    i want to open files in terminal(in vim) in /home/user/folder2 without changing directory in terminal..

  6. #6
    Just Joined!
    Join Date
    Sep 2007
    Posts
    19
    I am asking whether can we link files in one directory to another directory..

  7. #7
    Linux Guru techieMoe's Avatar
    Join Date
    Aug 2004
    Location
    Texas
    Posts
    9,496
    Quote Originally Posted by yuva View Post
    let me in home/user/folder1 in terminal ...


    i want to open files in terminal(in vim) in /home/user/folder2 without changing directory in terminal..
    Ok. You can't tell vim to open the file in "/home/user/folder2/somefile"? Are you getting an error of some sort? You shouldn't have to do any weird directory changing from inside of vim.

    I'm going to leave this one to someone more familiar with vim. Perhaps there's something obvious here that I'm just not seeing.
    Registered Linux user #270181
    TechieMoe's Tech Rants

  8. #8
    Just Joined!
    Join Date
    Dec 2005
    Posts
    96
    I want to open the files on after the other in vim without cding to other directory...
    Code:
    $ vim ~/Documents/text.txt ~/Desktop/folder1/text2.txt
    This will open 2 files (text.txt and text2.txt) for you in vim one after another.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...