20100330 my vimrc - plembo/onemoretech GitHub Wiki

title: My .vimrc link: https://onemoretech.wordpress.com/2010/03/30/my-vimrc/ author: lembobro description: post_id: 171 created: 2010/03/30 12:15:42 created_gmt: 2010/03/30 12:15:42 comment_status: open post_name: my-vimrc status: publish post_type: post

My .vimrc

Vim is my standard editor on Linux and Windows. The .vimrc file lets you set up you individual preferences for how vim should behave. Here's mine, for posterity. UPDATED! Note, it's a work in progress so I continue to update it over time (if this were a wiki I wouldn't even have to mention that). [code lang="bash" gutter="false"] " My vimrc set nu set ignorecase set tabstop=4 set shiftwidth=4 set expandtab set nohls set encoding=utf-8 set fileencodings=ucs-bom,utf-8 set pdev=hplj_fl3 [/code] Commented lines begin with a double quote ("). The "set nu" command, of course, tells vim to display line numbers. What programmer wouldn't? The ignorecase command makes all searches case-insensitive. While the default tabstop on most systems is 8 characters, I've always preferred 4. To ensure uniformity of indentation in my scripts I've added the shiftwidth and expandtab directives to use spaces rather than tab characters in doing these indents. If you don't want to be haunted by highlighted search results, set nohls. Many systems nowadays default to UTF-8 ("UCS Transformation Format for 8-bit", an adaptation of Unicode for backward compatibility with ASCII based systems) encoding, so it might not be necessary to force it here, but I do it for the sake of portability across machines. The fileencoding directive is especially important when you're dealing with text that may contain characters from multiple languages. The two encodings set out (ucs-bom and utf-8) have proven a good combination in such cases. Including both ucs-bom (the "Universal Character Set" with Byte Order Mark, predecessor to UTF-16 Unicode) and utf-8 is important especially for reading documents in which UCS encodings are mixed in with UTF-8 ones. In such cases vim can get confused and fall back to rendering everything in escaped ASCII characters. That last option for printer device contains the name of my default printer as it appears in my Linux distribution's system-config-printer. Now when I want to use vim as a story or document editor, as opposed to a programmer's editor, I enable the following additional commands to enable word wrap at 80 characters: [code lang="bash" gutter="false"] set formatoptions=1 set wrap linebreak nolist set textwidth=80 [/code]

Copyright 2004-2019 Phil Lembo