I hope it helps you to pimp your vim, I try to make this guide as simple as possible, and you will need take a little effort to install vundle, this plugin is used to organize your plugins and its a default manager in vim awesome
- Terminus for powerline, You need
Download
and
Double Click
and install in your Font Book
- Install Vundle Read Instructions
open your vim ~/.vimrc
and update the file with my setting of .vimrc
set nocompatible " be iMproved, required
filetype on " required
set background=dark
syntax on
set number
set noshowmode
" Poweline setup
set guifont=Terminus\ for\ Powerline:h14
let g:Powerline_symbols = 'fancy'
set encoding=utf-8
set t_Co=256
set term=xterm-256color
set termencoding=utf-8
if has("gui_running")
let s:uname = system("uname")
if s:uname == "Darwin\n"
set guifont=Terminus\ for\ Powerline:h14
endif
endif
" Configuration
set encoding=utf-8
scriptencoding utf-8
" NerdTree
let g:nerdtree_tabs_open_on_gui_startup=1
let g:nerdtree_tabs_open_on_console_startup=1
map <F5> :NERDTreeToggle<cr>
map <S-Up> :tabn<CR>
map <S-Down> :tabp<CR>
map <S-Left> :NERDTreeSteppedOpen<CR>
map <S-Right> :NERDTreeSteppedClose<CR>
" ligthline
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ], ['ctrlpmark'] ],
\ 'right': [ [ 'syntastic', 'lineinfo' ], ['percent'], [ 'fileformat', 'fileencoding', 'filetype' ] ]
\ },
\ 'component':{
\ 'readonly': '%{&readonly?"⭤":""}',
\ },
\ 'component_function': {
\ 'fugitive': 'LightLineFugitive',
\ 'filename': 'LightLineFilename',
\ 'fileformat': 'LightLineFileformat',
\ 'filetype': 'LightLineFiletype',
\ 'fileencoding': 'LightLineFileencoding',
\ 'mode': 'LightLineMode',
\ 'ctrlpmark': 'CtrlPMark',
\ },
\ 'component_visible_condition': {
\ 'readonly': '(&filetype!="help"&& &readonly)',
\ 'modified': '(&filetype!="help"&&(&modified||!&modifiable))'
\ },
\ 'component_expand': {
\ 'syntastic': 'SyntasticStatuslineFlag',
\ },
\ 'component_type': {
\ 'syntastic': 'error',
\ },
\ 'separator': { 'left': "⮀", 'right': "⮂" },
\ 'subseparator': { 'left': "⮁", 'right': "⮃" }
\ }
function! LightLineModified()
return &ft =~ 'help' ? '' : &modified ? '+' : &modifiable ? '' : '-'
endfunction
function! LightLineReadonly()
return &ft !~? 'help' && &readonly ? '⭤' : ''
endfunction
function! LightLineFilename()
let fname = expand('%:t')
return fname == 'ControlP' ? g:lightline.ctrlp_item :
\ fname == '__Tagbar__' ? g:lightline.fname :
\ fname =~ '__Gundo\|NERD_tree' ? '' :
\ &ft == 'vimfiler' ? vimfiler#get_status_string() :
\ &ft == 'unite' ? unite#get_status_string() :
\ &ft == 'vimshell' ? vimshell#get_status_string() :
\ ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') .
\ ('' != fname ? fname : '[No Name]') .
\ ('' != LightLineModified() ? ' ' . LightLineModified() : '')
endfunction
function! LightLineFugitive()
try
if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*fugitive#head')
let mark = '⭠ ' " edit here for cool mark
let _ = fugitive#head()
return strlen(_) ? mark._ : ''
endif
catch
endtry
return ''
endfunction
function! LightLineFileformat()
return winwidth(0) > 70 ? &fileformat : ''
endfunction
function! LightLineFiletype()
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : ''
endfunction
function! LightLineFileencoding()
return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : ''
endfunction
function! LightLineMode()
let fname = expand('%:t')
return fname == '__Tagbar__' ? 'Tagbar' :
\ fname == 'ControlP' ? 'CtrlP' :
\ fname == '__Gundo__' ? 'Gundo' :
\ fname == '__Gundo_Preview__' ? 'Gundo Preview' :
\ fname =~ 'NERD_tree' ? 'NERD_Tree' :
\ &ft == 'unite' ? 'Unite' :
\ &ft == 'vimfiler' ? 'VimFiler' :
\ &ft == 'vimshell' ? 'VimShell' :
\ winwidth(0) > 60 ? lightline#mode() : ''
endfunction
function! CtrlPMark()
if expand('%:t') =~ 'ControlP'
call lightline#link('iR'[g:lightline.ctrlp_regex])
return lightline#concatenate([g:lightline.ctrlp_prev, g:lightline.ctrlp_item
\ , g:lightline.ctrlp_next], 0)
else
return ''
endif
endfunction
let g:ctrlp_status_func = {
\ 'main': 'CtrlPStatusFunc_1',
\ 'prog': 'CtrlPStatusFunc_2',
\ }
function! CtrlPStatusFunc_1(focus, byfname, regex, prev, item, next, marked)
let g:lightline.ctrlp_regex = a:regex
let g:lightline.ctrlp_prev = a:prev
let g:lightline.ctrlp_item = a:item
let g:lightline.ctrlp_next = a:next
return lightline#statusline(0)
endfunction
function! CtrlPStatusFunc_2(str)
return lightline#statusline(0)
endfunction
let g:tagbar_status_func = 'TagbarStatusFunc'
function! TagbarStatusFunc(current, sort, fname, ...) abort
let g:lightline.fname = a:fname
return lightline#statusline(0)
endfunction
augroup AutoSyntastic
autocmd!
autocmd BufWritePost *.c,*.cpp call s:syntastic()
augroup END
function! s:syntastic()
SyntasticCheck
call lightline#update()
endfunction
let g:unite_force_overwrite_statusline = 0
let g:vimfiler_force_overwrite_statusline = 0
let g:vimshell_force_overwrite_statusline = 0
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
" Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Avoid a name conflict with L9
" Plugin 'user/L9', {'name': 'newL9'}
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
"
Plugin 'itchyny/lightline.vim'
Plugin 'chriskempson/base16-vim'
Plugin 'davidhalter/jedi-vim'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/nerdcommenter'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'altercation/vim-colors-solarized'
Plugin 'powerline/powerline'
Plugin 'hynek/vim-python-pep8-indent'
Plugin 'mitsuhiko/vim-python-combined'
Plugin 'voithos/vim-python-syntax'
Plugin 'othree/html5.vim'
Plugin 'mustache/vim-mustache-handlebars'
Plugin 'pangloss/vim-javascript'
Plugin 'dsawardekar/ember.vim'
Plugin 'heartsentwined/vim-ember-script'
Plugin 'tpope/vim-markdown'
Plugin 'Wombat'
Plugin 'guifontpp.vim'
Plugin 'scrooloose/syntastic'
Plugin 'nathanaelkane/vim-indent-guides'
save the file :w
and install the plugins :PluginInstall
mkdir ~/.vim/colors
ln $HOME/.vim/bundle/Wombat/colors/wombat.vim $HOME/.vim/colors/wombat.vim
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14)
to GNU bash, versión 4.3.42(1)-release (x86_64-apple-darwin14.5.0)
brew install bash
brew install python3
if you have another version of vim brew uninstall vim; brew unlink vim ; brew prune
or macvim brew uninstall macvim; brew unlink macvim ; brew prune
# vim instrucctons
brew install vim --with-python3 --without-python # [issue](https://github.com/Homebrew/homebrew/issues/20327)
brew link vim
# macvim instructions
brew install macvim --with-override-system-vim --with-unicode3 --with-python3 --without-python
brew link macvim
Note In both cases you will need reload the session, open a new window (iTerm, Terminal, etc.)
Configure iTerm2 to use Terminus for Powerline
,
First Open a new session and choose preference tab
Go to Profile -> Text -> Change Font -> Choose [Terminus for Powerline]
Note: In both cases Regular Font
and Non-ASCII Font
, choose the same font, I suggest uses 14px of size
If you prefer another font. powerfont project and tool for patching fontpatcher
mkdir -p $HOME/.local/tmp
cd $HOME/.local/tmp
git clone https://github.com/Lokaltog/vim-powerline
brew uninstall fontforge # if you install as brew install fontforge you need to uninstall and reinstall
brew update
brew install --use-gcc fontforge
patching a font fontforge -script /path/to/fontpatcher MyFontFile.ttf
In my case i will patch a font before installed, Terminus-1.ttf
located on $HOME/Library/Fonts
cd $HOME/Library/Fonts
fontforge -script $HOME/.local/tmp/vim-powerline/fontpatcher/fontpatcher Terminus-1.ttf
I got Terminus-1-Powerline.ttf
after running the previous command, or whatever you patch, you only need change the font in your iTerm2
, or in .vimrc
the variable guifont
to display in macvim, remember if your font look like this Font OtherStuff for Powerline
So the variable guifont
can look like this set guifont=Font\ OtherStuff\ for\ Powerline:h14
where h14
is the font size in this case 14px.
Roberto Estrada restrada@paridin.com
To navigate between windows
NERD_Tree | your code
press
shift + right arrow
for go to the right windowYou code buffer
press
shift + left arrow
for go to the left windowNERD_Tree buffer
To create a new tab
press
shift + t
To navigate between Tabs
press
shift + up arrow
press
shift + down arrow
For toggle shortcut
press
F5
keyFor more custom detail to mapping keys