nvim: Add scratchpad item to start screen
Added an item to quickly create a scratchpad to the mini.starter template. The difference to opening a default empty buffer is that it is seen as ephemeral (i.e. will not complain if you close vim without saving) and it sets the default filetype to markdown. Closes 753ed1f.
This commit is contained in:
parent
01809f1ee5
commit
19c95400f7
2 changed files with 8 additions and 3 deletions
|
@ -6,7 +6,7 @@ appear in the buffer list. Useful for e.g. jotting down quick notes and thoughts
|
|||
If called with bang, will replace the current buffer with the scratch
|
||||
window, otherwise opens a new split.
|
||||
|
||||
The buffer, by default is set to the pandoc filetype.
|
||||
The buffer, by default is set to the markdown filetype.
|
||||
This can be changed by setting the `g:scratchpad_ft` variable or the `b:scratchpad_ft`
|
||||
variable to the intended filetype.
|
||||
]]
|
||||
|
@ -25,9 +25,9 @@ function M.create(split, ft)
|
|||
else
|
||||
split = true
|
||||
end
|
||||
-- which filetype to set for the scratchpad, defaults to pandoc
|
||||
-- which filetype to set for the scratchpad, defaults to markdown
|
||||
if isempty(ft) then
|
||||
ft = vim.b["scratchpad_ft"] or vim.g["scratchpad_ft"] or "pandoc"
|
||||
ft = vim.b["scratchpad_ft"] or vim.g["scratchpad_ft"] or "markdown"
|
||||
end
|
||||
|
||||
local buf = api.nvim_create_buf(false, true)
|
||||
|
|
|
@ -173,6 +173,11 @@ return {
|
|||
evaluate_single = true,
|
||||
items = {
|
||||
starter.sections.builtin_actions(),
|
||||
{
|
||||
name = "Scratchpad",
|
||||
action = "lua require('personal.scratchpad').create()",
|
||||
section = "Builtin actions",
|
||||
},
|
||||
starter.sections.recent_files(10, true),
|
||||
starter.sections.recent_files(10, false),
|
||||
-- Use this if you set up 'mini.sessions'
|
||||
|
|
Loading…
Reference in a new issue