This is getting bigger than I initially thought but personally I like it this way. If any of you with enough free time and some knowledge in vim internals, please review it. In any case I will try to open a ticket in the next days.
Index: postlfs/config/vimrc.xml =================================================================== --- postlfs/config/vimrc.xml (revision 6656) +++ postlfs/config/vimrc.xml (working copy) @@ -36,10 +36,7 @@ section you'll find an attempt to enhance this file. At startup, <command>vim</command> reads <filename>/etc/vimrc</filename> and <filename>~/.vimrc</filename> (i.e., the global <filename>vimrc</filename> - and the user-specific one). Note that this is only true if you compiled - <application>vim</application> using LFS-3.1 onwards. Prior to this, the - global <filename>vimrc</filename> was - <filename>/usr/share/vim/vimrc</filename>.</para> + and the user-specific one).</para> <para>Here is a slightly expanded <filename>.vimrc</filename> that you can put in <filename>~/.vimrc</filename> to provide user specific effects. Of @@ -49,14 +46,57 @@ users already on the system, such as <systemitem class='username'>root</systemitem>. Be sure to set permissions, owner, and group if you do copy anything directly from - <filename class="directory">/etc/skel</filename>.</para> + <filename class="directory">/etc/skel</filename>. + </para> + <note> + <para> + There are also a <filename>vimrc_example.vim</filename> and a + <filename>gvimrc_example.vim</filename>,located in + <filename class="directory">$VIMRUNTIME</filename> (issue: + <command>echo $VIMRUNTIME</command> to find out the $VIMRUNTIME directory), + which both are good starting points.</para> + <para> + You can source one of those example vim files,if you put in your <filename>.vimrc</filename>: + <screen><literal>runtime vimrc_example.vim</literal></screen> + If you do this,keep in mind that some of those options might be also included in our + example.</para> + </note> + <para>Review the following options and comment out those that you don't really need them. + </para> <screen><literal>" Begin .vimrc +set autoindent set columns=80 +set foldmethod=indent +set history=50 +set ruler +set showcmd +set wildmenu set wrapmargin=8 -set ruler +iabbrev mispell misspell + +if &t_Co > 2 || has("gui_running") +syntax on +set hlsearch +endif + +if has("autocmd") +autocmd BufRead *.txt set tw=78 +autocmd BufEnter * lcd %:p:h +autocmd BufReadPost * +\ if line("'\"") > 0 && line ("'\"") <= line("$") | +\ exe "normal g'\"" | +\ endif +endif + +if has("gui_running") +map <S-Insert> <MiddleMouse> +map! <S-Insert> <MiddleMouse> +set guifont=Monospace\ 12 +endif + " End .vimrc</literal></screen> <para>Note that the comment tags are " instead of the more @@ -80,32 +120,79 @@ of the backspace option. It is fairly complex so see <command>:help 'bs' </command> for more details.</para> </listitem> + <listitem> + <para><option>set background=dark</option>: This tells + <command>vim</command> to use colors which look good on a dark + background.</para> + </listitem> + <listitem> + <para><option>syntax on</option>: Enables + <command>vim</command>'s syntax highlighting.</para> + </listitem> --> <listitem> + <para><option>set autoindent</option>: This makes <command>vim</command> to + obtain the indent of the new line from the previous line. + <emphasis>Note</emphasis>. The <option>'autoindent'</option> option is reset when the + <option>'paste'</option> option is set.</para> + </listitem> + <listitem> <para><option>set columns=80</option>: This simply sets the number of columns used on the screen.</para> </listitem> - <!-- + <listitem> + <para><option>set foldmethod=indent</option>: By default <option>folding</option> is enabled. + Here we set the folding method. There are 5 more methods to choose from. + Issue: <literal>:help folding</literal> and <literal>:help foldmethod</literal> to find help about + folding and folding methods. + </para> + </listitem> <listitem> - <para><option>set background=dark</option>: This tells - <command>vim</command> to use colors which look good on a dark - background.</para> + <para><option>set history=50</option>: The number of command-lines that are remembered + in the history table. Default are 20.</para> </listitem> - --> <listitem> + <para><option>set ruler</option>: This makes <command>vim</command> + show the current row and column at the bottom right of the screen.</para> + </listitem> + <listitem> + <para><option>set showcmd</option>: Show (partial) command in status line.</para> + </listitem> + <listitem> + <para><option>set wildmenu</option>: Make the command line completion to operate in + an enhanced mode. Issue <literal>:help wildmenu</literal> to know more about it's usage.</para> + </listitem> + <listitem> <para><option>set wrapmargin=8</option>: This is the number of characters from the right window border where wrapping starts.</para> </listitem> - <!-- <listitem> - <para><option>syntax on</option>: Enables - <command>vim</command>'s syntax highlighting.</para> + <para><option>iabbrev mispell misspell</option>: Here is an example how to use the abbreviation + future in insert mode. Abbreviations can also be used in Replace and Command line mode. + Issue: <literal>:help abbreviations</literal> to find out more about this future. + </para> </listitem> - --> <listitem> - <para><option>set ruler</option>: This makes <command>vim</command> - show the current row and column at the bottom right of the screen.</para> + <para><option>if &t_Co > …</option>: If the number of supported colors in our + terminal are more than 2,or <command>vim</command> is running in GUI mode,then:</para> + <para>Enable syntax highlighting. + Highlight all of the matched text during a search.</para> </listitem> + <listitem> + <para><option>if has("autocmd") …</option>: If <command>vim</command> compiled with + <option>autocmd</option> support then:</para> + <para>Limit the width of text to 78 characters for files with a .txt extension. + Automatically change the current directory to the directory of the current file. + Jump to the last cursor position when you are reopening a file. + </para> + </listitem> + <listitem> + <para><option>if has("gui_running") …</option>: If running in GUI mode then:</para> + <para> + Make shift-insert work like in <command>xterm</command> terminal emulator. + Sets the desired font. + </para> + </listitem> </itemizedlist> <para>More information on the <emphasis>many</emphasis> @@ -115,5 +202,18 @@ <command>vim</command> to get the general help, or by typing <command>:</command><option>help usr_toc.txt</option> to view the User Manual Table of Contents.</para> + + <para>Another <command>vim</command> command,which might assist you while you are looking for + <emphasis>help</emphasis> in the extended <command>vim</command> documentation,is the internal + <command>grep</command> and particularly the <command>helpgrep</command> command. + Issue: + <screen><literal>:helpgrep <some pattern></literal></screen> + Then you can open a quickfix window to view the results. + <screen><literal>:copen</literal></screen> + Hit enter on the desired line to jump to the specific help text file. + When you are done,you can then close the quickfix window with: + <screen><literal>:close</literal></screen> + </para> + </sect1>
-- http://linuxfromscratch.org/mailman/listinfo/blfs-dev FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page