C++模板、.vimrc和一些Linux配置

C++模板

#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<vector>//don't forget!
using namespace std;
#define rep(i,l,r) for(register int i=(l);i<=(r);++i)
#define repdo(i,l,r) for(register int i=(l);i>=(r);--i)
#define il inline
typedef double db;
typedef long long ll;

//---------------------------------------
int n;
int main(){
    ios::sync_with_stdio(0),cin.tie(0);

    return 0;
}














//  freopen(".in","r",stdin);
//  freopen(".out","w",stdout);

.vimrc

vimscript 的高亮看起来似乎有点奇怪, 应该是 " 注释的锅...

"base
set nu
set ruler
set mouse=a
set confirm "confirm for saving changes
set showcmd
set laststatus=2 "show status bar
set foldmethod=manual
set encoding=utf8
set fileencodings=ucs-bom,utf8,gb18030,gbk,big5,latin9
"colorscheme ron

"indent
set shiftwidth=4 tabstop=4 softtabstop=4
set cindent autoindent smartindent

"search
set ignorecase
set is hls

"auto
set autochdir
set autoread

"lang en_US.utf8 "set language

map  <c-a> ggVG
imap <c-a> <esc><c-a>
map  <c-v> "+p
imap <c-v> <esc><c-v>i<right>
vmap <c-c> "+y
vmap <c-x> "+d
imap <c-e> <esc><c-e>i<right>
imap <c-y> <esc><c-y>i<right>

inoremap ' ''<left>
inoremap " ""<left>
inoremap ( ()<left>
inoremap [ []<left>
inoremap { {}<left>
inoremap {<cr> {<cr>}<esc>O

vnoremap <tab> :s/^/<tab><cr>:noh<cr> "tab 缩进

map <f5> :w<cr>:!g++ % -o %<.exec -g3 -std=c++11 -Wall -Wextra && gdb %<.exec <cr>
map <f9> :w<cr>:!g++ % -o %<.exec -std=c++98 -Wall -Wextra && ./%<.exec <cr>
map <f10> :w<cr>:!g++ % -o %<.exec -O2 -std=c++11 -Wall -Wextra && ./%<.exec <cr>
map <f8> :w<cr>:!time ./%<.exec <cr>

"au VimEnter * silent! !xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'
"au VimLeave * silent! !xmodmap -e 'clear Lock' -e 'keycode 0x42 = Caps_Lock'

.bashrc

# append at the end of ~/.bashrc
# edited by myself
alias rm='trash-put -v'
alias oi='sh ~/oi/base/new.sh'
alias mv='mv -bvi'
alias cp='cp -bvi'
alias ll='ls -AlhFb'
alias mkdir='mkdir -pv'

alias unzip936='unzip -O cp936'

# capslock <=> esc 
# xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'
# xmodmap -e 'clear Lock' -e 'keycode 0x9 = Caps_Lock' # not exactly sure it's right; but it works

new.sh

# ~/oi/code/base/new.sh
# command 'oi' : create a file as a copy of '~/oi/base/template.cpp'
cp -bvi ~/oi/code/base/template.cpp $1.cpp
echo "new"
vim $1.cpp

judge脚本

#!/bin/bash

# jud.sh
# 评测和提答
# check *.cpp with *.ans

for i in $(seq 1 20)
do
    printf "Case #%d-----------------------------\n" $i
    time ./$1.exec < "$1"$i.in > "$1"$i.out
    diff -bs "$1"$i.out "$1"$i.ans
    read -sn 1
    printf "\n"
done
#!/bin/bash

# pia.sh
# 对拍

for i in $(seq 1 200)
do
    ./$1-gene.exec > "$1"$i.in
    ./$1-std.exec < "$1"$i.in > "$1"$i.ans
    time ./$1.exec < "$1"$i.in > "$1"$i.out
    diff -bs "$1"$i.out "$1"$i.ans
    read -s -n 1
done

.gdbinit

位于 ~/.gdbinit .

set max-value-size unlimited

其他

Ubuntu紫

RGB: (48,9,36)
0x300924

Cygwin

download:
https://cygwin.com/setup-x86.exe
https://cygwin.com/setup-x86_64.exe

source:
https://mirrors.tuna.tsinghua.edu.cn/cygwin

:q<cr>

转载于:https://www.cnblogs.com/ubospica/p/9550143.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值