Commit Graph

324 Commits

Author SHA1 Message Date
Maxime Coste
9ae8f5e47b Editor::move_selection now either takes a LineCount or a CharCount 2012-10-02 14:10:00 +02:00
Maxime Coste
081f579ba1 OSX compilation fixes 2012-10-02 10:36:28 +02:00
Maxime Coste
79d8d082bd Store capture groups with selections in editor, and access them through dynamic registers 2012-09-26 20:43:42 +02:00
Maxime Coste
a2fd1528e6 Move last insertion from Client to Context 2012-09-26 20:07:06 +02:00
Maxime Coste
77eb86bcdb Forbid context copy 2012-09-26 14:27:23 +02:00
Maxime Coste
efc069b531 Extract IncrementalInserter::Mode as InsertMode
move ClientMode classes in a namespace due to InsertMode name collisions
2012-09-26 14:22:24 +02:00
Maxime Coste
f76323f56e Move UserInterface out of Client into Context 2012-09-26 14:13:04 +02:00
Maxime Coste
a312ce6dc2 extract Client virtual methods to a UserInterface class 2012-09-24 19:24:27 +02:00
Maxime Coste
b3c4912404 Use context.editor() instead of context.window() when a window is not needed 2012-09-24 13:56:39 +02:00
Maxime Coste
5cf947f845 Add a ColorRegistry class responsible of color parsing and supporting aliases
colalias command permits to define names for color pairs
2012-09-17 19:01:13 +02:00
Maxime Coste
b5a2901f8d add 'r' for replacing selection with next typed char 2012-09-11 14:01:41 +02:00
Maxime Coste
82a2bb37e7 Remove runtime command, use shell expansion to source files in rc dir.
With the help of a new kak_runtime env var.
2012-09-10 20:10:18 +02:00
Maxime Coste
ae76b7dddc Add support for shell script parameters
Now %sh{ ... } can access positional parameters through
standard shell construct, allowing simple handling of variable
parameters.

def command accepts -shell-params flag to use this facility.
2012-09-09 17:10:53 +02:00
Maxime Coste
46565723b1 Add support for page up and page down 2012-09-07 21:09:23 +02:00
Maxime Coste
287628ec19 Editor::{select,move_cursor} takes a enum SelectMode parameter instead of a boolean 2012-09-07 14:29:29 +02:00
Maxime Coste
bf42d77469 Handle inserting in Client::InsertMode 2012-09-05 14:27:14 +02:00
Maxime Coste
bdaa083c88 Factor select to next char commands using Client::on_next_key 2012-09-05 00:30:59 +02:00
Maxime Coste
737ee8af24 use on_next_key in do_go and do_select_object 2012-09-05 00:21:42 +02:00
Maxime Coste
b08d8719e6 move input handling, including menu and prompt, to the Client class 2012-09-03 14:22:02 +02:00
Maxime Coste
bbce6b22a3 remove regex.hh, define Regex directly in string.hh 2012-08-29 21:49:36 +02:00
Maxime Coste
00d32fd392 main: EventManager should be destroyed after the Buffers 2012-08-29 00:11:16 +02:00
Maxime Coste
ab47b72dc8 add a poll based EventManager and use it for ncurse client update 2012-08-28 22:32:15 +02:00
Maxime Coste
1833cb4dcf use a separate context for kakrc execution 2012-08-28 14:10:44 +02:00
Maxime Coste
0d8cce2728 use a strongly typed int LineCount for line counts 2012-08-22 23:33:52 +02:00
Maxime Coste
c6e8080426 do_go: some cleanups 2012-08-21 20:58:10 +02:00
Maxime Coste
26313a3f68 bind <a-c> to window::center_selection 2012-08-21 20:06:35 +02:00
Maxime Coste
c1fcc593a1 Store the current client in context 2012-08-15 22:36:45 +02:00
Maxime Coste
25a1a9c159 Fix do_pipe 2012-08-07 23:25:54 +02:00
Maxime Coste
718f62b6a3 support line and column in command line parameters 2012-08-07 14:00:47 +02:00
Maxime Coste
a38a9c3bf2 Commands take a mutable context, main_context is gone ! 2012-08-06 22:02:11 +02:00
Maxime Coste
a712dd5bbe Completions functions take a Context parameter 2012-08-06 21:37:43 +02:00
Maxime Coste
4dc9973288 Registers need a context to return their values 2012-08-05 20:13:41 +02:00
Maxime Coste
1ce2d3e302 cleanup keymap definition 2012-08-05 19:53:39 +02:00
Maxime Coste
0164d78c10 Use a context as parameter to keymap functions 2012-08-05 19:39:37 +02:00
Maxime Coste
6bd67c01cc refactor insertion and insertion replay functions 2012-07-27 10:22:33 +02:00
Maxime Coste
0e9b0c8b3a insert_char: remove 'ctrl-r %' handling, already provided by dynamic register 2012-07-25 14:29:51 +02:00
Maxime Coste
06dd3f8aad Add Editor::replace(memoryview) and bind alt-P to replace paste 2012-07-11 14:15:27 +02:00
Maxime Coste
dfbda951d3 support static and dynamic registers, add '%' (filename) and '.' (selection) registers 2012-06-29 18:37:17 +02:00
Maxime Coste
7aa533c049 simplify Register interface 2012-06-29 13:25:34 +02:00
Maxime Coste
9b6b6b6b17 Rename UI to Client 2012-06-28 14:11:43 +02:00
Maxime Coste
286462a2f6 Add Context::option_manager()
it returns the more specific option manager available
(window -> buffer -> global)
2012-06-28 14:01:37 +02:00
Maxime Coste
9c78453cb7 Context references buffer and window with a safe_ptr 2012-06-28 13:46:14 +02:00
Maxime Coste
70bd18e1f2 add kak_opt_.* environement variable retriever to access options from shell. 2012-06-27 14:28:43 +02:00
Maxime Coste
7fb49b183e ShellManager environment variable use a regex instead of an exact match
when a kakoune releated env var used in a shell command, the ShellManager
tries to match it with given regex and the first that matches calls its
value retriever.

