All configuration options for vim are stored in the user’s home directory in a file named .vimrc
VIM is light, powerful, extendible, runs on every possible OS, and can be used for all sorts of programming languages. The philosophy of VIM is that it is a tool and not a text editor made to hold the user's hands. It is my de-facto editor on both Mac, Linux and Windows and all the other platforms I. Nov 29, 2018 Vim for Mac is an advanced text editor, which harvests the power of Unix' editor 'Vi', albeit with an enhanced feature set. It is highly configurable, and has been designed to enable efficient text editing, much like 'Vi' Key features include: Vim offers syntax highlighting for over 200 languages. Highlighting Matches.
The script code is below but there are somethings you’ll want to do before setting it up.
You’ll need to create directories for the following: backups, colors, swaps and undo.
Execute this command to set up the directories in the terminal ( The ~ character will set the path to your home directory. ex: /Users/username/ ):
$ cd ~/.vim ; mkdir backups ; mkdir colors ; mkdir swaps; mkdir undo;
This will keep all your backups, swaps and undos in your .vim user directory. Also the colors directory is for installing themes.
Visit vimninjas.com if you would like to download a color scheme. Once you find a color scheme you like, just download it and copy and paste the code into the relevant scheme file and place the file in ~/.vim/colors/
For example if you download the Candy theme, you would name the file candy.vim and place it in the relevant directory described above. Then in your .vimrc config file you would set the theme like so:
I've created a github repo with the .vimrc configuration. Please take a look at the repo and download from here.
Checkout or download the git zip and setup the .vimrc file by using the cp command.
$ cd ~/Downloads/MacOSVimConfig-master
$ cp vimrc-example ~/.vimrc
Otherwise you can create your .vimrc file by copying the Raw text from github and pasting the text below. NOTE: While in vim before you paste try doing this command.
:set paste
This should paste the text with the best result. Once the .vimrc file is configured open a new terminal windows and open a file to test out the setup.
$ vim ~/.vimrc
------------ .vimrc example configuration ------------------
Then paste in these configuration options:
' Vundle config |
setnocompatible' be iMproved, required |
filetypeoff' required |
' set the runtime path to include Vundle and initialize |
setrtp+=~/.vim/bundle/Vundle.vim |
callvundle#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' |
' Git plugin not hosted on GitHub |
Plugin'git://git.wincent.com/command-t.git' |
'From here other plugins from the original Vundle config |
Plugin'scrooloose/nerdtree' |
Plugin'skammer/vim-css-color' |
Plugin'hail2u/vim-css3-syntax' |
Plugin'groenewege/vim-less' |
Plugin'jelera/vim-javascript-syntax' |
Plugin'cakebaker/scss-syntax.vim' |
Plugin'airblade/vim-gitgutter' |
Plugin'scrooloose/syntastic' |
' All of your Plugins must be added before the following line |
callvundle#end()' required |
filetypepluginindenton' 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 |
' End of Vundle config |
' General |
setnumber' Show line numbers |
setlinebreak' Break lines at word (requires Wrap lines) |
setshowbreak=+++' Wrap-broken line prefix |
settextwidth=100' Line wrap (number of cols) |
setshowmatch' Highlight matching brace |
setvisualbell' Use visual bell (no beeping) |
sethlsearch' Highlight all search results |
setsmartcase' Enable smart-case search |
setignorecase' Always case-insensitive |
setincsearch' Searches for strings incrementally |
setautoindent' Auto-indent new lines |
setexpandtab' Use spaces instead of tabs |
setshiftwidth=2' Number of auto-indent spaces |
setsmartindent' Enable smart-indent |
setsmarttab' Enable smart-tabs |
setsofttabstop=2' Number of spaces per Tab |
' Advanced |
setruler' Show row and column ruler information |
setundolevels=1000' Number of undo levels |
setbackspace=indent,eol,start' Backspace behaviour |
' Generated by VimConfig.com |
setmouse=a' activate mouse |
' Autoload NERDTree if no file specified |
autocmdStdinReadPre*lets:std_in=1 |
autocmdVimEnter*ifargc() 0&&!exists('s:std_in') | NERDTree | endif |
' Auto close NERDTree if no more files |
autocmdbufenter*if (winnr('$') 1&&exists('b:NERDTreeType') &&b:NERDTreeType'primary') | q | endif |
' Show hidden files in NERDTree |
let NERDTreeShowHidden=1 |
syntaxon |
' enable copy to clipboard |
setclipboard=unnamed |
' copy to clipboard with Ctrl-C |
map<C-x> :!pbcopy<CR> |
vmap<C-c> :w!pbcopy<CR><CR> |
' paste from clipboard with Ctrl-V |
setpastetoggle=<F10> |
inoremap<C-v><F10><C-r>+<F10> |
'''''''''''''' |
' Git-gutter configuration |
'''''''''''''' |
letg:gitgutter_updatetime=750 |
letg:syntastic_auto_loc_list=1 |
letg:syntastic_check_on_open=1 |
'''''''''''''' |
' Syntastic configuration |
'''''''''''''' |
setstatusline+=%#warningmsg# |
setstatusline+=%{SyntasticStatuslineFlag()} |
setstatusline+=%* |
letg:syntastic_always_populate_loc_list=1 |
letg:syntastic_auto_loc_list=1 |
letg:syntastic_check_on_open=0 |
letg:syntastic_check_on_wq=0 |
' so that syntastic uses .jshintrc files if present - http://stackoverflow.com/questions/28573553/how-can-i-make-syntastic-load-a-different-checker-based-on-existance-of-files-in |
autocmdFileType javascript letb:syntastic_checkers=findfile('.jshintrc', '.;') !='' ? ['jshint'] : ['standard'] |
'''''''''''''' |
' Custom (no plugin related) |
'''''''''''''' |
' show filename |
setstatusline+=%F |