My first Blog about Linux
home/.vimrc
下的配置
autocmd FileType cpp source ~/.vim/cpp.vim "cpp配置
set nu "顯示行號
set cul "高亮當前行
set tabstop=4 "tab鍵爲四個空格
set ai! "設置自動縮進
set showmatch "設置匹配模式
set shiftwidth=4 "tab寬度
set autoindent "自動縮進
set cindent "c語言縮進
set mouse=a "鼠標可用
syntax on "語法高亮
set laststatus=2 "老是顯式狀態行
set ruler "顯示遊俠叫光標位置的狀態行
map <C-A> ggVG"+y
" 全選複製
map <C-D> gg=G
"格式對齊
寫cpp算法的配置在 ~/.vim/cpp.vim
,主要是執行編譯和添加頭文件
map <F5> :call Run()<CR> "編譯
func! Run()
exec "w"
exec "!g++ -Wall %"
exec "!./a.out"
endfunc
map <F10> :call SetTitle()<CR> "添加頭文件
func SetTitle()
let l =0
let l = l+1 | call setline(l,'#include <bits/stdc++.h>')
let l = l+1 | call setline(l,'#define P pair<int,int>')
let l = l+1 | call setline(l,'#define fir first')
let l = l+1 | call setline(l,'#define sec second')
let l = l+1 | call setline(l,'using namespace std;')
let l = l+1 | call setline(l,'typedef long long ll;')
let l = l+1 | call setline(l,' ')
let l = l+1 | call setline(l,'const int N=2e5+5;')
let l = l+1 | call setline(l,'const int mod=998244353;')
let l = l+1 | call setline(l,'')
let l = l+1 | call setline(l,'int main(){')
let l = l+1 | call setline(l,' ')
let l = l+1 | call setline(l,' return 0;')
let l = l+1 | call setline(l,'}')
endfunc