Merge PR 223: New option: g:startify_commands
The new list "commands" makes it possible to put commands on the start screen. Choosing an entry executes the command. Optionally a custom index and/or command description can be given: let g:startify_commands = [ \ ':help reference', \ ['Vim Reference', 'h ref'], \ {'h': 'h ref'}, \ {'g': ['Vim Reference', 'h ref']}, \ ]
This commit is contained in:
commit
8585dd577a
|
@ -113,6 +113,7 @@ function! startify#insane_in_the_membrane() abort
|
||||||
\ [' MRU '. getcwd()], 'dir',
|
\ [' MRU '. getcwd()], 'dir',
|
||||||
\ [' Sessions'], 'sessions',
|
\ [' Sessions'], 'sessions',
|
||||||
\ [' Bookmarks'], 'bookmarks',
|
\ [' Bookmarks'], 'bookmarks',
|
||||||
|
\ [' Commands'], 'commands',
|
||||||
\ ])
|
\ ])
|
||||||
|
|
||||||
for item in s:lists
|
for item in s:lists
|
||||||
|
@ -621,6 +622,36 @@ function! s:show_bookmarks() abort
|
||||||
call append('$', '')
|
call append('$', '')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:show_commands {{{1
|
||||||
|
function! s:show_commands() abort
|
||||||
|
if !exists('g:startify_commands') || empty(g:startify_commands)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists('s:last_message')
|
||||||
|
call s:print_section_header()
|
||||||
|
endif
|
||||||
|
|
||||||
|
for entry in g:startify_commands
|
||||||
|
if type(entry) == type({}) " with custom index
|
||||||
|
let [index, command] = items(entry)[0]
|
||||||
|
else
|
||||||
|
let command = entry
|
||||||
|
let index = s:get_index_as_string(s:entry_number)
|
||||||
|
let s:entry_number += 1
|
||||||
|
endif
|
||||||
|
" If no list is given, the description is the command itself.
|
||||||
|
let [desc, cmd] = type(command) == type([]) ? command : [command, command]
|
||||||
|
|
||||||
|
call append('$', ' ['. index .']'. repeat(' ', (3 - strlen(index))) . desc)
|
||||||
|
call s:register(line('$'), index, 'special', cmd, '', s:nowait_string)
|
||||||
|
|
||||||
|
unlet entry command
|
||||||
|
endfor
|
||||||
|
|
||||||
|
call append('$', '')
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Function: s:is_in_skiplist {{{1
|
" Function: s:is_in_skiplist {{{1
|
||||||
function! s:is_in_skiplist(arg) abort
|
function! s:is_in_skiplist(arg) abort
|
||||||
for regexp in s:skiplist
|
for regexp in s:skiplist
|
||||||
|
|
|
@ -36,7 +36,7 @@ CONTENTS *startify-contents*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
INTRO *startify-intro*
|
INTRO *startify-intro*
|
||||||
|
|
||||||
Startify is a plugin that shows recently used files, bookmarks and
|
Startify is a plugin that shows recently used files, bookmarks, commands and
|
||||||
sessions that were saved to a certain directory.
|
sessions that were saved to a certain directory.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
@ -48,8 +48,8 @@ Startify basically provides two things:
|
||||||
it reads from STDIN), startify will show a small but pretty start screen
|
it reads from STDIN), startify will show a small but pretty start screen
|
||||||
that shows recently used files (using viminfo) and sessions by default.
|
that shows recently used files (using viminfo) and sessions by default.
|
||||||
|
|
||||||
Additionally, you can define bookmarks, thus entries for files that always
|
Additionally, you can define bookmarks (thus entries for files) and
|
||||||
should be available on the start screen.
|
commands that always should be available on the start screen.
|
||||||
|
|
||||||
You can either navigate to a certain menu entry and hit enter or you just
|
You can either navigate to a certain menu entry and hit enter or you just
|
||||||
key in whatever is written between the square brackets on that line. You
|
key in whatever is written between the square brackets on that line. You
|
||||||
|
@ -97,6 +97,7 @@ default values.
|
||||||
|g:startify_update_oldfiles|
|
|g:startify_update_oldfiles|
|
||||||
|
|
||||||
Misc options:~
|
Misc options:~
|
||||||
|
|g:startify_commands|
|
||||||
|g:startify_custom_footer|
|
|g:startify_custom_footer|
|
||||||
|g:startify_custom_header_quotes|
|
|g:startify_custom_header_quotes|
|
||||||
|g:startify_custom_indices|
|
|g:startify_custom_indices|
|
||||||
|
@ -128,7 +129,8 @@ The default for Windows systems is '$HOME\vimfiles\session'.
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*g:startify_list_order*
|
*g:startify_list_order*
|
||||||
>
|
>
|
||||||
let g:startify_list_order = ['files', 'dir', 'bookmarks', 'sessions']
|
let g:startify_list_order = ['files', 'dir', 'bookmarks', 'sessions',
|
||||||
|
\ 'commands']
|
||||||
<
|
<
|
||||||
At the moment startify supports these lists:~
|
At the moment startify supports these lists:~
|
||||||
|
|
||||||
|
@ -151,6 +153,10 @@ At the moment startify supports these lists:~
|
||||||
|
|
||||||
This lists all the sessions saved in the directory |g:startify_session_dir|.
|
This lists all the sessions saved in the directory |g:startify_session_dir|.
|
||||||
|
|
||||||
|
5) "commands"
|
||||||
|
|
||||||
|
This lists commands defined in |g:startify_commands|.
|
||||||
|
|
||||||
Section headers:~
|
Section headers:~
|
||||||
|
|
||||||
Additionally you can add lists of strings to that list. These will be shown
|
Additionally you can add lists of strings to that list. These will be shown
|
||||||
|
@ -174,6 +180,8 @@ Section headers example:~
|
||||||
\ 'sessions',
|
\ 'sessions',
|
||||||
\ [' These are my bookmarks:'],
|
\ [' These are my bookmarks:'],
|
||||||
\ 'bookmarks',
|
\ 'bookmarks',
|
||||||
|
\ [' These are my commands:'],
|
||||||
|
\ 'commands',
|
||||||
\ ]
|
\ ]
|
||||||
<
|
<
|
||||||
Feel free to add some cool ASCII action!
|
Feel free to add some cool ASCII action!
|
||||||
|
@ -193,6 +201,25 @@ Example:
|
||||||
<
|
<
|
||||||
NOTE: Avoid using keys from |startify-mappings| if providing custom indices.
|
NOTE: Avoid using keys from |startify-mappings| if providing custom indices.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*g:startify_commands*
|
||||||
|
>
|
||||||
|
let g:startify_commands = []
|
||||||
|
<
|
||||||
|
A list of commands to execute on selection. Leading colons are optional. It
|
||||||
|
supports optional custom indices and/or command descriptions.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
>
|
||||||
|
let g:startify_commands = [
|
||||||
|
\ ':help reference',
|
||||||
|
\ ['Vim Reference', 'h ref'],
|
||||||
|
\ {'h': 'h ref'},
|
||||||
|
\ {'m': ['My magical function', 'call Magic()']},
|
||||||
|
\ ]
|
||||||
|
<
|
||||||
|
NOTE: Avoid using keys from |startify-mappings| if providing custom indices.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*g:startify_files_number*
|
*g:startify_files_number*
|
||||||
>
|
>
|
||||||
|
@ -880,17 +907,6 @@ This is my configuration..
|
||||||
let g:startify_session_persistence = 1
|
let g:startify_session_persistence = 1
|
||||||
let g:startify_session_delete_buffers = 1
|
let g:startify_session_delete_buffers = 1
|
||||||
|
|
||||||
let g:startify_list_order = [
|
|
||||||
\ [' LRU:'],
|
|
||||||
\ 'files',
|
|
||||||
\ [' LRU within this dir:'],
|
|
||||||
\ 'dir',
|
|
||||||
\ [' Sessions:'],
|
|
||||||
\ 'sessions',
|
|
||||||
\ [' Bookmarks:'],
|
|
||||||
\ 'bookmarks',
|
|
||||||
\ ]
|
|
||||||
|
|
||||||
let g:startify_skiplist = [
|
let g:startify_skiplist = [
|
||||||
\ 'COMMIT_EDITMSG',
|
\ 'COMMIT_EDITMSG',
|
||||||
\ 'bundle/.*/doc',
|
\ 'bundle/.*/doc',
|
||||||
|
|
Loading…
Reference in a new issue