commit
e400365688
|
@ -8,8 +8,8 @@ both vi/vim neophytes and experts alike.
|
||||||
### Installation/Usage
|
### Installation/Usage
|
||||||
|
|
||||||
The easiest way to install is to download the
|
The easiest way to install is to download the
|
||||||
[latest extension file](https://raw.github.com/linuxmage/vibreoffice/master/dist/vibreoffice-1.1.1.oxt)
|
[latest extension file](https://raw.github.com/linuxmage/vibreoffice/master/dist/vibreoffice-1.1.4.oxt)
|
||||||
and open it with LibreOffice/OpenOffice.
|
and open it with LibreOffice/OpenOffice. LibreOffice/OpenOffice will need to be restarted before this extension can be used.
|
||||||
|
|
||||||
To enable/disable vibreoffice, simply select Tools -> Add-Ons -> vibreoffice.
|
To enable/disable vibreoffice, simply select Tools -> Add-Ons -> vibreoffice.
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ my patience.
|
||||||
word processing.
|
word processing.
|
||||||
- Using `d`, `c` (or any of their variants) will temporarily bring you into
|
- Using `d`, `c` (or any of their variants) will temporarily bring you into
|
||||||
Visual mode. This is intentional and should not have any noticeable effects.
|
Visual mode. This is intentional and should not have any noticeable effects.
|
||||||
|
- In OS X, repeating commands by holding down keys can have strange behavior.
|
||||||
|
|
||||||
vibreoffice is new, so it is bound to have plenty of bugs. Please let me know
|
vibreoffice is new, so it is bound to have plenty of bugs. Please let me know
|
||||||
if you run into anything!
|
if you run into anything!
|
||||||
|
|
Binary file not shown.
|
@ -89,20 +89,15 @@ Function formatVisualBase()
|
||||||
oTextCursor = getTextCursor()
|
oTextCursor = getTextCursor()
|
||||||
VISUAL_BASE = getCursor().getPosition()
|
VISUAL_BASE = getCursor().getPosition()
|
||||||
|
|
||||||
' If current line is empty then select it.
|
' Select the current line by moving cursor to start of the bellow line and
|
||||||
If oTextCursor.isStartOfParagraph() And oTextCursor.isEndOfParagraph() Then
|
' then back to the start of the current line.
|
||||||
getCursor().goRight(1, False)
|
getCursor().gotoEndOfLine(False)
|
||||||
getCursor().goLeft(1, True)
|
If getCursor().getPosition().Y() = VISUAL_BASE.Y() Then
|
||||||
Else
|
If getCursor().goRight(1, False) Then
|
||||||
' Select the current line by moving cursor to end of line and then
|
|
||||||
' back to the start of line.
|
|
||||||
getCursor().gotoEndOfLine(False)
|
|
||||||
' Move cursor back if gotoEndOfLine moved cursor down.
|
|
||||||
If getCursor().getPosition().Y() > VISUAL_BASE.Y() Then
|
|
||||||
getCursor().goLeft(1, True)
|
getCursor().goLeft(1, True)
|
||||||
End If
|
End If
|
||||||
getCursor().gotoStartOfLine(True)
|
|
||||||
End If
|
End If
|
||||||
|
getCursor().gotoStartOfLine(True)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Function gotoMode(sMode)
|
Function gotoMode(sMode)
|
||||||
|
@ -476,12 +471,13 @@ Function ProcessModeKey(oEvent)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' Mode matching
|
' Mode matching
|
||||||
dim bMatched
|
dim bMatched, oTextCursor
|
||||||
bMatched = True
|
bMatched = True
|
||||||
|
oTextCursor = getTextCursor()
|
||||||
Select Case oEvent.KeyChar
|
Select Case oEvent.KeyChar
|
||||||
' Insert modes
|
' Insert modes
|
||||||
Case "i", "a", "I", "A", "o", "O":
|
Case "i", "a", "I", "A", "o", "O":
|
||||||
If oEvent.KeyChar = "a" Then getCursor().goRight(1, False)
|
If oEvent.KeyChar = "a" And NOT oTextCursor.isEndOfParagraph() Then getCursor().goRight(1, False)
|
||||||
If oEvent.KeyChar = "I" Then ProcessMovementKey("^")
|
If oEvent.KeyChar = "I" Then ProcessMovementKey("^")
|
||||||
If oEvent.KeyChar = "A" Then ProcessMovementKey("$")
|
If oEvent.KeyChar = "A" Then ProcessMovementKey("$")
|
||||||
|
|
||||||
|
@ -496,7 +492,7 @@ Function ProcessModeKey(oEvent)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If oEvent.KeyChar = "O" Then
|
If oEvent.KeyChar = "O" Then
|
||||||
ProcessMovementKey("^")
|
ProcessMovementKey("0")
|
||||||
getCursor().setString(chr(13))
|
getCursor().setString(chr(13))
|
||||||
If Not getCursor().isAtStartOfLine() Then
|
If Not getCursor().isAtStartOfLine() Then
|
||||||
ProcessMovementKey("h")
|
ProcessMovementKey("h")
|
||||||
|
@ -576,8 +572,10 @@ Function ProcessNormalKey(keyChar, modifiers)
|
||||||
' after that. Fix?
|
' after that. Fix?
|
||||||
' --------------------
|
' --------------------
|
||||||
If keyChar = "p" or keyChar = "P" Then
|
If keyChar = "p" or keyChar = "P" Then
|
||||||
|
dim oTextCursor
|
||||||
|
oTextCursor = getTextCursor()
|
||||||
' Move cursor right if "p" to paste after cursor
|
' Move cursor right if "p" to paste after cursor
|
||||||
If keyChar = "p" Then
|
If keyChar = "p" And NOT oTextCursor().isEndOfParagraph() Then
|
||||||
ProcessMovementKey("l", False)
|
ProcessMovementKey("l", False)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
@ -650,7 +648,7 @@ Function ProcessSpecialKey(keyChar)
|
||||||
bIsSpecialCase = (keyChar = "d" And getSpecial() = "d") Or (keyChar = "c" And getSpecial() = "c")
|
bIsSpecialCase = (keyChar = "d" And getSpecial() = "d") Or (keyChar = "c" And getSpecial() = "c")
|
||||||
|
|
||||||
If bIsSpecialCase Then
|
If bIsSpecialCase Then
|
||||||
ProcessMovementKey("^", False)
|
ProcessMovementKey("0", False)
|
||||||
ProcessMovementKey("j", True)
|
ProcessMovementKey("j", True)
|
||||||
|
|
||||||
oTextCursor = getTextCursor()
|
oTextCursor = getTextCursor()
|
||||||
|
@ -756,7 +754,7 @@ Function ProcessSpecialKey(keyChar)
|
||||||
|
|
||||||
ElseIf keyChar = "D" Or keyChar = "C" Then
|
ElseIf keyChar = "D" Or keyChar = "C" Then
|
||||||
If MODE = "VISUAL" Or MODE = "VISUAL_LINE" Then
|
If MODE = "VISUAL" Or MODE = "VISUAL_LINE" Then
|
||||||
ProcessMovementKey("^", False)
|
ProcessMovementKey("0", False)
|
||||||
ProcessMovementKey("$", True)
|
ProcessMovementKey("$", True)
|
||||||
ProcessMovementKey("l", True)
|
ProcessMovementKey("l", True)
|
||||||
Else
|
Else
|
||||||
|
@ -777,7 +775,7 @@ Function ProcessSpecialKey(keyChar)
|
||||||
|
|
||||||
' S only valid in NORMAL mode
|
' S only valid in NORMAL mode
|
||||||
ElseIf keyChar = "S" And MODE = "NORMAL" Then
|
ElseIf keyChar = "S" And MODE = "NORMAL" Then
|
||||||
ProcessMovementKey("^", False)
|
ProcessMovementKey("0", False)
|
||||||
ProcessMovementKey("$", True)
|
ProcessMovementKey("$", True)
|
||||||
yankSelection(True)
|
yankSelection(True)
|
||||||
gotoMode("INSERT")
|
gotoMode("INSERT")
|
||||||
|
@ -1008,6 +1006,12 @@ Function ProcessMovementKey(keyChar, Optional bExpand, Optional keyModifiers)
|
||||||
' lines.
|
' lines.
|
||||||
If VISUAL_BASE.Y() = getCursor().getPosition().Y() Then
|
If VISUAL_BASE.Y() = getCursor().getPosition().Y() Then
|
||||||
getCursor().gotoEndOfLine(False)
|
getCursor().gotoEndOfLine(False)
|
||||||
|
' Make sure that cursor is on the start of the line bellow
|
||||||
|
' the Visual base line. This is needed to make sure the
|
||||||
|
' new line character will be selected.
|
||||||
|
If getCursor().getPosition().Y() = VISUAL_BASE.Y() Then
|
||||||
|
getCursor().goRight(1, False)
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' Move cursor to start of the line above last selected line.
|
' Move cursor to start of the line above last selected line.
|
||||||
|
@ -1097,9 +1101,48 @@ Function ProcessMovementKey(keyChar, Optional bExpand, Optional keyModifiers)
|
||||||
|
|
||||||
' ----------
|
' ----------
|
||||||
|
|
||||||
ElseIf keyChar = "0" or keyChar = "^" Then
|
ElseIf keyChar = "0" Then
|
||||||
getCursor().gotoStartOfLine(bExpand)
|
getCursor().gotoStartOfLine(bExpand)
|
||||||
bSetCursor = False
|
bSetCursor = False
|
||||||
|
ElseIf keyChar = "^" Then
|
||||||
|
dim oldLine
|
||||||
|
oldLine = getCursor().getPosition().Y()
|
||||||
|
|
||||||
|
' Select all of the current line and put it into a string.
|
||||||
|
getCursor().gotoEndOfLine(False)
|
||||||
|
If getCursor().getPosition.Y() > oldLine Then
|
||||||
|
' If gotoEndOfLine moved cursor to next line then move it back.
|
||||||
|
getCursor().goLeft(1, False)
|
||||||
|
End If
|
||||||
|
getCursor().gotoStartOfLine(True)
|
||||||
|
dim s as String
|
||||||
|
s = getCursor().String
|
||||||
|
|
||||||
|
' Undo any changes made to the view cursor, then move to start of
|
||||||
|
' line. This way any previous selction made by the user will remain.
|
||||||
|
getCursor().gotoRange(oTextCursor, False)
|
||||||
|
getCursor().gotoStartOfLine(bExpand)
|
||||||
|
|
||||||
|
' This integer will be used to determine the position of the first
|
||||||
|
' character in the line that is not a space or a tab.
|
||||||
|
dim i as Integer
|
||||||
|
i = 1
|
||||||
|
|
||||||
|
' Iterate through the characters in the string until a character that
|
||||||
|
' is not a space or a tab is found.
|
||||||
|
Do While i <= Len(s)
|
||||||
|
dim c
|
||||||
|
c = Mid(s,i,1)
|
||||||
|
If c <> " " And c <> Chr(9) Then
|
||||||
|
Exit Do
|
||||||
|
End If
|
||||||
|
i = i + 1
|
||||||
|
Loop
|
||||||
|
|
||||||
|
' Move the cursor to the first non space/tab character.
|
||||||
|
getCursor().goRight(i - 1, bExpand)
|
||||||
|
bSetCursor = False
|
||||||
|
|
||||||
ElseIf keyChar = "$" Then
|
ElseIf keyChar = "$" Then
|
||||||
dim oldPos, newPos
|
dim oldPos, newPos
|
||||||
oldPos = getCursor().getPosition()
|
oldPos = getCursor().getPosition()
|
||||||
|
|
Loading…
Reference in New Issue