* Support for highlighting all search matches (hlsearch)
hlsearch is implemented efficiently using the buffer's line array,
somewhat similarly to the syntax highlighting.
Unlike the syntax highlighter which highlights the entire file,
hlsearch searches for matches for the displayed lines only.
Matches are searched when the given line is displayed first time
or after it was modified. Otherwise the previously found matches
are used.
* Add UnhighlightSearch action
and add it to the list of actions triggered by Esc key by default.
* Add comment explaining the purpose of search map
* Add hlsearch colors to colorschemes
Mostly just copied from the corresponding original (mostly vim) colorschemes.
* Highlight matches during/after replace as well
As a side effect it also changes the last search value, i.e. affects FindNext
and FindPrevious, but it's probably fine. In vim it works the same way.
* Improve hlsearch option description
Modified behavior of CursorUp, CursorDown, CursorPageUp etc:
if softwrap is enabled, cursor moves by visual lines, not logical lines.
TODO: implement it also for Home and End keys: move cursor to the
visual start or end of a line. I haven't implemented it for now, because
I'm not sure what should be the behavior of StartOfTextToggle then
(considering that Home key is bound to StartOfTextToggle by default).
Fixes#1598
Fix regressions after ba98b55:
- Unable to override filetype autodetection by setting a specific filetype
for specific files, i.e. this doesn't work:
"*.h": {
"filetype": "c++"
},
- Unable to enable/disable syntax highlighting for specific files,
i.e. this doesn't work:
"*.c": {
"syntax": false
},
- "readonly" setting doesn't work (neither global nor per-filetype).
Fix the regression after 3b34a02: setting readonly option to true
in onBufferOpen lua callback doesn't work, since it is automatically
reset to false if write permission is not denied.
This commit introduces several improvements to the backup system.
* Backups are made every 8 seconds for buffers that have been modified
since the last backup.
* The `permbackup` option allows users to specify that backups should
be kept permanently.
* `The backupdir` option allows users to store backups in a custom
directory.
Fixes#1641Fixes#1536
Ref #1539 (removes possibility of race condition for backups)
This option is disabled by default, and when enabled causes micro
to parse `:line:col` as a location for the cursor rather than
as part of the filename.
Closes#1650Closes#1685
There is a bit of mess in the usage of HighlightMatches: in some places
we assume that it updates lines from startline to endline inclusive,
in other places we assume it's non-inclusive.
This fix makes it always inclusive.
In particular, it fixes a bug: when we open a file which has no
newline at the end, the last line isn't highlighted.
If you run micro as `micro | cat` for example, micro will disallow
you from saving the file, and when you quit the buffer, the contents
will be sent to the pipe. This allows one to use micro as part of
an interactive unix pipeline.
Closes#1524
The autosave option is now specified as an integer, which denotes
the number of seconds to wait between saving the file. If the option
is 0, then autosaving is disabled. If the option is given by the user
as a boolean, it will be converted to 8 if true, and 0 if false.
Fixes#1479