mirror of
https://github.com/zyedidia/micro
synced 2024-11-05 17:41:24 +00:00
Add binding to move to next split (default binding: CtrlW)
This commit is contained in:
parent
4a15a1d3c8
commit
3089967546
2 changed files with 27 additions and 2 deletions
|
@ -76,6 +76,8 @@ var bindingActions = map[string]func(*View) bool{
|
|||
"AddTab": (*View).AddTab,
|
||||
"PreviousTab": (*View).PreviousTab,
|
||||
"NextTab": (*View).NextTab,
|
||||
"NextSplit": (*View).NextSplit,
|
||||
"PreviousSplit": (*View).PreviousSplit,
|
||||
}
|
||||
|
||||
var bindingKeys = map[string]tcell.Key{
|
||||
|
@ -398,6 +400,7 @@ func DefaultBindings() map[string]string {
|
|||
"CtrlB": "ShellMode",
|
||||
"CtrlQ": "Quit",
|
||||
"CtrlE": "CommandMode",
|
||||
"CtrlW": "NextSplit",
|
||||
|
||||
// Emacs-style keybindings
|
||||
"Alt-f": "WordRight",
|
||||
|
@ -1170,6 +1173,28 @@ func (v *View) NextTab() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// Changes the view to the next split
|
||||
func (v *View) NextSplit() bool {
|
||||
tab := tabs[curTab]
|
||||
if tab.curView < len(tab.views)-1 {
|
||||
tab.curView++
|
||||
} else {
|
||||
tab.curView = 0
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Changes the view to the previous split
|
||||
func (v *View) PreviousSplit() bool {
|
||||
tab := tabs[curTab]
|
||||
if tab.curView > 0 {
|
||||
tab.curView--
|
||||
} else {
|
||||
tab.curView = len(tab.views) - 1
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// None is no action
|
||||
func None() bool {
|
||||
return false
|
||||
|
|
|
@ -689,7 +689,7 @@ func (v *View) DisplayView() {
|
|||
lineIndentStyle = style
|
||||
}
|
||||
}
|
||||
if settings["cursorline"].(bool) && !v.Cursor.HasSelection() && v.Cursor.Y == lineN+v.Topline {
|
||||
if settings["cursorline"].(bool) && tabs[curTab].curView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == lineN+v.Topline {
|
||||
if style, ok := colorscheme["cursor-line"]; ok {
|
||||
fg, _, _ := style.Decompose()
|
||||
lineIndentStyle = lineIndentStyle.Background(fg)
|
||||
|
@ -745,7 +745,7 @@ func (v *View) DisplayView() {
|
|||
|
||||
for i := 0; i < v.width-((x-v.x)-v.leftCol); i++ {
|
||||
lineStyle := defStyle
|
||||
if settings["cursorline"].(bool) && !v.Cursor.HasSelection() && v.Cursor.Y == lineN+v.Topline {
|
||||
if settings["cursorline"].(bool) && tabs[curTab].curView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == lineN+v.Topline {
|
||||
if style, ok := colorscheme["cursor-line"]; ok {
|
||||
fg, _, _ := style.Decompose()
|
||||
lineStyle = lineStyle.Background(fg)
|
||||
|
|
Loading…
Reference in a new issue