My build of nnn with minor changes
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

105 wiersze
4.1 KiB

  1. /* See LICENSE file for copyright and license details. */
  2. #define CWD "cwd: "
  3. #define CURSR " > "
  4. #define EMPTY " "
  5. static int filtermode = 0; /* Set to 1 to enter filter mode */
  6. static int mtimeorder = 0; /* Set to 1 to sort by time modified */
  7. static int sizeorder = 0; /* Set to 1 to sort by file size */
  8. static int bsizeorder = 0; /* Set to 1 to sort by blocks used including content */
  9. static int idletimeout = 0; /* Screensaver timeout in seconds, 0 to disable */
  10. static int showhidden = 0; /* Set to 1 to show hidden files by default */
  11. static int showdetail = 0; /* Set to show additional file info */
  12. static char *idlecmd = "rain"; /* The screensaver program */
  13. static struct assoc assocs[] = {
  14. { "\\.(c|cpp|h|log|md|py|sh|txt)$", "text" },
  15. { "\\.(3g2|3gp|asf|avi|divx|flv|m2v|m4v|mkv|mov|mp4|mp4v|mpeg|mpg|ogv|qt|rm|rmvb|vob|webm|wmv)$", "video" },
  16. { "\\.(aac|ac3|amr|flac|m4a|m4b|m4p|mp3|mp4a|ogg|opus|ra|wav|wma)$", "audio" },
  17. { "\\.(bmp|gif|jpeg|jpg|pbm|pgm|png|svg|tiff|webp)$", "image" },
  18. { "\\.pdf$", "pdf" },
  19. };
  20. static struct key bindings[] = {
  21. /* Quit */
  22. { 'q', SEL_QUIT, "", "" },
  23. { 'Q', SEL_CDQUIT, "", "" },
  24. /* Back */
  25. { KEY_BACKSPACE, SEL_BACK, "", "" },
  26. { KEY_LEFT, SEL_BACK, "", "" },
  27. { 'h', SEL_BACK, "", "" },
  28. { CONTROL('H'), SEL_BACK, "", "" },
  29. /* Inside */
  30. { KEY_ENTER, SEL_GOIN, "", "" },
  31. { '\r', SEL_GOIN, "", "" },
  32. { KEY_RIGHT, SEL_GOIN, "", "" },
  33. { 'l', SEL_GOIN, "", "" },
  34. /* Filter */
  35. { '/', SEL_FLTR, "", "" },
  36. /* Toggle filter mode */
  37. { KEY_IC, SEL_MFLTR, "", "" },
  38. /* Desktop search */
  39. { CONTROL('_'), SEL_SEARCH, "", "" },
  40. /* Next */
  41. { 'j', SEL_NEXT, "", "" },
  42. { KEY_DOWN, SEL_NEXT, "", "" },
  43. { CONTROL('N'), SEL_NEXT, "", "" },
  44. /* Previous */
  45. { 'k', SEL_PREV, "", "" },
  46. { KEY_UP, SEL_PREV, "", "" },
  47. { CONTROL('P'), SEL_PREV, "", "" },
  48. /* Page down */
  49. { KEY_NPAGE, SEL_PGDN, "", "" },
  50. { CONTROL('D'), SEL_PGDN, "", "" },
  51. /* Page up */
  52. { KEY_PPAGE, SEL_PGUP, "", "" },
  53. { CONTROL('U'), SEL_PGUP, "", "" },
  54. /* First entry */
  55. { KEY_HOME, SEL_HOME, "", "" },
  56. { 'g', SEL_HOME, "", "" },
  57. { CONTROL('A'), SEL_HOME, "", "" },
  58. { '^', SEL_HOME, "", "" },
  59. /* Last entry */
  60. { KEY_END, SEL_END, "", "" },
  61. { 'G', SEL_END, "", "" },
  62. { CONTROL('E'), SEL_END, "", "" },
  63. { '$', SEL_END, "", "" },
  64. /* Change dir */
  65. { 'c', SEL_CD, "", "" },
  66. /* HOME */
  67. { '~', SEL_CDHOME, "", "" },
  68. /* Initial directory */
  69. { '&', SEL_CDBEGIN, "", "" },
  70. /* Last visited dir */
  71. { '-', SEL_CDLAST, "", "" },
  72. /* Toggle hide .dot files */
  73. { '.', SEL_TOGGLEDOT, "", "" },
  74. /* Detailed listing */
  75. { 'd', SEL_DETAIL, "", "" },
  76. /* File details */
  77. { 'D', SEL_STATS, "", "" },
  78. /* Show mediainfo short */
  79. { 'm', SEL_MEDIA, "", "" },
  80. /* Show mediainfo full */
  81. { 'M', SEL_FMEDIA, "", "" },
  82. /* Open dir in desktop file manager */
  83. { 'o', SEL_DFB, "", "" },
  84. /* Toggle sort by size */
  85. { 's', SEL_FSIZE, "", "" },
  86. /* Sort by total block size including dir contents */
  87. { 'S', SEL_BSIZE, "", "" },
  88. /* Toggle sort by time */
  89. { 't', SEL_MTIME, "", "" },
  90. { CONTROL('L'), SEL_REDRAW, "", "" },
  91. /* Copy currently selected file path */
  92. { CONTROL('K'), SEL_COPY, "", "" },
  93. /* Show help */
  94. { '?', SEL_HELP, "", "" },
  95. /* Run command */
  96. { 'z', SEL_RUN, "top", "" },
  97. { '!', SEL_RUN, "sh", "SHELL" },
  98. /* Run command with argument */
  99. { 'e', SEL_RUNARG, "vi", "EDITOR" },
  100. { 'p', SEL_RUNARG, "less", "PAGER" },
  101. };