My Personal Vim Config for Reading Linux Kernel Source Code
-
Setup Vundle.vim
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
-
clone this Repo. to anywhere you like, such as
HOME
:git clone https://github.com/mintisan/oh-my-vim.git ~/oh-my-vim
-
Change the directory you just cloned(maybe
cd ~/oh-my-vim
), create symbolic link to~/.vimrc
# Attension : the source file can't use relative path, must absolutely path ln -s $PWD/vimrc ~/.vimrc
When you execute
echo $PWD
in shell, you will know what the$PWD
means.
-
Download Linue Kernel Source Code, like 2.6.32 Version, and
tar
ittar xzf linux-2.6.32.69.tar.xz
-
Enter the directory, and generate
tags
&cscope.out
for Vim, maybe for a coffee of time XDctags -R * cscope -Rbkq
-
Execute
Vim
current directory and then Update Vim Plugin, maybe for another coffee of time XD. It depends on your network solution.:PluginInstall
or u can use shell script below after you backup your vim config:
sh -c "$(curl -fSL https://raw.githubusercontent.com/mintisan/oh-my-vim/master/install.sh)"
Use shortcut to jump between files and functions
- use
CTRL+F
to forward page &CTRL+B
to back page - use
gg
to top &shift+g
to bottom(current file) - use
shift+m
to middle &shift+l
to bottom &shift+h
to top(current view) - use
:number
to any line of file - use
CTRL+p
to find file in current directory - use
CTRL+w
+left/right
to jump with (left-NERDTree-windown & center-main-window & right-tagbar-window) CTRL+]
to locate definition andCTRL+t
to come back- Debian:
sudo apt-get install ctags
- Mac:
brew install ctags
- Windows:
choco install ctags
- Debian:
:tabnew
to open a new tab;:tabn
to the next tab;tabp
to the previous tabAck {pattern}
orAg {pattern} --hidden
to search text patten in current directory- Debian:
sudo apt-get install ack-grep
- Mac:
brew install ack
- Windows:
choco install ack
- Debian:
/
to find specific string you like, and usen
to next,N
to previouscs find <x> <xxx>
: use cscope to location files or functions- sudo apt-get install cscope
- brew install cscope