create_user_session_files.ksh 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #!/bin/ksh
  2. # fail if any commands fails
  3. set -e
  4. # debug log
  5. #set -x
  6. cd || return
  7. {
  8. print 'export ENV=$HOME/.kshrc'
  9. } >>$HOME/.profile
  10. {
  11. print "# use vim if it's installed, vi otherwise"
  12. print "case "$(command -v vim)" in"
  13. print " */vim) VIM=vim ;;"
  14. print " *) VIM=vi ;;"
  15. print "esac"
  16. print ""
  17. print "# env"
  18. print "export EDITOR=vim"
  19. print "export FCEDIT=$EDITOR"
  20. print "export PAGER=less"
  21. print "export LESS='-iMRS -x2'"
  22. print "export LANG=en_US.UTF-8"
  23. print "export LC_CTYPE=en_US.UTF-8"
  24. print "export CLICOLOR=1"
  25. print "HISTFILE=$HOME/.ksh_history"
  26. print "HISTSIZE=20000"
  27. print ""
  28. print "# emacs mode gives you the familiar Ctrl-A, Ctrl-E, etc"
  29. print "set -o emacs"
  30. print ""
  31. print "# prompt"
  32. print "export PS1='$USER:$PWD $ '"
  33. print "#export PS1='$USER:$PWD \! $ '"
  34. print "#export PS1='$USER (${PWD##*/}) $ '"
  35. } >>$HOME/.kshrc
  36. {
  37. print '# use UTF-8 everywhere'
  38. print 'export LANG=en_US.UTF-8'
  39. print ''
  40. print '# specify location of kshrc'
  41. print 'export ENV=$HOME/.kshrc'
  42. print ''
  43. print '# load Xresources file'
  44. print 'xrdb -merge $HOME/.Xresources'
  45. print ''
  46. print '# disable system beep'
  47. print 'xset b off'
  48. print ''
  49. print '# synchronize copy buffers'
  50. print 'autocutsel &'
  51. print ''
  52. print '# reduce sound to not destroy my ears'
  53. print 'sndioctl -f snd/1 output.level=0.3'
  54. print ''
  55. print '# compositor for faster windows drawing'
  56. print 'picom &'
  57. print ''
  58. print '#xsetroot -solid grey &'
  59. print '#xterm -bg black -fg white +sb &'
  60. print './src/scripts/setWallpaperRandomPicture.ksh'
  61. print ''
  62. print '# Set PATH'
  63. print "PATH=\$HOME/bin/:\$HOME/src/scripts/:\$PATH"
  64. print ''
  65. print "cwm"
  66. } >>$HOME/.xsession
  67. {
  68. print '" display current mode (insert/normal)'
  69. print 'set showmode'
  70. print '" show matching parens, braces, etc'
  71. print 'set showmatch'
  72. print '" display row/column info'
  73. print 'set ruler'
  74. print '" autoindent width = 2 spaces'
  75. print 'set shiftwidth=2'
  76. print '" tab width = 2 spaces'
  77. print 'set tabstop=2'
  78. print '" display all error messages'
  79. print 'set verbose'
  80. print '" enable horizontal scrolling'
  81. print 'set leftright'
  82. print '" use extended regular expressions'
  83. print 'set extended'
  84. print '" case-insensitive search, unless an uppercase letter is used'
  85. print 'set iclower'
  86. print '" incremental search'
  87. print 'set searchincr'
  88. print '" print helpful messages (eg, 4 lines yanked)'
  89. print 'set report=1'
  90. } >>$HOME/.exrc