# HG changeset patch # User Steve Losh # Date 1350083495 14400 # Node ID d6110e1c1451474837c81261cab4cc31327b0ce0 # Parent 8da4158741c9fce135cedc8132265ee8f17a3ba1# Parent 8825c740bb7c85be290f57832fdfc68aa93185f7 Merge. diff -r 8825c740bb7c -r d6110e1c1451 .ffignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.ffignore Fri Oct 12 19:11:35 2012 -0400 @@ -0,0 +1,12 @@ +syntax: literal +\.DS_Store +\.ropeproject +tags +build +venv + +syntax: regex +.*\.pyc +.*\.swp +.*\.swo +.*\.un~ diff -r 8825c740bb7c -r d6110e1c1451 chapters/07.markdown --- a/chapters/07.markdown Sun Aug 26 20:03:48 2012 -0400 +++ b/chapters/07.markdown Fri Oct 12 19:11:35 2012 -0400 @@ -1,7 +1,7 @@ Editing Your Vimrc ================== -Before we move on to learning more Vimscript lets find a way to make it easier +Before we move on to learning more Vimscript let's find a way to make it easier to add new mappings to our `~/.vimrc` file. When you're coding away furiously at a problem and realize a new mapping would diff -r 8825c740bb7c -r d6110e1c1451 chapters/09.markdown --- a/chapters/09.markdown Sun Aug 26 20:03:48 2012 -0400 +++ b/chapters/09.markdown Fri Oct 12 19:11:35 2012 -0400 @@ -76,7 +76,7 @@ instead of double quotes. Try using `vnoremap` to add a mapping that will wrap whatever text you have -*visually selected* in quotes. You'll probably need the ```<`` and ```>`` +*visually selected* in quotes. You'll probably need the `` `<`` and `` `>`` commands for this, so read up on them with ``:help `<``. Map `H` in normal mode to go to the beginning of the current line. Since `h` diff -r 8825c740bb7c -r d6110e1c1451 chapters/16.markdown --- a/chapters/16.markdown Sun Aug 26 20:03:48 2012 -0400 +++ b/chapters/16.markdown Fri Oct 12 19:11:35 2012 -0400 @@ -48,7 +48,9 @@ ------ The `:normal` command takes a set of characters and performs whatever action -they would do if they were typed in normal mode. Run this command: +they would do if they were typed in normal mode. We'll go into greater detail +in a later chapter, but we've seen it a few times already so it's time to at +least get a taste. Run this command: :::vim :normal gg @@ -60,13 +62,8 @@ Vim will indent the current line. -In our mapping we're using a version of `:normal` with a `!` at the end. This -version will *not* take any existing mappings into account, whereas plain -`:normal` will use them. - -In effect, `:normal!` is to `:normal` as `nnoremap` is to `nmap`. You should -*always* prefer `:normal!` for the same reasons you should always use -`nnoremap`, which we discussed in an earlier chapter. +For now, don't worry about the `!` after `normal` in our mapping. We'll talk +about that later. Execute ------- diff -r 8825c740bb7c -r d6110e1c1451 chapters/19.markdown --- a/chapters/19.markdown Sun Aug 26 20:03:48 2012 -0400 +++ b/chapters/19.markdown Fri Oct 12 19:11:35 2012 -0400 @@ -56,7 +56,8 @@ integer "0" as "false" and the integer "1" as "true". It's reasonable to assume that Vim treats *any* non-zero integer as "truthy", and this is indeed the case. -We can also *set* options as variables. Run the following commands: +We can also *set* options as variables using the `let` command. Run the +following commands: :::vim :let &textwidth = 100 diff -r 8825c740bb7c -r d6110e1c1451 chapters/23.markdown --- a/chapters/23.markdown Sun Aug 26 20:03:48 2012 -0400 +++ b/chapters/23.markdown Fri Oct 12 19:11:35 2012 -0400 @@ -9,7 +9,7 @@ :::vim :function meow() -You might think this would start defining a function named `Meow`. +You might think this would start defining a function named `meow`. Unfortunately this is not the case, and we've already run into one of Vimscript's quirks. diff -r 8825c740bb7c -r d6110e1c1451 chapters/31.markdown --- a/chapters/31.markdown Sun Aug 26 20:03:48 2012 -0400 +++ b/chapters/31.markdown Fri Oct 12 19:11:35 2012 -0400 @@ -104,7 +104,7 @@ * First, `execute` takes a String, so the double backslashes we used turn into single backslashes by the time they get to `normal!`. -* Vim, has *four* different "modes" of parsing regular expressions! The default +* Vim has *four* different "modes" of parsing regular expressions! The default mode requires a backslash before the `+` character to make it mean "1 or more of the preceding character" instead of "a literal plus sign". diff -r 8825c740bb7c -r d6110e1c1451 chapters/33.markdown --- a/chapters/33.markdown Sun Aug 26 20:03:48 2012 -0400 +++ b/chapters/33.markdown Fri Oct 12 19:11:35 2012 -0400 @@ -128,7 +128,7 @@ :::vim nnoremap g :set operatorfunc=GrepOperatorg@ - vnoremap g :call GrepOperator(visualmode()) + vnoremap g :call GrepOperator(visualmode()) function! GrepOperator(type) if a:type ==# 'v' @@ -191,7 +191,7 @@ :::vim nnoremap g :set operatorfunc=GrepOperatorg@ - vnoremap g :call GrepOperator(visualmode()) + vnoremap g :call GrepOperator(visualmode()) function! GrepOperator(type) if a:type ==# 'v' @@ -217,7 +217,7 @@ :::vim nnoremap g :set operatorfunc=GrepOperatorg@ - vnoremap g :call GrepOperator(visualmode()) + vnoremap g :call GrepOperator(visualmode()) function! GrepOperator(type) if a:type ==# 'v' diff -r 8825c740bb7c -r d6110e1c1451 chapters/34.markdown --- a/chapters/34.markdown Sun Aug 26 20:03:48 2012 -0400 +++ b/chapters/34.markdown Fri Oct 12 19:11:35 2012 -0400 @@ -18,7 +18,7 @@ :::vim nnoremap g :set operatorfunc=GrepOperatorg@ - vnoremap g :call GrepOperator(visualmode()) + vnoremap g :call GrepOperator(visualmode()) function! GrepOperator(type) let saved_unnamed_register = @@ @@ -60,7 +60,7 @@ :::vim nnoremap g :set operatorfunc=GrepOperatorg@ - vnoremap g :call GrepOperator(visualmode()) + vnoremap g :call GrepOperator(visualmode()) function! s:GrepOperator(type) let saved_unnamed_register = @@ diff -r 8825c740bb7c -r d6110e1c1451 chapters/43.markdown --- a/chapters/43.markdown Sun Aug 26 20:03:48 2012 -0400 +++ b/chapters/43.markdown Fri Oct 12 19:11:35 2012 -0400 @@ -112,7 +112,7 @@ Create a Mercurial or Git repository for your plugin, called `potion`. You can put it anywhere you like and symlink it into `~/.vim/bundle/potion/` or just put -it directory in `~/.vim/bundle/potion/`. +it directly in `~/.vim/bundle/potion/`. Create `README` and `LICENSE` files in the repository and commit them. diff -r 8825c740bb7c -r d6110e1c1451 chapters/44.markdown --- a/chapters/44.markdown Sun Aug 26 20:03:48 2012 -0400 +++ b/chapters/44.markdown Fri Oct 12 19:11:35 2012 -0400 @@ -72,8 +72,8 @@ :set filetype? This time Vim displays `filetype=potion`. When Vim started up it loaded the -autocommand group inside `~/.vim/bundle/potion.vim`, and when it opened -`factorial.pn` the autocommand fired, setting the `filetype` to `potion`. +autocommand group inside `~/.vim/bundle/potion/ftdetect/potion.vim`, and when it +opened `factorial.pn` the autocommand fired, setting the `filetype` to `potion`. Now that we've taught Vim to recognize Potion files we can move on to actually creating some useful behavior in our plugin. diff -r 8825c740bb7c -r d6110e1c1451 chapters/49.markdown --- a/chapters/49.markdown Sun Aug 26 20:03:48 2012 -0400 +++ b/chapters/49.markdown Fri Oct 12 19:11:35 2012 -0400 @@ -245,7 +245,7 @@ If the current line has some non-whitespace characters it won't match and we'll just return `'0'` as before. -If the current line *does* match the regex (i.e. is it's empty or just +If the current line *does* match the regex (i.e. if it's empty or just whitespace) we return the string `'-1'`. Earlier I said that a line's foldlevel can be zero or a positive integer, so @@ -514,7 +514,7 @@ d 1 e 0 -You could, of course, combine these two cases with `&&`, but I prefer to keep +You could, of course, combine these two cases with `||`, but I prefer to keep them separate to make it more explicit. You might feel differently. It's a style issue. @@ -658,7 +658,7 @@ i string print 1 '! is: ' print 1 factorial (i) string print 1 - "\n" print. 1 + "\n" print. The same thing happens when the next line's indentation is *less* than the current line's: diff -r 8825c740bb7c -r d6110e1c1451 introduction.markdown --- a/introduction.markdown Sun Aug 26 20:03:48 2012 -0400 +++ b/introduction.markdown Fri Oct 12 19:11:35 2012 -0400 @@ -1,10 +1,10 @@ -[Learn Vimscript the Hard Way][book] is a short book for users of the Vim editor +[Learn Vimscript the Hard Way][book] is a book for users of the [Vim][] editor who want to learn how to customize Vim. Before reading this book you should be comfortable using Vim and know what terms like "buffer", "window" and "insert mode" mean. -LVSTHW is divided into three sections: +LVSTHW is divided roughly into three sections: * The first covers basic Vim commands that you can use in your `~/.vimrc` file to customize Vim quickly and easily. @@ -28,6 +28,7 @@ if you're not comfortable with that I understand. [book]: / +[Vim]: http://www.vim.org/ [hg]: http://bitbucket.org/sjl/learnvimscriptthehardway/ [git]: http://github.com/sjl/learnvimscriptthehardway/ [license]: /license.html diff -r 8825c740bb7c -r d6110e1c1451 outline.org --- a/outline.org Sun Aug 26 20:03:48 2012 -0400 +++ b/outline.org Fri Oct 12 19:11:35 2012 -0400 @@ -1,51 +1,13 @@ -* part 3 - creating a full plugin -** ... stuff that's done ... -** TODO mapping -*** run and view output -*** run and view bytecode + output -*** :nnoremap ]] /\v^\S:noh -*** :nnoremap [[ ?\v^\S:noh -** TODO indent files -** TODO customization -*** mappings -**** custom leader -**** disable entirely -**** autoinsert period -*** behaviour -**** vertical/horizontal preview splits -**** split sizes -** TODO dynamic status lines +* remaining chapters +** TODO run and view output ** TODO autoload ** TODO documentation -*** TOC -*** Mappings -*** Configuration -*** Bugs -*** License ** TODO distributing -*** GitHub -*** Vim.org -*** a Web page -* TODO Where to go from here -** Omnicomplete -** makeprg, errorfmt -** Read the fucking documentation -** Read the source of some popular plugins -*** Powerline for a mindfuck -*** Fugitive -* Ideas -** MOAR SYNTAX -** MOAR MAPPING -*** -*** -** String Escaping -** Character theory - i.e. n vs n -** -** -** ! -** GUI-Specific stuff -** Color schemes -** command! -** Case Studies -*** Visual mode * from Scrooloose +** TODO Where to go from here +*** Omnicomplete +*** makeprg, errorfmt +*** Color schemes +*** Read the fucking documentation +*** Read the source of some popular plugins +**** Powerline for a mindfuck +**** Fugitive diff -r 8825c740bb7c -r d6110e1c1451 publish.sh --- a/publish.sh Sun Aug 26 20:03:48 2012 -0400 +++ b/publish.sh Fri Oct 12 19:11:35 2012 -0400 @@ -1,5 +1,5 @@ #!/usr/bin/env bash set -e -./venv/bin/python ../bookmarkdown/bookmarkdown/bookmarkdown build +python ../bookmarkdown/bookmarkdown/bookmarkdown build rsync --delete -az build/html/ sl:/var/www/vimscript/