-
Notifications
You must be signed in to change notification settings - Fork 140
Add new feature: Vim mode #368
base: master
Are you sure you want to change the base?
Changes from 17 commits
10de420
f0515f4
a15d76c
26d6a15
714e23b
ce00566
56fcff0
2016462
2c86b71
7219309
155c160
ad82e0e
9e0b15d
1b1c0c1
86df4fd
a2cc7de
5050954
422d825
87a8946
b55c343
b38cbd9
6de4e41
eea5b6b
1cc4e20
9e8bd4c
b2bd175
9d79a7f
076d73b
8774ec7
1e22b40
e7e4512
dfdc8c6
30b8b96
68d0832
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package commandimpls | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
|
||
"github.com/Bios-Marcel/cordless/config" | ||
"github.com/Bios-Marcel/cordless/util/vim" | ||
) | ||
|
||
const ( | ||
vimOpenHelpPage = `[::b]NAME | ||
vim-mode - minor vim mode for cordless | ||
|
||
[::b]SYNOPSIS | ||
[::b]Normal Mode: Navigate around the containers with hjkl. | ||
Perform some usual commands inside text box input, as pasting, moving cursor or such. | ||
Press ESC anywhere to return to normal mode. | ||
|
||
[::b]Insert Mode: Type inside box input, perform actions inside chatview. | ||
Insert without any key restriction inside the text box using insert mode. | ||
Inside chat view, perform useful commands such as editing message "i" or replying to user "a" | ||
|
||
[::b]Visual Mode: Move around everywhere with vim keys. | ||
This mode allows to use hjkl pretty much anywhere inside the app. Due to some restrictions, this is | ||
the only mode that officially supports using hjkl anywhere. | ||
Also allows using same commands as insert mode inside chat view, or selecting text inside text input. | ||
|
||
|
||
[::b]DESCRIPTION | ||
This is a minor mode for vim. See all the shorcuts with Ctrl K, and edit them inside shortcuts/shortcuts.go` | ||
) | ||
|
||
type VimHelp struct { | ||
} | ||
|
||
func NewVimCmd() *VimHelp { | ||
return new(VimHelp) | ||
} | ||
|
||
// PrintHelp prints a static help page for this command | ||
func (v VimHelp) PrintHelp(writer io.Writer) { | ||
fmt.Fprintln(writer, vimOpenHelpPage) | ||
} | ||
|
||
func (v VimHelp) Execute(writer io.Writer, parameters []string) { | ||
if config.Current.VimMode.CurrentMode == vim.Disabled { | ||
config.Current.VimMode.Normal() | ||
fmt.Fprintf(writer, "Vim mode enabled") | ||
} else { | ||
config.Current.VimMode.SetMode(vim.Disabled) | ||
fmt.Fprintf(writer, "Vim mode disabled") | ||
} | ||
config.PersistConfig() | ||
} | ||
|
||
// Name returns the primary name for this command. This name will also be | ||
// used for listing the command in the commandlist. | ||
func (v VimHelp) Name() string { | ||
return "vim" | ||
} | ||
|
||
// Aliases are a list of aliases for this command. There might be none. | ||
func (v VimHelp) Aliases() []string { | ||
return []string{"vim", "vim-mode"} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
replace github.com/Bios-Marcel/cordless => github.com/0xSteeW/cordless v0.0.0-20201117104521-a2cc7de4b6dd | ||
|
||
module github.com/Bios-Marcel/cordless | ||
|
||
go 1.12 | ||
|
@@ -9,6 +11,7 @@ require ( | |
github.com/Bios-Marcel/shortnotforlong v1.1.1 | ||
github.com/alecthomas/chroma v0.7.3 | ||
github.com/atotto/clipboard v0.1.2 | ||
github.com/bunyk/gokeybr v0.0.0-20201019133936-f9e4ed3fdc5d // indirect | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Installed some things while working on this, thought I had reverted go.sum and go.mod. Will fix |
||
github.com/gdamore/tcell/v2 v2.0.0 | ||
github.com/gen2brain/beeep v0.0.0-20200526185328-e9c15c258e28 | ||
github.com/google/go-github/v29 v29.0.3 | ||
|
@@ -20,6 +23,8 @@ require ( | |
github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac | ||
github.com/sergi/go-diff v1.1.0 | ||
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 | ||
golang.org/x/tools v0.0.0-20201112171726-b38955972a18 // indirect | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as previous |
||
golang.org/x/tools/gopls v0.5.2 // indirect | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as previous |
||
gopkg.in/sourcemap.v1 v1.0.5 // indirect | ||
rsc.io/qr v0.2.0 | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be upstream, it shouldn't be necessary at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will not build either way. It was a quick test to try to get appveyor to recognize my files