EncloseLine, add $ and @ as part of load word
This commit is contained in:
@@ -242,6 +242,11 @@ function MatchExec(s, meta)
|
||||
return {kind = "exec_console", cmd = s, working_dir = GetMainDir()}
|
||||
end
|
||||
|
||||
if s:match("^%$") then
|
||||
Print(s:sub(2, -1))
|
||||
return {kind = "exec_console", cmd = s:sub(2, -1), working_dir = GetMainDir()}
|
||||
end
|
||||
|
||||
Eval(s)
|
||||
return {kind = "skip"}
|
||||
end
|
||||
|
||||
@@ -291,7 +291,7 @@ Int GetWordEnd(Buffer *buffer, Int pos) {
|
||||
}
|
||||
|
||||
bool IsLoadWord(char16_t w) {
|
||||
bool result = w == u'(' || w == u')' || w == u'/' || w == u'\\' || w == u':' || w == u'+' || w == u'_' || w == u'.' || w == u'-' || w == u',';
|
||||
bool result = w == u'(' || w == u')' || w == u'/' || w == u'\\' || w == u':' || w == u'$' || w == u'_' || w == u'.' || w == u'@' || w == u',';
|
||||
if (!result) {
|
||||
result = !(IsSymbol(w) || IsWhitespace(w));
|
||||
}
|
||||
|
||||
@@ -721,6 +721,16 @@ void Command_KillSelectedLines(View *view) {
|
||||
Command_Replace(view, u"");
|
||||
}
|
||||
|
||||
void EncloseLine(View *view) {
|
||||
Buffer *buffer = GetBuffer(view->active_buffer);
|
||||
For (view->carets) {
|
||||
Int eof = 0;
|
||||
it.range.max = GetFullLineEnd(buffer, it.range.max, &eof);
|
||||
it.range.min = GetFullLineStart(buffer, it.range.min);
|
||||
it.range.min -= Clamp(eof, (Int)0, buffer->len);
|
||||
}
|
||||
}
|
||||
|
||||
void Command_Delete(View *view, int direction, bool ctrl = false) {
|
||||
Assert(direction == DIR_LEFT || direction == DIR_RIGHT);
|
||||
Scratch scratch;
|
||||
|
||||
@@ -688,6 +688,10 @@ void OnCommand(Event event) {
|
||||
}
|
||||
|
||||
|
||||
if (CtrlPress(SDLK_L)) {
|
||||
EncloseLine(active.view);
|
||||
}
|
||||
|
||||
if (CtrlShiftPress(SDLK_G)) {
|
||||
} else if (CtrlPress(SDLK_G)) {
|
||||
|
||||
|
||||
@@ -308,12 +308,17 @@ function MatchExec(s, meta)
|
||||
return nil
|
||||
end
|
||||
|
||||
if c:match(".exe$") then
|
||||
return {kind = "exec_console", cmd = c, working_dir = GetMainDir()}
|
||||
if s:match(".exe$") then
|
||||
return {kind = "exec_console", cmd = s, working_dir = GetMainDir()}
|
||||
end
|
||||
|
||||
if s:match("^%$") then
|
||||
Print(s:sub(2, -1))
|
||||
return {kind = "exec_console", cmd = s:sub(2, -1), working_dir = GetMainDir()}
|
||||
end
|
||||
|
||||
Eval(s)
|
||||
return nil
|
||||
return {kind = "skip"}
|
||||
end
|
||||
|
||||
OnOpenMatchers = {
|
||||
|
||||
@@ -5,18 +5,19 @@
|
||||
- Delete directory/file on disk command
|
||||
- Check. Convert more commands to taking buffer instead of view
|
||||
- Check. Rewrite more commands to use already implemented commands?
|
||||
|
||||
- Set window layout using project file
|
||||
- Split command
|
||||
- not needed but would be nice:
|
||||
- Query ids somehow
|
||||
- Open buffer using id
|
||||
- Set active window using id
|
||||
- Fix jump scroll, the query ends up the last line on screen, kind of wacky
|
||||
- Fix Ctrl+1 Ctrl+2 (choosing window)
|
||||
- Fix search, should have an anchor
|
||||
|
||||
- Use project file as working dir instead of scratch buffer path, separate project dir and project file
|
||||
|
||||
- Maybe Shift+Ctrl+Click sends a meta command of execute to Open(), it would allow to open exes
|
||||
- Enclose line (Ctrl + L)
|
||||
- Enclose most outer scope (but without the last chars, this would be for eval)
|
||||
- Enclose scope
|
||||
|
||||
Reference in New Issue
Block a user