Frank LENORMAND
51ab59cd36
src: Implement a write!
command
...
This commit allows "forced" writes to a write-protected file, by
attempting to temporarily grant the current user write permissions on
it. After the buffer has been written, the previous permissions are
restored if the file existed, or set to 0644 otherwise.
2017-04-20 17:13:42 +03:00
Maxime Coste
30e6387071
Assume filename passed to write_buffer_to_file is already parsed
2017-04-20 09:55:56 +01:00
Maxime Coste
6ad2f721dd
Do not disable autoinfo and autoshowcompl in non interactive context
...
Fixes #1303
Fixes #1152
2017-04-03 18:16:32 +01:00
Maxime Coste
055ed5ff7e
Expose hook params regex captures in hook_param_capture_N
2017-03-30 11:31:07 +01:00
Maxime Coste
2cfe3cae36
Add an InsertDelete hook
2017-03-30 10:38:56 +01:00
Maxime Coste
5f7464d90d
Try to clean up option include a bit
2017-03-16 09:57:39 +00:00
Maxime Coste
a49e175727
Migrate to a more value based meta programming model
...
Introduce Meta::Type<T> to store a type as value, and pass it
around, migrate enum_desc and option_type_name to this.
2017-03-15 17:42:02 +00:00
Maxime Coste
a0b42323ed
Add a -debug flag to :edit to set the buffer as debug data
...
As for the *debug* buffer, buffers with the debug flag wont get
used for cycling through buffer, or word completion.
2017-03-08 19:33:25 +00:00
Maxime Coste
dc7c5f6e67
Collapse undo groups during an eval command
2017-03-07 16:18:09 +00:00
Maxime Coste
f0ae0b8410
Replace IdMap with HashMap
2017-03-07 01:12:37 +00:00
Maxime Coste
6373338c50
Replace uses of UnorderedMap with HashMap
2017-03-07 01:03:26 +00:00
Maxime Coste
420373475e
Introduce a custom HashMap implementation along with a quick benchmark
2017-03-06 22:25:08 +00:00
Maxime Coste
2fa98e04c3
Merge remote-tracking branch 'ekie/hook'
2017-03-03 21:14:14 +00:00
Maxime Coste
e3cfde6d07
Add docstring support for mappings, and use them in autoinfo
...
Fixes #105
Fixes #1100
Closes #1165
2017-03-03 20:16:36 +00:00
Eike Plack
a35f50d832
Add RawKey
to hook completion list
2017-03-01 03:28:23 +01:00
Maxime Coste
7d487e3b4c
Small naming tweak
2017-02-27 20:44:38 +00:00
Maxime Coste
2b01da530d
Fix hook list in commands.cc
2017-02-19 14:14:22 +00:00
Maxime Coste
c3af384c70
Detect when -client, -buffer or -try-client are used at the same time
...
Fixes #1218
2017-02-15 18:59:37 +00:00
Maxime Coste
d470bd2cc9
Make numeric registers setable
...
Fixes #1214
2017-02-14 00:02:01 +00:00
Maxime Coste
e3a04dfa65
Fix RegisterRestorer not handling potential throws on register assign
...
This should fix part of #1214
2017-02-13 23:31:16 +00:00
Maxime Coste
2edb7d62ef
Add support for -on-change and -on-abort to prompt
...
Fixes #1209
2017-02-12 12:51:58 +00:00
Maxime Coste
4ae441db68
Merge remote-tracking branch 'Delapouite/decl-completer'
2017-02-09 23:26:12 +00:00
Delapouite
0cf94292e4
Add command completer for types to declare-option
2017-02-09 10:18:13 +01:00
Delapouite
cfb2b4fade
Fix missing new line char in declare_option_cmd info
2017-02-09 09:01:49 +01:00
Maxime Coste
c793ef3aa8
Store shell-candidates completions in the Completion memory domain
2017-02-03 13:42:47 +00:00
Maxime Coste
8a62ec12af
Fix shell context capture that was accessing dead parameters
...
Fixes #1156
2017-01-24 20:20:50 +00:00
Maxime Coste
ffc362cf9e
Propagate ShellContext custom env-vars through custom commands
...
Fixes #1131
2017-01-13 00:26:43 +00:00
Maxime Coste
343df600cb
Merge remote-tracking branch 'alexherbo2/command-names'
2017-01-10 13:44:11 +00:00
Maxime Coste
dcd8f6ef01
Apply clang-tidy modernize to the codebase
2017-01-08 22:39:01 +00:00
Maxime Coste
f9f11aa762
Make the currently sourced file path available through $kak_source
...
The :source command sets an 'source' value to the real path of the
file getting sourced while its commands are executed.
Fixes #1112
2017-01-06 19:46:47 +00:00
Alex Leferry 2
671b50bb52
update command names
2017-01-04 13:04:27 +01:00
Maxime Coste
6beb9b6f02
Fix unmap 4th argument not being optional
...
Fixes #1078
2016-12-27 06:49:35 +00:00
Maxime Coste
33eb93b619
Skip debug buffer when cycling through the buffer list
...
Fixes #1059
2016-12-23 16:37:54 +00:00
Delapouite
99f38c99ec
Fix :prompt command description
2016-12-15 14:42:46 +01:00
Maxime Coste
2fd1414b05
Clean up includes of user_interface.hh
2016-11-29 19:53:11 +00:00
Maxime Coste
12856066b1
Cleanup include dependencies a bit
2016-11-28 23:58:08 +00:00
Maxime Coste
2f3a7112ea
Add more memory domains to certain data
2016-11-28 13:59:55 +00:00
Maxime Coste
a4738ace5f
:prompt and :onkey (renamed :on-key) now use values instead of registers
...
:prompt provides the entered text in the `text` value, :on-key provides
the entered key in the `key` value.
Closes #938
2016-11-27 20:57:04 +00:00
Maxime Coste
e340e0ed39
Forward client name to contexts created for write-all
...
Fixes #937
2016-11-24 13:35:42 +00:00
Maxime Coste
8f2c6eb586
Fix write_all_buffers when BufWrite... hooks create/delete buffers
...
The buffer list can be mutated during iteration, so it is no safe
to directly iterate on the BufferManager, we need to first create
our own copy of the buffer list.
Fixes #935
2016-11-23 23:51:16 +00:00
Maxime Coste
b884b499dd
Rework ensure_all_buffers_are_saved to remove an unneeded Vector
2016-11-23 23:39:42 +00:00
Maxime Coste
0b806cd4f1
Add missing hooks to completion list and validate hook name in hook cmd
2016-11-21 09:51:47 +00:00
Maxime Coste
be03fdce2a
Support completing hook names
...
Fixes #879
2016-11-20 11:17:13 +00:00
Maxime Coste
cd8d51af34
Fix PerArgumentCommandCompleter when completing the non first arg
...
The actualy query passed was always the first argument.
2016-11-20 11:16:34 +00:00
Maxime Coste
4a2fea8c9e
Continue command renaming to improve consistency
2016-11-15 13:49:06 +00:00
Maxime Coste
b3ba769220
Propagate the hooks disabled state through prompt, menu, and command execution
...
Maintain it as well during buffer creation even if the hooks are not executed
in client context.
Fixes #818
2016-11-14 19:39:35 +00:00
Maxime Coste
dcd733e5fa
Do a first phase of command renaming
2016-11-14 00:27:14 +00:00
Maxime Coste
9153663dfa
Add -save-regs defaults in the context wrap docstring
2016-11-08 09:49:48 +00:00
Nikolaus Wittenstein
e7970232d3
Fix typo in write_cmd's desc
...
Should be possessive "its".
2016-10-31 12:42:10 -04:00
Maxime Coste
cc2affea11
Always allow to delete a buffer, just recreate a scratch buffer if needed
...
Fixes #850
2016-10-13 21:37:44 +01:00
Maxime Coste
1f3e424047
Do not expand filenames when doing insert filename completion
...
Fixes #855
2016-10-13 19:46:09 +01:00
Frank LENORMAND
f7e2bfd76f
Document the optional parameter of the cd
command
2016-10-11 10:39:20 +03:00
Maxime Coste
025b91baca
Convert some uses of lambda to more concise std::mem_fn
2016-10-10 23:44:18 +01:00
Maxime Coste
5dd47e9c33
Preserve shell context through eval command
...
Fixes #835
2016-10-06 23:22:39 +01:00
Maxime Coste
d50087eabe
Change BufWritePre/BufWritePost logic
...
Run them in client context if possible, and give them the target
filename instead of the buffer name.
Fixes #823
2016-10-01 23:51:53 +01:00
Maxime Coste
35559b65dd
Support codepoints of variable width
...
Add a ColumnCount type and use it in place of CharCount whenever
more appropriate, take column size of codepoints into account for
vertical movements and docstring wrapping.
Fixes #811
2016-10-01 13:45:00 +01:00
Maxime Coste
e3c4bddd3b
Make hook disabling work for all hooks, not only user hooks
...
Fixes #823
2016-09-26 23:43:05 +01:00
Maxime Coste
4f874a3679
Code cleanup in make_completer, use std::decay
2016-09-19 23:26:52 +01:00
Maxime Coste
396b71ecc2
Add an unmap command to remove key mappings
2016-09-19 09:10:41 +01:00
Maxime Coste
44e9da3bee
More command completer code cleanup
2016-09-18 16:27:34 +01:00
Maxime Coste
d14c39ebdd
Rewrite PerArgumentCommandCompleter to use compile time dispatching
...
No need to store these vectors of std::functions around anymore.
2016-09-18 16:07:00 +01:00
Maxime Coste
4fc20b8d7d
Rework client quitting and handling of remote errors
...
Client quitting no longer immediately unwinds, client is just pushed
for deletion until we get back to the main loop, similarly to what
happens for buffer and window deletion.
2016-09-04 17:56:07 +01:00
Maxime Coste
3831117bc7
style tweak
2016-08-30 23:23:07 +01:00
Maxime Coste
b6cab458ed
Use a heap instead of sorting to gather the best shell-candidates matches
...
O(n + k * log n) (with k = 100 here) instead of O(n log n), much faster
with many candidates.
2016-08-30 13:42:29 +01:00
Maxime Coste
f6cb6319d6
Enable shell-candidates update in fast completion mode
2016-08-30 00:55:01 +01:00
Maxime Coste
911a32a992
Only drop blank prefixed history entries in command/shell prompts
...
For regex prompts we actually want to save them, as a leading space
is significant
Fixes #767
2016-08-22 20:37:14 +01:00
Maxime Coste
f73e89a716
Add information of types of options
2016-08-06 09:05:50 +01:00
Maxime Coste
5b7b6eebaf
Regenerate shell-candidates for each completion sessions
...
That should allow fixing the #665 issue while still avoiding to
run a potentially long shell command on each keystroke.
2016-08-05 13:53:19 +01:00
Maxime Coste
38d372567b
Do not force exec to run in normal mode anymore, run in the current mode
2016-08-05 09:43:33 +01:00
Maxime Coste
2425f4a781
Tweak session renaming code
2016-07-28 00:16:41 +01:00
Maxime Coste
62fa133efd
Merge remote-tracking branch 'doppioandante/set_session'
2016-07-28 00:12:09 +01:00
Enrico Lumetti
1a7cd707aa
Add 'session' command to change remote session name
2016-07-24 22:46:33 +02:00
Frank LENORMAND
e3bf01d1f9
Replace C-style operators with their alphabetical equivalent
2016-07-24 08:34:49 +03:00
Frank LENORMAND
8a4596bea9
Implement a readonly
mode
...
This commit introduces the `readonly` variable as well as the `-ro`
command line option which prevent buffers from being overwritten on
disk when the `write` command is used without arguments. Some buffers
can selectively be put in readonly mode by setting the `readonly`
variable on the `buffer` scope, the `global` mode will affect all
buffers (even those who will be open subsequently), using the `window`
scope will have no effect.
Closes #685
2016-07-23 10:03:21 +03:00
Maxime Coste
88a9607552
Keep modified selections in non-draft exec/eval -itersel
...
Fixes #727
2016-07-08 09:52:10 +01:00
Maxime Coste
fcf73c2293
Refactor context_wrap to share more code between draft/non draft case
...
Fixes #706
2016-06-22 22:27:43 +01:00
Maxime Coste
5cb9cf4cc3
Go back to saving built-in registers by default in non draft :exec/:eval
2016-06-22 19:57:21 +01:00
Maxime Coste
91bf0d4622
Make window scope available to draft contexts
...
We do want window options/aliases/keymaps/hooks to be available in
draft context, dont we ?
Fixes #702
2016-06-20 19:45:15 +01:00
Maxime Coste
fef37e6a92
Do not preserve registers by default when exec/eval in a non draft context
...
Fixes #700
2016-06-20 19:40:49 +01:00
Maxime Coste
5cab2078f8
Fix string view created from a temporary string
...
This is clearly a case where rust style lifetime analysis would
have been nice, hopefully it comes with GSL lifetime extensions...
Fixes #680
2016-05-24 22:36:20 +01:00
Maxime Coste
6181781f3d
Change dir to $HOME when no parameters are given to cd
...
Fixes #678
2016-05-20 09:41:29 +01:00
Maxime Coste
fb01c8c377
Do not force recreate scratch buffers by default, require edit! for that
2016-05-17 19:41:24 +01:00
Maxime Coste
1788126f38
BufferManager now owns the Buffers instead of registering them
2016-05-14 08:33:50 +01:00
Maxime Coste
da40828801
Check all buffer are saved in :kill, and add :kill! to avoid that
2016-04-29 21:58:04 +01:00
Maxime Coste
66a40a37cd
prompt: zero password memory after running the command to be slightly more secure
2016-04-20 13:31:34 +01:00
Maxime Coste
199ccb4021
Add a -password switch to :prompt to allow for more secure password entering
...
Fixes #660
2016-04-19 09:51:09 +01:00
Maxime Coste
013519b3cb
Remove iterator based regex constructor
2016-04-16 21:41:04 +01:00
Maxime Coste
3eca90f2b1
Only offer directories when completing :cd arguments
...
Refactor code in file.cc, avoid many double stat when searching
commands
Fixes #646
2016-04-07 22:47:41 +01:00
Maxime Coste
b5a68307ba
Use a specific option type completions for insert completion
...
Fix escaping in jedi.kak as well
2016-04-04 13:42:58 +01:00
Maxime Coste
75e9bbfa43
Uniquify candidates in -shell-candidates mode
2016-03-28 14:16:45 +01:00
Maxime Coste
1bd356473b
Use UsedLetters for shell-candidates filtering
2016-03-25 20:38:27 +00:00
Maxime Coste
840b7658fd
Add an alternative -shell-candidates shell completion support
...
-shell-candidates use a shell script that returns all the candidates
and then sort them using Kakoune ranked matches system instead of
delegating the whole completion to the shell script (as shell-completion does)
2016-03-24 14:01:59 +00:00
Maxime Coste
1d646c03f5
Add completion support for alias/unalias commands
2016-03-24 00:05:40 +00:00
Maxime Coste
5bf9243006
User mappings and :exec are always executed in normal mode
...
Fix #551
2016-03-22 22:54:29 +00:00
Maxime Coste
7ecd65e1af
Code cleanups
2016-03-14 13:41:20 +00:00
Maxime Coste
9e15181dc9
Rework container helpers, use pipe syntax and cleanup implementation
...
use 'container | filter(func) | reverse() | transform(func)' instead
of 'transform(reverse(filter(container), func), func)' to express
container transformations.
2016-03-08 21:35:56 +00:00
Maxime Coste
2df7b1f6da
In buffer name completion, give priority to filename (not dirname) matches
...
First list filename matches, then full path matches to allow fast selection
of buffers in deep hierarchies where queries match the path of every buffers
2016-03-02 13:51:50 +00:00
Maxime Coste
3987463e75
Remove direct access to ui, go through client
...
Client can now update menu/info positions when the window move
around.
2016-02-27 17:23:13 +00:00
Maxime Coste
dfe3098b18
Fix buffer deletion logic
...
'eval -buffer * db' was failing in certain cases
2016-02-11 23:07:42 +00:00
Maxime Coste
8701a53252
Fix use of dead temporary strings in completions
2016-02-10 13:33:49 +00:00
Maxime Coste
87769c9b03
Migrate most completion to ranked match
2016-02-09 22:50:10 +00:00
Maxime Coste
c8dedf458d
Use the ranked word completion logic for buffer name completion
2016-02-09 20:04:23 +00:00
Maxime Coste
11652ce230
Remove the exec_keys function
2015-12-27 23:15:09 +00:00
Maxime Coste
43f1fcf616
Slight refactor
2015-12-27 23:09:32 +00:00
Maxime Coste
a5dcca6f78
Formatting fix
2015-12-27 23:07:06 +00:00
Maxime Coste
1288a1d385
Support collapsing jumps in eval and exec
...
Fixes #535
2015-12-23 02:46:13 +00:00
Maxime Coste
8dcffd8f5a
Initial, WIP spelling implementation
...
Add a ranges highlighter that takes a timestamped list of ranges and
associated face. Add a spell.kak file that uses aspell pipe interface
to fill a range-faces option.
2015-12-17 04:07:49 +00:00
Maxime Coste
4cb74623bb
Store the buffer timestamp in line flags options respect it for highlighting
...
Option content is auto updated to match current buffer, so that line flags
are updated according to buffer modifications.
2015-12-12 11:45:45 +00:00
Maxime Coste
c4a9f059dc
Fix unset option when using the current scope and it points to global
2015-12-02 19:25:40 +00:00
Maxime Coste
550a95a3d7
Change def -shell-params to def -params and take the counts as parameters
2015-12-01 14:00:55 +00:00
Maxime Coste
7335065d20
Update buffer display names after changing working directory
...
Fixes #501
2015-12-01 13:42:42 +00:00
Maxime Coste
516e999a28
Disable history in all non interactive contexts
2015-11-27 13:50:40 +00:00
Maxime Coste
9e08cf8ea4
Preserve default registers in exec/eval by default
2015-11-26 13:34:46 +00:00
Maxime Coste
001da44e11
Add -save-regs <regs> option to exec and eval to preserve registers
...
Fixes #279
2015-11-25 23:40:38 +00:00
Maxime Coste
ad5c8db7a8
Add support for various completions in :prompt
...
Fixes #489
2015-11-23 13:57:36 +00:00
Maxime Coste
9656f088e7
Change autoinfo option to be a flags option, document flags options
...
Support the value1|value2|value3 syntax for flag options.
2015-11-18 23:47:28 +00:00
Maxime Coste
5c37f0dd5e
Propagate shell context through prompt/onkey/menu commands
2015-11-18 20:15:51 +00:00
Maxime Coste
b73a890f8c
Document i attribute in face command info
2015-11-11 19:05:47 +00:00
Maxime Coste
6840f7ce9c
Store the last used buffer in clients
...
Fixes #474
2015-11-07 18:25:49 +00:00
Maxime Coste
28d451b844
Support 'current' scope in set/unset command
2015-11-06 13:56:48 +00:00
Maxime Coste
40c6edf243
Document exclusive attribute
2015-10-23 13:49:02 +01:00
Maxime Coste
da7fc3311f
Pass ShellContext to commands
...
Fix #427
2015-10-22 13:59:23 +01:00
Maxime Coste
e51ef6c3c2
Wrap the shell params en env vars in a ShellContext struct
2015-10-22 13:48:57 +01:00
Maxime Coste
7346220e38
Fix :set completion when -add switch is given
2015-10-22 13:29:34 +01:00
Maxime Coste
76fadd8108
More cleanups in the buffer open/reload code
2015-10-17 11:33:09 +01:00
Maxime Coste
3795ff735a
Refactor buffer creation and reloading to be more explicit
...
Reloading used to be implicit in the buffer creation function,
which is not always nice, as code that explicitely wanted to
reload a buffer could not say so.
2015-10-17 11:33:09 +01:00
Maxime Coste
7776c38755
Detect ungraceful exits, and backup modified buffers in these cases
2015-10-08 13:43:39 +01:00
Maxime Coste
db2fa6f5cb
Support markup in menu command
2015-10-05 13:51:13 +01:00
Maxime Coste
c54e6738b9
Use DisplayLine for menu choices
2015-10-05 01:25:23 +01:00
Maxime Coste
77408becbd
Fix removing shared highlighters
2015-09-30 00:18:37 +01:00
Maxime Coste
2b4b73ae8e
Remove the default_face parameter of parse_display_line
...
No need to define a default face there, we will pass a default face
to UserInterface::draw_status later.
2015-09-20 11:34:13 +01:00
Maxime Coste
6bc5f8c3a3
Add simple markup support to generate display lines from strings
...
The syntax is simply {face} to enable the given face, use \{ to
escape a {, and \\ to escape a \.
2015-09-19 12:19:17 +01:00
Maxime Coste
693d9a4861
Store key hash in IdMap
2015-09-16 20:02:12 +01:00
Maxime Coste
04536657d1
Add a kill command that kills the current session
...
Fixes #331
A given session can be killed with 'echo kill | kak -p <session>'
2015-08-26 19:34:19 +01:00
Maxime Coste
ae839fc471
Remove Client::window() method, use a force_redraw() one
...
We cannot assume Client::m_window is always non-null, as when
changing current buffer its temporarily null, at the point
where WinCreate hook might get called.
Fixes #382
2015-08-23 13:29:24 +01:00
Maxime Coste
3f493fa186
Rename Disableable to more general NestedBool
...
A NestedBool can be set multiple times, and will be considered false
only when unset the same number.
2015-08-18 23:17:56 +01:00
Maxime Coste
d2762e6a1a
Try to fix compilation on travis
2015-08-12 19:16:52 +01:00
Maxime Coste
d7744308f6
Ensure the command exist before adding an alias
...
Fixes #371
2015-08-11 13:37:38 +01:00
Maxime Coste
94ec1cdde7
Add an unset command to remove an option value (falling back to parent)
...
unset is not applicable to global scope.
2015-08-10 13:54:52 +01:00
Maxime Coste
10d8cf64cf
Move option docstring obtention to OptionRegistry
2015-08-10 13:53:30 +01:00
Maxime Coste
bfb116b8b4
Move option name completion to the OptionRegistry
...
Option names are the same for every option manager.
2015-08-10 13:38:06 +01:00
Maxime Coste
ea02467564
Disable notifications when disabling an option temporarly
2015-07-23 23:42:48 +01:00
Viktor Palmkvist
ab2007bd4e
Add remapping of text object keys
2015-07-01 17:53:38 +02:00
Maxime Coste
58d115ec88
Force redraw all clients after a face changed
2015-06-30 19:12:25 +01:00
Maxime Coste
5b554ff474
Add support for command completion on commands, use it for :new
...
That means commands can be completed using other commands and their
completers. Yes that does makes sense.
Closes #296
2015-06-26 13:57:23 +01:00
Maxime Coste
cf33a062df
Force redraw window after adding/removing highlighters
2015-06-25 19:45:41 +01:00
Maxime Coste
3834440298
Rework window redraw handling, should redraw window less often
2015-06-21 19:56:23 +01:00
Eike Plack
1bdc98abd3
Fix Self Documentation
2015-06-19 17:10:16 +02:00
Maxime Coste
409d804ee8
Do not close stderr/stdout before program finish
...
Programs like grep called in '$' command will fail due to SIGPIPE
for example. So we need to keep the pipe open.
2015-06-08 22:42:51 +01:00
Maxime Coste
942fc224af
Specify if ShellManager should read output or not using a flag
...
Some program (xclip), will fork a daemon keeping stdout/stderr open,
so waiting for them to be closed make kakoune hang. Commands discarding
stdout can then just not wait on it.
2015-06-08 13:45:20 +01:00