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) { constructor(private _parent) {
super( super(
[ [
"o ",
"open ", "open ",
"t ",
"tabopen ", "tabopen ",
"w ",
"winopen ", "winopen ",
], ],
"HistoryCompletionSource", "History" "HistoryCompletionSource", "History"
@ -575,6 +578,7 @@ export class BufferCompletionSource extends CompletionSourceFuse {
constructor(private _parent) { constructor(private _parent) {
super( super(
[ [
"b ",
"buffer ", "buffer ",
"tabclose ", "tabclose ",
"tabdetach ", "tabdetach ",

View file

@ -274,6 +274,12 @@ export function open(...urlarr: string[]) {
window.location.href = forceURI(url) window.location.href = forceURI(url)
} }
/** Convenience function for [[ open ]] */
//#background
export function o(...urlarr: string[]) {
open(...urlarr)
}
/** Go to your homepage(s) /** Go to your homepage(s)
@ -628,6 +634,12 @@ export async function tablast() {
tabIndexSetActive(0) 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]` */ /** 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 //#background
export async function tabopen(...addressarr: string[]) { export async function tabopen(...addressarr: string[]) {
@ -785,6 +797,12 @@ export async function pin() {
// {{{ WINDOWS // {{{ WINDOWS
/** Alias for [[winopen]] */
//#background
export async function w(...args: string[]) {
winopen(...args)
}
/** Like [[tabopen]], but in a new window */ /** Like [[tabopen]], but in a new window */
//#background //#background
export async function winopen(...args: string[]) { export async function winopen(...args: string[]) {
@ -1028,6 +1046,12 @@ export async function buffers() {
tabs() tabs()
} }
/** Alias for [[buffer]] */
//#background
export async function b(index: number | '#') {
buffer(index)
}
/** Change active tab. /** Change active tab.
@param index @param index