options.zsh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. bindkey -v
  2. bindkey -M vicmd 'k' history-substring-search-up
  3. bindkey -M vicmd 'j' history-substring-search-down
  4. # last command should be recalled and cursor would go in the beginning, ready to edit it.
  5. last_command() {
  6. zle insert-last-word -- -1 -1
  7. CURSOR=0
  8. }
  9. zle -N last_command
  10. bindkey -M vicmd 'b' last_command
  11. # History Settings (big history for use with many open shells and no dups)
  12. # Different History files for root and standard user
  13. if (( ! EUID )); then
  14. HISTFILE=/root/.zsh_history
  15. else
  16. HISTFILE=~/.zsh_history
  17. fi
  18. SAVEHIST=100000
  19. HISTSIZE=120000
  20. setopt share_history append_history extended_history hist_no_store hist_ignore_all_dups hist_ignore_space
  21. # 2x control is completion from history!!!
  22. zle -C hist-complete complete-word _generic
  23. zstyle ':completion:hist-complete:*' completer _history
  24. bindkey '^X^X' hist-complete
  25. # If a command is issued that can’t be executed as a normal command, and the command is the name of a directory, perform the cd command to that directory.
  26. setopt AUTO_CD
  27. # Treat the ‘#’, ‘~’ and ‘^’ characters as part of patterns for filename generation, etc. (An initial unquoted ‘~’ always produces named directory expansion.)
  28. setopt EXTENDED_GLOB
  29. # If a pattern for filename generation has no matches, print an error, instead of leaving it unchanged in the argument list. This also applies to file expansion of an initial ‘~’ or ‘=’.
  30. setopt NOMATCH
  31. # no Beep on error in ZLE.
  32. setopt NO_BEEP
  33. # Remove any right prompt from display when accepting a command line. This may be useful with terminals with other cut/paste methods.
  34. setopt TRANSIENT_RPROMPT
  35. # If unset, the cursor is set to the end of the word if completion is started. Otherwise it stays there and completion is done from both ends.
  36. setopt COMPLETE_IN_WORD
  37. # Make cd push the old directory onto the directory stack.
  38. setopt AUTO_PUSHD
  39. # Don’t push multiple copies of the same directory onto the directory stack.
  40. setopt PUSHD_IGNORE_DUPS
  41. # DON NOT Allow ‘>’ redirection to truncate existing files, and ‘>>’ to create files. Otherwise ‘>!’ or ‘>|’ must be used to truncate a file, and ‘>>!’ or ‘>>|’ to create a file.
  42. setopt no_clobber
  43. # **.c is equivalent to **/*.c
  44. setopt GLOBSTARSHORT
  45. # wait 10 seconds if using rm with *
  46. setopt RM_STAR_WAIT
  47. # Allow comments with #
  48. setopt interactive_comments
  49. # Spell check arguments
  50. setopt correct_all
  51. # In completion, go to the end of the word
  52. unsetopt always_to_end
  53. # No first completion entry
  54. unsetopt menu_complete
  55. # No first item
  56. setopt auto_list
  57. # Show directory name
  58. setopt auto_name_dirs
  59. # Put a slash for ~
  60. setopt auto_param_slash
  61. # allow completion from within a word/phrase
  62. setopt complete_in_word
  63. # Glob complete
  64. setopt glob_complete