diff --git a/README.md b/README.md index 58f09563..7c29072d 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,14 @@ # The Ultimate vimrc -Over the last 10 years I have used and tweaked Vim. This is the ultimate vimrc (or at least my version of it). +Over the last 10 years, I have used and tweaked Vim. This configuration is the ultimate vimrc (or at least my version of it). There are two versions: * **The Basic**: If you want something small just copy [basic.vim](https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim) into your ~/.vimrc and you will have a good basic setup -* **The Awesome**: Includes a ton of useful plugins, color schemes and configurations +* **The Awesome**: Includes a ton of useful plugins, color schemes, and configurations -I would of course recommend using the awesome version. +I would, of course, recommend using the awesome version. ## How to install the Awesome version? The awesome version includes a lot of great plugins, configurations and color schemes that make Vim a lot better. To install it simply do following from your terminal: @@ -17,12 +17,12 @@ The awesome version includes a lot of great plugins, configurations and color sc git clone https://github.com/amix/vimrc.git ~/.vim_runtime sh ~/.vim_runtime/install_awesome_vimrc.sh -I also recommend using [the Hack font](http://sourcefoundry.org/hack/) (it's free and awesome font designed for source code). The Awesome vimrc is already setup to try to use it. +I also recommend using [the Hack font](http://sourcefoundry.org/hack/) (it's a free and awesome font designed for source code). The Awesome vimrc is already setup to try to use it. ## How to install the Basic version? -The basic version is basically just one file and no plugins. Simply copy [basic.vim](https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim) and paste it into your vimrc. +The basic version is just one file and no plugins. Just copy [basic.vim](https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim) and paste it into your vimrc. -This is useful to install on remote servers where you don't need many plugins and you don't do many edits. +The basic version is useful to install on remote servers where you don't need many plugins, and you don't do many edits. git clone git://github.com/amix/vimrc.git ~/.vim_runtime sh ~/.vim_runtime/install_basic_vimrc.sh @@ -39,7 +39,7 @@ If you have vim aliased as `vi` instead of `vim`, make sure to either alias it: ## How to update to latest version? -Simply just do a git rebase! +Just do a git rebase! cd ~/.vim_runtime git pull --rebase @@ -48,9 +48,11 @@ Simply just do a git rebase! ## Some screenshots Colors when editing a Python file: + ![Screenshot 1](http://files1.wedoist.com/e952fdb343b1e617b90d256e474d0370/as/screenshot_1.png) -Opening recently opened files [mru.vim](https://github.com/vim-scripts/mru.vim): +Opening recently opened files with the [mru.vim](https://github.com/vim-scripts/mru.vim) plugin: + ![Screenshot 2](http://files1.wedoist.com/1967b0e48af40e513d1a464e08196990/as/screenshot_2.png) [NERD Tree](https://github.com/scrooloose/nerdtree) plugin in a terminal window: @@ -65,7 +67,7 @@ Distraction free mode using [goyo.vim](https://github.com/junegunn/goyo.vim) and ## Included Plugins -I recommend reading the docs of these plugins to understand them better. Each of them provide a much better Vim experience! +I recommend reading the docs of these plugins to understand them better. Each plugin provides a much better Vim experience! * [ag.vim](https://github.com/rking/ag.vim): Vim plugin for `the_silver_searcher` (ag) -- a wicked fast grep * [bufexplorer.zip](https://github.com/vim-scripts/bufexplorer.zip): Quickly and easily switch between buffers. This plugin can be opened with `` @@ -108,37 +110,38 @@ Remove all clutter and focus only on the essential. Similar to iA Writer or Writ ## How to include your own stuff? -After you have installed the setup you can create **~/.vim_runtime/my_configs.vim** to fill in any configurations that are important for you. For instance, my **my_configs.vim** looks like this: +After you have installed the setup, you can create **~/.vim_runtime/my_configs.vim** to fill in any configurations that are important for you. For instance, my **my_configs.vim** looks like this: ~/.vim_runtime (master)> cat my_configs.vim map ct :cd ~/Desktop/Todoist/todoist map cw :cd ~/Desktop/Wedoist/wedoist -You can also install your own plugins, for instance, via pathogen you can install [vim-rails](https://github.com/tpope/vim-rails): +You can also install your plugins, for instance, via pathogen you can install [vim-rails](https://github.com/tpope/vim-rails): cd ~/.vim_runtime git clone git://github.com/tpope/vim-rails.git sources_non_forked/vim-rails - + ## Key Mappings The [leader](http://learnvimscriptthehardway.stevelosh.com/chapters/06.html#leader) is `,`, so whenever you see `` it means `,`. + ### Plugin related mappings -Open [bufexplorer](https://github.com/vim-scripts/bufexplorer.zip) and see and manage the current buffers (`o`): +Open [bufexplorer](https://github.com/vim-scripts/bufexplorer.zip) to see and manage the current buffers (`o`): map o :BufExplorer -Open [MRU.vim](https://github.com/vim-scripts/mru.vim) and see the recently open files (`f`): +Open [MRU.vim](https://github.com/vim-scripts/mru.vim) to see the recently open files (`f`): map f :MRU -Open [ctrlp.vim](https://github.com/kien/ctrlp.vim) plugin (`j` or `f`): +Open [ctrlp.vim](https://github.com/kien/ctrlp.vim) plugin to quickly find a file or a buffer (`j` or `f`): let g:ctrlp_map = '' -Managing the [NERD Tree](https://github.com/scrooloose/nerdtree) plugin: +[NERD Tree](https://github.com/scrooloose/nerdtree) mappings: map nn :NERDTreeToggle map nb :NERDTreeFromBookmark @@ -148,6 +151,7 @@ Managing the [NERD Tree](https://github.com/scrooloose/nerdtree) plugin: map z :Goyo + ### Normal mode mappings Fast saving of a buffer (`w`): @@ -160,7 +164,7 @@ Map `` to `/` (search) and `+` to `?` (backwards search): map ? map :noh -Disable highlight when `` is pressed: +Disable highlights when you press ``: map :noh @@ -171,7 +175,7 @@ Smart way to move between windows (`j` etc.): map h map l -Closing of current buffer(s) (`bd` and (`ba`)): +Closing of the current buffer(s) (`bd` and (`ba`)): " Close current buffer map bd :Bclose @@ -190,18 +194,14 @@ Useful mappings for managing tabs: " Super useful when editing files in the same directory map te :tabedit =expand("%:p:h")/ -Switch CWD to the directory of the open buffer: +Switch [CWD](http://vim.wikia.com/wiki/Set_working_directory_to_the_current_file) to the directory of the open buffer: map cd :cd %:p:h:pwd -Open `ag.vim` and put the cursor in the right position: +Open `ag.vim` for fast search: map g :Ag -Remove the Windows ^M - when the encodings gets messed up: - - noremap m mmHmt:%s///ge'tzt'm - Quickly open a buffer for scripbble: map q :e ~/buffer @@ -211,23 +211,6 @@ Toggle paste mode on and off: map pp :setlocal paste! -### Insert mode mappings - -Quickly insert parenthesis/brackets/etc.: - - inoremap $1 ()i - inoremap $2 []i - inoremap $3 {}i - inoremap $4 {o}O - inoremap $q ''i - inoremap $e ""i - inoremap $t <>i - -Insert the current date and time (useful for timestamps): - - iab xdate =strftime("%d/%m/%y %H:%M:%S") - - ### Visual mode mappings Visual mode pressing `*` or `#` searches for the current selection: @@ -251,7 +234,24 @@ Surround the visual selection in parenthesis/brackets/etc.: vnoremap $$ `>a"` vnoremap $q `>a'` vnoremap $e `>a"` - + + +### Insert mode mappings + +Quickly insert parenthesis/brackets/etc.: + + inoremap $1 ()i + inoremap $2 []i + inoremap $3 {}i + inoremap $4 {o}O + inoremap $q ''i + inoremap $e ""i + inoremap $t <>i + +Insert the current date and time (useful for timestamps): + + iab xdate =strftime("%d/%m/%y %H:%M:%S") + ### Command line mappings @@ -274,19 +274,20 @@ Write the file as sudo (works only on Unix). Super useful when you open a file a ### Spell checking -Pressing `ss` will toggle and untoggle spell checking +Pressing `ss` will toggle spell checking: map ss :setlocal spell! -Shortcuts using `` instead of special chars +Shortcuts using `` instead of special characters: map sn ]s map sp [s map sa zg map s? z= -### Cope -Do :help cope if you are unsure what cope is. It's super useful! + +### Cope +Query `:help cope` if you are unsure what cope is. It's super useful! When you search with `ag.vim`, display your results in cope by doing: `cc` @@ -297,14 +298,15 @@ To go to the next search result do: To go to the previous search results do: `p` -Vimscript mappings: +Cope mappings: map cc :botright cope map co ggVGy:tabnew:set syntax=qfpgg map n :cn map p :cp + ## How to uninstall -Do following: +Just do following: * Remove `~/.vim_runtime` * Remove any lines that reference `.vim_runtime` in your `~/.vimrc`