当前位置:网站首页>How to use align regexp to align userscript meta information
How to use align regexp to align userscript meta information
2022-07-26 17:22:00 【Flying watermelon】
There is one userscript, Meta information [1] No strict alignment , Can work , But not pretty , What shall I do? ?
// ==UserScript==
// @name Github Commented Issues
// @namespace https://github.com/jiacai2050
// @description Show your commented issues on github easily.
// @match https://github.com/issues*
// @author jiacai2050
// @version 0.2.3
// @icon https://github.githubassets.com/favicons/favicon.svg
// @grant none
// ==/UserScript==align-regexp to the resuce!
C-u M-x align-regexp @[a-z]+\(\s-*\) RET 1 RET 1 RET n
Before explaining the above command , First look at his signature :
(align-regexp BEG END REGEXP &optional GROUP SPACING REPEAT)•REGEXP Regular for alignment , At least one group namely () , By modifying this group To achieve the effect of alignment
• @[a-z]+\(\s-*\) This regular representation uses @name Zero or more spaces after as modified group
• \s- Said the blank space , For specific grammar, please refer to Regexp-Backslash[2]
• GROUP Indicate which of the regular expressions group Use to make changes to achieve the alignment effect
• SPACING The number of spaces between different columns
• REPEAT Whether it works on this whole line , In this example, it doesn't matter , Because there are only two columns in the end
// ==UserScript==
// @name Github Commented Issues
// @namespace https://github.com/jiacai2050
// @description Show your commented issues on github easily.
// @match https://github.com/issues*
// @author jiacai2050
// @version 0.2.3
// @icon https://github.githubassets.com/favicons/favicon.svg
// @grant none
// ==/UserScript==Last , Encapsulate as a function
(defun my/align-userscript-metablock (start end)
(interactive "r")
(align-regexp start end
"@[a-z]+\\(\\s-*\\)" 1 1 t))practice
the quick brown fox
jumped over the lazy
dogs the quick brownC-u M-x align-regexp \(\s-*\)\s- RET 1 RET 0 RET y
the quick brown fox
jumped over the lazy
dogs the quick brownReference resources
• Aligning text[3]
• Aligning columns in Emacs[4]
• Emacs: Align Text[5]
Reference link
[1] Meta information : https://violentmonkey.github.io/api/metadata-block/[2] Regexp-Backslash: https://www.gnu.org/software/emacs/manual/html_node/elisp/Regexp-Backslash.html[3] Aligning text: http://pragmaticemacs.com/emacs/aligning-text/[4] Aligning columns in Emacs: https://blog.lambda.cx/posts/emacs-align-columns/[5] Emacs: Align Text: http://ergoemacs.org/emacs/emacs_align_and_sort.html
边栏推荐
- Implement softmax classification from zero sum using mxnet
- 使用 replace-regexp 在行首添加序号
- [basic course of flight control development 1] crazy shell · open source formation UAV GPIO (LED flight information light and signal light control)
- Win11 how to close a shared folder
- Redis hotspot key and big value
- OpenWrt之feeds.conf.default详解
- Current limiting comparison: how to choose sentinel vs hystrix?
- 正则表达式
- [Luogu cf643f] bears and juice (conclusion)
- Recurrence of historical loopholes in ThinkPHP
猜你喜欢

Alibaba cloud Toolkit - project one click deployment tool

Quickly build a development platform for enterprise applications

Win11系统如何一键进行重装?

Speaker recruitment | AI time recruit icml/ijcai 2022 as a Chinese speaker!!!

Win11怎么重新安装系统?

On the evolution of cloud native edge computing framework

Chapter 1 Overview - Section 1 - 1.3 composition of the Internet

Stop using xshell and try this more modern terminal connection tool

【飞控开发基础教程2】疯壳·开源编队无人机-定时器(LED 航情灯、指示灯闪烁)

Comparison between dimensional modeling and paradigm modeling
随机推荐
SQL注入(思维导图)
Week 4 Recurrent Neural Networks
37. [categories of overloaded operators]
Why are test / development programmers who are better paid than me? Abandoned by the times
[development tutorial 8] crazy shell · open source Bluetooth heart rate waterproof sports Bracelet - triaxial meter pace
2019普及组总结
【开发教程8】疯壳·开源蓝牙心率防水运动手环-三轴计步伐
Oracle is slow to perform a large number of DML operations. Is it the problem of CPU or hard disk?
Heavy! Zeng Xuezhong was promoted to vice chairman and CEO of zhanrui, and Chu Qingren was appointed as co CEO!
How to use C language nested linked list to realize student achievement management system
Focus on 5g and AI! Next year, zhanrui will promote 7Nm 5g chips and NPU chips!
Realizing DDD based on ABP -- related concepts of DDD
【飞控开发基础教程2】疯壳·开源编队无人机-定时器(LED 航情灯、指示灯闪烁)
Xiaomi Wuhan headquarters building starts today! Lei Jun: planned according to the scale of 10000 people
Avalanche subnets vs. polygon supernets of application chain
SCCM tips - improve the download speed of drivers and shorten the deployment time of the system when deploying the system
maximum likelihood estimation
On the evolution of cloud native edge computing framework
PXE高效批量网络装机
正则表达式