docs:vim:sorting

Sorting in VIM (version 7)

:[range]sor[t][!] [i][u][r][n][x][o] [/{pattern}/]
  • type :help sorting inside vim
  • document content:
    150
      20
    xavier
    300
    Ace
    1205
    710
    aab
    300
    20
    1205
  • sort alphabetic, case sensitive:
    :sort
    
      20
    1205
    1205
    150
    20
    300
    300
    710
    Ace  <-- notice capital A is before a
    aab
    xavier
  • sort alphabetic, case-insensitive:
    :sort i
    
      20
    1205
    1205
    150
    20
    300
    300
    710
    aab  <-- notice lowercase a is before A
    Ace
    xavier
  • sort unique:
    :sort u
    
      20
    1205  <-- duplicate has been removed
    150
    20
    300  <-- duplicate has been removed
    710
    Ace  <-- capital A is before a
    aab
    xavier
  • sort unique and case insensitive:
    :sort ui
    
      20
    1205  <-- duplicate has been removed
    150
    20
    300  <-- duplicate has been removed
    710
    aab  <-- lowercase a is before A
    Ace
    xavier
  • sort numeric:
    :sort n
    
    xavier
    Ace
    aab
      20
    20
    150
    300
    300
    710
    1205
    1205
  • docs/vim/sorting.txt
  • Last modified: 2008/10/17 10:49
  • by billh