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.
 
 
 
 
 
 

100 lines
3.9 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. /* Next */
  36. { 'j', SEL_NEXT, "", "" },
  37. { KEY_DOWN, SEL_NEXT, "", "" },
  38. { CONTROL('N'), SEL_NEXT, "", "" },
  39. /* Previous */
  40. { 'k', SEL_PREV, "", "" },
  41. { KEY_UP, SEL_PREV, "", "" },
  42. { CONTROL('P'), SEL_PREV, "", "" },
  43. /* Page down */
  44. { KEY_NPAGE, SEL_PGDN, "", "" },
  45. { CONTROL('D'), SEL_PGDN, "", "" },
  46. /* Page up */
  47. { KEY_PPAGE, SEL_PGUP, "", "" },
  48. { CONTROL('U'), SEL_PGUP, "", "" },
  49. /* First entry */
  50. { KEY_HOME, SEL_HOME, "", "" },
  51. { 'g', SEL_HOME, "", "" },
  52. { CONTROL('A'), SEL_HOME, "", "" },
  53. { '^', SEL_HOME, "", "" },
  54. /* Last entry */
  55. { KEY_END, SEL_END, "", "" },
  56. { 'G', SEL_END, "", "" },
  57. { CONTROL('E'), SEL_END, "", "" },
  58. { '$', SEL_END, "", "" },
  59. /* Change dir */
  60. { 'c', SEL_CD, "", "" },
  61. /* HOME */
  62. { '~', SEL_CDHOME, "", "" },
  63. /* Initial directory */
  64. { '&', SEL_CDBEGIN, "", "" },
  65. /* Last visited dir */
  66. { '-', SEL_CDLAST, "", "" },
  67. /* Toggle hide .dot files */
  68. { '.', SEL_TOGGLEDOT, "", "" },
  69. /* Detailed listing */
  70. { 'd', SEL_DETAIL, "", "" },
  71. /* File details */
  72. { 'D', SEL_STATS, "", "" },
  73. /* Show mediainfo short */
  74. { 'm', SEL_MEDIA, "", "" },
  75. /* Show mediainfo full */
  76. { 'M', SEL_FMEDIA, "", "" },
  77. /* Open dir in desktop file manager */
  78. { 'o', SEL_DFB, "", "" },
  79. /* Toggle sort by size */
  80. { 's', SEL_FSIZE, "", "" },
  81. /* Sort by total block size including dir contents */
  82. { 'S', SEL_BSIZE, "", "" },
  83. /* Toggle sort by time */
  84. { 't', SEL_MTIME, "", "" },
  85. { CONTROL('L'), SEL_REDRAW, "", "" },
  86. /* Copy currently selected file path */
  87. { CONTROL('K'), SEL_COPY, "", "" },
  88. /* Show help */
  89. { '?', SEL_HELP, "", "" },
  90. /* Run command */
  91. { 'z', SEL_RUN, "top", "" },
  92. { '!', SEL_RUN, "sh", "SHELL" },
  93. /* Run command with argument */
  94. { 'e', SEL_RUNARG, "vi", "EDITOR" },
  95. { 'p', SEL_RUNARG, "less", "PAGER" },
  96. };