mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-08-13 14:17:07 +02:00
Merge remote-tracking branch 'origin/map-commands' into map-commands
This commit is contained in:
@@ -18,6 +18,7 @@ The following `:set` commands can appear in `~/.vimrc` or set manually in the co
|
||||
'sidescroll' 'ss' minimum number of columns to scroll horizontal
|
||||
'sidescrolloff' 'siso' min. nr. of columns to left and right of cursor
|
||||
'smartcase' 'scs' no ignore case when pattern has uppercase
|
||||
'timeoutlen' 'tm' time that is waited for a mapped key sequence
|
||||
'undolevels' 'ul' maximum number of changes that can be undone
|
||||
'visualbell' 'vb' use visual bell instead of beeping
|
||||
'wrapscan' 'ws' searches wrap around the end of the file
|
||||
|
@@ -23,6 +23,7 @@ import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.group.RegisterGroup;
|
||||
import com.maddyhome.idea.vim.helper.EditorData;
|
||||
import com.maddyhome.idea.vim.key.ParentNode;
|
||||
import com.maddyhome.idea.vim.option.NumberOption;
|
||||
import com.maddyhome.idea.vim.option.Options;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -34,6 +35,8 @@ import java.util.List;
|
||||
import java.util.Stack;
|
||||
|
||||
public class CommandState {
|
||||
public static final int DEFAULT_TIMEOUT_LENGTH = 1000;
|
||||
|
||||
@Nullable private static Command ourLastChange = null;
|
||||
private static char ourLastRegister = RegisterGroup.REGISTER_DEFAULT;
|
||||
|
||||
@@ -47,7 +50,7 @@ public class CommandState {
|
||||
private boolean myIsRecording = false;
|
||||
|
||||
private CommandState() {
|
||||
myMappingTimer = new Timer(0, null);
|
||||
myMappingTimer = new Timer(DEFAULT_TIMEOUT_LENGTH, null);
|
||||
myMappingTimer.setRepeats(false);
|
||||
myStates.push(new State(Mode.COMMAND, SubMode.NONE, MappingMode.NORMAL));
|
||||
}
|
||||
@@ -131,8 +134,10 @@ public class CommandState {
|
||||
}
|
||||
|
||||
public void startMappingTimer(@NotNull ActionListener actionListener) {
|
||||
// TODO: Read the 'timeoutlen' option
|
||||
myMappingTimer.setInitialDelay(3000);
|
||||
final NumberOption timeoutLength = Options.getInstance().getNumberOption("timeoutlen");
|
||||
if (timeoutLength != null) {
|
||||
myMappingTimer.setInitialDelay(timeoutLength.value());
|
||||
}
|
||||
for (ActionListener listener : myMappingTimer.getActionListeners()) {
|
||||
myMappingTimer.removeActionListener(listener);
|
||||
}
|
||||
|
@@ -70,6 +70,15 @@ public class Options {
|
||||
return res;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public NumberOption getNumberOption(@NotNull String name) {
|
||||
final Option option = getOption(name);
|
||||
if (option instanceof NumberOption) {
|
||||
return (NumberOption)option;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all options
|
||||
*
|
||||
@@ -434,6 +443,7 @@ public class Options {
|
||||
addOption(new NumberOption("sidescroll", "ss", 0));
|
||||
addOption(new NumberOption("sidescrolloff", "siso", 0));
|
||||
addOption(new ToggleOption("smartcase", "scs", false));
|
||||
addOption(new NumberOption("timeoutlen", "tm", 1000, -1, Integer.MAX_VALUE));
|
||||
addOption(new NumberOption("undolevels", "ul", 1000, -1, Integer.MAX_VALUE));
|
||||
addOption(new ToggleOption("visualbell", "vb", false));
|
||||
addOption(new ToggleOption("wrapscan", "ws", true));
|
||||
|
Reference in New Issue
Block a user