Skip to content

Commit 6b920eb

Browse files
authored
Merge branch 'master' into support_sheband_and_tangle_mode_header_tag
2 parents 717bb80 + 15d66ea commit 6b920eb

7 files changed

Lines changed: 40 additions & 14 deletions

File tree

doc/orgmode.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ Determine whether properties of one headline are inherited by sub-headlines.
600600
- `string` - only properties matching the given regex are inherited
601601

602602
Note that for a select few properties, the inheritance behavior is hard-coded
603-
withing their special applications. See Property Inheritance
603+
within their special applications. See Property Inheritance
604604
<https://orgmode.org/manual/Property-Inheritance.html> for details.
605605

606606

@@ -623,8 +623,8 @@ Available options:
623623
- `0` - start week on Sunday
624624
- `1` - start week on Monday
625625

626-
Determine on which day the week will start in calendar modal
627-
(ex:|orgmode-changing-the-date-under-cursor|)
626+
Determine on which day the week will start in calendar modal (ex:
627+
|orgmode-changing-the-date-under-cursor|)
628628

629629

630630
emacs_config *orgmode-emacs_config*
@@ -789,7 +789,7 @@ org_agenda_sorting_strategy *orgmode-org_agenda_sorting_strategy*
789789

790790
- Type:
791791

792-
`table<'agenda' | 'todo' | 'tags', OrgAgendaSortingStrategy[]><`
792+
`table<'agenda' | 'todo' | 'tags', OrgAgendaSortingStrategy[]>`
793793

794794
- Default:
795795

docs/configuration.org

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ Determine whether properties of one headline are inherited by sub-headlines.
544544
- =string[]= - only the properties named in the given list are inherited
545545
- =string= - only properties matching the given regex are inherited
546546

547-
Note that for a select few properties, the inheritance behavior is hard-coded withing their special applications.
547+
Note that for a select few properties, the inheritance behavior is hard-coded within their special applications.
548548
See [[https://orgmode.org/manual/Property-Inheritance.html][Property Inheritance]] for details.
549549

550550
*** org_babel_default_header_args
@@ -566,7 +566,7 @@ Available options:
566566
- =0= - start week on Sunday
567567
- =1= - start week on Monday
568568

569-
Determine on which day the week will start in calendar modal (ex:[[#org_change_date][changing the date under cursor]])
569+
Determine on which day the week will start in calendar modal (ex: [[#org_change_date][changing the date under cursor]])
570570

571571
*** emacs_config
572572
:PROPERTIES:
@@ -736,7 +736,7 @@ These arguments are shared between all of the agenda types:
736736
:CUSTOM_ID: org_agenda_sorting_strategy
737737
:END:
738738
- Type:
739-
=table<'agenda' | 'todo' | 'tags', OrgAgendaSortingStrategy[]><=
739+
=table<'agenda' | 'todo' | 'tags', OrgAgendaSortingStrategy[]>=
740740
- Default:
741741
~{ agenda = {'time-up', 'priority-down', 'category-keep'}, todo = {'priority-down', 'category-keep'}, tags = {'priority-down', 'category-keep'}}~
742742
List of sorting strategies to apply to a given view. Available

docs/index.org

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ To view this documentation offline in Neovim, run =:Org help=. More info in [[#g
2626
end,
2727
}
2828
#+end_src
29-
- Capture youf first note with =<leader>oc=
29+
- Capture your first note with =<leader>oc=
3030
- Open up the prompt for agenda with =<leader>oa=
3131

3232
For more details about the installation and usage, check [[./installation.org][Installation page]].

ftplugin/org.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,9 @@ vim.b.undo_ftplugin = table.concat({
7171
'indentkeys<',
7272
'| unlet! b:org_tmp_edit_window',
7373
}, ' ')
74+
75+
-- Manually attach Snacks.image module to ensure that images are shown.
76+
-- Snacks usually handles this automatically, but if Orgmode plugin is loaded after Snacks, it will not pick it up.
77+
if vim.tbl_get(_G, 'Snacks', 'image', 'config', 'enabled') and vim.tbl_get(_G, 'Snacks', 'image', 'config', 'doc', 'enabled') then
78+
require('snacks.image.doc').attach(bufnr)
79+
end

lua/orgmode/org/indent.lua

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ local function get_indent_for_match(matches, linenr, mode, bufnr)
6262
end
6363
return indent
6464
end
65-
if mode:match('^[iR]') and prev_line_match.type == 'listitem' and linenr - prev_linenr < 3 then
66-
-- In insert mode, we also count the non-listitem line *after* a listitem as
65+
-- node type is nil while inserting!
66+
local is_inserting = (not match.type) or mode:match('^[iR]')
67+
if is_inserting and prev_line_match.type == 'listitem' and linenr - prev_linenr < 3 then
68+
-- While inserting, we also count the non-listitem line *after* a listitem as
6769
-- part of the listitem. Keep in mind that double empty lines end a list as
6870
-- per Orgmode syntax.
6971
--
@@ -217,6 +219,9 @@ local get_matches = ts_utils.memoize_by_buf_tick(function(bufnr)
217219
end
218220
elseif type == 'paragraph' or type == 'drawer' or type == 'property_drawer' then
219221
opts.indent_type = 'other'
222+
for i = range.start.line, range['end'].line - 1 do
223+
matches[i + 1] = opts
224+
end
220225
end
221226
end
222227

@@ -254,9 +259,7 @@ local function indentexpr(linenr, bufnr)
254259
end
255260

256261
local indentexpr_cache = buf_indentexpr_cache[bufnr] or { prev_linenr = -1 }
257-
if indentexpr_cache.prev_linenr ~= linenr - 1 or not mode:lower():find('n') then
258-
indentexpr_cache.matches = get_matches(bufnr)
259-
end
262+
indentexpr_cache.matches = get_matches(bufnr)
260263

261264
-- Treesitter failed to parse the document (due to errors or missing tree)
262265
-- So we just fallback to autoindent

queries/org/images.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(link url: (expr) @image.src
22
(#gsub! @image.src "^file:" "")
3-
(#match? @image.src "(png|jpg|jpeg|gif|bmp|webp|tiff|heic|avif|mp4|mov|avi|mkv|webm|pdf)$")
3+
(#match? @image.src "(png|jpg|jpeg|gif|bmp|webp|tiff|heic|avif|mp4|mov|avi|mkv|webm|pdf|svg)$")
44
)
55

66
(block

tests/plenary/org/indent_spec.lua

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,19 @@ local function test_add_line_breaks_to_existing_file()
237237
expect_whole_buffer(expected)
238238
end
239239

240+
local function test_insertion_from_normal_mode()
241+
helpers.create_file({ '- first item' })
242+
vim.cmd([[normal! o]])
243+
local user_input = vim.api.nvim_replace_termcodes('i- second item<Esc>ocontent', true, true, true)
244+
vim.api.nvim_feedkeys(user_input, 'ntix', false)
245+
local expected = {
246+
'- first item',
247+
'- second item',
248+
' content',
249+
}
250+
expect_whole_buffer(expected)
251+
end
252+
240253
-- The actual tests are here.
241254

242255
describe('with "indent",', function()
@@ -259,6 +272,10 @@ describe('with "indent",', function()
259272
it('adding line breaks to list items maintains indent', function()
260273
test_add_line_breaks_to_existing_file()
261274
end)
275+
276+
it('inserting content from nomral mode is well indented', function()
277+
test_insertion_from_normal_mode()
278+
end)
262279
end)
263280

264281
describe('with "noindent",', function()

0 commit comments

Comments
 (0)