Skip to content

Commit

Permalink
diffview.nvim for resolving merge conflicts, hex values for ascii tab…
Browse files Browse the repository at this point in the history
…le and misc things
  • Loading branch information
matu3ba committed Feb 7, 2025
1 parent 6554cc3 commit 87847a2
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 48 deletions.
5 changes: 3 additions & 2 deletions .config/nvim/lua/my_fmt.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ if not has_conform then return end
local fmts_by_ft = {
-- lsp_format = 'never(default)|fallback|prefer|first|last'
-- cmake = { 'cmake_format' },
c = { 'clang-format' }, -- // clang-format off|on
cpp = { 'clang-format' }, -- // clang-format off|on
-- FIXME: looks broken on windows, so check yourself for .clang-format file
-- c = { 'clang-format' }, -- // clang-format off|on
-- cpp = { 'clang-format' }, -- // clang-format off|on
lua = { 'stylua' }, -- stylua: ignore start|end
-- python = { 'ruff_format' }, -- # fmt: off|on, # fmt: skip
rust = { 'rustfmt', lsp_format = 'prefer' },
Expand Down
28 changes: 20 additions & 8 deletions .config/nvim/lua/my_plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,24 @@ return {
},
--:DiffviewOpen, :DiffviewClose/tabclose, :DiffviewFileHistory
-- USAGE
--:DiffviewOpen origin/HEAD...HEAD --imply-local
--:DiffviewFileHistory --range=origin/HEAD...HEAD --right-only --no-merges
--:DiffviewFileHistory -g --range=stash
-- https://github.com/sindrets/diffview.nvim/blob/main/USAGE.md
-- np, nextprev file tab,s-tab cycle
-- cycle through diffs for modified files and git rev
-- view
-- * :DiffviewOpen origin/HEAD...HEAD --imply-local
-- * :DiffviewFileHistory --range=origin/HEAD...HEAD --right-only --no-merges
-- * :DiffviewFileHistory -g --range=stash
-- * https://github.com/sindrets/diffview.nvim/blob/main/USAGE.md
-- * np, nextprev file tab,s-tab cycle
-- * cycle through diffs for modified files and git rev
-- merge tools
-- * :DiffviewOpen during rebase/merge
-- * :h copy-diffs, :h diffview-conflict-versions, :h diffview-actions-conflict_choose
-- * target branch's version (OURS, left), to be merged branch (THEIRS, right).
-- * unclear usage 2do OURS, 3do THEIRS, 1do BASE
-- * hunk usage
-- <leader>co: Choose OURS version of conflict.
-- <leader>ct: Choose THEIRS version of conflict.
-- <leader>cb: Choose BASE version of conflict.
-- <leader>ca: Choose all versions of conflict (deletes markers leaving content)
-- dx: Choose none of versions of conflict (delete conflict region).
{ 'sindrets/diffview.nvim' },

-- idea { "axieax/urlview.nvim" } -- :Telescope urlview
Expand Down Expand Up @@ -286,7 +298,7 @@ return {
{ 'matu3ba/harpoon', dev = false }, -- <l> or ; [m|c|s]key=[j|k|l|u|i] mv|mc|mm, :CKey, :CCmd
-- { 'ThePrimeagen/harpoon' }, -- <l> or ; [m|c|s]key=[j|k|l|u|i] mv|mc|mm, :CKey, :CCmd
-- use instead track.nvim?
{ 'matu3ba/libbuf.nvim', dev = true },
-- { 'matu3ba/libbuf.nvim', dev = false }, TODO fixup
-- any benchmark against nvim-telescope/telescope-fzf-native.nvim ?
-- any way to place results in buffer?
-- git clone https://github.com/jake-stewart/jfind && cd jfind && cmake -S . -B build && cd build && make -j$(nproc) && sudo make install
Expand Down Expand Up @@ -324,7 +336,7 @@ return {
-- https://www.baeldung.com/linux/vim-drawit-ascii-diagrams
-- TODO open source ascii editor, ideally within neovim
-- inspiration https://monodraw.helftone.com/
{ 'jbyuki/venn.nvim', dev = true },
-- { 'jbyuki/venn.nvim', dev = false }, TODO fixup
-- idea { 'simnalamburt/vim-mundo' } to search undotree

-- TODO replacement with search
Expand Down
1 change: 1 addition & 0 deletions .config/shells/aliases_git
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ alias gcs='git rebase -i --autosquash'
# To ignore indentation changes in git diff, add -w
alias gd='git diff'
alias gdc='git diff --cached'
# Check for conflict markers: git diff --check
alias gdn='git --no-pager diff --name-only'
alias gdcn='git --no-pager diff --cached'
alias gds='git --no-pager diff --shortstat'
Expand Down
6 changes: 4 additions & 2 deletions scr/fetchNeovim.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,10 @@ IfExistDelDir "$HOME\.local\share\locale" $PWD
IfExistDelDir "$HOME\.local\share\man" $PWD
IfExistDelDir "$HOME\.local\share\nvim" $PWD

$zip_target = "nvim-windows-x86_64-0.12.0-e27f7125d66f6026adacbbad00bbf6e66a6ba883.zip"
$unzip_target = "nvim-windows-x86_64-0.12.0-e27f7125d66f6026adacbbad00bbf6e66a6ba883"
#testing
#$zip_target = "nvim-windows-x86_64-0.12.0-e27f7125d66f6026adacbbad00bbf6e66a6ba883.zip"
#$unzip_target = "nvim-windows-x86_64-0.12.0-e27f7125d66f6026adacbbad00bbf6e66a6ba883"

Write-Output "Unpacking $NEOVIM_TMP_DIR\$zip_target .."
New-Item -Path "$NEOVIM_TMP_DIR\$unzip_target" -ItemType Directory
CheckLastExitCode($PWD)
Expand Down
68 changes: 34 additions & 34 deletions templates/ascii
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
from https://www.cs.cmu.edu/~pattis/15-1XX/common/handouts/ascii.html
Dec Char Dec Char Dec Char Dec Char
--------- --------- --------- ----------
0 NUL (null) 32 SPACE 64 @ 96 `
1 SOH (start of heading) 33 ! 65 A 97 a
2 STX (start of text) 34 " 66 B 98 b
3 ETX (end of text) 35 # 67 C 99 c
4 EOT (end of transmission) 36 $ 68 D 100 d
5 ENQ (enquiry) 37 % 69 E 101 e
6 ACK (acknowledge) 38 & 70 F 102 f
7 BEL (bell) 39 ' 71 G 103 g
8 BS (backspace) 40 ( 72 H 104 h
9 TAB (horizontal tab) 41 ) 73 I 105 i
10 LF (NL line feed, new line) 42 * 74 J 106 j
11 VT (vertical tab) 43 + 75 K 107 k
12 FF (NP form feed, new page) 44 , 76 L 108 l
13 CR (carriage return) 45 - 77 M 109 m
14 SO (shift out) 46 . 78 N 110 n
15 SI (shift in) 47 / 79 O 111 o
16 DLE (data link escape) 48 0 80 P 112 p
17 DC1 (device control 1) 49 1 81 Q 113 q
18 DC2 (device control 2) 50 2 82 R 114 r
19 DC3 (device control 3) 51 3 83 S 115 s
20 DC4 (device control 4) 52 4 84 T 116 t
21 NAK (negative acknowledge) 53 5 85 U 117 u
22 SYN (synchronous idle) 54 6 86 V 118 v
23 ETB (end of trans. block) 55 7 87 W 119 w
24 CAN (cancel) 56 8 88 X 120 x
25 EM (end of medium) 57 9 89 Y 121 y
26 SUB (substitute) 58 : 90 Z 122 z
27 ESC (escape) 59 ; 91 [ 123 {
28 FS (file separator) 60 < 92 \ 124 |
29 GS (group separator) 61 = 93 ] 125 }
30 RS (record separator) 62 > 94 ^ 126 ~
31 US (unit separator) 63 ? 95 _ 127 DEL
Hex Dec Char Hex Dec Char Hex Dec Char Hex Dec Char
------------- ------------ --------- ----------
0 0 NUL (null) 20 32 SPACE 40 64 @ 60 96 `
1 1 SOH (start of heading) 21 33 ! 41 65 A 61 97 a
2 2 STX (start of text) 22 34 " 42 66 B 62 98 b
3 3 ETX (end of text) 23 35 # 43 67 C 63 99 c
4 4 EOT (end of transmission) 24 36 $ 44 68 D 64 100 d
5 5 ENQ (enquiry) 25 37 % 45 69 E 65 101 e
6 6 ACK (acknowledge) 26 38 & 46 70 F 66 102 f
7 7 BEL (bell) 27 39 ' 47 71 G 67 103 g
8 8 BS (backspace) 28 40 ( 48 72 H 68 104 h
9 9 TAB (horizontal tab) 29 41 ) 49 73 I 69 105 i
a 10 LF (NL line feed, new line) 2a 42 * 4a 74 J 6a 106 j
b 11 VT (vertical tab) 2b 43 + 4b 75 K 6b 107 k
c 12 FF (NP form feed, new page) 2c 44 , 4c 76 L 6c 108 l
d 13 CR (carriage return) 2d 45 - 4d 77 M 6d 109 m
e 14 SO (shift out) 2e 46 . 4e 78 N 6e 110 n
f 15 SI (shift in) 2f 47 / 4f 79 O 6f 111 o
10 16 DLE (data link escape) 30 48 0 50 80 P 70 112 p
11 17 DC1 (device control 1) 31 49 1 51 81 Q 71 113 q
12 18 DC2 (device control 2) 32 50 2 52 82 R 72 114 r
13 19 DC3 (device control 3) 33 51 3 53 83 S 73 115 s
14 20 DC4 (device control 4) 34 52 4 54 84 T 74 116 t
15 21 NAK (negative acknowledge) 35 53 5 55 85 U 75 117 u
16 22 SYN (synchronous idle) 36 54 6 56 86 V 76 118 v
17 23 ETB (end of trans. block) 37 55 7 57 87 W 77 119 w
18 24 CAN (cancel) 38 56 8 58 88 X 78 120 x
19 25 EM (end of medium) 39 57 9 59 89 Y 79 121 y
1a 26 SUB (substitute) 3a 58 : 5a 90 Z 7a 122 z
1b 27 ESC (escape) 3b 59 ; 5b 91 [ 7b 123 {
1c 28 FS (file separator) 3c 60 < 5c 92 \ 7c 124 |
1d 29 GS (group separator) 3d 61 = 5d 93 ] 7d 125 }
1e 30 RS (record separator) 3e 62 > 5e 94 ^ 7e 126 ~
1f 31 US (unit separator) 3f 63 ? 5f 95 _ 7f 127 DEL
16 changes: 16 additions & 0 deletions templates/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2788,6 +2788,22 @@ void use_try_emplace() {
(void)ec;
}


// template<typename Ty1>
// IWritableInterface<Ty1>* CreateNewWritableInterface(const std::string& sname) {
// using ObjInternalTy = typename CRegisterObj<Ty1>::InternalTy;
// auto * pNextFreeRegSlot = GetNextFreeSlot();
// return CRegisterObj<_ValueType>::template CreateRegisterObj<CWritableExtRegObj>(
// sname
// , reinterpret_cast<ObjInternalTy*>(pNextFreeRegSlot)
// );
// }

void use_template_template();
void use_template_template() {
// CreateNewWritableInterface<std::string>("test123");
}

#endif // HAS_CPP20

// SHENNANIGAN msvc custom predicate compiler messages may be horrible, for example if const is missing
Expand Down
21 changes: 21 additions & 0 deletions templates/common.zig
Original file line number Diff line number Diff line change
Expand Up @@ -843,5 +843,26 @@ test "@hasDecl" {
// @workItemId
// 23*5+1 => 116 builtins

// unreachable can be anything
// test {
// unreachable[0..5];
// unreachable[0..5] ** 3;
// unreachable(1, true, "foo");
// unreachable(1, true, "foo")[0..5];
// try unreachable(1, true, "foo");
// unreachable.*;
// unreachable.?;
// !unreachable;
// unreachable.enumField;
// unreachable.method();
// unreachable.field.method();
// for (unreachable) |_| {}
// while (unreachable) {}
// if (unreachable) {}
// switch (unreachable) {}
// defer unreachable;
// unreachable;
// }

// https://github.com/CTSRD-CHERI/qemu/tree/qemu-cheri
// nice comptime usage https://bur.gy/2024/08/31/why-not-zig.html
2 changes: 1 addition & 1 deletion templates/testing
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
https://lwn.net/Articles/995276/#Comments
todo summarize
https://mutants.rs/
https://www.fuzzingbook.org

Best Practice taken from "Large Scale Architecture: The Unreasonable
Effectiveness of Simplicity - Randy Shoup" and extended by personal experience.
Expand Down Expand Up @@ -203,7 +204,6 @@ TODO best practice

https://lcamtuf.blogspot.com/2014/10/fuzzing-binaries-without-execve.html
fuzzing ideas + process semantics

https://skia.org/docs/dev/testing/automated_testing/
https://github.com/luci/luci-py/blob/main/appengine/swarming/doc/Design.md
https://github.com/luci/luci-py/blob/main/appengine/swarming/doc/Detailed-Design.md
1 change: 1 addition & 0 deletions templates/win
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ fd link.exe 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community'
'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\link.exe'
VS2015 x64 Native Tools Command Prompt
x64 Native Tools Command Prompt for VS2019
notepad++ with HEX-Editor

====MSVC_build_system
.sln file contains 1. build modes (Debug/Release;x64 etc), 2. dependencies and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ $env:Editor = "nvim"
# https://github.com/wez/wezterm/releases
# winget install wez.wezterm

# Installing new version of powershell called pwsh.exe to fix utf8:
# Install/update of powershell called pwsh.exe to fix utf8:
# function GitDiff { & git diff --no-color $args }
# winget search Microsoft.PowerShell
# winget install --id Microsoft.Powershell --source winget
Expand Down

0 comments on commit 87847a2

Please sign in to comment.