Question

The Kate text editor has a default line length of 1024 chars. I need to change this. And I need to change it via a bash script (it's for automated installs).

Here's some background: https://stackoverflow.com/a/13496876/463994

I would appreciate a bash script that changes that sets the default line length to 0 chars.

Was it helpful?

Solution 2

With permission of Ansgar Wiechers, I post a solution that seems to work for me:

sed -i.bak -e 's/^Line Length Limit=.*$/##&\nLine Length Limit=0/' ~/.kde4/share/config/katerc

It comments current value adding ## at the beginning of the line and appending after that the same with 0 as value. I use the -i switch that appends a .bak suffix as backup to the original file. Use sed -i -e ... (note the space between both switches) to modify the file in place. Be careful with this last option.


In my case, I prefer to modify files in-place with , so as extra I will post a one-liner that does the same than the previous command, only that its backup file is suffixed with ~:

vim \
    +'/^\v\cline\s+length\s+limit' \
    -u NONE \
    -N \
    -c 'set backup | yank | s/\v^/##/ | put | s/\v(\=\s*)\d+/\10/ | x' \
~/.kde4/share/config/katerc

OTHER TIPS

If KDE is installed, use kwriteconfig. This is a KDE tool to modify config files:

kwriteconfig --file katerc --group "Kate Document Defaults" --key "Line Length Limit" 0

The value 0 entirely disables the line length limit. In this case, the edited file is katerc, located in ~/.kde4/share/config/. Of course, you can choose any other file here, such as kilerc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top