我的.vimrc配置

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 "全选复制

写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

猜你喜欢

转载自www.cnblogs.com/archer-yjun/p/10990911.html