This is a continuation of "Create a plugin to execute Python Doctest with Vim (1)". We have created a plug-in that works as it is, so we will publish it.
https://github.com/daizutabi/unite-greater3
The screenshot is shown below.
This plugin is named greater3. The following is an excerpt from the help.
The greater3 plugin runs the Python doctest. Since it also supports standard output and standard error output, it can also be used to execute Python modules.
greater3 is a Vim plugin that runs doctest on the Python file you are editing. The results of the executed doctest are listed using the Unite interface. You can jump to the doctest of the original file from the list, or use the output of doctest to rewrite the source code of the original file. In addition, the standard output stdout and standard error output stderr are also displayed on the Unite interface, so they can be used instead of QuickRun. Since the module specified in the import statement is not imported for each execution, the startup time can be expected to be shortened.
Requirements: --Vim 7.4 or later --Python 3.5 or later
Latest edition: http://github.com/daizutabi/unite-greater3
Run current buffer
:Unite greater3
Shortcut key assignment. Example: When assigning to F10. With ~ / vimfiles / after / ftplugin / python.vim
etc.
nnoremap <silent> <buffer> <F10> :<C-u>Unite greater3<CR>
Working with the Unite buffer
You can assign the execution of Unite greater3 to a shortcut key.
With ~ / vimfiles / after / ftplugin / python.vim
etc.
nnoremap <silent> <buffer> <F10> :<C-u>Unite greater3<CR>
will do.
Key mapping in the Unite buffer is done by setting an alias for the standard action. Specifically, the alias_table of the greater3 source is set as follows.
alias_table = {'*': {'delete': 'toggle', 'bookmark': 'toggle_entire',
\ 'edit': 'entire', 'yank': 'replace'}}
This setting can be changed with g: greater3.alias
.
You can customize the behavior using the global variable g: greater3
.
The default settings are executed when the Python file is first loaded. To overwrite it, write a setting to overwrite it in ~ / vimfiles / after / ftplugin / python.vim
etc.
Use g: greater3.statusline to set the linkage with the statusline plugin. Currently, it supports cooperation with lightline.
By setting g: greater3.statusline ='lighline', the cooperation with lightline becomes effective. Specifically, the result of doctest is displayed in color on the status line. In practice, the above settings are done by default.
Please set as follows in the .vimrc / _vimrc file.
"Prohibits Unite from overwriting the status line.
let g:unite_force_overwrite_statusline = 0
" g:Wherever you like the acitve element of the lightline'greater3'Place.
"For example
let g:lightline = {
\ 'colorscheme': 'solarized',
\ 'mode_map': {'c': 'NORMAL'},
\ 'active': {
\ 'left': [['mode', 'paste'],
\ ['fugitive', 'filename', 'greater3']],
\ }
\}
'greater3' is treated as the expansion component of lightline.
Recommended Posts