Penguin

Differences between version 6 and predecessor to the previous major change of VimNotes.

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

Newer page: version 6 Last edited on Friday, October 29, 2004 1:22:33 pm by JohnMcPherson Revert
Older page: version 5 Last edited on Tuesday, July 15, 2003 11:15:26 am by DanielLawson Revert
@@ -1,17 +1,17 @@
 See also ViNotes 
  
 vim(1) -- potentially the most powerful editor unix users have access to, and one of the best things about it is in actual fact it's not restricted to unix users at all. Anybody can use vim, anywhere (more or less). Its only real drawback is that it's a little difficult to get to grips with at first. This page is not designed to cover basic editing. Rather, this page is a list of tips which will make your vim editing experience more enjoyable, particularly if vim is used as a programming editor. 
  
-__ Syntax Highlighting__  
+!! Syntax Highlighting 
  
 vim, of course, supports syntax highlighting. Often this isn't on by default. The easiest way to turn this on is to type ":syntax on". Viola. What's that? You're using a dark background and the highlighting looks terrible? No real problem. Try ":set background=dark". Adjust as appropriate for 'it looks horrible and I have a white background'. If you just think it looks horrible fullstop, you can get a new syntax highlighting file for it... download one from vim.org, throw it into your ~/.vim/colors directory (you may have to create this) and explore the colorscheme command (hint, ":help colorscheme" or just ":colorscheme x", where your scheme file is x.vim). I recommend borland.vim, the colorscheme for the borland "Turbo" IDEs. 
  
-__ Compiling__  
+!! Compiling 
  
 To build from within vim, simply use ":make". It's probably a good idea to set your current working directory to the same place as your makefile is located, which you can do with ":chdir <directory>". Vim will build your project, and hopefully jump intelligently to the right place whenever you encounter errors. If you need to set environment variables for your build, it's probably a good idea to set them on your :make line, eg ":make x=n" 
  
-__ Buffer Movement__  
+!! Buffer Movement 
  
 Vim will support multiple buffers. You can switch between them using the menu in gvim, or if you prefer to use commands you can use the following: 
  :bn # next buffer 
  :bp # previous buffer 
@@ -32,10 +32,30 @@
 Set autowrite tells vim to save the file when you change buffers. Vim wants to do this, its a bit annoying. 
 The above maps will map tab and shift tab to next and previous buffer, and ctrl-f4 to delete current buffer. ctrl-f4 will delete the current buffer in a way that will preserve any splits you have open, ie it'll move to the next buffer, then delete the previous one. 
  
 --DanielLawson 
+  
+!!Character Encoding/Unicode  
+Vim has several options to do with character encoding, and each does slightly  
+different things.  
+* __encoding__ is used by vim internally for strings held in buffers, registers, expressions, etc.  
+* __termencoding__ is used to tell vim what encoding to display to the terminal, and it will convert text from its internal encoding to this encoding if necessary for display.  
+* __fileencoding__ is the encoding that files are assumed to be encoded with on disk, although vim will try to auto-detect this. __vim will default to latin1 (iso-8859-1) if it can't detect the encoding!__.  
+* __fileencodings__ is a list of encodings that vim will use when autodetecting files on load.  
+  
+If you want to be modern, and only use utf-8 everywhere, put the following in your  
+$HOME/.vimrc file:  
+ set encoding=utf-8  
+ set termencoding=utf-8  
+ set fileencoding=utf-8  
+  
+If you might ever use vim to edit raw binary data, then it's a good idea to make  
+sure that vim doesn't try any conversation on file load:  
+ " leave these as blank, so no conversation done?  
+ set fileencoding=  
+ set fileencodings=  
  
 ---- 
  
 There is a good vim reference guide [here|http://www.dc.turkuamk.fi/docs/soft/vim/vim.html] 
  
 ----