My build of nnn with minor changes
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

hace 10 años
hace 7 años
hace 7 años
hace 7 años
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /* See LICENSE file for copyright and license details. */
  2. #define CONTROL(c) ((c) ^ 0x40)
  3. /* Supported actions */
  4. enum action {
  5. SEL_QUIT = 1,
  6. SEL_CDQUIT,
  7. SEL_BACK,
  8. SEL_GOIN,
  9. SEL_FLTR,
  10. SEL_MFLTR,
  11. SEL_SEARCH,
  12. SEL_NEXT,
  13. SEL_PREV,
  14. SEL_PGDN,
  15. SEL_PGUP,
  16. SEL_HOME,
  17. SEL_END,
  18. SEL_CD,
  19. SEL_CDHOME,
  20. SEL_CDBEGIN,
  21. SEL_CDLAST,
  22. SEL_CDBM,
  23. SEL_PIN,
  24. SEL_VISIT,
  25. SEL_TOGGLEDOT,
  26. SEL_DETAIL,
  27. SEL_STATS,
  28. SEL_MEDIA,
  29. SEL_FMEDIA,
  30. SEL_DFB,
  31. SEL_FSIZE,
  32. SEL_BSIZE,
  33. SEL_MTIME,
  34. SEL_REDRAW,
  35. SEL_COPY,
  36. SEL_NEW,
  37. SEL_RENAME,
  38. SEL_HELP,
  39. SEL_RUN,
  40. SEL_RUNARG,
  41. };
  42. /* Associate a pressed key to an action */
  43. struct key {
  44. int sym; /* Key pressed */
  45. enum action act; /* Action */
  46. char *run; /* Program to run */
  47. char *env; /* Environment variable to run */
  48. };
  49. /* Extension pattern and mime combination */
  50. struct assoc {
  51. char *regex; /* Regex to match on filename */
  52. char *mime; /* File type */
  53. };
  54. static struct assoc assocs[] = {
  55. { "\\.(c|cpp|h|log|md|py|sh|txt)$", "text" },
  56. };
  57. static struct key bindings[] = {
  58. /* Quit */
  59. { 'q', SEL_QUIT, "", "" },
  60. { CONTROL('Q'), SEL_QUIT, "", "" },
  61. /* Change dir on quit */
  62. { 'Q', SEL_CDQUIT, "", "" },
  63. /* Back */
  64. { KEY_BACKSPACE, SEL_BACK, "", "" },
  65. { KEY_LEFT, SEL_BACK, "", "" },
  66. { 'h', SEL_BACK, "", "" },
  67. { CONTROL('H'), SEL_BACK, "", "" },
  68. /* Inside */
  69. { KEY_ENTER, SEL_GOIN, "", "" },
  70. { '\r', SEL_GOIN, "", "" },
  71. { KEY_RIGHT, SEL_GOIN, "", "" },
  72. { 'l', SEL_GOIN, "", "" },
  73. /* Filter */
  74. { '/', SEL_FLTR, "", "" },
  75. /* Toggle filter mode */
  76. { KEY_IC, SEL_MFLTR, "", "" },
  77. /* Desktop search */
  78. { CONTROL('_'), SEL_SEARCH, "", "" },
  79. /* Next */
  80. { 'j', SEL_NEXT, "", "" },
  81. { KEY_DOWN, SEL_NEXT, "", "" },
  82. { CONTROL('N'), SEL_NEXT, "", "" },
  83. /* Previous */
  84. { 'k', SEL_PREV, "", "" },
  85. { KEY_UP, SEL_PREV, "", "" },
  86. { CONTROL('P'), SEL_PREV, "", "" },
  87. /* Page down */
  88. { KEY_NPAGE, SEL_PGDN, "", "" },
  89. { CONTROL('D'), SEL_PGDN, "", "" },
  90. /* Page up */
  91. { KEY_PPAGE, SEL_PGUP, "", "" },
  92. { CONTROL('U'), SEL_PGUP, "", "" },
  93. /* First entry */
  94. { KEY_HOME, SEL_HOME, "", "" },
  95. { 'g', SEL_HOME, "", "" },
  96. { CONTROL('A'), SEL_HOME, "", "" },
  97. { '^', SEL_HOME, "", "" },
  98. /* Last entry */
  99. { KEY_END, SEL_END, "", "" },
  100. { 'G', SEL_END, "", "" },
  101. { CONTROL('E'), SEL_END, "", "" },
  102. { '$', SEL_END, "", "" },
  103. /* Change dir */
  104. { 'c', SEL_CD, "", "" },
  105. /* HOME */
  106. { '~', SEL_CDHOME, "", "" },
  107. /* Initial directory */
  108. { '&', SEL_CDBEGIN, "", "" },
  109. /* Last visited dir */
  110. { '-', SEL_CDLAST, "", "" },
  111. /* Change dir using bookmark */
  112. { 'b', SEL_CDBM, "", "" },
  113. /* Mark a path to visit later */
  114. { CONTROL('B'), SEL_PIN, "", "" },
  115. /* Visit marked directory */
  116. { CONTROL('V'), SEL_VISIT, "", "" },
  117. /* Toggle hide .dot files */
  118. { '.', SEL_TOGGLEDOT, "", "" },
  119. /* Detailed listing */
  120. { 'd', SEL_DETAIL, "", "" },
  121. /* File details */
  122. { 'D', SEL_STATS, "", "" },
  123. /* Show media info short, run is hacked */
  124. { 'm', SEL_MEDIA, NULL, "" },
  125. /* Show media info full, run is hacked */
  126. { 'M', SEL_FMEDIA, "-f", "" },
  127. /* Open dir in desktop file manager */
  128. { 'o', SEL_DFB, "", "" },
  129. /* Toggle sort by size */
  130. { 's', SEL_FSIZE, "", "" },
  131. /* Sort by total block count including dir contents */
  132. { 'S', SEL_BSIZE, "", "" },
  133. /* Toggle sort by time */
  134. { 't', SEL_MTIME, "", "" },
  135. /* Redraw window */
  136. { CONTROL('L'), SEL_REDRAW, "", "" },
  137. { KEY_F(5), SEL_REDRAW, "", "" }, /* Undocumented */
  138. /* Copy currently selected file path */
  139. { CONTROL('K'), SEL_COPY, "", "" },
  140. /* Create a new file */
  141. { 'n', SEL_NEW, "", "" },
  142. /* Show rename prompt */
  143. { CONTROL('R'), SEL_RENAME, "", "" },
  144. { KEY_F(2), SEL_RENAME, "", "" }, /* Undocumented */
  145. /* Show help */
  146. { '?', SEL_HELP, "", "" },
  147. /* Run command */
  148. { '!', SEL_RUN, "sh", "SHELL" },
  149. /* Run command with argument */
  150. { 'e', SEL_RUNARG, "vi", "EDITOR" },
  151. { 'p', SEL_RUNARG, "less", "PAGER" },
  152. };