diff options
Diffstat (limited to 'runtime/doc/usr_05.txt')
-rw-r--r-- | runtime/doc/usr_05.txt | 58 |
1 files changed, 32 insertions, 26 deletions
diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt index af17d75656..d85be4ccae 100644 --- a/runtime/doc/usr_05.txt +++ b/runtime/doc/usr_05.txt @@ -11,12 +11,13 @@ Vim's capabilities. Or define your own macros. |05.1| The vimrc file |05.2| The example vimrc file explained -|05.3| Simple mappings -|05.4| Adding a package -|05.5| Adding a plugin -|05.6| Adding a help file -|05.7| The option window -|05.8| Often used options +|05.3| The defaults.vim file explained +|05.4| Simple mappings +|05.5| Adding a package +|05.6| Adding a plugin +|05.7| Adding a help file +|05.8| The option window +|05.9| Often used options Next chapter: |usr_06.txt| Using syntax highlighting Previous chapter: |usr_04.txt| Making small changes @@ -172,21 +173,12 @@ This switches on three very clever mechanisms: automatically. Vim comes with these indent rules for a number of filetypes. See |:filetype-indent-on| and 'indentexpr'. -> - autocmd FileType text setlocal textwidth=78 - -This makes Vim break text to avoid lines getting longer than 78 characters. -But only for files that have been detected to be plain text. There are -actually two parts here. "autocmd FileType text" is an autocommand. This -defines that when the file type is set to "text" the following command is -automatically executed. "setlocal textwidth=78" sets the 'textwidth' option -to 78, but only locally in one file. - *restore-cursor* > - autocmd BufReadPost * - \ if line("'\"") > 1 && line("'\"") <= line("$") | - \ exe "normal! g`\"" | - \ endif + *restore-cursor* *last-position-jump* > + autocmd BufReadPost * + \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit' + \ | exe "normal! g`\"" + \ | endif Another autocommand. This time it is used after reading any file. The complicated stuff after it checks if the '" mark is defined, and jumps to it @@ -195,8 +187,22 @@ from the previous line. That avoids a line getting very long. See |line-continuation|. This only works in a Vim script file, not when typing commands at the command-line. +> + command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis + \ | wincmd p | diffthis + +This adds the ":DiffOrig" command. Use this in a modified buffer to see the +differences with the file it was loaded from. See |diff|. + +> + set nolangremap + +Prevent that the langmap option applies to characters that result from a +mapping. If set (default), this may break plugins (but it's backward +compatible). See 'langremap'. + ============================================================================== -*05.3* Simple mappings +*05.4* Simple mappings A mapping enables you to bind a set of Vim commands to a single key. Suppose, for example, that you need to surround certain words with curly braces. In @@ -243,7 +249,7 @@ The ":map" command (with no arguments) lists your current mappings. At least the ones for Normal mode. More about mappings in section |40.1|. ============================================================================== -*05.4* Adding a package *add-package* *vimball-install* +*05.5* Adding a package *add-package* *vimball-install* A package is a set of files that you can add to Vim. There are two kinds of packages: optional and automatically loaded on startup. @@ -283,7 +289,7 @@ an archive or as a repository. For an archive you can follow these steps: More information about packages can be found here: |packages|. ============================================================================== -*05.5* Adding a plugin *add-plugin* *plugin* +*05.6* Adding a plugin *add-plugin* *plugin* Vim's functionality can be extended by adding plugins. A plugin is nothing more than a Vim script file that is loaded automatically when Vim starts. You @@ -420,7 +426,7 @@ Further reading: |new-filetype| How to detect a new file type. ============================================================================== -*05.6* Adding a help file *add-local-help* +*05.7* Adding a help file *add-local-help* If you are lucky, the plugin you installed also comes with a help file. We will explain how to install the help file, so that you can easily find help @@ -453,7 +459,7 @@ them through the tag. For writing a local help file, see |write-local-help|. ============================================================================== -*05.7* The option window +*05.8* The option window If you are looking for an option that does what you want, you can search in the help files here: |options|. Another way is by using this command: > @@ -492,7 +498,7 @@ border. This is what the 'scrolloff' option does, it specifies an offset from the window border where scrolling starts. ============================================================================== -*05.8* Often used options +*05.9* Often used options There are an awful lot of options. Most of them you will hardly ever use. Some of the more useful ones will be mentioned here. Don't forget you can |