Ⅰ. 插件描述
Vim Reminder Tips - Print personal tips and reminders on CursorHoldⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'kreskij/vim-reminder-tips'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'kreskij/vim-reminder-tips'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'kreskij/vim-reminder-tips'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/kreskij/vim-reminder-tips
Ⅳ. 文档说明
# vim-reminder-tips

Define personal tips and reminders in your .vimrc and vim-reminder-tips will
echo a random tip on each CursorHold event.
Features
- Ability to Enable and Disable the plugin on-the-fly.
- Register Important Tips to show first before showing all (important & regular) tips randomized.
- Option to run on every nth CursorHold event for less frequent tip displays.
- Color/Style your tips using basic markup. (Example
[B]for bold). - Show all tips with the
:PrintReminderTipscommand.
Why I created this plugin:
- To recap on things I've learned in Vim and to see such information while I'm in the process of editing text – where it's most relevant.
- To remind myself to use features that I forget to use because they are not yet second-nature or they are regularly forgotten about.
- To see tips and reminders passively without interfering with my workflow. May help for visual learners such as myself.
Installation
Use your favourite plugin manager to install. Examples below:
" vim-plug
Plug 'kreskij/vim-reminder-tips'
" Vundle
Plugin 'kreskij/vim-reminder-tips'Quick Examples
Plug 'kreskij/vim-reminder-tips' " Install the plugin via vim-plug
" Add Tips (Method 1, :Command)
"-------------------------------
call reminder_tips#Setup() " Required to add tips via Method 1
AddReminderTip 'Example Reminder Tip'
AddImportantTip 'Example Important Tip'
" Add Tips (Method 2: global variable)
"--------------------------------------
let g:reminder_tips_reminder_tips = [
\ {'tip': 'Example Reminder Tip #1 '},
\ {'tip': 'Example Reminder Tip #2 '} ]
let g:reminder_tips_important_tips = [
\ {'tip': 'Example Important Tip #1 '},
\ {'tip': 'Example Important Tip #2 '} ]
" Add Tips (Method 3: function call)
"------------------------------------
call reminder_tips#AddReminderTip('Example Reminder Tip')
call reminder_tips#AddImportantTip('Example Important Tip')Adding Tips: The 3 Methods
This plugin provides 3 ways for you to add tips. Use whichever you like
best or use more than one if you like. I personally use Method 1 because the
commands are terse, easy to remember, and easy to read.
"===============================================================================
" Method 1: :Commands
"===============================================================================
"--------------------------------------------------------------------------
" Load the plugin first
"--------------------------------------------------------------------------
" Since Vim plugins are loaded *after* your vimrc, Method 1 requires you to
" autoload the plugin to ensure the Add(Reminder|Important)Tip commands are
" defined before you use them. To load the plugin, call the following setup
" function first:
call reminder_tips#Setup() " Required to add tips via Method 1
" Alternatively, if your plugin manager supports on-demand loading, that will
" work too. Example using vim-plug:
Plug 'kreskij/vim-reminder-tips', {'on': ['AddReminderTip', 'AddImportantTip']}
"--------------------------------------------------------------------------
" Add some tips...
"--------------------------------------------------------------------------
AddReminderTip 'Example Reminder Tip'
AddImportantTip 'Example Important Tip'
"===============================================================================
" Method 2: global variables
"===============================================================================
let g:reminder_tips_reminder_tips = [
\ {'tip': 'Example Reminder Tip #1 '},
\ {'tip': 'Example Reminder Tip #2 '} ]
let g:reminder_tips_important_tips = [
\ {'tip': 'Example Important Tip #1 '},
\ {'tip': 'Example Important Tip #2 '} ]
"===============================================================================
" Method 3: function call
"===============================================================================
call reminder_tips#AddReminderTip('Example Reminder Tip')
call reminder_tips#AddImportantTip('Example Important Tip')
List of Commands
| Command | Description |
|---|---|
AddReminderTip 'Example tip: Use ''jk''' | Add a reminder tip. Reminder tips are displayed in a random order. Tips must be surrounded in single quotes. To use a single quote in your tip, use 2 single quotes. |
AddImportantTip 'Example tip: Use ''jk''' | Add an important tip. Important tips are displayed first, in the order they were registered. Once all of the important tips have been displayed, both Reminder Tips and Important Tips will be displayed randomly from then on. |
PrintReminderTips | Print (echo) all Reminder and Important tips |
EnableReminderTips | Enable Reminder Tips |
DisableReminderTips | Disable Reminder Tips |
Configuration Options
g:vim_reminder_tips_enabled
If set to 0, vim-reminer-tips will be disabled by default (Default: 1):
let g:reminder_tips_enabled = 1g:vim_reminder_tips_every_nth_cursorhold
Show a new tip on every nth CursorHold event. All other CursorHold events will
be ignored. This is useful for reducing the frequency that tips are shown.
Set to 1 to show a new reminder tip on every CursorHold event. (Default: 1)
let g:reminder_tips_every_nth_cursorhold = 1g:vim_reminder_tips_prefix
Prefix text to show before the contents of the tip. If the length of the command
output line is less than the length of the prefix + the tip. The prefix will
not be shown. The example below will output 'TIP: <tip contents>' each time a tip
is echo'd. Set it to an empty string to disable or omit the prefix. (Default: 'TIP: ')
let g:reminder_tips_prefix = 'TIP: 'Tip Colorizing and Styles
Tips can be colorized using the following markup tags,
" TAG DESC. HIGHLIGHT GROUP Default Value
"-------------------------------------------------------------------
" [R] = RESET (ReminderTips) links to Normal
" [B] = BOLD (ReminderTipsBold) style=BOLD fg=NONE bg=NONE
" [I] = ITALIC (ReminderTipsItalic) style=ITALIC fg=NONE bg=NONE
" [U] = UNDERLINE (ReminderTipsUnderline) style=UNDERLINE fg=NONE bg=NONE
" [C1] = CUSTOM1 (ReminderTipsCustom1) links to ReminderTips
" [C2] = CUSTOM2 (ReminderTipsCustom2) links to ReminderTips
" [C3] = CUSTOM3 (ReminderTipsCustom3) links to ReminderTips
" [C4] = CUSTOM4 (ReminderTipsCustom4) links to ReminderTips
" [C5] = CUSTOM5 (ReminderTipsCustom5) links to ReminderTips
" [C6] = CUSTOM6 (ReminderTipsCustom6) links to ReminderTips
" Examples:
AddReminderTip '[B] This is bold text [R] this is normal text'
AddReminderTip '[B] bold text [C1] CUSTOM1 text [I] Italic text [C3] CUSTOM3 text'Highlight Groups
Use the following highlight groups to control the colors and styles used by
vim-reminder-tips. Examples (using defaults):
" Tip highlights
highlight link ReminderTipsPrefix Special " The 'TIP:' prefix
highlight link ReminderTips Normal " Tip text
highlight link ReminderTipsPrintHeader Special " :PrintReminderTips header
" Tip Markup - [B]old , [I]talic, [U]nderline
highlight ReminderTipsBold ctermfg=NONE ctermbg=NONE cterm=BOLD guifg=NONE guibg=NONE gui=BOLD
highlight ReminderTipsItalic ctermfg=NONE ctermbg=NONE cterm=ITALIC guifg=NONE guibg=NONE gui=ITALIC
highlight ReminderTipsUnderline ctermfg=NONE ctermbg=NONE cterm=UNDERLINE guifg=NONE guibg=NONE gui=UNDERLINE
" Tip Markup - Custom colors [C1],[C2],[C3],[C4],[C5],[C6] tags
highlight link ReminderTipsCustom1 Normal
highlight link ReminderTipsCustom2 Normal
highlight link ReminderTipsCustom3 Normal
highlight link ReminderTipsCustom4 Normal
highlight link ReminderTipsCustom5 Normal
highlight link ReminderTipsCustom6 Normal