1

I am using this code for console log

nmap cll yiwocll<Esc>p

I wanted to add some random string inside this console log, assume 10 characters symbols length.

How to achieve this?

2
  • 1
    r!base64 /dev/urandom | head -c 10
    – balki
    Aug 18, 2023 at 22:17
  • Do you still have something open in your question? How can we help you further? If the solution fit your need could you accept it using the v buttonnext to the arrow voting button. It allow the question to rest :-) Aug 21, 2023 at 12:03

1 Answer 1

0

I would do:

function! RandomString(n)
  let ret = ""
  for i in range(a:n)
    let j = rand()
    let c = nr2char(char2nr('a') + (j % 26))
    let ret .= c
  endfor
  return ret
endfunction

echo RandomString(10)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.