53 Commits

Author SHA1 Message Date
Ingo Karkat dcb9bcadc4 ingo#buffer#{scratch,generate}#Create(): ENH: Support "pedit" as a:windowOpenCommand 2022-06-20 22:22:44 +02:00
Ingo Karkat fdf1af342b generate: Cosmetics: Simplify dependencies, fix whitespace 2022-06-20 22:18:16 +02:00
Ingo Karkat 51703e0f5f Add ingo#buffer#network#Read() 2021-08-07 18:05:18 +02:00
Ingo Karkat e05d083dd7 ingo#buffer#scratch#CreateWithWriter(): Nicer output of write errors
Because the write action is executed inside the ingo#actions#ExecuteOrFunc(), an ugly multi-line exception will be printed. We shouldn't use :echoerr here, because then Vim will prepend a line about the failing :autocmd, which is an implementation detail here. So use plain :echomsg.
2019-08-09 14:18:07 +02:00
Ingo Karkat db4ffeabf1 Refactoring: Define l:record instead of individual variables, rename b:IngoLibrary_scratch_converted
We can only assign to the (renamed) b:IngoLibrary_scratch_converted_record at the end inside the scratch buffer, but let's build the Dict already at the beginning, to avoid having so many individual variables.
2019-07-25 08:33:35 +02:00
Ingo Karkat 6865ebe974 ENH: Use reserved marks instead of change marks to allow parallel editing 2019-07-24 19:02:49 +02:00
Ingo Karkat 6b208d04ab Default a:options.isShowDiff to true only if the entire buffer is being edited 2019-07-24 18:21:06 +02:00
Ingo Karkat 8d7d402433 ENH: Support editing of a buffer subrange in a scratch buffer as a different filetype 2019-07-24 18:17:27 +02:00
Ingo Karkat 567e525f55 ingo#buffer#scratch#converted#Create(): Keep original 'modified' state after toggling 2019-07-24 15:28:23 +02:00
Ingo Karkat 0515aaf2f8 ingo#buffer#scratch#converted#Create(): CHG: Default toggle mapping to <LocalLeader><LocalLeader> 2019-07-24 15:27:46 +02:00
Ingo Karkat 5183557860 Add ingo#buffer#scratch#converted#Create() to convert buffer contents to a scratch buffer with the possibility to sync back and ingo#ftplugin#converter#builder#EditAsFiletype() that can be used by filetype plugins to edit one filetype in an intermediate different format 2019-07-24 15:04:16 +02:00
Ingo Karkat 77615dcddf Documentation: Suggest using :bwipe instead of :close 2019-07-24 15:01:00 +02:00
Ingo Karkat 09b27ebf26 ingo#buffer#scratch#CreateWithWriter(): FIX: Need to actually configure a non-writable scratch buffer, too 2019-07-24 11:28:37 +02:00
Ingo Karkat 92112e713a ENH: Also support Funcref a:contentsCommand / a:scratchCommand for ingo#buffer#generate#Create() and ingo#buffer#scratch#Create\[WithWriter]() 2019-07-24 11:01:00 +02:00
Ingo Karkat ba5cf6b671 ingo#buffer#scratch#CreateWithWriter(): Support empty a:Writer 2019-07-23 22:17:28 +02:00
Ingo Karkat 5d8268c7dd Add optional a:NextFilenameFuncref to ingo#buffer#scratch#Create\[WithWriter]() 2019-07-23 21:48:32 +02:00
Ingo Karkat 7a786d435f Add ingo#buffer#scratch#CreateWithWriter(), a variant of ingo#buffer#scratch#Create() that supports custom persistence 2019-07-10 16:15:41 +02:00
Ingo Karkat 6f07b8147b Refactoring: Use ingo#change#Set() for updating last changed area 2019-04-02 12:01:13 +02:00
Ingo Karkat 3b9ec44bef Add ingo#buffer#locate#OtherWindowWithSameBuffer() 2018-10-30 17:00:40 +01:00
Ingo Karkat 4dbef979b1 Add ingo/buffer/ephemeral.vim module 2018-04-27 15:02:52 +02:00
Ingo Karkat 0cba2f4395 Complete separation of buffer#generate from buffer#scratch
Failing tests (WriteBackup/writebackupVewDiffDaysChanges001.vim) alerted me that the implementation is stil incomplete.
ingo#buffer#generate#Create() needs to take an additional a:NextFilenameFuncref argument instead of invoking non-existent ingo#buffer#generate#NextFilename().
ingo#buffer#scratch#NextFilename() needs to invoke ingo#buffer#generate#NextBracketedFilename(), not the eponymous function in its own module.
2017-10-09 11:20:43 +02:00
Ingo Karkat f6e2720334 FIX: Must not :set readonly if no scratch contents
The previous split of ingo#buffer#generate#Create() subtly changed the behavior with empty scratch contents. We must not :setlocal readonly if the scratch buffer is still empty.
Add a:isInitialized argument to ingo#buffer#scratch#SetLocal().
2017-09-11 14:19:49 +02:00
Ingo Karkat f43f89e093 Split off generic ingo#buffer#generate#Create() from ingo/buffer/scratch.vim
This allows reuse for non-scratch buffer creation; i.e. where the buftype / readonly stuff isn't needed. Also, the code is easier to understand now that the two concepts are separated.
2017-09-10 12:02:20 +02:00
Ingo Karkat 466bd46c33 ENH: ingo#buffer#scratch#Create(): Allow to set the scratch buffer contents + directly by passing a List as a:scratchCommand 2017-09-09 21:21:53 +02:00
Ingo Karkat ed53ce9b33 Cosmetics: Fix typo in revision history dates 2017-05-26 22:14:22 +02:00
Ingo Karkat 24668aa871 2017-05-26 17:55:02 +02:00
Ingo Karkat 0381aae7c0 FIX: Correct delegation in ingo#buffer#temp#Execute(); wrong recursive call was used (after 1.027)
ENH: Add optional a:isSilent argument to ingo#buffer#temp#Execute().
2017-05-26 17:54:58 +02:00
Ingo Karkat e3bba666c6 2017-05-26 17:51:03 +02:00
Ingo Karkat a3f5c5c9ac Also prefer current / previous window in other tab pages 2017-05-26 17:51:00 +02:00
Ingo Karkat 6eb42d517e file creation 2017-05-26 17:51:00 +02:00
Ingo Karkat 9537eacb2a 2017-05-26 17:50:54 +02:00
Ingo Karkat 33716e8bc7 FIX: Correct delegation in ingo#buffer#temp#Execute(); wrong recursive call was used (after 1.027)
Add ingo#buffer#temp#ExecuteWithText() and ingo#buffer#temp#CallWithText() variants that pre-initialize the buffer (a common use case).
2017-05-26 17:50:50 +02:00
Ingo Karkat 055f09649b 2017-05-26 17:49:55 +02:00
Ingo Karkat 9cdc62e5ee FIX: Temporarily reset 'switchbuf' in ingo#buffer#visible#Execute(), to avoid that "usetab" switched to another tab page 2017-05-26 17:47:51 +02:00
Ingo Karkat 12ea200cb8 ENH: Add optional a:isReturnAsList flag to ingo#buffer#temp#Execute() and ingo#buffer#temp#Call() 2017-05-26 17:47:46 +02:00
Ingo Karkat 8640585a2a ingo#buffer#visible#Execute(): Restore the window layout when the buffer is visible but in a window with 0 height / width
And restore the previous window when the buffer isn't visible yet. Add a check that the command hasn't switched to another window (and go back if true) before closing the split window.
2017-05-26 17:47:44 +02:00
Ingo Karkat 88605e1568 Simplify ingo#buffer#temprange#Execute() by using changenr()
Keep using ingo#undo#GetChangeNumber() because we need to create a new no-op change when there was a previous :undo.
2017-05-26 17:36:21 +02:00
Ingo Karkat f5dbbe9821 BUG: ingo#buffer#scratch#Create() with existing scratch buffer yields "E95: Buffer with this name already exists" instead of reusing the buffer
Use new a:isFile flag to ingo#escape#file#bufnameescape() and set a:isFullMatch to 1 instead of emulating the full-match for non-existing scratch buffers.
Keep current cursor position when ingo#buffer#scratch#Create() removes the first empty line in the scratch buffer.
2017-05-26 17:36:08 +02:00
Ingo Karkat b3723b93fd 2017-05-26 17:33:59 +02:00
Ingo Karkat 2b20b89684 BUG: ingo#buffer#scratch#Create() with existing scratch buffer yields "E95: Buffer with this name already exists" instead of reusing the buffer
Use new a:isFile flag to ingo#escape#file#bufnameescape() and set a:isFullMatch to 1 instead of emulating the full-match for non-existing scratch buffers.
2017-05-26 17:33:43 +02:00
Ingo Karkat 2944addc49 2017-05-26 17:33:14 +02:00
Ingo Karkat 0b601c39d9 Use :close! in ingo#buffer#visible#Execute() to handle modified buffers when :set nohidden, too
ENH: Keep previous (last accessed) window on ingo#buffer#visible#Execute().
2017-05-26 17:33:08 +02:00
Ingo Karkat 118c07b929 file creation 2017-05-26 17:32:55 +02:00
Ingo Karkat 0fc8cb1b89 Name the temp buffer for ingo#buffer#temp#Execute() and re-use previous instances to avoid increasing the buffer numbers and output of :ls! 2017-05-26 17:32:15 +02:00
Ingo Karkat bde794cb99 ingo#buffer#temprange#Execute(): Replace ingo#undo#GetChangeNumber() with the built-in changenr() 2017-05-26 17:30:02 +02:00
Ingo Karkat 9635e918ac Factor out ingo#undo#GetChangeNumber() 2017-05-26 17:29:58 +02:00
Ingo Karkat dcca859af7 2017-05-26 17:28:33 +02:00
Ingo Karkat 2bc89c09c9 Add optional a:undoCnt argument 2017-05-26 17:28:26 +02:00
Ingo Karkat e504d8db0c 2017-05-26 17:28:26 +02:00
Ingo Karkat 023ae549f2 file creation 2017-05-26 17:28:26 +02:00