Implement aliases for o,t,w,b (open, tabopen, winopen, buffer)

This commit is contained in:
Isaac Khor 2017-12-23 13:09:42 +08:00
parent fb74ad460f
commit d5b95c587f
2 changed files with 28 additions and 0 deletions

View file

@ -449,8 +449,11 @@ export class HistoryCompletionSource extends CompletionSourceFuse {
constructor(private _parent) {
super(
[
"o ",
"open ",
"t ",
"tabopen ",
"w ",
"winopen ",
],
"HistoryCompletionSource", "History"
@ -575,6 +578,7 @@ export class BufferCompletionSource extends CompletionSourceFuse {
constructor(private _parent) {
super(
[
"b ",
"buffer ",
"tabclose ",
"tabdetach ",

View file

@ -274,6 +274,12 @@ export function open(...urlarr: string[]) {
window.location.href = forceURI(url)
}
/** Convenience function for [[ open ]] */
//#background
export function o(...urlarr: string[]) {
open(...urlarr)
}
/** Go to your homepage(s)
@ -628,6 +634,12 @@ export async function tablast() {
tabIndexSetActive(0)
}
/** Convenience function for [[tabopen]] */
//#background
export async function t(...addressarr: string[]) {
tabopen(...addressarr)
}
/** Like [[open]], but in a new tab. If no address is given, it will open the newtab page, which can be set with `set newtab [url]` */
//#background
export async function tabopen(...addressarr: string[]) {
@ -785,6 +797,12 @@ export async function pin() {
// {{{ WINDOWS
/** Alias for [[winopen]] */
//#background
export async function w(...args: string[]) {
winopen(...args)
}
/** Like [[tabopen]], but in a new window */
//#background
export async function winopen(...args: string[]) {
@ -1028,6 +1046,12 @@ export async function buffers() {
tabs()
}
/** Alias for [[buffer]] */
//#background
export async function b(index: number | '#') {
buffer(index)
}
/** Change active tab.
@param index