summaryrefslogtreecommitdiff
path: root/_posts/2012-05-18-using-vim.md
diff options
context:
space:
mode:
authorAndreas Maunz <andreas@maunz.de>2012-07-12 14:20:37 +0200
committerAndreas Maunz <andreas@maunz.de>2012-07-12 14:20:37 +0200
commitc0ac9fb23cdb197c434b565799763b80437d644e (patch)
tree9d864b905dbb36c2fe3db73cc0bbe00828c179cd /_posts/2012-05-18-using-vim.md
parent5da15dfb8f58775c9d95667d17bbe6eee88a782c (diff)
added vim and git tricks
Diffstat (limited to '_posts/2012-05-18-using-vim.md')
-rw-r--r--_posts/2012-05-18-using-vim.md37
1 files changed, 33 insertions, 4 deletions
diff --git a/_posts/2012-05-18-using-vim.md b/_posts/2012-05-18-using-vim.md
index eeb8fd2..c9aac04 100644
--- a/_posts/2012-05-18-using-vim.md
+++ b/_posts/2012-05-18-using-vim.md
@@ -7,7 +7,7 @@ tags: [vim, latex]
---
{% include JB/setup %}
-Vim is arguably among the best text editors. Text file editing is an everyday task on Linux, as opposed to e.g. Windows, where operating system and applications are configured graphically (by clicking with the mouse). Moreover, Vim is suitable for programming through plug-ins.
+Vim is arguably among the best text editors. Text file editing is an everyday task on Linux, as opposed to e.g. Windows, where operating system and applications are configured graphically (by clicking with the mouse). Moreover, Vim is suitable for programming through plug-ins. This page applies to Debian/Ubuntu.
<p></p>
---
@@ -157,9 +157,6 @@ LaTeX is a system for setting characters ('types'). Actually, it is a wrapper of
-System Setup on Debian/Ubuntu
------------------------------
-
Install LaTeX:
sudo apt-get install \
@@ -307,4 +304,36 @@ where the argument's meanings are:
- `-R` : to start vim in read-only mode
- `-` : to make vim act as a pager
+It turns out to be very useful to be able to alternate between the two versions of diff.
+
+
+<p></p>
+---
+<p></p>
+
+
+
+Using **Vim** with Ruby
+==================
+
+**Vim** and ruby are like beer and pizza -- a perfect couple. Following the above will already give you syntax highlighting on ruby files. Here is how you add code completion, i.e. type a command prefix and use the TAB key and be presented with a list of possible completions.
+
+First install the [SuperTab](http://www.vim.org/scripts/script.php?script_id=1643) module for **Vim**. Then put this in your `.vimrc`
+
+ " ruby autocompletion
+ autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
+ autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
+ autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
+ autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
+ let g:SuperTabDefaultCompletionType = "<C-X><C-O>"
+
+ "improve autocomplete menu color
+ highlight Pmenu ctermbg=238 gui=bold
+
+Now, for example, if you want to implement a `collect` call on some container (such as a hash), you can type in **Vim** a prefix of `collect` and press TAB:
+
+ { ... }.c<TAB>
+
+and **Vim** will present you with a list of applicable commands, from which you select `collect`.
+![picture](/images/vim-cc.png "Vim code completion")