Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6972543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:58:59+00:00 2026-05-27T16:58:59+00:00

Say in my C head file I wanna include another file which has not

  • 0

Say in my C head file I wanna include another file which has not being created yet:

#include "AnotherFile.h" /*not being created yet*/

Now, I select the file in Visual Mode,
#include “AnotherFile.h“

How to create a new file with the name of what I’ve selected? I mean,

:e  {something that  refers to what I selected} 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:58:59+00:00Added an answer on May 27, 2026 at 4:58 pm

    The closest I can think of is to create a function:

    function! W() range
      execute "e " .  getline("'<")[getpos("'<")[2]-1:getpos("'>")[2]] 
    endfu
    

    You can then select the word and type :call W() + enter, which should open the new buffer.

    EDIT The function above does not work without errors if the buffer containing the #include is modified. In such case, the following function is suited better:

    function! W() range
      let l:fileName = getline("'<")[getpos("'<")[2]-1:getpos("'>")[2]] 
      new      
      execute "w " . l:fileName
    endfu
    

    EDIT 2 You can also try to type :e <cfile> (see :help <cfile>).

    EDIT 3 Finally, under :help gf you find hidden

    If you do want to edit a new file, use: >
            :e <cfile>
    To make gf always work like that: 
            :map gf :e <cfile><CR>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I need to call a javascript file in the <head> of an ERb
Say file xyz.ext in the head/master is v1.25, but I want to commit v1.23
My JavaScript (say File 1) needs to fetch another JS file (say File 2)
Let's say I have some code like this: <html> <head><title>Title</title></head> <body> <?php if (!$someCondition){
For some time already I am breaking my head on the following. Say we
So lets say I had a string that was <html> <head><title>301 Moved Permanently</title><head> and
Say I have the following file structure: app/ app.py controllers/ __init__.py project.py plugin.py If
Say I've got this array: MyArray(0)=aaa MyArray(1)=bbb MyArray(2)=aaa Is there a .net function which
Say I have an ASMX web service, MyService. The service has a method, MyMethod.
Let's say I have a large HTML file with different kinds of tags, similar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.