summaryrefslogtreecommitdiff
path: root/_posts
diff options
context:
space:
mode:
authormaunz <andreas.maunz@oncotest.de>2013-04-02 08:11:16 +0200
committermaunz <andreas.maunz@oncotest.de>2013-04-02 08:11:16 +0200
commit37d3511defbd02a75707b2f5d19b025f13df381d (patch)
treeecc6a04f7cd252b5739447de4e8cab73a58a257a /_posts
parent6344a29dd9404f3f905bbae8ce0bd177c0018d54 (diff)
Added CtrlP and Ag
Diffstat (limited to '_posts')
-rw-r--r--_posts/2012-05-18-using-vim.md51
1 files changed, 30 insertions, 21 deletions
diff --git a/_posts/2012-05-18-using-vim.md b/_posts/2012-05-18-using-vim.md
index 0e0cd29..09b537a 100644
--- a/_posts/2012-05-18-using-vim.md
+++ b/_posts/2012-05-18-using-vim.md
@@ -42,16 +42,16 @@ Put this in your `~/.vimrc`:
set tabstop=2
set expandtab
set shiftwidth=2
- set softtabstop=2
-
+ set softtabstop=2
+
" always show ^M in DOS files
set fileformats=unix
-
+
" my terminal is white on black
set background=dark
highlight Comment ctermbg=blue
highlight Comment ctermfg=white
-
+
" always show line and col number and the current command, set title
set ruler
set showcmd
@@ -60,10 +60,10 @@ Put this in your `~/.vimrc`:
" caseinsensitive incremental search
set ignorecase
set incsearch
-
+
" Show matching brackets
set showmatch
-
+
" disable any autoindenting which could mess with your mouse pastes (and your head)
" (not useing 'set paste' here to keep fancy stuff like tab completion working)
set nocindent
@@ -74,7 +74,7 @@ Put this in your `~/.vimrc`:
" Enable 256 colors
set t_Co=256
-
+
" Maps Alt-[h,j,k,l] to resizing a window split
map <silent> <A-h> <C-w><
@@ -87,7 +87,7 @@ Put this in your `~/.vimrc`:
" Maps Alt-[n,p] for moving next and previous window respectively
map <silent> <A-n> <C-w><C-w>
map <silent> <A-p> <C-w><S-w>
-
+
Your user experience should now be much better. You will have syntax highlighting, and can split the **Vim** window using `Alt+s` and `Alt+v`. See the comments above for more options.
@@ -132,7 +132,7 @@ Put the following in your `~/.vimrc`:
endfun
This function toggles spell checking for a given language on/off. For the language files downloaded, you can now map keys to toggle spell checking for each of them. Example for german:
-
+
" Switch on german spelling (in addition to what is active already!)
map <F3> :call ToggleSpl('de')<cr>
@@ -140,7 +140,7 @@ Now, `F3` will toggle spell checking for the german language. Go ahead and creat
![spell checking](/images/spell.png "spell checking")
-Note: Toggling a specific language on/off will not affect the status of other languages. Arbitrary combinations of languages can be enabled at a time.
+Note: Toggling a specific language on/off will not affect the status of other languages. Arbitrary combinations of languages can be enabled at a time.
To use spell correction, a few commands are needed:
@@ -167,7 +167,7 @@ Auto-Indenting on Paste
-----------------------
In a console or terminal version of **Vim**, there is no standard procedure
-to paste text from another application. Instead, the terminal
+to paste text from another application. Instead, the terminal
emulates pasting by inserting text into the keyboard buffer, so **Vim**
thinks the text has been typed by the user. After each line ending, **Vim**
moves the cursor so the next line starts with the same indent as the
@@ -178,7 +178,7 @@ Put the following in your `~/.vimrc`:
nnoremap <F2> :set invpaste paste?
set pastetoggle=<F2>
- set showmode
+ set showmode
The first line sets a mapping so that pressing F2 in normal mode will
invert the `'paste'`{.western} option, and will then show the value of
@@ -233,16 +233,25 @@ Now **Vim** loads all plugins from `.vim/bundle`. Install plugins:
git clone git://github.com/vim-scripts/delimitMate.vim.git
git clone git://github.com/jcf/vim-latex.git
git clone git://github.com/ervandew/supertab.git
+ git clone git://github.com/kien/ctrlp.vim.git bundle/ctrlp.vim
+ git clone git://github.com/rking/ag.vim
You can install the plugins without git by downloading and expanding them to `~/.vim/bundle`.
+For complete descriptions see the the github repositories. Here is a sample:
Nerdtree displays a directory tree to the right. Add this to your `.vimrc`:
" map Ctrl+D to nerdtree
map <C-d> :NERDTreeToggle<CR>
+CtrlP allows fuzzy file searching. Add this to your `.vimrc`:
+
+ " map Ctrl+P to invoke CtrlP file finder (http://kien.github.com/ctrlp.vim/)
+ let g:ctrlp_map = '<c-p>'
+ let g:ctrlp_cmd = 'CtrlP'
+
For details consult the respective plugin documentation.
-
+
<p></p>
---
@@ -296,7 +305,7 @@ It turns out to be very useful to be able to alternate between the two versions
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.
+**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.
Although ruby support is built into **Vim** 7.x, the vim-ruby plugin should be installed manually for updates. Also install the SuperTab module, see 'Plugins' for both.
Then put this in your `.vimrc`
@@ -326,7 +335,7 @@ and **Vim** will present you with a list of applicable commands, from which you
-Using **Vim** with Latex
+Using **Vim** with Latex
====================
LaTeX is a system for setting characters ('types'). Actually, it is a wrapper of macros around TeX, [created by Donald Knuth](http://www.tug.org/whatis.html). LaTeX is most widely used In technical writing, especially mathematics, physics, and computer science, because it can typeset mathematical formulae beautifully.
@@ -357,16 +366,16 @@ Add this to your `~/.vimrc`:
" REQUIRED. This makes **Vim** invoke Latex-Suite when you open a tex file.
filetype plugin on
-
+
" IMPORTANT: win32 users will need to have 'shellslash' set so that latex
" can be called correctly.
set shellslash
-
+
" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep\ -nH\ $*
-
+
" Spelling:
autocmd FileType tex setlocal spell spelllang=en_us
@@ -389,7 +398,7 @@ in your `.gvimrc`.
**GVim** can interact with xdvi
--------------------------
-If one clicks at some place in xdvi (usually Ctrl+Button1), **Vim** automatically jumps to the corresponding line in the LaTeX source file ("reverse search").
+If one clicks at some place in xdvi (usually Ctrl+Button1), **Vim** automatically jumps to the corresponding line in the LaTeX source file ("reverse search").
Also, from inside **Vim**, one can jump to the corresponding line in xdvi which becomes highlighted ("forward search").
Note: This shows only the process for **GVim**, the graphical **Vim** version. It works analogous for the terminal **Vim**.
@@ -415,10 +424,10 @@ And in your `.bashrc`:
alias gvim='gvim --servername vimtex'
-Press `\ld` in **GVim** in normal mode to start xdvi with forward search.
+Press `\ld` in **GVim** in normal mode to start xdvi with forward search.
For things to work you must, in order:
-1. Open the tex file with **GVim** (after `source`-ing your changed `~/.bashrc`),
+1. Open the tex file with **GVim** (after `source`-ing your changed `~/.bashrc`),
2. Open the dvi file with the command `\ld`
3. reverse-search using Ctrl + left-mouse-click.