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 6381291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:22:37+00:00 2026-05-25T02:22:37+00:00

I has in vim: foo barba[r]bar foo [] indicates cursor position and when I

  • 0

I has in vim:

foo barba[r]bar
foo

[] indicates cursor position

and when I use vaw or viw the barbarbar is higlithted. And it is ok.

But I would like understand – why? v is for visual mode, a – i dont know why, and w normaly approach to the begin of new word.

I also checked caw and ciw. First one deletes barbarbar and leave cursor after foo without space, second will leave space after foo, both enters insert mode…

So why it works? Is any referance for this in vim help? Could anyone translate it for vim language?

  • 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-25T02:22:38+00:00Added an answer on May 25, 2026 at 2:22 am

    See :help text-object. This explains it all better than any guy here could.

    Here is the whole section:

    6. Text object selection            *object-select* *text-objects*
                            *v_a* *v_i*
    
    This is a series of commands that can only be used while in Visual mode or
    after an operator.  The commands that start with "a" select "a"n object
    including white space, the commands starting with "i" select an "inner" object
    without white space, or just the white space.  Thus the "inner" commands
    always select less text than the "a" commands.
    
    These commands are {not in Vi}.
    These commands are not available when the |+textobjects| feature has been
    disabled at compile time.
                                *v_aw* *aw*
    aw          "a word", select [count] words (see |word|).
                Leading or trailing white space is included, but not
                counted.
                When used in Visual linewise mode "aw" switches to
                Visual characterwise mode.
    
                                *v_iw* *iw*
    iw          "inner word", select [count] words (see |word|).
                White space between words is counted too.
                When used in Visual linewise mode "iw" switches to
                Visual characterwise mode.
    
                                *v_aW* *aW*
    aW          "a WORD", select [count] WORDs (see |WORD|).
                Leading or trailing white space is included, but not
                counted.
                When used in Visual linewise mode "aW" switches to
                Visual characterwise mode.
    
                                *v_iW* *iW*
    iW          "inner WORD", select [count] WORDs (see |WORD|).
                White space between words is counted too.
                When used in Visual linewise mode "iW" switches to
                Visual characterwise mode.
    
                                *v_as* *as*
    as          "a sentence", select [count] sentences (see
                |sentence|).
                When used in Visual mode it is made characterwise.
    
                                *v_is* *is*
    is          "inner sentence", select [count] sentences (see
                |sentence|).
                When used in Visual mode it is made characterwise.
    
                                *v_ap* *ap*
    ap          "a paragraph", select [count] paragraphs (see
                |paragraph|).
                Exception: a blank line (only containing white space)
                is also a paragraph boundary.
                When used in Visual mode it is made linewise.
    
                                *v_ip* *ip*
    ip          "inner paragraph", select [count] paragraphs (see
                |paragraph|).
                Exception: a blank line (only containing white space)
                is also a paragraph boundary.
                When used in Visual mode it is made linewise.
    
    a]                      *v_a]* *v_a[* *a]* *a[*
    a[          "a [] block", select [count] '[' ']' blocks.  This
                goes backwards to the [count] unclosed '[', and finds
                the matching ']'.  The enclosed text is selected,
                including the '[' and ']'.
                When used in Visual mode it is made characterwise.
    
    i]                      *v_i]* *v_i[* *i]* *i[*
    i[          "inner [] block", select [count] '[' ']' blocks.  This
                goes backwards to the [count] unclosed '[', and finds
                the matching ']'.  The enclosed text is selected,
                excluding the '[' and ']'.
                When used in Visual mode it is made characterwise.
    
    a)                          *v_a)* *a)* *a(*
    a(                          *v_ab* *v_a(* *ab*
    ab          "a block", select [count] blocks, from "[count] [(" to
                the matching ')', including the '(' and ')' (see
                |[(|).  Does not include white space outside of the
                parenthesis.
                When used in Visual mode it is made characterwise.
    
    i)                          *v_i)* *i)* *i(*
    i(                          *v_ib* *v_i(* *ib*
    ib          "inner block", select [count] blocks, from "[count] [("
                to the matching ')', excluding the '(' and ')' (see
                |[(|).
                When used in Visual mode it is made characterwise.
    
    a>                      *v_a>* *v_a<* *a>* *a<*
    a<          "a <> block", select [count] <> blocks, from the
                [count]'th unmatched '<' backwards to the matching
                '>', including the '<' and '>'.
                When used in Visual mode it is made characterwise.
    
    i>                      *v_i>* *v_i<* *i>* *i<*
    i<          "inner <> block", select [count] <> blocks, from
                the [count]'th unmatched '<' backwards to the matching
                '>', excluding the '<' and '>'.
                When used in Visual mode it is made characterwise.
    
                            *v_at* *at*
    at          "a tag block", select [count] tag blocks, from the
                [count]'th unmatched "<aaa>" backwards to the matching
                "</aaa>", including the "<aaa>" and "</aaa>".
                See |tag-blocks| about the details.
                When used in Visual mode it is made characterwise.
    
                            *v_it* *it*
    it          "inner tag block", select [count] tag blocks, from the
                [count]'th unmatched "<aaa>" backwards to the matching
                "</aaa>", excluding the "<aaa>" and "</aaa>".
                See |tag-blocks| about the details.
                When used in Visual mode it is made characterwise.
    
    a}                          *v_a}* *a}* *a{*
    a{                          *v_aB* *v_a{* *aB*
    aB          "a Block", select [count] Blocks, from "[count] [{" to
                the matching '}', including the '{' and '}' (see
                |[{|).
                When used in Visual mode it is made characterwise.
    
    i}                          *v_i}* *i}* *i{*
    i{                          *v_iB* *v_i{* *iB*
    iB          "inner Block", select [count] Blocks, from "[count] [{"
                to the matching '}', excluding the '{' and '}' (see
                |[{|).
                When used in Visual mode it is made characterwise.
    
    a"                          *v_aquote* *aquote*
    a'                          *v_a'* *a'*
    a`                          *v_a`* *a`*
                "a quoted string".  Selects the text from the previous
                quote until the next quote.  The 'quoteescape' option
                is used to skip escaped quotes.
                Only works within one line.
                When the cursor starts on a quote, Vim will figure out
                which quote pairs form a string by searching from the
                start of the line.
                Any trailing white space is included, unless there is
                none, then leading white space is included.
                When used in Visual mode it is made characterwise.
                Repeating this object in Visual mode another string is
                included.  A count is currently not used.
    
    i"                          *v_iquote* *iquote*
    i'                          *v_i'* *i'*
    i`                          *v_i`* *i`*
                Like a", a' and a`, but exclude the quotes and
                repeating won't extend the Visual selection.
                Special case: With a count of 2 the quotes are
                included, but no extra white space as with a"/a'/a`.
    
    When used after an operator:
    For non-block objects:
        For the "a" commands: The operator applies to the object and the white
        space after the object.  If there is no white space after the object
        or when the cursor was in the white space before the object, the white
        space before the object is included.
        For the "inner" commands: If the cursor was on the object, the
        operator applies to the object.  If the cursor was on white space, the
        operator applies to the white space.
    For a block object:
        The operator applies to the block where the cursor is in, or the block
        on which the cursor is on one of the braces.  For the "inner" commands
        the surrounding braces are excluded.  For the "a" commands, the braces
        are included.
    
    When used in Visual mode:
    When start and end of the Visual area are the same (just after typing "v"):
        One object is selected, the same as for using an operator.
    When start and end of the Visual area are not the same:
        For non-block objects the area is extended by one object or the white
        space up to the next object, or both for the "a" objects.  The
        direction in which this happens depends on which side of the Visual
        area the cursor is.  For the block objects the block is extended one
        level outwards.
    
    For illustration, here is a list of delete commands, grouped from small to big
    objects.  Note that for a single character and a whole line the existing vi
    movement commands are used.
        "dl"    delete character (alias: "x")       |dl|
        "diw"   delete inner word           *diw*
        "daw"   delete a word               *daw*
        "diW"   delete inner WORD (see |WORD|)      *diW*
        "daW"   delete a WORD (see |WORD|)      *daW*
        "dd"    delete one line             |dd|
        "dis"   delete inner sentence           *dis*
        "das"   delete a sentence           *das*
        "dib"   delete inner '(' ')' block      *dib*
        "dab"   delete a '(' ')' block          *dab*
        "dip"   delete inner paragraph          *dip*
        "dap"   delete a paragraph          *dap*
        "diB"   delete inner '{' '}' block      *diB*
        "daB"   delete a '{' '}' block          *daB*
    
    Note the difference between using a movement command and an object.  The
    movement command operates from here (cursor position) to where the movement
    takes us.  When using an object the whole object is operated upon, no matter
    where on the object the cursor is.  For example, compare "dw" and "daw": "dw"
    deletes from the cursor position to the start of the next word, "daw" deletes
    the word under the cursor and the space after or before it.
    

    Note that you can create your own text objects with two commands (for example you would like “K” to be a new text object : when in operator mode you want to select three characters with cursor at the centre, and in visual mode you would like to extend the selection by 1 character to both ends (provided that your cursor is at the end of the selection):

    "operator-pending mapping
    onoremap K :normal! hv2l<return>
    "visual mapping (xmap preferred over vmap because vmap also works in select mode)
    "note that in visual mode o goes to the other end. Therefore this will expand selection if you were at the end and restrict it otherwise.
    xnoremap K ohol
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm choosing what to use: Eclipse or NetBeans. NetBeans has better vim plugin -
I have a html file, it has good colors in vim. But I want
I use vim, sed, bash and Perl. Each has somewhat different regex syntax. I
ViM has this option hlsearch where a searched string is displayed in highlight mode
For example if I open a brand new file in vim it has the
Has anyone else found VIM's syntax highlighting of Javascript sub-optimal? I'm finding that sometimes
I saw this same question for VIM and it has been something that I
Has anyone looked at Yahoo's ASTRA ? It's fairly nifty, but I had some
I have made a central bare shared repo at foo.org. user A has done
Mac OS X 10.6 (Snow Leopard) has VIM pre-installed (version 7.2), which is great.

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.