bashshelleditorkate

Fix Kate text editor line limit via bash script


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.


Solution

  • 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