2
在Notepad ++中我一直在使用Edit-> Column Editor在文本文件的每一行上放一個數字,太好了!Notepad ++列編輯器
有沒有一種方法可以對所有打開的文檔執行此操作,以便爲每個文本文件節省這些操作?
在Notepad ++中我一直在使用Edit-> Column Editor在文本文件的每一行上放一個數字,太好了!Notepad ++列編輯器
有沒有一種方法可以對所有打開的文檔執行此操作,以便爲每個文本文件節省這些操作?
是的,你可以寫一個Python腳本來做到這一點。執行這些步驟(省略如果N/A):
AddLineIdsAllTabs.py
腳本offset = 1 # Define the offset (step) value
fileNames = notepad.getFiles() # get all open files
for x in fileNames[1:]: # iterate thru all tabs (first is doubled, thus skipping)
filename, bufferID, index, view = x # get the details
notepad.activateIndex(view, index) # activate the tab
line_number = editor.getLineCount() # get line count
for id in range(line_number): # iterate thru all lines
editor.gotoLine(id) # go to line with a given ID
editor.home() # place cursor at the line start
editor.addText("{0}. ".format(str(id+offset))) # Add text
現在,從運行腳本插件 - >的Python腳本 - >腳本 - >AddLineIdsAllTabs。
替代文字
的notepad.activateIndex(view, index)
線後,使用
editor.selectAll()
notepad.runMenuCommand('TextFX Tools', 'Insert Line Numbers')
最快的方法是在你最喜歡的腳本語言編寫一個腳本。 – Toto