forked from danlucraft/redcar
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added SelectWordCommand from itrekkie
- Loading branch information
1 parent
98fc680
commit ca34440
Showing
4 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module Redcar | ||
class SelectWordCommand < Redcar::EditTabCommand | ||
key "Super+W" | ||
|
||
def execute | ||
start = doc.cursor_iter | ||
finish = doc.cursor_iter | ||
|
||
unless start.inside_word? or start.starts_word? or start.ends_word? | ||
return | ||
end | ||
|
||
start.backward_word_start unless start.starts_word? | ||
finish.forward_word_end unless finish.ends_word? | ||
|
||
doc.select(start, finish) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters