mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 04:17:59 +01:00
- new 'insertmode' option
- fixed c-u behavior
This commit is contained in:
2
NEWS
2
NEWS
@@ -2,7 +2,7 @@
|
||||
2007-xx-xx:
|
||||
* version 0.6
|
||||
* new gi browser command to focus last used input box
|
||||
* edit TEXTAREAs with many vim commands in a vim and even visual mode
|
||||
* edit TEXTAREAs with many vim commands in a vim and even visual mode if you :set noinsertmode
|
||||
* support for emacs/bash-like ctrl-e/a/u/k/h keys in single line text fields
|
||||
* support for * and # mappings to search for the text selection or the text under the cursor
|
||||
* Escape finally clears any selection made in the document
|
||||
|
||||
@@ -388,7 +388,9 @@ function Events() //{{{
|
||||
}
|
||||
else if (elem && elem instanceof HTMLTextAreaElement)
|
||||
{
|
||||
if (elem.selectionEnd - elem.selectionStart > 0)
|
||||
if (vimperator.options["insertmode"])
|
||||
vimperator.setMode(vimperator.modes.INSERT, vimperator.modes.TEXTAREA);
|
||||
else if (elem.selectionEnd - elem.selectionStart > 0)
|
||||
vimperator.setMode(vimperator.modes.VISUAL, vimperator.modes.TEXTAREA);
|
||||
else
|
||||
vimperator.editor.startNormal();
|
||||
@@ -408,24 +410,17 @@ function Events() //{{{
|
||||
if (controller && controller.isCommandEnabled("cmd_copy"))
|
||||
could_copy = true;
|
||||
|
||||
var extended = vimperator.modes.NONE;
|
||||
if (vimperator.hasMode(vimperator.modes.TEXTAREA))
|
||||
extended = vimperator.modes.TEXTAREA;
|
||||
else if (vimperator.hasMode(vimperator.modes.CARET))
|
||||
extended = vimperator.modes.CARET;
|
||||
|
||||
if (could_copy && !vimperator.hasMode(vimperator.modes.VISUAL) &&
|
||||
(vimperator.hasMode(vimperator.modes.NORMAL) ||
|
||||
vimperator.hasMode(vimperator.modes.TEXTAREA) ||
|
||||
vimperator.hasMode(vimperator.modes.CARET)))
|
||||
if (could_copy && !vimperator.hasMode(vimperator.modes.VISUAL))
|
||||
{
|
||||
vimperator.setMode(vimperator.modes.VISUAL, extended);
|
||||
if (vimperator.hasMode(vimperator.modes.TEXTAREA) && !vimperator.options["insertmode"])
|
||||
vimperator.setMode(vimperator.modes.VISUAL, vimperator.modes.TEXTAREA);
|
||||
else if (vimperator.hasMode(vimperator.modes.CARET))
|
||||
vimperator.setMode(vimperator.modes.VISUAL, vimperator.modes.CARET);
|
||||
}
|
||||
else if (vimperator.hasMode(vimperator.modes.VISUAL))
|
||||
{
|
||||
if (!could_copy && !vimperator.hasMode(vimperator.modes.CARET) &&
|
||||
!vimperator.hasMode(vimperator.modes.TEXTAREA))
|
||||
vimperator.setMode(extended || vimperator.modes.NORMAL);
|
||||
if (!could_copy && vimperator.hasMode(vimperator.modes.CARET))
|
||||
vimperator.setMode(vimperator.modes.CARET);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,7 +456,7 @@ function Events() //{{{
|
||||
}
|
||||
else if (vimperator.hasMode(vimperator.modes.INSERT))
|
||||
{
|
||||
if(vimperator.hasMode(vimperator.modes.TEXTAREA))
|
||||
if(vimperator.hasMode(vimperator.modes.TEXTAREA) && !vimperator.options["insertmode"])
|
||||
vimperator.setMode(vimperator.modes.TEXTAREA);
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1832,7 +1832,13 @@ function Mappings() //{{{
|
||||
{ }
|
||||
));
|
||||
addDefaultMap(new Map([vimperator.modes.INSERT, vimperator.modes.COMMAND_LINE], ["<C-u>"],
|
||||
function() { vimperator.editor.executeCommand("cmd_deleteToBeginningOfLine", 1); },
|
||||
function()
|
||||
{
|
||||
// broken in FF3, deletes the wohle line:
|
||||
// vimperator.editor.executeCommand("cmd_deleteToBeginningOfLine", 1);
|
||||
vimperator.editor.executeCommand("cmd_selectBeginLine", 1);
|
||||
vimperator.editor.executeCommand("cmd_delete", 1);
|
||||
},
|
||||
{ }
|
||||
));
|
||||
addDefaultMap(new Map([vimperator.modes.INSERT, vimperator.modes.COMMAND_LINE], ["<C-k>"],
|
||||
|
||||
@@ -452,6 +452,14 @@ function Options() //{{{
|
||||
default_value: true
|
||||
}
|
||||
));
|
||||
addOption(new Option(["insertmode", "im"], "boolean",
|
||||
{
|
||||
short_help: "Use Insert mode as the default for text areas",
|
||||
help: "Makes Vimperator work in a way that Insert mode is the default mode for text areas. " +
|
||||
"Useful if you want to use Vimperator as a modeless editor, keeping the known Firefox interface for editing text areas.",
|
||||
default_value: true
|
||||
}
|
||||
));
|
||||
addOption(new Option(["maxhints", "mh"], "number",
|
||||
{
|
||||
short_help: "Maximum number of simultaneously shown hints",
|
||||
|
||||
@@ -31,9 +31,9 @@ syn match vimperatorCommandWrapper "\<\h\w*\>" contains=vimperatorCommand
|
||||
syn region vimperatorSet matchgroup=vimperatorCommand start="\<set\=\>" end="$" keepend oneline contains=vimperatorOption
|
||||
syn keyword vimperatorOption activate act complete cpt defsearch ds extendedhinttags eht focusedhintstyle fhs fullscreen fs
|
||||
\ nofullscreen nofs guioptions go hintchars hc hintstyle hs hinttags incsearch is noincsearch nois ignorecase ic
|
||||
\ noignorecase noic maxhints mh popups pps preload nopreload previewheight pvh showmode smd noshowmode nosmd showstatuslinks ssli
|
||||
\ showtabline stal smartcase scs nosmartcase noscs titlestring usermode um nousermode noum verbose vbs visualbell vb
|
||||
\ wildmode wim wildoptions wop
|
||||
\ noignorecase noic insertmode im noinsertmode noim maxhints mh popups pps preload nopreload previewheight pvh showmode smd
|
||||
\ noshowmode nosmd showstatuslinks ssli \ showtabline stal smartcase scs nosmartcase noscs titlestring usermode um nousermode noum
|
||||
\ verbose vbs visualbell vb wildmode wim wildoptions wop
|
||||
\ contained
|
||||
|
||||
syn region vimperatorJavascript start="\%(^\s*\%(javascript\|js\)\s\+\)\@<=" end="$" contains=@javascriptTop keepend oneline
|
||||
|
||||
Reference in New Issue
Block a user