Text Field Seperator

  • Hi,

    How can I make vertical field separator (lets say every 8 characters) like the “Tabs” but starting from top and going all the way down to the bottom of the text file?

    Thank you!

  • Maybe doing a macro is a good idea ?

  • Hi A2020,

    Again, a regular expression seems to be the nice solution !!

    So, follow the steps, below :

    • Place your cursor at the beginning of the text to separate ( I chose the | character as separator ! )

    • Open the Replace dialog ( CTRL + H )

    • Set the Regular expression search mode

    • Uncheck, preferably, the Wrap around option

    • In the Replace with zone, type the simple regex $0|

    Now, from an original example text, below :


    • If you would like this kind of resulting text :



    Type, in the Find what zone, the regex (?-s).{8}

    Note :

    ONLY, standard characters are counted, in order to reach a 8-characters string !

    • If you would like this kind of resulting text :



    Type, in the Find what zone, the regex (?s).{8}

    Note :

    In that second case, we count the two Windows End of Line characters ( \r and \n ), as part of the 8 needed characters !

    • If you would like this kind of resulting text :



    Type, in the Find what zone, the regex :


    Note :

    Like in the first case, the End of Line characters are NOT taken in account. However, this time, the counting process goes on, through the multiples lines crossed !

    Remark :

    Of course, in these regexes :

    • The quantifier {n} can contain any other integer than the 8 digit

    • In each alternative .{n}\R+.{m}, of the 3rd regex, the sum n + m represents the total of characters needed, before the separator character added

    Best Regards,


  • Thanks for all your comments but I don’t want to actually separate the texts!,… just need an indicator to show me where I am,… please see the example below:

    Thanks again.

  • Something like that isn’t quite possible. There is a single edge line that can be set but Scintilla (the part of Notepad++ that handles the text) doesn’t support multiple lines.

    However with a plugin you could do something like set the background alternating between two colors (e.g. a light grey and dark grey) every 8 characters. Not exactly what you want but may be sufficient.

  • Actually I think the plug in would work for me just as you described it, could you please let me know its name or where I can find it,…?

    Thank you.

  • Nothing exists (existed?) that does it. However I wrote a quick piece of Lua to do it. I can’t say the columns are that pretty but this is as close as you will probably get to indicating columns based on width.

    1. Download the LuaScript plugin
    2. Extract the zip and copy the DLL to your plugins directory
    3. Select Plugins > LuaScript > Edit Startup Script
    4. Paste the chunk of code (See end of this post)
    5. Edit the first few lines of of the code to do what you want (you’ll probably just need to set the file extensions you want)
    6. Save and restart Notepad++
    7. Open one of your files

    Again, it isn’t the prettiest but there’s really nothing else I know of that will do what you want. Adjusting colors may help. For example…

    The code…

    -- Configure things here...
    local registeredExtensions = {".csv", ".xyz"}
    local columWidth = 8
    local col1Color = 0xd0d0d0
    local col2Color = 0xaaaaaa
    local field_indic = {12, 13} -- not sure what one is best to use but this works
    local function setupEditor(e)
    	e.IndicStyle[field_indic[1]] = INDIC_STRAIGHTBOX
    	e.IndicStyle[field_indic[2]] = INDIC_STRAIGHTBOX
    	e.IndicUnder[field_indic[1]] = true
    	e.IndicUnder[field_indic[2]] = true
    	e.IndicAlpha[field_indic[1]] = 255
    	e.IndicAlpha[field_indic[2]] = 255
    	e.IndicFore[field_indic[1]] = col1Color -- Color of first column
    	e.IndicFore[field_indic[2]] = col2Color -- Color of second column
    function highlightColumns()
    	local function getLineRangeOnScreen()
    		local firstLine = editor.FirstVisibleLine
    		local lastLine = firstLine + editor.LinesOnScreen
    		return firstLine, lastLine
    	local function getRangeOnScreen()
    		local firstLine, lastLine = getLineRangeOnScreen()
    		local startPos = editor:PositionFromLine(firstLine)
    		local endPos = editor.LineEndPosition[lastLine]
    		return startPos, endPos
    	local function clearIndicatorOnScreen()
    		local s, e = getRangeOnScreen()
    		editor:IndicatorClearRange(s, e - s)
    	-- Clear everything
    	editor.IndicatorCurrent = field_indic[1]
    	editor.IndicatorCurrent = field_indic[2]
    	local s, e = getLineRangeOnScreen()
    	for i=s,e do
    		local index = 0
    		local lineStart = editor:PositionFromLine(i)
    		local lineEnd = editor.LineEndPosition[i]
    		for p=0,editor:LineLength(i),columWidth do
    			editor.IndicatorCurrent = field_indic[(index % 2) + 1]
    			local col1 = editor:FindColumn(i, p)
    			local col2 = editor:FindColumn(i, p + columWidth)
    			editor:IndicatorFillRange(col1, col2 - col1)
    			index = index + 1
    npp.AddEventHandler("OnSwitchFile", function(filename, bufferid)
    	-- Always remove it
    	npp.RemoveEventHandler("OnUpdateUI", highlightColumns)
    	-- Check to see if the extension exists
    	for _,v in pairs(registeredExtensions) do
    	  if v == npp:GetExtPart() then
    		npp.AddEventHandler("OnUpdateUI", highlightColumns)

Log in to reply