Tips

Cheat Sheets

Graphical cheatsheet

By function:

List

Show recent files

Vim keeps a list of recent files in .viminfo. Run :oldfiles to view the list. Run :browse oldfiles to select from the list by entering a number.

option last set by who

E.g. Use verbose set filetype to show which script set filetype last time

expand the name of the script

Instead of %, just use the special ; in a script (but not inside a function within a script!), it is expanded to the file name of the sourced script:

:let s:local_path = expand('<sfile>:p:h')

source

change icon

place your favorite icon in bitmaps/vim.ico in a directory of ‘runtimepath’. For example ~/vimfiles/bitmaps/vim.ico.

Online ico converters:

How to change gVim icon on Windows?

key-notation

:h key-notaion

enable DirectX rendering for GViM

set renderoptions=type:directx,scrlines:1

Vim の DirectX をさらに高速化した話

将Vim的映射到Space

By default your is , backslash. You can check it with:

:echo mapleader

If this gives you an E121: Undefined variable: mapleader, it means it’s set to the default of . If it gives you something else, then it’s that :-)

You can easily remap it. I mapped it to the space-bar:

:let mapleader = "\<Space>"

Note that the value of mapleader is used at the moment the mapping is defined. So this example:

` let mapleader = “,” nnoremap a :echo “Hey there ,"

let mapleader = “<Space>” nnoremap a :echo “Hey there space” `

Will produce two mappings: ,a and a.

This means that the current value of mapleader is not necessarily the value that was used to define your mappings!

In addition, there’s the maplocalleader, which is the same as mapleader, except that it’s used by and that it’s local to the current buffer.