summaryrefslogtreecommitdiff
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
parent5da15dfb8f58775c9d95667d17bbe6eee88a782c (diff)
added vim and git tricks
-rw-r--r--_posts/2012-05-18-using-vim.md37
-rw-r--r--_posts/2012-06-29-useful-git-tricks.md2
-rw-r--r--images/vim-cc.pngbin0 -> 28705 bytes
3 files changed, 34 insertions, 5 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")
diff --git a/_posts/2012-06-29-useful-git-tricks.md b/_posts/2012-06-29-useful-git-tricks.md
index 5f462b8..b5126c9 100644
--- a/_posts/2012-06-29-useful-git-tricks.md
+++ b/_posts/2012-06-29-useful-git-tricks.md
@@ -48,7 +48,7 @@ will show you the file in `less`. Use output redirection, such as `git show HEAD
## Downgrade or delete a remote branch
Suppose your local HEAD on branch `<branch>` is rubbish, you have coded something and committed it already. Assume you want to get rid of the last `n` commits.
-First, make sure you are on branch `branch`, then remove them locally:
+First, make sure you are on branch `<branch>`, then remove them locally:
git reset --hard HEAD~n
diff --git a/images/vim-cc.png b/images/vim-cc.png
new file mode 100644
index 0000000..1cc8660
--- /dev/null
+++ b/images/vim-cc.png
Binary files differ