My build of nnn with minor changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

102 lines
4.0 KiB

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