Clone the plugin from the git repository
To clone from github:
git clone https://github.com/kien/ctrlp.vim.git ~/.vim/bundle/ctrlp.vim
2
Update your vimrc
Add the following to your vimrc file:
set runtimepath^=~/.vim/bundle/ctrlp.vim
To edit vimrc, type:
vim ~/.vimrc
3
Restart vim
============================
e.g. 2 install airline from github
git clone https://github.com/bling/vim-airline ~/.vim/bundle/vim-airline
Put the following line into ~/.vimrc
set funtimepath^=~/.vim/bundle/vim-airline
I got :help airline to work with this command:
:helptags ~/.vim/bundle/vim-airline/doc
Like you, now the help-page displays when I type :help airline.
To add airline and the buffer list, install airline, and then just add this to your .vimrc:
" Enable the list of buffers
let g:airline#extensions#tabline#enabled = 1
" Show just the filename
let g:airline#extensions#tabline#fnamemod = ':t'
Next I needed to replace the tab shortcuts that I’d no longer be using. I did this by adding these to my .vimrc as well:
" This allows buffers to be hidden if you've modified a buffer.
" This is almost a must if you wish to use buffers in this way.
set hidden
" To open a new empty buffer
" This replaces :tabnew which I used to bind to this mapping
nmap <leader>T :enew<cr>
" Move to the next buffer
nmap <leader>l :bnext<CR>
" Move to the previous buffer
nmap <leader>h :bprevious<CR>
" Close the current buffer and move to the previous one
" This replicates the idea of closing a tab
nmap <leader>bq :bp <BAR> bd #<CR>
" Show all open buffers and their status
nmap <leader>bl :ls<CR>
These settings gave me a hybrid approach to how I expected tabs to work in Vim yet it still gave me the same power that comes from understanding and using buffers.
No comments:
Post a Comment