Linux
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
Not sure if I totally grok what you're asking but try Ctrl+v to enter visual block mode or whatever it's called, navigate down to the line you want to go through, hit Shift+I, type in your junk, then hit escape.
Unfortunately, that will just skip over the short lines contained within the the block selection, which is exactly what I'm trying not to do (hence the initial question).
I do not think that this is an existing feature in neovim, however this seems to work
:%s/\(.*\)\zs\s*$/\=repeat(' ', 15 - len(submatch(1)))
Change 15
to the column desired. You could probably create a function where you pass the column number you want so that you dont have to type this string all the time.
Thank you for the response. I'm not sure I'd have any idea how to create a function for this at this point. Lack of support for this feature is pretty much the main reason I'm shifting away from vscode. (Also looking at nvim as I want a more powerful go-to solution for CLI editing...)
Certainly frustrating - it was my most used feature when I was coding SQL extensively...
command! -range -nargs=1 PadColumns call PadColumns(<line1>, <line2>, <args>)
function! PadColumns(start, end, columns)
execute a:start.','.a:end.'s/\(.*\)\zs\s*$/\='.'repeat(" ", a:columns - len(submatch(1)))'
endfunction
Use by typing in Normal mode :PadColumns 20
. This will add spaces after the line or selected lines to the column you specify (in this case, 20).
You could probably improve this by getting the length of the longest line and so you dont need to specify the specific column to add spaces to (20), and instead just add say 5 spaces after longest line for all lines.
It would be faster to just select every end of line and add spaces and then do the edit & Trim later.
Bottom line is that the functionality doesn't seem to exist in any useful way. Wish it did. I think Ultra Edit, notepad++ visualstudio and mssql mgnt studio must have spoiled me for other editors (in this respect). Even Geany does this (but oh, so janky...)