#
set copy_to_clipboard_delimited_tab=1
set autowrap=1
set ignorecase=1

# Visual mode
nnoremap	"a"	"v"
nnoremap	"A"	"0v$"
nnoremap	"R"	"e"
nnoremap	"r"	"E"

nnoremap	"_"	"="
nnoremap	"b"	"\"
nnoremap	"s"	"<"
nnoremap	"t"	"\\>"

#    j k l h     Move cursor down, up, right or left.
nnoremap	"e"	"j"
nnoremap	"u"	"k"
nnoremap	"i"	"l"
nnoremap	"n"	"h"
vnoremap	"e"	"j"
vnoremap	"u"	"k"
vnoremap	"i"	"l"
vnoremap	"n"	"h"

#    ^           Go up to row 0 of the current column.
#    #           Go down to the last valid row of the current column.  If
#                already in last valid row of the current column, then jump to
#                last valid row of the last valid cell in spreadsheet.
#    0           Go left to column A in the current row.
#    $           Go right to the last valid column of the current row.
nnoremap	"U"	"kkkkk"
nnoremap	"E"	"jjjjj"
nnoremap	"N"	"hhhhh"
nnoremap	"I"	"lllll"
nnoremap	"T"	"$l\\>"
nnoremap	"S"	"0<"

vnoremap	"U"	"kkkkk"
vnoremap	"E"	"jjjjj"
vnoremap	"N"	"hhhhh"
vnoremap	"I"	"lllll"

#    b           Go back to the previous valid cell.
#    w           Go forward to the next valid cell.
nnoremap	"l"	"b"
nnoremap	"y"	"w"
vnoremap	"l"	"b"
vnoremap	"y"	"w"

#    '{a-zA-Z}   Go to the cell or range marked previously with the character.
#                See 'm' for details.
#    goab24      Go to cell AB24.  (There is no need to press <ENTER>.)
#    g0          Go to the leftmost column visible on screen.
#    g$          Go to the rightmost column visible on screen.
#    H           Go to the top row visible on screen.
#    L           Go to the lowest row visible on screen.
nnoremap	"gn"	"g0"
nnoremap	"gi"	"g$"
nnoremap	"gu"	"H"
nnoremap	"ge"	"L"

vnoremap	"gn"	"g0"
vnoremap	"gi"	"g$"
vnoremap	"gu"	"H"
vnoremap	"ge"	"L"

#    gt          Move to next sheet in file.
#    gT          Move to previous sheet in file.
nnoremap	"Y"	"gt"
nnoremap	"L"	"gT"
vnoremap	"Y"	"gt"
vnoremap	"L"	"gT"

#    gM          Go to the middle column on the screen.
#    gf          Open filename or URL in current cell.
#                Uses helper script 'scopen'.
#    M           Go to the middle row on the screen.
#    gg    c-a   Go to the first cell of sheet.
nnoremap	"gg"	"^"
nnoremap	"G"	"#"
vnoremap	"gg"	"^"
vnoremap	"G"	"#"

#    G     gG    Go to last valid cell of sheet.
#    gl          Go to the last (previously occupied) cell position.
#    c-f   c-b   Scrolls down and up full screen.
#                :set half_page_scroll=1 to scroll by half a page instead.
#                half_page_scroll=0 (default) scrolls by a full page.
#                See :set command for details.
#    c-e   c-y   Scroll a row down and up.
#    zh          Scroll left one column.
#    zl          Scroll right one column.
#    zH          Scroll left half a page.
#    zL          Scroll right half page.
#    zm          Scroll horizontally to position the selected cell at the
#                center of the screen.
#    zz or z.    Scroll vertically to position the selected cell at the middle
#                of the screen.
#    zt          Scroll vertically to position the selected cell at the top
#                of the screen.
#    zb          Scroll vertically to position the selected cell at the bottom
#                of the screen.
#    Vir         Select the smallest range that covers all valid cells.
#    ESC or c-g  Clean stdin buffer, so sc-im no longer waits for completing a
#                correct command.


# Commands for handling cell content:
#    x     dd    Delete the current selected cell or range and save its
#                content in the yankbuffer.
#    m{a-zA-Z}   Mark the current cell or selected range with that letter.
#                Note: When a mark is changed, all ranges that use that mark
#                are deleted.
#    c{a-zA-Z}   Copy the marked cell or range to the current position,
#                adjusting row and column references in its numeric or string
#                expression, if any.
#    R{a-zA-Z}{a-zA-Z}
#                Select the range defined by the two marks.
#                Note: If a range already exists, it is replaced with the new
#                values.

#    { } |       Align the content of a cell to the left, right or center.  If
#                a range is selected, every cell of the range gets aligned.

#    f+                 Change column format: Increment decimal precision.
#    f-                 Change column format: Decrement decimal precision.

#    fr          Freeze a row or the rows selected.
#                If none is selected it freezes the current row.
#    fc          Freeze a col or the cols selected.
#                If none is selected it freezes the current col.
nnoremap	"ff"	"fr"
nnoremap	"F"	"fc"

#    fa          Freeze the area selected.
vnoremap	"f"	"fa"

#    ir          Insert a row.
#    ic          Insert a column.
nnoremap	"o"	"orj<"
nnoremap	"O"	"korj<"
nnoremap	"."	"orj="
nnoremap	"|"	"oc"


nnoremap	","	"."
vnoremap	","	"."
nnoremap	";"	":"
vnoremap	";"	":"

#    or          Open a row: insert after the current row.
#    oc          Open a column: insert after the current column.
#nunmap	"or" 
#nunmap	"oc"

