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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:01:03+00:00 2026-06-18T12:01:03+00:00

Frequently, e.g. when I write Latex code, I come across the task to rearrange

  • 0

Frequently, e.g. when I write Latex code, I come across the task to rearrange items of a list that are separated by commas. This is quickly done if both items are not at the at the beginning or the end of the list. But if they are at the margins, one has to take extra care of the separating comma.

As an example consider

\cite{GirR84, Tar00, Tem77}.

Is there a smart way in vim to put, e.g., the last item to the front or to the middle position?

  • 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-06-18T12:01:04+00:00Added an answer on June 18, 2026 at 12:01 pm

    I have the following mappings in .vimrc, I think I have them from this tip on wikia:

    nnoremap <silent> gl "_yiw:s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/<CR><c-o>/\w\+\_W\+<CR><c-l>
    nnoremap <silent> gh "_yiw?\w\+\_W\+\%#<CR>:s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/<CR><c-o><c-l>
    

    gh will swap word under the cursor to the left and gl to the right.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I frequently write code changes (PHP) that go along with a schema change. This
I frequently find myself writing code like this: List<int> list = new List<int> {
I frequently write C# code that has to use magic strings to express property
I frequently write throwaway code (in a research environment ) - for example to
I have a function that I use quite frequently, which allows me to write
I frequently write something like this: a_hash['x'] ? a_hash['x'] += ' some more text'
I frequently write code like: lines = open('wordprob.txt','r').readlines() words = open('StdWord.txt','r').readlines() i = 0
I frequently write programs consisting of nothing but assertions to test my code. While
I have a map that is frequently read but rarely write to. Some operations
I frequently find myself writing code like this: tupla = (1, 2, 3, 4)

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.