history-traverse


Ⅰ. 插件描述

Add ability to easily go back and forth in your buffer history in vim

Ⅱ. 基本信息

创建日期:  2017-09-03
使用用户:  2
Github星:  13
插件作者:  Cohen Karnell

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'ckarnell/history-traverse'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'ckarnell/history-traverse'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'ckarnell/history-traverse'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/ckarnell/history-traverse

Ⅳ. 文档说明

# history-traverse.vim
Easily go back and forth in your buffer history in vim, similar to the behavior of a browser. You even get little tiny arrows to put in your statusline to indicate when you can go back or forward (if you want them)!

:sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles:
Alt Text
:sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles:

Look at the majesty of those little arrows!

Each window (i.e. split) gets its own personal history, and each time you create a new window or a new tab, it inherits its history from the previous buffer (both forward and backward).

Usage

This plugin provides :HisTravBack and :HisTravForward commands to navigate similarly to a web browser.

Settings

" Put these in your .vimrc (all are optional):

" Set mappings for the commands.
" This plugin doesn't set any mappings by default, but <BS> and <C-n> are recommended
nnoremap <BS> :HisTravBack<CR>
nnoremap <C-n> :HisTravForward<CR>

" Set filetypes to pass over putting in the history. Defaults to ['netrw']
let g:history_ft_ignore = ['pyc', 'netrw']

" Set file names to pass over putting in the history. Defaults to an empty list
let g:history_fn_ignore = ['hate_this_file.py', 'worst_file']

" Set the maximum length of each buffer's history. Defaults to 100
let g:history_max_len = 1000

" Append this to your status line wherever you want if you want to see the history indicators
set statusline+=%{HistoryIndicator()}

" Use these variables to set custom characters for the history indicators.
" These are also the defaults for terminal vim
let g:history_indicator_back_active      = '⬅'
let g:history_indicator_back_inactive    = '⇦'
let g:history_indicator_forward_active   = '➡'
let g:history_indicator_forward_inactive = '⇨'
let g:history_indicator_separator        = ' '

Note the your mileage may vary with the default indicator characters depending on your vim environment / choice of font (and they may look weird in your browser too), so you may want to customize these - but it would be wise to load vim up with the defaults first to see if it looks okay. You never know.

If the defaults don't work for you, I recommend poking around :help digraph-table for some symbols that look nice in your environment. Google is a good resource for this too :)

Installation

Install with your favorite package manager. For the sake of completion, I'll give step by step instructions for installing with vundle.

  • Install vundle and do whatever setup business it requires.
  • Put the following in your .vimrc: Plugin 'ckarnell/history-traverse'.
  • Type :so % to source your .vimrc (or close and reopen it).
  • Type :PluginInstall.
  • Restart whatever instances of vim you were using, and it should work.

Shameless begging for help

I don't really know how to make vim plugins so if you want to review my code, make suggestions about defaults or extensions, let me know about issues, help me make it more clear exactly what this plugin does in this README, or anything else, please go right ahead.

Thank you!

Thanks to drzl for adding customization features for the indicators!

添加新评论