#    sk          Shifts the current cell or range up.
#    sj          Shifts the current cell or range down.
#    sh          Shifts the current cell or range left.
#    sl          Shifts the current cell or range right.

#    yy          Yank the selected cell.
#    y           If a range is selected, yank the range.
#    yr          Yank current row.
#    yc          Yank current column.
nnoremap	"cc"	"yy"
nnoremap	"c"	":ccopy<cr>"
nnoremap	"C"	"yr"
nnoremap	"CC"	"yc"

vnoremap	"c"	":ccopy<cr>"

vunmap	"ce"        
vunmap	"cw"        
vunmap	"c0"        
vunmap	"cb"        
vunmap	"cE"        
vunmap	"cW"        
vunmap	"c$"        
vunmap	"c^"        
vunmap	"cB"        
vunmap	"caw"       
vunmap	"cg_"       
vunmap	"caW"       
vunmap	"cl"        
vunmap	"c<RIGHT>" 
vunmap	"ch"        
#    p           Paste the previously yanked cell or range.
#                If yr was used to yank a row, create a new row below and
#                paste content there.
#                If yc was used to yank a column, create a new column to the
#                left and paste content there.
nnoremap	"v"	":cpaste<cr>"
nnoremap	"V"	"j:cpaste<cr>"

#    Pf          Works like 'p' except that only the cell formatting is
#                merged, leaving cell values intact.
#nnoremap	"Vf"	"Pf"
#nnoremap	"VF"	"Pf"

#    Pv          Works like 'p' except that only cell values are copied,
#                leaving cell formatting intact.
#nnoremap	"Vv"	"Pv"
#nnoremap	"VV"	"Pv"

#    Pc          Works like 'p' except that all cell references are adjusted
#                in the same way that they are for the copy command.
#nnoremap	"Vc"	"Pc"
#nnoremap	"VC"	"Pc"

#    t           Same as 'p' but if yr was used to yank a row, create a new
#                row above and paste content there.
#                If yc was used to yank a column, create a new column to the
#                right and paste content there.
#    Tf          Works like 't' except that only cell formatting information
#                is merged in, leaving cell values intact.
#    Tv          Works like 't' except that only cell values are copied,
#                leaving cell formatting intact.
#    Tc          Works like 't' except that all cell references are adjusted
#                in the same way that they are for the copy command.

#    dr          Delete the current row.
#    dc          Deletes the current column.
nnoremap	"dd"	"dr"
nnoremap	"DD"	"dc"

#    -           Decrease a numeric value of the cell or range.
#    +           Increase a numeric value of the cell or range.

#    u           UNDO last change
#    c-r         REDO last change
nnoremap	"z"	"u"
nnoremap	"Z"	"c-r"

#    c-d         Convert the text content of a selected cell or range to a
#                date, using default LOCALE's D_FMT format.
#                This converts text to a numeric value that can be shown as a
#                date. See DATES INPUT below for more info.
#                Note: USELOCALE has to be enabled during build.

#    aa    c-j   Auto-resize the selected column(s) to accommodate the widest
#                cells.

#    f< , fh , f-LEFT:  Change column format: Decrement column width.
#    f> , fl , f-RIGHT: Change column format: Increment column width.
#    fj , f-DOWN:       Change row format: Increase height.
#    fk , f-UP:         Change row format: Decrease height.
nnoremap	"["	"fh"
nnoremap	"]"	"fl"
nnoremap	"{"	"fj"
nnoremap	"}"	"fk"
nnoremap	"!"	"aa"
nnoremap	"\""	"aa"

#Other commands:
#    ^L          Redraw the screen.
#    Zr          Zap (hide) the current row.
#    Zc          Zap (hide) the current column.
#    Sr          If a range is selected, show the rows hidden in the range.
#    Sc          If a range is selected, show the columns hidden in the range.
#    /           Alias for ':int goto '.
nnoremap	"/"	":int goto \""

#                If a number is given, sc-im will search for a cell containing
#                that number.  Searches for either strings or numbers proceed
#                forward from the current cell, wrapping back to a0 at the end
#                of the table, and terminate at the current cell if the string
#                or number is not found.

#                Example: Type '/4' to look for cells containing the value 4.
#                Or type '/"value"' to look for cells that has "value" as
#                label content.
#                You can quote a regular expression, and sc-im will search for
#                a cell containing a string matching that regular expression.
#                Example: Type / followed by "[_mente]" (with the double
#                 quotes). That will look up for cells that has one character
#                and finish with 'mente'

#                You can search for formatted numbers or expressions using
#                regular expressions by preceding the opening quotes of the
#                regular expression with a '#' (for formatted numbers) or a
#                '%' (for expressions).
#                These are handy for searching for dates within a specified
#                range or cells which reference a given cell, for example,
#                although they are somewhat slower than searching through
#                ordinary strings, since all numbers must be formatted or
#                expressions decompiled on the fly during the search.

#    ?           Same as / but searchs backwards.
#    n           Move to next search match.
#    N           Move to previous search match.
nnoremap	"k"	"n"
nnoremap	"K"	"N"
vnoremap	"k"	"n"
vnoremap	"K"	"N"


#    rl          Lock the current cell or range. Locking makes cells immune to
#                any type of editing. A locked cell can't be changed in any
#                way until it is unlocked.
#    ru          Unlock a locked cell or range, making it editable.
#    rv          Valueize the current cell or range. Valueizing removes
#                expressions, leaving only the values.
