Using a substitution
:%s/.\{100}\zs.*//
Find 100 characters, .\{100} then start the match, \zs, and select the rest of the line, .*. Replace the match with nothing.
For more help see:
:h :s
:h /\.
:h /\{
:h \zs
:h /\*
Using filter
:%!cut -c 1-100
Use filter, :!, with a range of the entire file, %. This will take the entire buffer and pass the text as stdin to cut and replace the buffer text with the stdout of our command. Use -c 1-100 to get the first 100 characters.
For more help see:
:!
:range
Using :normal
:%norm! v99lyVp
For every line, %, run command, {cmd} via :normal! {cmd}. Select and yank the first 100 characters via v99ly. Then replace the entire line, V with the just yanked 100 characters, p.
In theory, it would be nice to use 101|D, however 101| will just move to the end of the line for too short of lines. This will result short lines losing their trailing character. | also jumps by screen columns so could be messed up by indention.
For more help see:
:h :norm
:h :range
:h v_p
:%normal 100|d$– Maxim Kim Nov 14 '19 at 19:13:%norm 100|Dwill not work because100|will just move to the end of the line on lines shorter than 100 chars. Meaning it will delete the last character for those lines. – Peter Rincker Nov 14 '19 at 19:15