sublime3 使用笔记

本文介绍了Sublime Text的几个高效使用技巧,包括使用Ctrl+p快速查找文件,使用正则表达式进行批量替换,设置长行自动断行,Alt+左右箭头实现光标快速跳转,以及安装DocBlockr_Python插件实现自动注释等功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.  查找文件    ctrl+p

 

2 . sublime 正则替换:

 

需求,原来print是打印到屏幕,现在需要打印到log文件 ,需要加上,file = log_file 

print("########### except 3######################")   --->   print("########### except 3######################",file = log_file )

 

记得要开启正则匹配,如红色箭头,具体匹配如下:

 

(print.*?)\)

$1,file=log_file.txt)

 

3. sublime 长行自动断行  https://jingyan.baidu.com/article/48b558e3205abb7f38c09a90.html

 

4. sublime  jump back  and jump forward

lookup in :  Sublime Text > Preferences > Key Bindings - Default opens a buffer named Default (OSX).sublime-keymap.

in my linux: It is   alt+-

5. sublime 的自动注释

python可使用DocBlockr_Python  参考:https://packagecontrol.io/packages/DocBlockr_Python

使用方法:''' + table ,一定要主要必须在函数底下按才能注释函数”

'''There isn't a command pallete command to start this plugin, it is triggerg by hitting enter or tab after opening a docstring (""") at the moduleclass, or function level. If you wanted to simply put a new line after opening a docstring and not trigger the formatter, just hold ctrl and press enter.'''

其它语言使用DocBlockr即可。

 

 

正则替换2:

rows= helper.queryAll(sql)  

替换为

即在执行sql时,都打印一下

替换规则

解析:$1 为空格+rows= helper.queryAll(sql)

 

 

 

$2为rows前面的空格

 

 

另外一些例子:

替换css中的border:

批量注释掉border的行:

附源文件:

p{
    margin:0;
}

.myfamily_bg{
    background-image: url(../../assets/images/ph_bg.png);
    width: 7.5rem;
    height: 100vh;
    border:solid red ;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    
}
.head{
    overflow: hidden;
    width: 6.18rem;
    border:solid yellow;
    margin: 0 auto;margin-top: 1.44rem;
}

.touxiang{
    height: 0.8rem;
    width: 0.8rem;
    border:solid blue;
    background-image: url(../../assets/images/weixintouxiang.jpg);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    border-radius: 15px;
    float:left;
    margin-right: 6vw;
}

.head_name{
    height: 0.82rem;
    width: 2.24rem;
    border:solid red;
    float:left;
    text-align: left;

}


.jiazu_name_p{
    font-size: 0.28rem;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #FFFFFF;
    line-height: 0.4rem;
}



.zuzhang{
    font-size: 12px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;   
    width: 2.26rem;
    height: 0.34rem;
    color:white;
    opacity: 0.7;
    border:solid red;
}
.zuzhang img{
    height: 0.34rem;
    width: 0.66rem;
    border:solid red
}

.zuzhang span{
    height: 0.34rem;
    width: 1.46rem;
    border:solid red;
    
    font-size: 0.24rem;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #FFFFFF;
    line-height: 0.34rem;
    }


.share_out{
    height: 0.48rem;
    width: 1.7rem;
    border: solid white;
    border-radius: 15px;
    float: right;
    font-size: 0.22rem;
    font-family: PingFangSC-Medium, PingFang SC;
    color: #FFFFFF;
    line-height: 0.48rem;   /*这里必须给行高,以便div里面的文字,img等行内元素在div中居中*/
    box-sizing: border-box;
    padding-left: 0.2rem;
    margin-top: 0.34rem;
}


.share_text_img{
    width: 0.25rem;
    height: 0.25rem;
    border:solid red
}





.body{
    height: 1.28rem;
    /* width: 6.18rem; */
    width: 6.3rem;  /* 算上border */  
    border: solid red 0.01rem;
    margin: 0 auto;margin-top: 0.58rem;
}

.body_left{
    width: 1.44rem;
    height: 1.28rem;
    float:left;
    border:solid red 0.01rem;
    background-color: #FF7E41  ;
    color: white;
}
.text1{
    margin: 0 auto;
    height: 0.66rem;
    margin-top:0.18rem;
    border:solid blue 0.01rem;

    font-size: 0.48rem;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    line-height: 0.66rem;
    
    text-align: center;
}
.text2{
    margin: 0;
    font-size: 0.24rem;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 600;
    color: black;
    text-align: center;
    border:solid red 0.01rem;
}
.body_middle{
    width: 1.46rem;
    height: 1.28rem;
    float:left;
    border:solid red 0.01rem;
    margin:0 auto ;margin-left:0.14rem;margin-right:0.14rem;
    background-color: white;
    color: black;
}
.body_right{
    width: 3.06rem;
    height: 1.28rem;
    float:left;
    border:solid red  0.01rem;
    background-color: white;
    color: black;
}


.tableStyle{
    width:6.18rem;
    height: auto;
    border:solid red;
    margin: 0 auto;
    margin-top: 0.42rem;

    font-size: 0.24rem;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #FFFFFF;
    opacity: 0.8;
    
}
.trHeader{
    border-bottom: 1px solid white;
    width: 90%;
    height: 20px;
    border:solid yellow 0.01rem;
    opacity: 0.5;
    
    font-size: 0.24rem;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #FFFFFF;
}

.name{
    border: solid blueviolet;
    width: 80%; 
    height: 0.8rem;  /*调整表格的高度*/
    font-size: 0.24rem;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #FFFFFF;

}
.name_th{
    text-align: left;
}


.score{
    text-align: right;
    border: solid red;
    width: 20%;
}
.score_td{
    color:#B6FF64
}


.trBody{
    margin-bottom:0.5rem ;
}

/* .td_rank_img{
    height: 24px;
    width: 24px;
    border:solid white;
    background-repeat: no-repeat;
    background-size: 100% 100%;
}
.td_rank_img1{
    background-image: url(../../assets/images/jb01.png);

}
.td_rank_img2{
    background-image: url(../../assets/images/jb02.png);

}
.td_rank_img3{
    background-image: url(../../assets/images/jb03.png);

} */


.td_touxiang_img{
    height:  0.48rem;
    width: 0.48rem;
    border:solid white;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    border:solid red;
    background-image: url(../../assets/images/weixintouxiang.jpg);
    /* vertical-align: middle; */
}
.td_touxiang_text{
    margin-left:0.18rem; /*自己大体设置的间距*/
    border: solid white;
    vertical-align: middle;
}


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值