My build of nnn with minor changes
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

config.def.h 4.2 KiB

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