For this to be useful, EnvVarRetrievers now also take the variable
name in its parameters.
2012-06-25 19:40:18 +02:00
Maxime Coste
fd8517f91e fix some warnings detected with clang 2012-06-05 13:33:02 +00:00
Maxime Coste
dc91f344f7 Reorder managers creation in main 2012-06-14 13:20:40 +00:00
Maxime Coste
67c6b6834e execute kakrc after creating an UI 2012-06-12 13:10:33 +00:00
Maxime Coste
6a416abae2 abstract ui functions in a UI base class 2012-06-05 23:15:19 +00:00
Maxime Coste
61bd77d529 fix compilation on MacOS 2012-06-05 13:31:14 +00:00
Maxime Coste
2c4bc5582a Alt-Space permits to remove a selection by index 2012-05-29 11:15:43 +00:00
Maxime Coste
3bfd774f49 Restore piping support.
Add a ShellManager::pipe method, which pipes a string into the
command. Not quite satisfied with this interface.
2012-05-29 10:39:03 +00:00
Maxime Coste
8fedbbf07b ShellManager::eval now takes an additional env_var map 2012-05-29 05:19:27 +00:00
Maxime Coste
56efb42962 add a selection environement variable to access the last selection content 2012-05-07 06:56:53 +00:00
Maxime Coste
ff86d9781d move commands to commands.{cc,hh} 2012-05-07 03:13:34 +00:00
Maxime Coste
55516af9d7 remove {add,rm}grouphl, go back to a -group arg in {add,rm}hl
more consistency, more shared code
2012-05-04 04:25:09 +00:00
Maxime Coste
7158aa00b7 use ShellManager in do_pipe 2012-05-03 07:33:13 +00:00
Maxime Coste
0c596a9d64 Add a ShellManager which handles executing shell commands
ShellManager provides shell commands with environement variable
to retrieve some internal values in the shell parameters.
2012-05-03 07:25:13 +00:00
Maxime Coste
2a291e6868 add an eval command which send it's arguments to the command evaluator 2012-05-03 07:24:27 +00:00
Maxime Coste
b8fe942dbb Implement our own String class in preparation to encoding support. 2012-04-14 01:23:20 +00:00
Maxime Coste
9337938403 replace std::string references with String 2012-04-14 01:17:09 +00:00
Maxime Coste
46c65fea10 Option name completion support 2012-04-03 18:25:27 +00:00
Maxime Coste
1d106fd31e add set{g,global,b,buffer,w,window} command to allow changing options 2012-04-03 14:04:02 +00:00
Maxime Coste
f3dd65fbf1 add an OptionManager class and use it to manage tabstops
OptionManager map names to options, and may delegate option resolution
to it's parent if it does not contains the asked for option. That way
Buffers can override global options, and Windows can override Buffer
options.
2012-04-03 13:39:20 +00:00
Maxime Coste
c8447658c0 fix tab insertion 2012-04-03 13:38:01 +00:00
Maxime Coste
9444c84b1c rename HooksManager to HookManager 2012-04-03 12:01:01 +00:00
Maxime Coste
a555e28b4e add basic unit tests run at startup 2012-03-21 19:27:36 +00:00
Maxime Coste
3dd96565b3 display modified buffers names when quit fails 2012-03-25 20:12:35 +00:00
Maxime Coste
cd615b35a2 generalize do_select_surrounding in do_select_object and add a whole word selector 2012-03-12 14:23:30 +00:00
Maxime Coste
c98657a512 fix some unitialized variable use (thanks valgrind) 2012-03-08 20:49:10 +00:00
Maxime Coste
782b557660 factor word and WORD selectors 2012-03-07 19:20:32 +00:00
Maxime Coste
8275fe30f9 support appending with search 2012-02-28 20:50:47 +00:00
Maxime Coste
c03506ca04 save and restore " and / registers in exec_keys 2012-02-27 19:51:30 +00:00
Maxime Coste
13d74414e1 fix exec_commands_in_file parsing of [\'"`] strings 2012-02-27 14:25:07 +00:00
Maxime Coste
7026693ecd move ncurses function to ncurses.{cc,hh} 2012-02-16 14:25:16 +00:00
Maxime Coste
6aacebd2e0 Add an echo command which print it's params in the status line 2012-02-15 14:24:52 +00:00
Maxime Coste
e9af61eb9f def command takes an optional argument for parameter policy
-env-params puts parameters in kak_param{0..9}
-append-params appends parameters to the ones defined in the command
2012-02-15 13:58:08 +00:00
Maxime Coste
03976e0a01 edit command supports optional line and column parameter 2012-02-13 21:54:30 +00:00
Maxime Coste
3019ce3d3c edit command switch to the given buffer if it is already opened
use edit! (or e!) to force reloading of the buffer
2012-02-13 21:48:16 +00:00
Maxime Coste
3273551665 add 'def' command to define new user commands 2012-02-13 21:40:09 +00:00
Maxime Coste
5f86941b8f support multiline strings when executing file commands 2012-02-13 21:39:41 +00:00
Maxime Coste
2c8a6ca56a Support shell commands expansion in CommandManager 2012-02-13 21:38:07 +00:00
Maxime Coste
9304e41326 support register access through ctrl-r in ncurses_prompt 2012-02-13 13:37:41 +00:00
Maxime Coste
333b470dd2 giving a count to paste selects which selections yank buffer to use
3p will paste using the yank buffer of the third selection instead
of each selection using it's own.
2012-02-10 14:00:21 +00:00
Maxime Coste
d84d085cc2 Merge captures into registers, implements register insertion 2012-02-09 23:47:55 +00:00
Maxime Coste
04a37d8895 Editor refactoring, merge undo and batch management 2012-02-07 23:41:10 +00:00
Maxime Coste
333e87dedd add a Register class, registers can now contain a list of string
That way, registers can be used to store per selection data
2012-02-07 23:01:02 +00:00
Maxime Coste
9b5e9ffee2 selectors now take a Selection as parameter instead of a BufferIterator 2012-02-07 14:26:51 +00:00
Maxime Coste
1e5d930f35 extract exec_keys function from exec_string 2012-02-07 13:35:41 +00:00
Maxime Coste
0483e951ad use memoryview instead of std::vector where applicable 2012-02-03 19:14:35 +00:00
Maxime Coste
96b167859a batches support in Editor, used by IncrementalInserter and exec_string
Editor groups all modification together in one undo group when batching.
nested batches are supported.
2012-02-03 13:55:22 +00:00
Maxime Coste
96101b4392 Use an Editor instead of a Window as much as possible 2012-02-02 20:48:03 +00:00
Maxime Coste
69d96c90da extract an Editor class from Window and refactor 2012-01-31 19:12:06 +00:00
Maxime Coste
3ef9895a97 Buffer: support creation of temporary windows to apply commands when no windows are in context 2012-01-31 14:03:10 +00:00
Maxime Coste
830d96f7a1 Buffer: add NewFile buffer type for buffer with an non existing yet file 2012-01-31 14:01:48 +00:00
Maxime Coste
73a8950e73 File: parse_filename function which handle ~ and environment variable in filenames 2012-01-29 22:24:43 +00:00
Maxime Coste
589b8e68bb history support in prompt 2012-01-25 22:32:17 +00:00
Maxime Coste
6411193f10 SelectionHighlighter: reverse color of the last char of each selection
the terminal cursor is now longer shown
2012-01-25 20:22:33 +00:00
Maxime Coste
d1c29d2b78 moving no longer clears multiple selections 2012-01-25 14:23:02 +00:00
Maxime Coste
81138b224f fix line break support in insert_char 2012-01-24 23:19:26 +00:00
Maxime Coste
381d884c16 use a settable get_key function to be able to override key reading 2012-01-24 23:18:59 +00:00
Maxime Coste
1fd8ec8bfd support Ctrl-R <reg> when inserting to insert a register 2012-01-24 19:08:57 +00:00
Maxime Coste
a62d56064f replace ncurses getch calls with a get_key method 2012-01-23 14:17:31 +00:00
Maxime Coste
a1ff9999f5 the hook command takes a first parameter to specify the hook owner
currently 'global' and 'window' are accepted owners. 'window' will
add the hook to the current context window.
2012-01-23 13:58:43 +00:00
Maxime Coste
945ad361fb HooksManager: forward declare Context instead of including context.hh 2012-01-23 13:56:43 +00:00
Maxime Coste
db9040e29e HooksManager: extract the Singleton version as GlobalHooksManager 2012-01-23 13:40:42 +00:00
Maxime Coste
73ae3d292f implement finding kak executable path on MacOS 2012-01-20 21:12:57 +00:00
Maxime Coste
2824bd9a46 HighlighterGroup: move to it's own file, Window uses them directly 2012-01-19 20:37:29 +00:00
Maxime Coste
541872cafa completion support for addgrouphl and rmgrouphl 2012-01-18 11:33:58 +00:00
Maxime Coste
cffdbcb689 replace addhl -group with addgrouphl command, and add rmgrouphl 2012-01-18 00:15:10 +00:00
Maxime Coste
ae8882b0de Context: do not permit access to window or buffer if null 2012-01-15 21:33:35 +00:00
Maxime Coste
c62b3b251d add a runtime command to execute files in the runtime directory 2012-01-15 17:34:05 +00:00
Maxime Coste
f3e8498a58 addhl supports a -group option
-group <group_id> can be used to add the highlighter in a
highlighter group which will be then handled as a whole.
2012-01-15 13:47:12 +00:00
Maxime Coste
f259af9326 CommandManager: add flags support and IgnoreSemiColons flag
commands are now registred with flags, and the IgnoreSemiColons
flag permit to specify a command which needs all the parameters
on the line, bypassing the command sequence operator ';'.

the hook command is tagged as such.
2012-01-15 03:02:08 +00:00
Maxime Coste
49ea6f7103 correctly clear the window status line 2012-01-15 01:45:23 +00:00
Maxime Coste
95db828e17 CommandManager: use directly first command parameter as the command name 2012-01-14 14:02:54 +00:00
Maxime Coste
66d91b8828 support '\' as a line continuation marker when executing commands in file 2012-01-14 13:50:45 +00:00
Maxime Coste
9557167f26 <space> with a count argument replaces current selections with the counth selection. 2012-01-09 14:28:01 +00:00
Maxime Coste
8b1b1d9cd8 Selectors: add select_surrounding to select blocks
Alt-a followed by []()<>{}bB selects the block surrounding current
selection end.

Alt-i is similar but selects only the inside of the block.
2012-01-04 14:18:08 +00:00
Maxime Coste
e59bdd931e search for kakrc next to the kak executable instead of in the current directory 2011-12-28 22:57:48 +00:00
Maxime Coste
4de41197c0 Add a | key that pipes each selection through an external filter 2011-12-28 19:04:06 +00:00
Maxime Coste
913ee3f096 Use Keys instead of char for keymap 2011-12-21 14:29:28 +00:00
Maxime Coste
ba1fe056f4 Add an exec command, similar to vim normal command 2011-12-20 19:22:05 +00:00
Maxime Coste
2239fb6e49 Filters: move from buffer to window 2011-12-07 14:29:10 +00:00
Maxime Coste
23eafd4504 Add a repeat last insert command, bound to . 2011-12-05 14:28:45 +00:00
Maxime Coste
c761420055 fix exec_commands_in_file 2011-12-02 19:00:37 +00:00
Maxime Coste
94d59cc4dd Buffer: add filter support
filters are functions called prior to applying a modification
to a buffer. They can manipulate the modification to change
the editor behaviour.
2011-12-02 14:28:27 +00:00
Maxime Coste
934e62b502 stop clearing selections all the time 2011-11-30 14:18:54 +00:00
Maxime Coste
0859b20bcf Rename Filter to Highlighter to be more explicit 2011-11-29 22:37:20 +00:00
Maxime Coste
46a01b5a0b Debug: stop writing key codes to debug buffer and cleanups 2011-11-28 18:52:29 +00:00
Maxime Coste
70e0393c4d Add a source command to execute commands from file
a kakrc file in current directory is sourced automatically
at start
2011-11-27 12:59:59 +00:00
Maxime Coste
b59a0816b9 Add wq and wq! commands 2011-11-26 19:11:24 +00:00
Maxime Coste
a00961da99 Add hook command 2011-11-26 18:41:55 +00:00
Maxime Coste
957446dee4 Add a Context parameter to commands 2011-11-26 18:32:57 +00:00
Maxime Coste
9775958012 Add a HooksManager class 2011-11-25 14:26:29 +00:00
Maxime Coste
d27aaab066 use alt-x instead of , to select whole lines 2011-11-22 14:31:20 +00:00
Maxime Coste
a1200aacad Add alt-j command to join lines 2011-11-22 14:24:50 +00:00
Maxime Coste
7861ad9ddb Selectors: add split_selection bound to Alt-s 2011-11-21 19:30:44 +00:00
Maxime Coste
b67c36358d Extract RegexSelector methods as plain selectors 2011-11-21 19:08:51 +00:00
Maxime Coste
2677fa7961 Add , to fully selects lines selection is on. 2011-11-21 18:53:22 +00:00
Maxime Coste
18913cfbff IncrementalInserter: add insert_capture method bound to ^B<num> 2011-11-16 19:24:37 +00:00
Maxime Coste
b1e815a66c RegexSelector: support multi selections, bound to s key 2011-11-16 14:06:01 +00:00
Maxime Coste
d1868e8f07 ncurses: set ESCDELAY to 25 so that esc key lag is less noticeable 2011-11-15 14:26:28 +00:00
Maxime Coste
a3b5c74512 remove unused code 2011-11-14 14:27:33 +00:00
Maxime Coste
0dc8442ca4 Completions: add filterid completion for rmfilter 2011-11-12 14:15:35 +00:00
Maxime Coste
a8b2c4f568 Completions: add basic addfilter completion 2011-11-12 14:08:05 +00:00
Maxime Coste
f5ad32f137 Completion: decentralise, move buffer name completion to BufferManager 2011-11-12 14:06:49 +00:00
Maxime Coste
82baa55eed Completions: change NullCompletion functor to complete_nothing function 2011-11-10 20:57:25 +00:00
Maxime Coste
f12929abad Filters: refactoring 2011-11-09 23:56:22 +00:00
Maxime Coste
5aeee719dd fix launching on new file 2011-11-09 14:17:46 +00:00
Maxime Coste
3af1b89034 Window: support adding and removing filters with :addfilter :rmfilter 2011-11-08 14:29:52 +00:00