|
|
@ -65,6 +65,25 @@ const getOpenCompletions = (command, keywords, searchConfig) => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getBufferCompletions = (command, keywords, excludePinned) => { |
|
|
|
|
|
|
|
return tabs.getCompletions(keywords, excludePinned).then((got) => { |
|
|
|
|
|
|
|
let items = got.map((tab) => { |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
caption: tab.title, |
|
|
|
|
|
|
|
content: command + ' ' + tab.title, |
|
|
|
|
|
|
|
url: tab.url, |
|
|
|
|
|
|
|
icon: tab.favIconUrl |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
name: 'Buffers', |
|
|
|
|
|
|
|
items: items |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const getCompletions = (line, settings) => { |
|
|
|
const getCompletions = (line, settings) => { |
|
|
|
let typedWords = line.trim().split(/ +/); |
|
|
|
let typedWords = line.trim().split(/ +/); |
|
|
|
let typing = ''; |
|
|
|
let typing = ''; |
|
|
@ -88,30 +107,17 @@ const getCompletions = (line, settings) => { |
|
|
|
return getOpenCompletions(name, keywords, settings.search); |
|
|
|
return getOpenCompletions(name, keywords, settings.search); |
|
|
|
case 'b': |
|
|
|
case 'b': |
|
|
|
case 'buffer': |
|
|
|
case 'buffer': |
|
|
|
case 'bd': |
|
|
|
return getBufferCompletions(name, keywords, false); |
|
|
|
case 'bdel': |
|
|
|
|
|
|
|
case 'bdelete': |
|
|
|
|
|
|
|
case 'bd!': |
|
|
|
case 'bd!': |
|
|
|
case 'bdel!': |
|
|
|
case 'bdel!': |
|
|
|
case 'bdelete!': |
|
|
|
case 'bdelete!': |
|
|
|
case 'bdeletes': |
|
|
|
|
|
|
|
case 'bdeletes!': |
|
|
|
case 'bdeletes!': |
|
|
|
return tabs.getCompletions(keywords).then((gotTabs) => { |
|
|
|
return getBufferCompletions(name, keywords, false); |
|
|
|
let items = gotTabs.map((tab) => { |
|
|
|
case 'bd': |
|
|
|
return { |
|
|
|
case 'bdel': |
|
|
|
caption: tab.title, |
|
|
|
case 'bdelete': |
|
|
|
content: name + ' ' + tab.title, |
|
|
|
case 'bdeletes': |
|
|
|
url: tab.url, |
|
|
|
return getBufferCompletions(name, keywords, true); |
|
|
|
icon: tab.favIconUrl |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
name: 'Buffers', |
|
|
|
|
|
|
|
items: items |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return Promise.resolve([]); |
|
|
|
return Promise.resolve([]); |
|
|
|
}; |
|
|
|
}; |
|
|
|