this repo has no description
at main 100 lines 2.6 kB view raw view rendered
1# VCMarkers.nvim 2 3Plugin that handles diff markers. Supports jj style diffs and diff3. 4 5When started, the processing of diff markers will continue to auto-update until 6there are no more diff markers in the file. By default the plugin tries to 7start tracking on buffer load, but if needed tracking can also be manually 8controlled using 9``` 10VCMarkers start 11VCMarkers stop 12``` 13 14## Features 15 16For all diff styles 17 18* Diff marker highlighting. 19* Navigation between markers. 20 * `VCMarkers next_marker` 21 * `VCMarkers prev_marker` 22* Fold everything except markers + context. 23 * `VCMarkers fold` 24* "Select" the current section and replace the marker with it. 25 * `VCMarkers select` 26 27For jj style diffs 28 29* Cycle through diff representations. 30 * `VCMarkers cycle` 31* Handling of jj 0.37 `\\\\\\\` section header continuation. 32 * Handled for both basic highlighting and cycling. 33 34E.g. snapshot first 35```diff 36<<<<<<< Conflict 1 of 1 37+++++++ Contents of side #1 38HELLO 39%%%%%%% Changes from base to side #2 40-hello 41+hi 42>>>>>>> Conflict 1 of 1 ends 43``` 44into snapshot second 45``` 46<<<<<<< Conflict 1 of 1 47%%%%%%% Changes from base to side #1 48-hello 49+HELLO 50+++++++ Contents of side #2 51hi 52>>>>>>> Conflict 1 of 1 ends 53``` 54into snapshot all 55``` 56<<<<<<< Conflict 1 of 1 57+++++++ Contents of side #1 58HELLO 59------- Contents of base 60hello 61+++++++ Contents of side #2 62hi 63>>>>>>> Conflict 1 of 1 ends 64``` 65and then back to snapshot first. 66 67### Not yet implemented 68 69* Documentation. 70 71## Flashy screenshots or recordings? 72TBD, maybe. 73 74## Example config 75For the documented default config, have a look inside `init.lua`. 76 77### Lazy 78Example configuration 79``` 80{ 81 'algmyr/vcmarkers.nvim', 82 config = function() 83 require('vcmarkers').setup {} 84 85 local function map(mode, lhs, rhs, desc, opts) 86 local options = { noremap = true, silent = true, desc = desc } 87 if opts then options = vim.tbl_extend('force', options, opts) end 88 vim.keymap.set(mode, lhs, rhs, options) 89 end 90 91 map('n', '<space>m]', function() require('vcmarkers').actions.next_marker(0, vim.v.count1) end, 'Go to next marker') 92 map('n', '<space>m[', function() require('vcmarkers').actions.prev_marker(0, vim.v.count1) end, 'Go to previous marker') 93 map('n', '<space>ms', function() require('vcmarkers').actions.select_section(0) end, 'Select the section under the cursor') 94 map('n', '<space>mf', function() require('vcmarkers').fold.toggle(0) end, 'Fold outside markers') 95 map('n', '<space>mc', function() require('vcmarkers').actions.cycle_marker(0) end, 'Cycle marker representations') 96 end, 97} 98``` 99 100As per https://lazy.folke.io/packages dependencies are specified in `lazy.lua`.