Compare commits

...
Sign in to create a new pull request.

300 commits

Author SHA1 Message Date
6191a91358 git: add alias for a watchable (auto-updating) log 2025-07-04 23:27:33 +02:00
a94fc5d9d6 tmux: don't leak internal variables into the environment 2025-07-04 23:26:14 +02:00
933d302e91 tmux: add rounded status-line option 2025-07-04 23:24:18 +02:00
63fe5901e9 tmux: more compact status-right 2025-07-04 22:51:34 +02:00
99cb0e7cd2 tmux: new status-line 2025-07-04 22:51:34 +02:00
1f502f1942 nvim: telescope: refactor global picker options to the proper place 2025-07-04 22:50:49 +02:00
40543164f6 nvim: add pickers for document & workspace diagnostics 2025-07-04 22:50:49 +02:00
3da6eb36b0 nvim: customize telescope pickers using action set 2025-07-04 22:50:49 +02:00
396b03682a tmux: split windows similar to neovim 2025-07-03 13:34:19 +02:00
c4f0fdc5ad tmux: easier pane swapping 2025-07-03 12:49:41 +02:00
c9c730f20a tmux: better layout switching 2025-07-03 12:49:09 +02:00
bae752a8a2 tmux: automatically clear pane selection after join 2025-07-03 12:41:13 +02:00
b827a18d6a tmux: better movement between panes and resize panes with arrow keys 2025-07-03 12:40:16 +02:00
787e8ccade tmux: zoom pane on choose-tree 2025-07-03 12:39:02 +02:00
4c72ec68c6 tmux: better pasting from buffers 2025-07-03 12:38:02 +02:00
68cdd1884b nvim: tweaks to neogit 2025-07-02 09:34:38 +02:00
d1e0aa51d0 nvim: modernize outdated functions 2025-07-01 22:15:34 +02:00
821165fea0 nvim: better key maps for navigating trailing whitespace 2025-07-01 22:15:34 +02:00
ef15c48f5f nvim: better function name: dynamic_color -> colored_when_focused 2025-07-01 22:15:34 +02:00
15c9d5c0b0 nvim: move plugins configuration under config 2025-07-01 22:15:34 +02:00
45b3e23f75 nvim: remove fschauen namespace from augroups 2025-07-01 22:15:34 +02:00
d5992d8ad6 nvim: remove fschauen namespace from custom lualine components 2025-07-01 22:15:34 +02:00
d86261158d nvim: remove fschauen namespace 2025-07-01 22:15:34 +02:00
1ccbe82506 nvim: add Telescope picker for files from installed plugins 2025-07-01 22:15:34 +02:00
b620c0a997 nvim: don't lazy load Oil 2025-06-30 22:13:04 +02:00
4e38fd5de1 nvim: fix Oil key maps 2025-06-30 22:03:48 +02:00
edbec9b0d5 nvim: better Telescope key maps 2025-06-30 21:56:37 +02:00
eddd7452d4 nvim: disable diagnostic false positives 2025-06-30 20:16:31 +02:00
d925f8ca0d nvim: remove unused wrapper 2025-06-30 17:19:24 +02:00
b70bbbc582 nvim: add plugin 'stevearc/oil.nvim' 2025-06-30 16:05:31 +02:00
1b9dfaaae4 nvim: fix deprecated trouble commands 2025-06-30 15:12:25 +02:00
5f98ed1696 nvim: improve diagnostic severity selection 2025-06-29 00:21:45 +02:00
bdb6d88fc5 nvim: remove key bindings obsolete since neovim 0.11 2025-06-27 21:41:32 +02:00
c850f7edb9 nvim: modernize diagnostics for neovim 0.11 2025-06-27 21:34:31 +02:00
e9623f6865 nvim: fix deprecated vim.diagnostic navigation 2025-06-27 21:00:51 +02:00
264a7f1210 nvim: add descriptions to LSP key bindings 2025-06-27 19:41:50 +02:00
2f2ac372f4 nvim: refactor LSP config 2025-06-27 19:41:50 +02:00
6a43247c4c nvim: patch built-in LSP functions instead of wrapping them
This causes the behavior to be what I expect anytime I call one of these
functions globally.
2025-06-27 19:41:50 +02:00
ab5ac5a628 git: add git-what: convenience wrapper around git describe 2025-06-27 09:50:45 +02:00
84e6509e99 clang-format: enable v20-only options 2025-06-27 09:50:45 +02:00
0ea854cda2 nvim: add spellings 2025-06-27 09:50:45 +02:00
c30c3a946b nvim: fix deprecated use of vim.validate 2025-06-26 22:04:06 +02:00
c5f293d5e2 nvim: add key binding to toggle LSP inlay hints 2025-06-26 21:54:01 +02:00
ebc75de2c3 nvim: Fix LSP configuration for neovim 0.11.x 2025-06-26 21:54:01 +02:00
3156ae8277 nvim: update plugins 2025-06-26 19:57:01 +02:00
ba93f37b1e nvim: add mapping for inserting include guards in C files 2025-03-25 22:41:09 +01:00
525c160c65 broot: remove leftover configuration 2025-03-25 22:15:38 +01:00
a8c1fa25b7 nvim: refactor creation of custom indicators for lualine 2025-03-25 21:59:54 +01:00
f55e1b6951 nvim: refactor lualine component for searchcount 2025-03-25 21:07:39 +01:00
14a0d8e7d2 nvim: add indicator for diagnostics to lualine 2025-03-25 21:03:16 +01:00
ff894c77a0 nvim: use vim.diagnostic.is_enabled() instead of deprecated vim.diagnostic.is_disabled() 2025-03-25 20:41:14 +01:00
75b544e352 mintty: darker background and cursor 2025-03-20 13:40:37 +01:00
1333d66788 nvim: add more columns in lukas-reineke/virt-column.nvim 2025-03-20 13:38:52 +01:00
e673e66e1b nvim: dismiss search highlight with <leader>h instead of <cr> 2025-03-19 21:28:47 +01:00
7915fc72ce nvim: use dev version of text-case.nvim 2025-03-18 22:19:19 +01:00
8ff672e509 nvim: fix deprecation: vim.loop -> vim.uv 2025-03-18 22:19:19 +01:00
85dbc295ec nvim: update plugins 2025-03-18 22:19:19 +01:00
3a531b1d69 git-cal: use colors in unicode mode and NerdFont in ascii mode 2025-03-18 22:19:19 +01:00
2dd65d4135 Ignore htop configuration 2025-03-18 17:56:14 +01:00
50117b8d09 nvim: tweak trailing whitespace counter in lualine 2025-03-18 17:54:59 +01:00
f23a73d02b nvim: use // for comments in C files 2025-03-17 20:03:02 +01:00
20e99cbeed nvim: lsp: disable header insert in clangd 2025-03-17 20:02:08 +01:00
9df850751b clang-format: better alignment after brackets 2025-03-05 10:24:16 +01:00
416d8618b2 clang-format: disable v20-only option (BreakBinaryOperations) 2025-03-05 10:23:39 +01:00
5f2d56232a Ignore podman configurations (config/containers) 2025-03-05 10:20:45 +01:00
734c012556 nvim: improvements to filetype detection 2025-03-05 10:17:28 +01:00
448513ad70 nvim: search all man section with Telescope 2025-03-05 09:19:59 +01:00
841d9bd600 git: remove newlines from ln alias 2025-03-05 09:19:10 +01:00
487c750831 nvim: add spellings 2025-02-14 09:26:04 +01:00
d8ed650761 zsh: enable option noclobber
Require `>|` to overwrite an existing file when redirecting output.
2025-02-14 09:26:04 +01:00
2068330fd0 debian: update package versions 2024-10-23 18:26:41 +02:00
d9e6d2e372 debian: remove broot 2024-10-23 18:15:11 +02:00
c2258ba17b debian: install fzf 2024-10-23 18:13:34 +02:00
baa4f6a508 editorconfig: indent JSON with 2 spaces 2024-10-23 18:12:55 +02:00
ac6e86a9b2 clang-format: disable BreakBeforeBinaryOperators until I can rely on v20 2024-10-23 18:12:03 +02:00
3d7b013393 install: add a global .clang-format 2024-08-23 21:21:17 +02:00
66b9cfd1f0 nvim: don't ensure any LSP servers are installed automatically 2024-08-23 20:26:44 +02:00
1066095ef3 nvim: add spellings 2024-08-23 20:25:30 +02:00
88ea5719c7 nvim: fix clipboard on WSL 2024-08-23 20:24:57 +02:00
801f0cc7b3 nvim: select diagnostic virtual text severity with custom telescope picker 2024-08-06 01:17:14 +02:00
fdf94be847 nvim: use tabstop = 2 for YAML files 2024-08-05 19:24:46 +02:00
6f6124e2a3 nvim: schedule setting 'clipboard' after UIEnter
Without scheduling, the startup time in WSL is slowed down by over
a second!
2024-08-04 23:23:07 +02:00
824089b6ba zsh: fix up/down arrows in git prompt
The previous arrows overlapped with some numbers, e.g. 7.
2024-08-02 01:07:46 +02:00
32a14e5b61 tmux: status line tweaks
- Add server PID to right side.
- Current window name is bold.
- Last window index shown in color.
- Active pane border is now blue.
2024-08-02 01:06:27 +02:00
86e2687bca tmux: add bindings to split window in full width/height 2024-08-01 23:21:37 +02:00
de115d0e92 tmux: fix rotation direction
This is more intuitive, given the position of the `i` and `o` keys on
the keyboard:

  - C-o: rotates clockwise
  - C-i: rotates counter-clockwise
2024-08-01 23:08:17 +02:00
e0b35d87d4 zsh: use a ZLE widget to save command line when opening nvim with ctrl-v 2024-08-01 23:03:46 +02:00
3ac248c53d nvim: disable spell check in quickfix windows 2024-08-01 23:03:03 +02:00
84673a04a5 nvim: move module: fschauen.window -> fschauen.util.window 2024-08-01 22:53:44 +02:00
f0011b9eb1 nvim: execute current buffer as lua script by :write and :luafile 2024-08-01 22:45:04 +02:00
62dacd2c04 nvim: add comments to undocumented functions 2024-08-01 22:44:38 +02:00
b776aa4260 zsh: make orange in git prompt a bit brighter 2024-07-29 20:34:28 +02:00
39ead8b9ee zsh: use array for colors in git prompt 2024-07-29 20:34:16 +02:00
4b779b8336 zsh: avoid global array of icons in prompt 2024-07-29 20:27:06 +02:00
eff5a3d0b1 zsh: avoid global array of colors in prompt 2024-07-29 19:46:35 +02:00
a28fa3a3f8 zsh: don't use abbreviation unnecessarily 2024-07-29 17:51:41 +02:00
bc602776af zsh: consistent function naming 2024-07-29 12:57:29 +02:00
a5ee1b137b zsh: remove unused option 2024-07-29 12:41:51 +02:00
0dac129b53 zsh: add feature flag for transient prompts
I am not 100% sure yet that I want to use transient prompts long term.
This makes it easy to turn them on/off and experiment for a while.
2024-07-29 12:40:57 +02:00
0d1ed7112e zsh: remove outdated TODO 2024-07-29 02:04:18 +02:00
197ba88d47 nvim: include - in 'iskeyword' for zsh
My zsh functions tend to be dash-case.
2024-07-29 01:55:24 +02:00
aa6cf52d63 zsh: add transient prompt 2024-07-29 01:54:52 +02:00
baa9b5a2e1 zsh: prefix my prompt-related functions with fs- 2024-07-29 01:06:50 +02:00
7464e383e3 zsh: add special ZLE widgets rather than replace them
Also took the opportunity to prefix all my functions with `fs-` to
differentiate from built-ins and avoid conflicts.
2024-07-29 00:40:33 +02:00
131d2097cc zsh: new error icon in prompt 2024-07-28 23:06:42 +02:00
1e0ac2b51b zsh: color prompt according to previous exit code 2024-07-28 23:04:20 +02:00
dbac417322 zsh: add icons to prompt 2024-07-28 22:52:19 +02:00
745b5b2fd5 zsh: use a custom command for fzf ZLE widgets
Notable differences to the default command shipped with fzf:

  - I want to see hidden files, but not directories (the default hides
    both).
  - I want to exclude some directories on my Mac home, which are too
    large and make the find command really slow. Plus, I never want to
    dig into those directories with this method anyway.
2024-07-28 18:45:21 +02:00
3949848924 zsh: visual tweaks to prompt 2024-07-27 22:43:06 +02:00
62dd4efc38 zsh: reduce the number of global variables used for colors in prompt 2024-07-27 22:41:51 +02:00
bb3f6a7b6f zsh: remove the need to render the prompt in a global array 2024-07-27 22:41:09 +02:00
3c8857b1f6 zsh: major refactor of .zshrc 2024-07-27 20:35:38 +02:00
92089a01ee zsh: ZLE improvements (yank, edit-command-line, clear-status-line) 2024-07-27 10:38:27 +02:00
aeee2648ca zsh: make ctrl-q usable in the terminal 2024-07-27 10:37:19 +02:00
61cf8ad5fb tmux: use non-login shells 2024-07-27 03:52:35 +02:00
da0285f274 tmux: reattach-to-user-namespace is no longer needed in macOS 2024-07-27 03:41:19 +02:00
3c7d3778ce zsh: make sure entries in PATH and MANPATH are in a consistent order 2024-07-27 03:30:23 +02:00
b47b986ae8 zsh: make profiling .zprofile easier by using functions 2024-07-26 18:54:08 +02:00
c6750c86c5 zsh: split local config into zprofile and zshrc 2024-07-26 18:40:53 +02:00
2bc0bfc4da nvim: minor color tweak to lualine 2024-07-26 00:11:26 +02:00
e41195a7a7 nvim: icon tweaks 2024-07-26 00:00:02 +02:00
d6a489b221 nvim: better lualine custom components 2024-07-25 23:59:48 +02:00
de3e6518e8 nvim: minor simplification in LSP configuration 2024-07-25 19:37:56 +02:00
44f977d2da nvim: add plugin 'FabijanZulj/blame.nvim' 2024-07-25 01:36:14 +02:00
a69a39fde7 nvim: navigate diagnostics with new keys from neovim 0.10 2024-07-24 22:33:05 +02:00
9fee4373ba nvim: make option toggles not verbose 2024-07-24 22:23:22 +02:00
e814da54a9 nvim: use rg for :grep if installed 2024-07-24 22:16:55 +02:00
c44785f3a7 nvim: dismiss search highlight with <cr> instead of <es> 2024-07-24 22:16:47 +02:00
62d28c5aa0 nvim: add plugin 'danymat/neogen' 2024-07-24 21:17:49 +02:00
f6e6a319a5 nvim: define variables in the narrowest possible scope 2024-07-23 23:09:06 +02:00
e1adca48e0 nvim: factor out autoformat and add indicator to lualine 2024-07-23 22:33:57 +02:00
ca89048a67 nvim: dismiss search highlight with <esc> instead of <leader>h 2024-07-23 11:49:14 +02:00
c0dea465da bin: add git-ignore 2024-07-23 11:32:47 +02:00
71c07b1998 pre-commit: use hook provided by the stylua developer 2024-07-23 09:08:55 +02:00
2a260279e8 nvim: remove obsolete spellings
Also took the opportunity to sort the file.
2024-07-23 08:56:08 +02:00
7f15d314fb nvim: add indicators for 'spell' and 'wrap' to lualine 2024-07-23 01:25:53 +02:00
932b7b0047 nvim: factor out custom lualine components 2024-07-23 01:24:55 +02:00
b87bec08c3 nvim: remove paste component from lualine (paste is deprecated) 2024-07-23 01:24:50 +02:00
b9d60d7078 pre-commit: enable stylua hook 2024-07-22 21:28:31 +02:00
1db5d0015a pre-commit: trim hooks to a reasonable set 2024-07-22 21:14:13 +02:00
03d52dcf70 nvim: fix indentation for markdown files 2024-07-22 21:14:13 +02:00
d596908f2c nvim: enable linter markdownlint for markdown files 2024-07-22 21:14:13 +02:00
3dae4ffe76 nvim: add spellings 2024-07-22 21:14:13 +02:00
7cd4492f1d nvim: load LSP plugins on :Mason command 2024-07-22 21:14:13 +02:00
04d4f3d002 nvim: fix highlighting from todo-comments 2024-07-22 21:14:13 +02:00
11652303df nvim: use dependencies consistently 2024-07-22 21:14:13 +02:00
139629725f nvim: style change for readability 2024-07-22 21:14:13 +02:00
8dc1dd324a nvim: use opts and config consistently for all plugins 2024-07-22 21:14:13 +02:00
965173484f nvim: style change for readability 2024-07-22 21:14:13 +02:00
aaa3b3236e nvim: use consistent style for lua files 2024-07-22 21:14:13 +02:00
b1361e85a5 nvim: add spellings 2024-07-22 21:14:13 +02:00
80a3ba49ef nvim: use icons consistently 2024-07-22 21:14:13 +02:00
0f6e9fc070 nvim: fix typo in comment 2024-07-21 19:19:05 +02:00
c0d1bd2df8 nvim: disable spell checking for NeogitStatus buffers 2024-07-21 19:12:46 +02:00
608d971a3c nvim: use ftplugin instead of autocmd for NeogitCommitMessage settings 2024-07-21 19:11:52 +02:00
217f0e1796 nvim: minor style fixes 2024-07-21 19:05:17 +02:00
19c3cd9ab8 nvim: use Telescope for text-case instead of default mappings 2024-07-21 01:27:30 +02:00
37aec2fac7 nvim: remove extension configuration from Telescope setup
This makes the Telescope plugin configuration more independent from
extensions. The next step would be to move the `fzf-native` extension to
its own file.
2024-07-21 01:25:46 +02:00
fef06d87b3 nvim: enable matchparen plugin 2024-07-21 01:25:15 +02:00
96dc308f5c nvim: remove legacy option 'pastetoggle' 2024-07-20 22:02:51 +02:00
83c8c8bd28 nvim: add plugin 'lukas-reineke/headlines.nvim' 2024-07-20 01:47:20 +02:00
4d03979765 readme: use ATX-style headings 2024-07-20 01:37:11 +02:00
470543f295 nvim: disable format on write by default 2024-07-20 00:34:00 +02:00
b3c8886304 nvim: enable format on write and add key map to toggle it 2024-07-20 00:21:29 +02:00
24fe53f1cc nvim: fix handling of tabs/spaces for shfmt formatter 2024-07-19 23:49:47 +02:00
73da48e6e6 nvim: rename builtin formatters for clarity 2024-07-19 22:42:10 +02:00
e086b337b1 install: fix formatting 2024-07-19 22:42:10 +02:00
80136704e7 nvim: fix annoyances with completion key map 2024-07-19 22:37:45 +02:00
c6e0d17e27 nvim: add spellings 2024-07-19 22:35:35 +02:00
9081702473 nvim: update spellings 2024-07-18 10:06:01 +02:00
cbe4a440f7 nvim: refactor completion key mappings 2024-07-17 23:20:50 +02:00
7952eeed2f nvim: use single line comments for plantuml files 2024-07-17 22:48:10 +02:00
3d68f6fb65 Add .editorconfig 2024-07-17 22:48:10 +02:00
85f0b10c39 install: sort links (just style fix, no functional change) 2024-07-17 21:28:23 +02:00
bbf6885b9c Make it easier to work with dotfiles linked to home directory 2024-07-17 21:27:31 +02:00
53f9c5a4d9 nvim: add key maps to toggle previewers (PlantUML and Markdown) 2024-07-17 21:10:20 +02:00
3c558004bf nvim: remove redundant parameter
DuckDuckGo is already set as the default search engine, no need to
specify it again in the key map.
2024-07-17 20:45:40 +02:00
c38b32415b nvim: remove redundant pass through function definition 2024-07-17 20:45:06 +02:00
38eb78f0bd nvim: add some neovim specific spellings 2024-07-17 20:21:22 +02:00
3dbe95d1c2 nvim: disable Lazy's change detection 2024-07-17 20:20:38 +02:00
a70e2801af zsh: add function to prepend to PATH without duplicates
With this function, I can use the same logic in other configuration
files (e.g. `~/.local/etc/zsh/config.zsh`). This avoids duplication in
tmux sessions when prepending naively.
2024-07-15 21:37:28 +02:00
154e9bf1b0 pre-commit: don't fix end-of-file for lazy-lock.json
This file is updated automatically by the plugin whenever
I install/update/uninstall plugins and a extra new line is always
appended.
2024-07-14 23:52:33 +02:00
e5793203f2 Revert "nvim: fix opening browser with Markdown preview on macOS + Firefox + tmux"
This reverts commit 50dfc1efa6.

It seems that the issue with open(1) was temporary and fixed by
restarting the machine.
2024-07-14 23:52:33 +02:00
1a89e1324f pre-commit: separate hook repos with blank lines 2024-07-14 23:52:23 +02:00
8e2b50e034 nvim: add custom icons to Mason 2024-07-14 23:52:23 +02:00
e9b2121e65 Fix shellcheck findings 2024-07-14 23:52:23 +02:00
44d0f1f769 pre-commit: disable shellcheck for zsh files
`shellcheck` does not support zsh and throws all sort of errors because
the pre-commit thinks all zsh file are shell scripts.
2024-07-14 23:52:07 +02:00
d7b6938a74 bin: make color index more readable
Use white text for darker colors and black text for lighter colors.

Also, now the `colors256` script became redundant, so it's removed.
2024-07-14 23:52:07 +02:00
82979b2153 nvim: add plugin 'mfussenegger/nvim-lint' 2024-07-14 23:52:07 +02:00
c453f2909e nvim: fix keymap description for formatter.nvim 2024-07-14 23:52:07 +02:00
80a3043d87 pre-commit: add shellcheck 2024-07-14 23:51:56 +02:00
13fa12c5c3 Ensure files end with a new line 2024-07-14 23:51:56 +02:00
ab7d4933aa Fix trailing white space 2024-07-14 23:51:56 +02:00
3a10b4dc32 Remove BOM (byte order marker) from .XCompose 2024-07-14 23:51:56 +02:00
5559eaa6da Fix permissions for files that should be executable 2024-07-14 23:51:56 +02:00
88bde902ea zsh: remove executable bit from files that are meant to be sourced 2024-07-14 23:51:56 +02:00
564e26df7f pre-commit: add initial configuration 2024-07-14 23:51:41 +02:00
8a5478ad4c vim: add plugin 'tyru/open-browser.vim' 2024-07-14 02:35:43 +02:00
c3b1b29768 zsh: cd to git repository root with ctrl-g in the line editor 2024-07-14 02:34:04 +02:00
d28bb6099f git: add some useful commands (authors, cal, ignored, tree) 2024-07-14 02:33:19 +02:00
3fc86cf7c6 git: minor tweaks to my git commands 2024-07-14 02:33:00 +02:00
0f85776d14 git: turn git-alias into a git command 2024-07-14 02:32:03 +02:00
6f5ddfaad6 bin: print color index 2024-07-13 21:58:42 +02:00
c409d31f7f zsh: rename alias dot -> dots
The previous name conflicts with one of the Graphviz executables, which
I started using lately.
2024-07-13 11:59:29 +02:00
50dfc1efa6 nvim: fix opening browser with Markdown preview on macOS + Firefox + tmux 2024-07-12 16:40:35 +02:00
735d6ffaef nvim: don't close Markdown preview when leaving the buffer 2024-07-12 16:39:53 +02:00
55fe46e113 nvim: update spellings 2024-07-12 16:39:16 +02:00
76ecc9b533 nvim: disable conceal for markdown files 2024-07-12 16:35:25 +02:00
3a273afd06 nvim: extract PlantUML JAR from launch script
I had previously hard-coded the path on my Debian install, but this
commit will find the correct JAR file as long as there is a `plantuml`
launch script in the PATH.
2024-07-12 13:26:26 +02:00
c91a813f83 nvim: add plugin 'weirongxu/plantuml-previewer.vim' 2024-07-11 12:43:45 +02:00
5274f0a7f2 nvim: use 2 spaces for file type cmake 2024-07-11 12:25:31 +02:00
10d2bdbf49 nvim: add some spelling from work 2024-07-11 12:25:08 +02:00
5a957f6de3 nvim: Add PlantUML syntax 2024-07-11 12:24:25 +02:00
089c6f8ffc vim: ensure cmake treesitter parser is installed 2024-04-11 10:44:00 +02:00
d14ebc7281 zsh: enable completion from packages in /usr/local 2024-03-20 23:29:26 +01:00
9170201712 zsh: formatting 2024-03-20 23:29:13 +01:00
d80292efd2 debian: install git-delta v0.17.0 2024-03-20 23:06:41 +01:00
529e049613 debian: install fd v9.0.0 2024-03-20 23:06:41 +01:00
9a92bfb005 debian: install eza v0.18.7 2024-03-20 23:06:41 +01:00
d8477d58d3 debian: install broot v1.36.1 2024-03-20 23:06:41 +01:00
118cf229d9 debian: don't require root access for dry run 2024-03-20 23:06:41 +01:00
5e57c1351e debian: Add info output (and be more verbose)
This makes it easier to follow what is happening while the script is
running.
2024-03-20 23:06:24 +01:00
ceffaf3737 debian: enable dry run 2024-03-20 22:42:23 +01:00
9b7143d33d debian: remove custom packages 2024-03-19 20:42:36 +01:00
af8b2a956c Clean up 2024-03-18 22:18:12 +01:00
076b08c583 debian: use custom packages and remove dry-run 2024-03-18 22:15:21 +01:00
2a77358b1c mintty: sync current wsltty tweaks 2024-03-18 11:27:01 +01:00
b42c0c04ba eza: make user/group not stand out so much 2024-03-18 11:24:00 +01:00
f39ac9a666 vim: navigate up/down completions with <c-j>/<c-k> 2024-03-17 23:37:42 +01:00
fee0d0f5c7 vim: better telescope key mappings (match fzf) 2024-03-17 23:36:44 +01:00
7392fed0d5 vim: open neogit commit editor on a new tab 2024-03-17 23:36:02 +01:00
54c68d0076 fzf: add page-up/page-down + visual tweaks 2024-03-17 23:35:13 +01:00
c15bb13a00 git: default git-delta theme to gruvbox 2024-03-17 23:33:53 +01:00
12a5a39922 broot: visual tweaks
Changes:
- don't use icons -> less visual clutter.
- don't use bold for directories and executables -> same as my custom
  `EZA_COLORS`
2024-03-11 00:18:32 +01:00
316ff49b08 zsh: customize EZA_COLORS 2024-03-11 00:14:40 +01:00
abdedb4ce9 zsh: customize fzf 2024-03-10 23:03:40 +01:00
b06970472d Add broot 2024-03-10 17:47:56 +01:00
d2529413dc zsh: git ignore sessions 2024-03-10 16:32:07 +01:00
b98404a488 vim: set gitconfig filetype for delta config 2024-03-09 03:27:45 +01:00
4ed212a5e1 git: extract delta themes to separate file and add tokyonight 2024-03-09 03:20:34 +01:00
b051f3bd24 debian: update nvim (0.9.1 -> 0.9.5) and lf (r30 -> r31) 2024-03-08 22:47:44 +01:00
2be6fb83f5 Replace exa with eza
`exa` is unmaintained, `eza` is a maintained fork.
2024-03-08 22:41:04 +01:00
82db341e82 zsh: alias to dotfiles 2024-03-08 22:00:44 +01:00
7bc64134eb zsh: load local configuration if present 2024-03-08 21:53:00 +01:00
9378ae2b30 zsh: remove tmux alias
Since 3.2, tmux will search for `$XDG_CONFIG_HOME/tmux/tmux.conf`.
2024-03-08 21:37:33 +01:00
15d163c534 git: update git-lfs installation 2024-02-28 17:38:06 +01:00
7ded520703 Ignore gitk config 2024-02-27 22:35:39 +01:00
61e658e074 Remove debugging info 2024-02-26 21:35:23 +01:00
79de13cb33 vim: enable experimental module loader 2024-02-25 22:10:46 +01:00
786b28fba5 vim: Apply gitcommit options to NeogitCommitMessage buffers 2024-02-24 21:08:01 +01:00
c39be0a592 vim: clear telescope prompt with <c-u> 2024-02-23 23:46:47 +01:00
fe084ae46a vim: enforce style in top-level code 2024-02-22 18:42:06 +01:00
f513e9346e vim: enforce style in util 2024-02-21 20:30:19 +01:00
c2b340ef88 vim: refactor plugin specs 2024-02-20 19:09:18 +01:00
c4db3de78a vim: add keymap to run formatter in visual mode 2024-02-19 18:13:37 +01:00
1b4f468324 vim: add keymap to dismiss notifications 2024-02-19 18:09:11 +01:00
f1c60d8012 git: ensure correct e-mail for dotfiles and personal projects 2024-02-19 11:09:31 +01:00
3921c1e52b vim: ensure some LSPs are installed (clangd, cmake, lua_ls, pyright) 2024-02-19 02:20:19 +01:00
15f944eb4c vim: better higlights for todo-comments 2024-02-19 02:18:46 +01:00
36ceb2c15c vim: make sure not to blow up on nil opts 2024-02-19 02:04:09 +01:00
a15e582567 vim: add plugin 'mhartington/formatter.nvim' 2024-02-19 01:58:57 +01:00
98c8837469 vim: telescope refactor 2024-02-18 23:41:06 +01:00
c924601769 vim: visual mode paste without loosing yanked text 2024-02-18 21:48:41 +01:00
890d2def13 vim: add plugin 'monaqa/dial.nvim' 2024-02-18 21:25:09 +01:00
d7de20a635 vim: enable lazy.nvim change detection notifications
Now that I am using `nvim-notify` the notifications aren't so annoying
and, most importantly, don't cause the windows to jump up and down.
2024-02-18 16:59:20 +01:00
43b65bf2c1 vim: refactor LSP configuration 2024-02-18 16:49:29 +01:00
1108538484 vim: add keymaps to change quote style in lua files 2024-02-18 14:25:15 +01:00
fe5eddd739 vim: collect syntax-only plugins into a syntax file 2024-02-18 13:52:14 +01:00
335884af95 vim: add plugin 'stevearc/dressing.nvim' 2024-02-18 13:44:35 +01:00
0a29953d6b vim: playing with colorschemes 2024-02-18 13:18:31 +01:00
26e882780a vim: consistent telescope keymap descriptions and comments 2024-02-18 04:08:36 +01:00
316c6f828c vim: add plugin '2kabhishek/nerdy.nvim' 2024-02-18 04:00:50 +01:00
3c21f801b8 vim: prevent very narrow telescope previews 2024-02-18 03:44:17 +01:00
a1d23e4b5c vim: more consistent descriptions for keymaps 2024-02-18 03:26:37 +01:00
9bdf67e320 vim: move more code to utils 2024-02-18 03:16:14 +01:00
c07b06d4a7 vim: move reusable functions to util 2024-02-18 02:41:05 +01:00
e34671ddaa vim: better structure for utils 2024-02-18 02:31:02 +01:00
5f2dd220d9 vim: use the opts key in plugin specs where possible 2024-02-18 02:25:06 +01:00
5286b9f987 vim: remove plugin 'stevearc/oil.nvim' 2024-02-18 01:22:29 +01:00
11aa2394ee vim: fix neogit missing cmd definition for lazy loading 2024-02-18 01:04:43 +01:00
e1618b5484 vim: fix colorizer condition 2024-02-18 00:49:28 +01:00
a054a3a894 vim: use correct signatures for lazy config() and init() 2024-02-18 00:42:44 +01:00
3011a077d3 vim: add plugin 'rcarriga/nvim-notify' 2024-02-17 23:09:52 +01:00
f84b35600b vim: make fidget a bit more visible 2024-02-17 23:09:15 +01:00
a6b117d44c vim: add separate icons for checkmark and checkbox 2024-02-17 22:52:56 +01:00
2a042f9927 vim: add winblend 2024-02-17 22:39:24 +01:00
b9f152ce66 vim: add bold diagnostic icons 2024-02-17 22:38:47 +01:00
b9ecc49df2 vim: better descriptions for keymaps 2024-02-17 19:30:00 +01:00
e97a7dbd7e zsh: don't add duplicates to history 2024-02-17 17:59:11 +01:00
b5eef19e5a zsh: use <c-v> as a shortcut to start neovim 2024-02-17 17:52:44 +01:00
0944776bf2 vim: better keymap to strip whitespace 2024-02-17 17:34:05 +01:00
c7ccb92634 vim: don't lazy-load luaref 2024-02-17 17:31:00 +01:00
237d67f82b vim: move code from lua ftplugin to utils
The ftplugin is executed via the FileType event every time a lua file is
opened, so better to have just the keymaps set there.
2024-02-17 15:16:43 +01:00
7817b927ee vim: move lua gf handler from autocmd to ftplugin 2024-02-17 13:23:49 +01:00
8d9f3ea390 vim: disable <c-x> in Telescope 2024-02-17 13:21:18 +01:00
0bccfe6ad7 vim: make gf work for lua modules 2024-02-17 00:39:57 +01:00
d45715e545 vim: add some colorschemes to try out 2024-02-16 19:14:20 +01:00
267c01ff9d vim: enable alternative plugin dev paths in lazy.nvim
I have to keep the local development version of my plugins in different
places depending on the machine. This make that possible.
2024-02-16 16:10:48 +01:00
ee08716bed vim: make horizontal split keymaps consistent in telescope and nvim-tree 2024-02-16 02:07:33 +01:00
b4aa060a0e vim: simplify keymap for nvim-tree 2024-02-16 02:06:58 +01:00
183 changed files with 5283 additions and 3078 deletions

1
.gitattributes vendored
View file

@ -1,2 +1 @@
ssh/config filter=git-crypt diff=git-crypt

8
.gitignore vendored
View file

@ -4,7 +4,11 @@
.git/
config.sh
config/containers
config/git/gitk
config/htop
config/iterm2
config/zsh/.zcompcache
config/zsh/.zcompdump
config/iterm2
config/zsh/.zsh_sessions

26
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,26 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: end-of-file-fixer
exclude: ^config\/nvim\/lazy-lock\.json$
- id: trailing-whitespace
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
exclude: |
(?x)^(
config\/zsh\/.*|
home/\.zshenv
)$
- repo: https://github.com/JohnnyMorganz/StyLua
rev: v0.20.0
hooks:
- id: stylua
args: [-f, config/nvim/stylua.toml]
files: ^config\/nvim\/.*lua$

View file

@ -1,10 +1,8 @@
My dotfiles
================================================================================
# My dotfiles
Always evolving...
Quick Start
--------------------------------------------------------------------------------
## Quick Start
```bash
$ git clone https://github.com/fschauen/dotfiles.git $HOME/.dotfiles
@ -16,12 +14,10 @@ $ ./unlock.sh # decrypt the SSH configuration
If you are not me, then you won't have the password to use in the last step.
Just `git rm unlock.sh ssh/config` and add your own.
Prerequisites
--------------------------------------------------------------------------------
## Prerequisites
[git-crypt] and [gpg] are needed to decrypt sensitive information in the
repository.
[git-crypt]: https://github.com/AGWA/git-crypt
[gpg]: https://gnupg.org

View file

@ -24,4 +24,3 @@ cat <<EOF
37m  gYw  gYw   gYw   gYw   gYw   gYw   gYw   gYw   gYw 
1;37m  gYw  gYw   gYw   gYw   gYw   gYw   gYw   gYw   gYw 
EOF

View file

@ -22,7 +22,6 @@ bg_256() { printf '\e[48;5;%sm' "$1"; }
fg_rgb() { printf '\e[38;2;%s;%s;%sm' "$1" "$2" "$3"; }
bg_rgb() { printf '\e[48;2;%s;%s;%sm' "$1" "$2" "$3"; }
rgb_from_hex() {
echo "$1" | awk '{
r="0x"substr($0, 2, 2)
@ -41,38 +40,53 @@ reset() { printf '\e[0m'; }
fg_reset() { printf '\e[39m'; }
bg_reset() { printf '\e[49m'; }
indent() { printf ' '; }
indent() { printf ' '; }
newline() { printf '%b\n' '\e[0m'; }
indexed_16() {
echo "16 indexed colors:"
black=0
white=15
for i in 0 1; do
[ "$i" -eq 0 ] && fg="$white" || fg="$black"
indent
for j in $(seq 0 7); do
bg_16 $((8*i + j)); printf '%4s' ''
n=$((8*i + j))
bg_16 "$n"; fg_16 "$fg"; printf ' %2d ' "$n"
done
newline
done
}
indexed_256() {
echo "256 indexed colors:"
black=232
white=255
# 16 standard colors
for i in 0 1; do
[ "$i" -eq 0 ] && fg="$white" || fg="$black"
indent
for j in $(seq 0 7); do
bg_256 $((8*i + j)); printf '%9s' ''
n=$((8*i + j))
bg_256 "$n"; fg_256 "$fg"; printf ' %3d ' "$n"
done
newline
done
# 216 colors
for i in 0 18; do
[ "$i" -eq 0 ] && fg="$white" || fg="$black"
for j in $(seq 0 5); do
indent
for k in $(seq $i $(( i + 17 ))); do
bg_256 $((16 + 36*j + k)); printf '%4s' ''
n=$((16 + 36*j + k))
bg_256 "$n"; fg_256 "$fg"; printf '%3d ' "$n"
done
newline
done
@ -81,8 +95,10 @@ indexed_256() {
# 24 grayscale colors
for i in 0 1; do
indent
[ "$i" -eq 0 ] && fg="$white" || fg="$black"
for j in $(seq 0 11); do
bg_256 $((232 + 12*i + j)); printf '%6s' ''
n=$((232 + 12*i + j))
bg_256 "$n"; fg_256 "$fg"; printf ' %3d ' "$n"
done
newline
done
@ -130,15 +146,14 @@ main() {
indexed_16
echo
indexed_256
echo
gruvbox_dark
echo
gruvbox_light
echo
solarized
echo
nord
# echo
# gruvbox_dark
# echo
# gruvbox_light
# echo
# solarized
# echo
# nord
}
main

View file

@ -1,37 +0,0 @@
#!/bin/sh
# Print all 256 colors
black="\e[38;5;232m"
white="\e[38;5;255m"
# 16 standard colors -> 0...15
for i in $(seq 0 15); do
[ $i -lt 8 ] && fg="$white" || fg="$black"
bg="\e[48;5;${i}m"
printf '%b%b %2d ' "$fg" "$bg" "$i"
done
printf '%b\n' '\e[0m'
# 216 colors -> 16...231
for i in $(seq 0 5); do
for j in $(seq 0 35); do
n=$(( 16 + 36 * i + j ))
[ $j -lt 18 ] && fg="$white" || fg="$black"
bg="\e[48;5;${n}m"
printf '%b%b%4d' "$fg" "$bg" "$n"
done
printf '%b\n' '\e[0m'
done
# 24 grayscale colors -> 232...255
for i in $(seq 0 23); do
n=$(( 232 + i ))
[ $i -lt 12 ] && fg="$white" || fg="$black"
bg="\e[48;5;${n}m"
printf '%b%b%4d ' "$fg" "$bg" "$n"
done
printf '%b\n' '\e[0m'

View file

@ -16,4 +16,3 @@ BEGIN {
}
printf "\n";
}

View file

@ -1,3 +1,2 @@
#!/bin/sh
env | sort | grep --color=always '=.*$'

8
bin/git-alias Executable file
View file

@ -0,0 +1,8 @@
#!/bin/sh
#
# List git aliases.
#
exec git config --get-regexp '^alias' \
| sed 's/^alias\.//' \
| sed 's/ /\t= /' \
| sort

8
bin/git-authors Executable file
View file

@ -0,0 +1,8 @@
#!/bin/sh
#
# List authors in the repository.
#
exec git shortlog --email --numbered --summary "$@" \
| awk '{$1=""; sub(" ", ""); print}' \
| awk -F'<' '!seen[$1]++' \
| awk -F'<' '!seen[$2]++'

516
bin/git-cal Executable file
View file

@ -0,0 +1,516 @@
#!/usr/bin/perl
#
# Github like contributions calendar on terminal.
#
# Source: https://github.com/k4rthik/git-cal
#
use strict;
use warnings;
use utf8;
use Getopt::Long;
use Pod::Usage;
use Time::Local;
use Data::Dumper;
binmode(STDOUT, ":utf8");
#command line options
my ( $help, $period, $use_ascii, $use_ansi, $use_unicode, $format, $author, $filepath, $all_branches );
GetOptions(
'help|?' => \$help,
'period|p=n' => \$period,
'ascii' => \$use_ascii,
'ansi' => \$use_ansi,
'unicode' => \$use_unicode,
'author=s' => \$author,
'all' => \$all_branches
) or pod2usage(2);
pod2usage(1) if $help;
$filepath = shift @ARGV;
# also tried to use unicode chars instead of colors, the exp did not go well
#qw(⬚ ⬜ ▤ ▣ ⬛)
#qw(⬚ ▢ ▤ ▣ ⬛)
my @unicode = qw(⬚ ▢ ▤ ▣ ⬛);
# my @colors = ( 237, 139, 40, 190, 1 ); original
my @colors = ( 235, 58, 64, 70, 82 );
my @ascii = ( " ", ".", "o", "O", "0" );
my @months = qw (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
configure(\$period, \$use_ascii, \$use_ansi, \$use_unicode, \$author);
process();
# 53 X 7 grid
# consists of 0 - 370 blocks
my ( @grid, @timeline, %pos_month, %month_pos, $jan1, $cur_year, $max_epoch, $min_epoch, $max_commits, $q1, $q2, $q3 );
my ( $first_block, $last_block, $start_block, $end_block, $row_start, $row_end );
#loads of global variables
sub process {
$format
= $use_ansi ? 'ansi'
: $use_ascii ? 'ascii'
: $use_unicode ? 'unicode'
: undef;
#if the user decided not to choose the format, let's pick some environmentally smart format
if ( !defined $format ) {
$format
= $ENV{EMACS} ? 'unicode'
: $ENV{TERM} eq 'dumb' ? 'ascii'
: 'ansi';
}
init_cal_stuff();
process_current_repo();
my %stats = compute_stats();
print_grid(%stats);
}
sub process_current_repo {
my $git_command = git_command();
my @epochs = qx/$git_command/;
if ($?) {
print "fatal: git-cal failed to get the git log\n";
exit(2);
}
if ( !@epochs ) {
print "git-cal: got empty log, nothing to do\n";
exit(1);
}
my $status;
foreach (@epochs) {
$status = add_epoch($_);
last if !$status;
}
}
sub git_command {
my $command = qq{git log --no-merges --pretty=format:"%at" --since="13 months"};
$command .= qq{ --author="$author"} if $author;
$command .= qq{ --all } if $all_branches;
if ($filepath) {
if ( -e $filepath ) {
$command .= qq{ -- $filepath};
}
else {
print "fatal: $filepath: no such file or directory\n";
exit(2);
}
}
return $command;
}
sub init_cal_stuff {
my ( $wday, $yday, $month, $year ) = ( localtime(time) )[ 6, 7, 4, 5 ];
$cur_year = $year;
$jan1 = 370 - ( $yday + 6 - $wday );
$last_block = $jan1 + $yday + 1;
$first_block = $last_block - 365;
$max_commits = 0;
push @timeline, $jan1;
$month_pos{0} = $jan1;
my $cur = $jan1;
foreach ( 0 .. $month - 1 ) {
$cur += number_of_days( $_, $year );
push @timeline, $cur;
$month_pos{ $_ + 1 } = $cur;
}
$cur = $jan1;
for ( my $m = 11; $m > $month; $m-- ) {
$cur -= number_of_days( $m, $year - 1 );
unshift @timeline, $cur;
$month_pos{$m} = $cur;
}
$pos_month{ $month_pos{$_} } = $months[$_] foreach keys %month_pos;
die "period can only be between -11 to 0 and 1 to 12" if ( defined $period && ( $period < -11 || $period > 12 ) );
if ( !defined $period ) {
$start_block = $first_block;
$end_block = $last_block;
}
elsif ( $period > 0 ) {
$start_block = $month_pos{ $period - 1 };
$end_block = $month_pos{ $period % 12 };
$end_block = $last_block if $start_block > $end_block;
}
else {
$start_block = $timeline[ 11 + $period ];
$start_block = $first_block if $period == -12;
$end_block = $last_block;
}
$row_start = int $start_block / 7;
$row_end = int $end_block / 7;
$max_epoch = time - 86400 * ( $last_block - $end_block );
$min_epoch = time - 86400 * ( $last_block - $start_block );
}
sub add_epoch {
my ($epoch, $count) = @_;
if ( $epoch > $max_epoch || $epoch < $min_epoch ) {
return 1;
}
my ( $month, $year, $wday, $yday ) = ( localtime($epoch) )[ 4, 5, 6, 7 ];
my $pos;
if ( $year == $cur_year ) {
$pos = ( $jan1 + $yday );
}
else {
my $total = ( $year % 4 ) ? 365 : 366;
$pos = ( $jan1 - ( $total - $yday ) );
}
return 0 if $pos < 0; #just in case
add_to_grid( $pos, $epoch, $count );
return 1;
}
sub add_to_grid {
my ( $pos, $epoch, $count ) = @_;
$count ||= 1;
my $r = int $pos / 7;
my $c = $pos % 7;
$grid[$r][$c]->{commits}+=$count;
$grid[$r][$c]->{epoch} = $epoch;
$max_commits = $grid[$r][$c]->{commits} if $grid[$r][$c]->{commits} > $max_commits;
}
sub compute_stats {
my %commit_counts;
my (
$total_commits,
$cur_streak,
$cur_start,
$max_streak,
$max_start,
$max_end,
$cur_streak_weekdays,
$cur_weekdays_start,
$max_streak_weekdays,
$max_weekdays_start,
$max_weekdays_end,
$q1,
$q2,
$q3,
) = (0) x 14;
foreach my $r ( $row_start .. $row_end ) {
foreach my $c ( 0 .. 6 ) {
my $cur_block = ( $r * 7 ) + $c;
if ( $cur_block >= $start_block && $cur_block < $end_block ) {
my $count = $grid[$r][$c]->{commits} || 0;
$total_commits += $count;
if ($count) {
$commit_counts{$count} = 1;
$cur_streak++;
$cur_start ||= $grid[$r][$c]->{epoch};
if ( $cur_streak > $max_streak ) {
$max_streak = $cur_streak;
$max_start = $cur_start;
$max_end = $grid[$r][$c]->{epoch};
}
#count++ if you work on weekends and streak will not be broken otherwise :)
$cur_streak_weekdays++;
$cur_weekdays_start ||= $grid[$r][$c]->{epoch};
if ( $cur_streak_weekdays > $max_streak_weekdays ) {
$max_streak_weekdays = $cur_streak_weekdays;
$max_weekdays_start = $cur_weekdays_start;
$max_weekdays_end = $grid[$r][$c]->{epoch};
}
}
else {
$cur_streak = 0;
$cur_start = 0;
if ( $c > 0 && $c < 6 ) {
$cur_streak_weekdays = 0;
$cur_weekdays_start = 0;
}
}
}
}
}
#now compute quartiles
my @commit_counts = sort { $a <=> $b } ( keys %commit_counts );
$q1 = $commit_counts[ int( scalar @commit_counts ) / 4 ];
$q2 = $commit_counts[ int( scalar @commit_counts ) / 2 ];
$q3 = $commit_counts[ int( 3 * ( scalar @commit_counts ) / 4 ) ];
#print "commit counts: " . (scalar @commit_counts) . " - " . (join ",",@commit_counts) . "\n\n";
#print "quartiles: $q1 $q2 $q3\n";
#die Dumper \%stat;
my %stat = (
total_commits => $total_commits,
cur_streak => $cur_streak ,
cur_start => $cur_start ,
max_streak => $max_streak ,
max_start => $max_start ,
max_end => $max_end ,
cur_streak_weekdays => $cur_streak_weekdays,
cur_weekdays_start => $cur_weekdays_start,
max_streak_weekdays => $max_streak_weekdays,
max_weekdays_start => $max_weekdays_start,
max_weekdays_end => $max_weekdays_end ,
q1 => $q1,
q2 => $q2,
q3 => $q3,
);
return %stat;
}
sub print_grid {
my %stat = @_;
my $space = 6;
print_month_names($space);
foreach my $c ( 0 .. 6 ) {
printf "\n%" . ( $space - 2 ) . "s", "";
print $c == 1 ? "M "
: $c == 3 ? "W "
: $c == 5 ? "F "
: " ";
foreach my $r ( $row_start .. $row_end ) {
my $cur_block = ( $r * 7 ) + $c;
if ( $cur_block >= $start_block && $cur_block < $end_block ) {
my $val = $grid[$r][$c]->{commits} || 0;
my $index = $val == 0 ? 0
: $val <= $stat{q1} ? 1
: $val <= $stat{q2} ? 2
: $val <= $stat{q3} ? 3
: 4;
print_block($index);
}
else {
print " ";
}
}
}
print "\n\n";
printf " %d total commits\t\t\tLess ", $stat{total_commits};
print_block($_) foreach ( 0 .. 4 );
printf " More\n\n";
}
sub print_block {
my $index = shift;
$index = 4 if $index > 4;
$_
= ( $format eq "ascii" ) ? "${ascii[$index]} "
: ( $format eq "unicode" ) ? "\e[38;5;$colors[$index]m${unicode[$index]} \e[0m"
: "\e[38;5;$colors[$index]m \e[0m";
print;
}
sub print_month_names {
#print month labels, printing current month in the right position is tricky
my $space = shift;
if ( defined $period && $period > 0 ) {
printf "%" . $space . "s %3s", "", $months[ $period - 1 ];
return;
}
my $label_printer = 0;
my $timeline_iter = defined $period ? 11 + $period : 0;
if ( $start_block == $first_block && $timeline[0] != 0 ) {
my $first_pos = int $timeline[0] / 7;
if ( $first_pos == 0 ) {
printf "%" . ( $space - 2 ) . "s", "";
print $pos_month{ $timeline[-1] } . " ";
print $pos_month{ $timeline[0] } . " ";
$timeline_iter++;
}
elsif ( $first_pos == 1 ) {
printf "%" . ( $space - 2 ) . "s", "";
print $pos_month{ $timeline[-1] } . " ";
}
else {
printf "%" . $space . "s", "";
printf "%-" . ( 2 * $first_pos ) . "s", $pos_month{ $timeline[-1] };
}
$label_printer = $first_pos;
}
else {
printf "%" . $space . "s", "";
$label_printer += ( int $start_block / 7 );
}
while ( $label_printer < $end_block / 7 && $timeline_iter <= $#timeline ) {
while ( ( int $timeline[$timeline_iter] / 7 ) != $label_printer ) { print " "; $label_printer++; }
print " " . $pos_month{ $timeline[$timeline_iter] } . " ";
$label_printer += 3;
$timeline_iter++;
}
}
sub print_message {
my ( $days, $start_epoch, $end_epoch, $message ) = @_;
if ($days) {
my @range;
foreach my $epoch ( $start_epoch, $end_epoch ) {
my ( $mday, $mon, $year ) = ( localtime($epoch) )[ 3, 4, 5 ];
my $s = sprintf( "%3s %2d %4d", $months[$mon], $mday, ( 1900 + $year ) );
push @range, $s;
}
printf "%4d: Days ( %-25s ) - %-40s\n", $days, ( join " - ", @range ), $message;
}
else {
printf "%4d: Days - %-40s\n", $days, $message;
}
}
sub number_of_days {
my ( $month, $year ) = @_;
return 30 if $month == 3 || $month == 5 || $month == 8 || $month == 10;
return 31 if $month != 1;
return 28 if $year % 4;
return 29;
}
sub configure {
my ($period, $ascii, $ansi, $unicode, $author) = @_;
my @wanted;
push @wanted, 'format' if (not grep { defined $$_ } ($ascii, $ansi, $unicode));
push @wanted, 'period' if (not defined $$period);
push @wanted, 'author' if (not defined $$author);
if (@wanted) {
my $git_command = "git config --get-regexp 'calendar\.*'";
my @parts = split(/\s/, qx/$git_command/);
if(@parts) {
my %config;
while(my ($key, $value) = splice(@parts, 0, 2)) {
$key =~ s/calendar\.//;
$config{$key} = $value;
}
local @ARGV = (map { ( "-$_" => $config{$_} ) }
grep { exists $config{$_} } @wanted);
GetOptions(
'period=n' => $period,
'format=s' => sub {
if ($_[1] eq 'ascii') { $$ascii ||= 1; }
elsif ($_[1] eq 'ansi') { $$ansi ||= 1; }
elsif ($_[1] eq 'unicode') { $$unicode ||= 1; }
},
'author=s' => $author
);
}
}
}
__END__
=head1 NAME
git-cal - A simple tool to view commits calendar (similar to github contributions calendar) on command line
=head1 SYNOPSIS
"git-cal" is a tool to visualize the git commit history in github's contribution calendar style.
The calendar shows how frequently the commits are made over the past year or some choosen period
Activity can be displayed using ascii, ansi or unicode characters, default is choosen based on ENV
git-cal
git-cal --period=<1..12, -11..0>
git-cal --author=<author>
git-cal --ascii
git-cal --ansi
git-cal --unicode
git-cal <options> <filepath>
=head2 OPTIONS
=over
=item [--period|-p]=<n>
Do not show the entire year:
=over
=item n = 1 to 12
Shows only one month (1=Jan .. 12=Dec)
=item n = -11 to 0
Shows the previous -n months (and the current month)
=back
=item --author=<author>
View commits of a particular author.
=item --all
View stats from all branches.
=item --ascii
Display activity using ASCII characters instead of ANSI colors.
=item --ansi
Display activity using ANSI colors
=item --unicode
Display activity using unicode characters
=item --help|-?
Print this message.
=back
=head2 ADDITIONAL OPTIONS
<filepath> to view the logs of a particular file or directory
=head2 USING GIT CONFIG
git-cal uses the git config tool to store configuration on disk. Similar keys are used to
those listed above with the notable exception being the bundling of ascii, ansi and unicode
into a "format" key. Examples of the three supported keys are below.
git config --global calendar.format ascii
git config --global calendar.period 5
git config --global calendar.author karthik
A command line supplied option will override the matching option set using this method.
=head1 AUTHOR
Karthik katooru <karthikkatooru@gmail.com>
=head1 COPYRIGHT AND LICENSE
This program is free software; you can redistribute it and/or modify it under the MIT License

View file

@ -1,10 +1,8 @@
#!/bin/bash
#!/bin/sh
#
# Written by Corey Haines
# Scriptified by Gary Bernhardt
# List files with commit count.
#
# Put this anywhere on your $PATH (~/bin is recommended). Then git will see it
# and you'll be able to do `git churn`.
# Based on: https://github.com/garybernhardt/dotfiles/blob/main/bin/git-churn
#
# Show churn for whole repo:
# $ git churn
@ -16,8 +14,15 @@
# $ git churn --since='1 month ago'
#
# (These are all standard arguments to `git log`.)
set -e
git log --all -M -C --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort -n | awk 'BEGIN {print "count\tfile"} {print $1 "\t" $2}'
#
exec git log --all \
--find-copies \
--find-renames \
--name-only \
--format='format:' \
"$@" \
| sort \
| grep -v '^$' \
| uniq -c \
| sort -n \
| awk 'BEGIN {print "count\tfile"} {print $1 "\t" $2}'

26
bin/git-ignore Executable file
View file

@ -0,0 +1,26 @@
#!/bin/sh
set -eu
WORKDIR="${XDG_CACHE_HOME:-$HOME/.cache}/git-ignore"
URL="https://github.com/github/gitignore.git"
if [ ! -d "$WORKDIR" ]; then
git clone --quiet --depth 1 "$URL" "$WORKDIR"
else
git -C "$WORKDIR" pull --quiet
fi
find "$WORKDIR" -maxdepth 1 -type f -name '*gitignore' |
sed -e "s,^$WORKDIR/\(.*\)\.gitignore$,\1," |
sort |
fzf --multi \
--preview="cat $WORKDIR/{}.gitignore" \
--bind='ctrl-p:toggle-preview' |
while read -r lang; do
echo "############################################################"
echo "# ${lang}"
echo "############################################################"
cat "$WORKDIR/${lang}.gitignore"
echo
done

5
bin/git-ignored Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
#
# List ignored files.
#
exec git ls-files --ignored --exclude-standard --others

View file

@ -1,7 +1,8 @@
#!/bin/sh
#
# Initialize a git repository and automatically create an empty root commit.
# NOTE: requires the `l` alias to be defined (see .gitconfig)
git init && git commit --allow-empty -m "Initial commit" && git l
#
set -e
git init
git commit --allow-empty -m "Initial commit"
git log --graph --pretty='%C(auto)%h%d %s %C(8) %ad'

9
bin/git-tree Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
#
# Show a simplified tree with all branches.
#
exec git log \
--all \
--graph \
--pretty='%C(auto)%h%d %s %C(8) %ad' \
--simplify-by-decoration

5
bin/git-what Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
#
# Detailed description of what I'm looking at.
#
exec git describe --always --tags --long --dirty

View file

@ -1,4 +1,3 @@
#!/bin/sh
# Head as much as fits on screen
exec head -n $(echo "$(tput lines) - 5" | bc) "$@"
exec head -n "$(echo "$(tput lines) - 5" | bc)" "$@"

View file

@ -9,6 +9,7 @@ error() {
[ -n "$1" ] || error "input file missing"
[ -r "$1" ] || error "can't read input file"
# shellcheck disable=SC2016 # I don't want $(tty) to be expanded
printf '#!/bin/sh
GPG_TTY=$(tty)
export GPG_TTY
@ -16,4 +17,3 @@ base64 -d <<EOF | gpg -d
%s
EOF
' "$(gpg -c --cipher-algo AES256 -o - -- "$1" | base64)"

View file

@ -1,3 +1,2 @@
#!/bin/sh
echo "$MANPATH" | tr -s ":" "\n"

View file

@ -6,4 +6,3 @@
exec curl -s https://ifconfig.co
#exec curl -s https://ifconfig.me
#exec dig +short myip.opendns.com @resolver1.opendns.com

View file

@ -1,3 +1,2 @@
#!/bin/sh
exec curl -s ipinfo.io

View file

@ -2,7 +2,7 @@
usage() {
echo "Usage:
$(basename $0) [-h] <volume> -- generate /etc/fstab entry to prevent automount on macOS
$(basename "$0") [-h] <volume> -- generate /etc/fstab entry to prevent automount on macOS
where:
-h print this help
@ -32,4 +32,3 @@ case "$1" in
"") error "volume required" ;;
*) gen_fstab_entry "$1";;
esac

View file

@ -1,3 +1,2 @@
#!/bin/sh
echo "$PATH" | tr -s ":" "\n"

View file

@ -11,4 +11,3 @@ printf '%b\n' "\e[7mThis text has the reverse (tput rev) attribute.${reset}"
printf '%b\n' "\e[8mThis text has the invisible (tput invis) attribute.${reset}"
printf '%b\n' "\e[9mThis text has the strikethrough (tput ?) attribute.${reset}"
printf '%b\n' "\e[21mThis text has the double underline (tput ?) attribute.${reset}"

View file

@ -1,4 +1,3 @@
#!/bin/sh
# Tail as much as fits on screen
exec tail -n $(echo "$(tput lines) - 5" | bc) "$@"
exec tail -n "$(echo "$(tput lines) - 5" | bc)" "$@"

View file

@ -108,4 +108,3 @@ if __name__ == '__main__':
generate = generators[args.terminal]
print(generate(SOLARIZED, **theme))

View file

@ -1,6 +1,6 @@
#!/bin/bash
scriptname=`basename "$0"`
scriptname=$(basename "$0")
usage() {
echo "Usage: $scriptname SHARE [...]"
@ -15,7 +15,7 @@ mount_share() {
share="$1"
sudo mkdir "/mnt/$share"
sudo chmod 777 "/mnt/$share"
sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) "$share" "/mnt/$share"
sudo mount -t vboxsf -o uid=$UID,gid="$(id -g)" "$share" "/mnt/$share"
}
main() {
@ -30,4 +30,3 @@ main() {
}
main "$@"

View file

@ -1,7 +0,0 @@
# Where to install the dotfiles, usually $HOME.
DESTDIR="$HOME"
# Git user information.
GIT_USER="Fernando Schauenburg"
GIT_EMAIL="dev@schauenburg.me"

View file

@ -1,5 +1,4 @@
[alias]
alias = config --get-regexp ^alias
b = branch
bv = b -vv
ba = bv --all
@ -16,12 +15,13 @@
la = l --all
lna = ln --all
lla = ll --all
lw = !watch -c -n 1 git log --color=always --graph --pretty=basic --all
s = status --short
ss = status
[pretty]
basic = %C(auto)%h%d %s %C(8) %ad
name = %C(auto)%h%d %s %n%C(2)%aN <%C(10)%aE%C(2)> %C(8) %ad %n
name = %C(auto)%h%d %s %C(2)%aN <%C(10)%aE%C(2)> %C(8) %ad
[core]
excludesfile = ~/.config/git/ignore
@ -35,25 +35,16 @@
date = human
[delta]
commit-decoration-style = "#d79921" bold box ul
features = gruvbox
commit-style = raw
dark = true
file-decoration-style = "#458588" bold box
file-modified-label = "modified:"
file-style = "#458588" # blue
hunk-header-style = omit
line-numbers = true
line-numbers-minus-style = "#cc241d" italic # red
line-numbers-plus-style = "#98971a" italic # green
line-numbers-zero-style = "#504945" # dark2
line-numbers-left-style = "#665c54" # dark3
line-numbers-right-style = "#ebdbb2" # light1
minus-emph-style = normal "#651e1b" # red almost darkest
minus-style = normal "#2e100f" # red darkest
plus-emph-style = syntax "#585818" # green almost darkest
plus-style = syntax "#2e2e0f" # green darkest
syntax-theme = Nord
[include]
path = delta.gitconfig
[push]
default = upstream
@ -76,6 +67,7 @@
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
# Color palette translation:
@ -116,8 +108,8 @@
path = ~/.local/etc/git/config.user # user name & e-mail (from template)
path = ~/.local/etc/git/config # optional manual configurations
# Overrides for my dotfiles directory to make sure I never commit with the
# wrong e-mail address.
# Never commit my dotfiles or personal projects with the wrong e-mail address.
[includeIf "gitdir:~/.dotfiles/"]
path = ~/.config/git/dotfiles
path = ~/.config/git/dev@schauenburg.me
[includeIf "gitdir:~/.local/src/"]
path = ~/.config/git/dev@schauenburg.me

View file

@ -0,0 +1,43 @@
[delta "gruvbox"]
dark = true
commit-decoration-style = "#d79921" bold box ul
file-decoration-style = "#458588" bold box
file-style = "#458588"
line-numbers-minus-style = "#cc241d" bold italic
line-numbers-plus-style = "#98971a" bold italic
line-numbers-zero-style = "#504945"
line-numbers-left-style = "#665c54"
line-numbers-right-style = "#ebdbb2"
minus-empty-line-marker-style = syntax "#2e100f"
minus-non-emph-style = syntax "#2e100f"
minus-emph-style = syntax "#651e1b"
minus-style = syntax "#2e100f"
plus-empty-line-marker-style = syntax "#2e2e0f"
plus-non-emph-style = syntax "#2e2e0f"
plus-emph-style = syntax "#585818"
plus-style = syntax "#2e2e0f"
[delta "tokyonight"]
dark = true
commit-decoration-style = "#e0af68" bold box ul
file-decoration-style = "#769def" bold box
file-style = "#769def"
line-numbers-minus-style = "#b2555b" bold italic
line-numbers-plus-style = "#266d6a" bold italic
line-numbers-zero-style = "#3b4261"
line-numbers-left-style = "#414868"
line-numbers-right-style = "#a9b1d6"
minus-empty-line-marker-style = syntax "#37222c"
minus-non-emph-style = syntax "#37222c"
minus-emph-style = syntax "#713137"
minus-style = syntax "#37222c"
plus-empty-line-marker-style = syntax "#20303b"
plus-non-emph-style = syntax "#20303b"
plus-emph-style = syntax "#2c5a66"
plus-style = syntax "#20303b"

View file

@ -1,4 +1,3 @@
[user]
name = Fernando Schauenburg
email = dev@schauenburg.me

View file

@ -1,3 +1,6 @@
AllowBlinking=yes
BellType=0
BoldAsColour=no
BoldAsFont=yes
Charset=UTF-8
Columns=110
@ -5,20 +8,18 @@ CtrlAltIsAltGr=yes
CursorType=line
Font=SauceCodePro NF Medium
FontHeight=11
FontSmoothing=default
FontWeight=500
Hold=error
Locale=en_US
OpaqueWhenFocused=yes
Padding=0
RewrapOnResize=no
Rows=45
Scrollbar=none
SelectionShowSize=6
StatusLine=no
Term=xterm-256color
ThemeFile=gruvbox-dark
Transparency=off
Utmp=yes
ThemeFile=gruvbox-dark
BoldAsColour=no
BellType=0
FontSmoothing=default
RewrapOnResize=no
StatusLine=no

View file

@ -1,10 +1,16 @@
# Gruvbox Dark
ForegroundColour = 235, 219, 178
#BackgroundColour = 29, 32, 33
BackgroundColour = 23, 26, 27
CursorColour = 204, 36, 29
IMECursorColour = 204, 36, 29
# BackgroundColour = 29, 32, 33
# BackgroundColour = 23, 26, 27
BackgroundColour = 19, 21, 22
CursorColour = 157, 0, 6
# CursorColour = 204, 36, 29
IMECursorColour = 157, 0, 6
# IMECursorColour = 204, 36, 29
Black = 40, 40, 40
Red = 204, 36, 29

View file

@ -1,7 +1,7 @@
# Solarized Dark
ForegroundColour=131,148,150
BackgroundColour=0,43,54
BackgroundColour=0,32,40
CursorColour=220,50,47
Black=7,54,66

View file

@ -0,0 +1,24 @@
# Tokyonight Night
ForegroundColour = #c0caf5
BackgroundColour = #1a1b26
CursorColour = #FB567A
IMECursorColour = #F7768E
Black = #15161E
Red = #F86D8B
Green = #9ECE6A
Yellow = #E0AF68
Blue = #5588F6
Magenta = #8E57F4
Cyan = #61B8EA
White = #A9B1D6
BoldBlack = #414868
BoldRed = #F7768E
BoldGreen = #A8DB70
BoldYellow = #EFB45D
BoldBlue = #7AA2F7
BoldMagenta = #BB9AF7
BoldCyan = #7DCFFF
BoldWhite = #C0CAF5

View file

@ -0,0 +1,24 @@
# Tokyonight Night
ForegroundColour = #c0caf5
BackgroundColour = #1a1b26
CursorColour = #f7768e
IMECursorColour = #f7768e
Black = #15161e
Red = #f7768e
Green = #9ece6a
Yellow = #e0af68
Blue = #7aa2f7
Magenta = #bb9af7
Cyan = #7dcfff
White = #a9b1d6
BoldBlack = #414868
BoldRed = #f7768e
BoldGreen = #9ece6a
BoldYellow = #e0af68
BoldBlue = #7aa2f7
BoldMagenta = #bb9af7
BoldCyan = #7dcfff
BoldWhite = #c0caf5

View file

@ -0,0 +1 @@
require("util.options").set_gitcommit_buffer_options()

View file

@ -0,0 +1 @@
vim.opt.spell = false

View file

@ -0,0 +1,27 @@
vim.bo.commentstring = "// %s"
local insert_include_guards = function(bufnr)
bufnr = bufnr or 0
-- foo.h -> FOO_H_
local guard = string.gsub(string.upper(vim.fn.expand("%:t")), "%.", "_") .. "_"
vim.api.nvim_buf_set_lines(bufnr, 0, 0, true, {
string.format("#ifndef %s", guard),
string.format("#define %s", guard),
"",
})
local last_lineno = vim.api.nvim_buf_line_count(bufnr)
vim.api.nvim_buf_set_lines(bufnr, last_lineno, last_lineno, true, {
"",
string.format("#endif // %s", guard),
})
end
vim.keymap.set(
"n",
"<localleader>ig",
insert_include_guards,
{ desc = "Add include guards", buffer = true, silent = true }
)

View file

@ -0,0 +1 @@
vim.bo.tabstop = 2

View file

@ -1,2 +1 @@
vim.bo.commentstring = '// %s'
vim.bo.commentstring = "// %s"

View file

@ -1,2 +1 @@
vim.bo.commentstring = '// %s'
vim.bo.commentstring = "// %s"

View file

@ -0,0 +1 @@
vim.bo.commentstring = "# %s"

View file

@ -1,4 +1 @@
vim.bo.textwidth = 72
vim.opt.formatoptions:append('t') -- wrap text on 'textwidth'
vim.opt.spell = true -- turn on spell checking
require("util.options").set_gitcommit_buffer_options()

View file

@ -1,22 +1,18 @@
vim.bo.tabstop = 2
local buffer = { buffer = true }
local lua = require("util.lua")
local map = vim.keymap.set
local opts = function(desc) return { desc = desc, buffer = true, silent = true } end
local exec_current_lua_line = function()
local lineno = vim.fn.line('.')
print('Executing line ' .. lineno)
vim.fn.luaeval(vim.fn.getline(lineno))
end
-- stylua: ignore start
map("n", "gf", lua.go_to_module, opts("Go to module under cursor"))
local exec_current_lua_selection = function()
local selection = { vim.fn.line('v'), vim.fn.line('.') }
local first, last = vim.fn.min(selection), vim.fn.max(selection)
local code = vim.fn.join(vim.fn.getline(first, last), '\n')
print('Executing lines ' .. first .. ' to ' .. last)
loadstring(code)()
end
vim.keymap.set('n', '<localleader>x', exec_current_lua_line, buffer)
vim.keymap.set('x', '<localleader>x', exec_current_lua_selection, buffer)
vim.keymap.set('n', '<localleader><localleader>x', '<cmd>write | luafile %<cr>', buffer)
map("n", "<localleader>x", lua.execute_lines, opts("Execute current line"))
map("x", "<localleader>x", lua.execute_selection, opts("Execute selection"))
map("n", "<localleader><localleader>x", lua.execute_file, opts("Execute current file"))
map("n", [[<localleader>']], [[:.s/"/'/g | nohl<cr>]], opts([[Replace: " 󱦰 ']]))
map("n", [[<localleader>"]], [[:.s/'/"/g | nohl<cr>]], opts([[Replace: ' 󱦰 "]]))
map("x", [[<localleader>']], [[:s/"/'/g | nohl<cr>]], opts([[Replace: " 󱦰 ']]))
map("x", [[<localleader>"]], [[:s/'/"/g | nohl<cr>]], opts([[Replace: ' 󱦰 "]]))
-- stylua: ignore end

View file

@ -1,5 +1,4 @@
vim.bo.tabstop = 2
vim.wo.conceallevel = 2
vim.opt.formatoptions:append('t') -- wrap text on 'textwidth'
vim.opt.spell = true -- turn on spell checking
vim.bo.shiftwidth = 0 -- use 'tabstop' for indenting
vim.opt.formatoptions:append("t") -- wrap text on 'textwidth'
vim.opt.spell = true -- turn on spell checking

View file

@ -0,0 +1,2 @@
vim.bo.commentstring = "' %s"
vim.bo.tabstop = 2

View file

@ -1,3 +1,2 @@
vim.opt.foldmethod = 'indent'
vim.opt.foldignore = '#'
vim.opt.foldmethod = "indent"
vim.opt.foldignore = "#"

View file

@ -0,0 +1 @@
vim.opt.spell = false

View file

@ -1,2 +1 @@
vim.opt.tabstop = 2

View file

@ -1,3 +1,2 @@
vim.opt.formatoptions:append('t') -- wrap text on 'textwidth'
vim.opt.spell = true -- turn on spell checking
vim.opt.formatoptions:append("t") -- wrap text on 'textwidth'
vim.opt.spell = true -- turn on spell checking

View file

@ -1,2 +1 @@
vim.opt.foldmethod = 'marker'
vim.opt.foldmethod = "marker"

View file

@ -0,0 +1 @@
vim.bo.tabstop = 2

View file

@ -1,2 +1,2 @@
vim.opt.tabstop = 2
vim.opt.iskeyword:append("-")

View file

@ -0,0 +1,4 @@
---@type vim.lsp.Config
return {
cmd = { "clangd", "--header-insertion=never" },
}

View file

@ -0,0 +1,24 @@
---@type vim.lsp.Config
return {
settings = {
Lua = {
-- I'm using lua only inside neovim, so the runtime is LuaJIT.
runtime = { version = "LuaJIT" },
-- Get the language server to recognize the `vim` global.
diagnostics = { globals = { "vim" } },
-- Make the server aware of Neovim runtime files.
workspace = {
library = { vim.env.VIMRUNTIME },
-- Alternatively, pull in all of 'runtimepath'.
-- But see: https://github.com/neovim/nvim-lspconfig/issues/3189
-- library = { vim.api.nvim_get_runtime_file("", true) }
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = { enable = false },
},
},
}

View file

@ -0,0 +1,18 @@
---@type vim.lsp.Config
return {
-- Use .editoconfig for code style, naming convention and analyzer settings.
enable_editorconfig_support = true,
-- Show unimported types and add`using` directives.
enable_import_completion = true,
-- Enable roslyn analyzers, code fixes, and rulesets.
enable_roslyn_analyzers = true,
-- Don't include preview versions of the .NET SDK.
sdk_include_prereleases = false,
handlers = {
["textDocument/definition"] = require("omnisharp_extended").handler,
},
}

View file

@ -1,2 +1,3 @@
require('fschauen')
if vim.loader then vim.loader.enable() end
require("config")

View file

@ -1,48 +1,61 @@
{
"LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"LuaSnip": { "branch": "master", "commit": "eda5be8f0ce9816278671f0b578cdbb8b762c701" },
"blame.nvim": { "branch": "main", "commit": "b87b8c820e4cec06fbbd2f946b7b35c45906ee0c" },
"catppuccin": { "branch": "main", "commit": "fa42eb5e26819ef58884257d5ae95dd0552b9a66" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"dial.nvim": { "branch": "master", "commit": "2c7e2750372918f072a20f3cf754d845e143d7c9" },
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
"fidget.nvim": { "branch": "legacy", "commit": "2f7c08f45639a64a5c0abcf67321d52c3f499ae6" },
"git-messenger.vim": { "branch": "master", "commit": "8a61bdfa351d4df9a9118ee1d3f45edbed617072" },
"formatter.nvim": { "branch": "master", "commit": "b9d7f853da1197b83b8edb4cc4952f7ad3a42e41" },
"git-messenger.vim": { "branch": "master", "commit": "fd124457378a295a5d1036af4954b35d6b807385" },
"gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" },
"indent-blankline.nvim": { "branch": "master", "commit": "12e92044d313c54c438bd786d11684c88f6f78cd" },
"lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" },
"lspkind-nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
"lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" },
"headlines.nvim": { "branch": "master", "commit": "bf17c96a836ea27c0a7a2650ba385a7783ed322e" },
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
"kanagawa.nvim": { "branch": "master", "commit": "debe91547d7fb1eef34ce26a5106f277fbfdd109" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
"lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "0954d7730e749d606ddf8d7ae8846848be435d53" },
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
"neogit": { "branch": "master", "commit": "536b4cfc009fc6d8bd771f010f04d48204533fae" },
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
"neogen": { "branch": "main", "commit": "d7f9461727751fb07f82011051338a9aba07581d" },
"neogit": { "branch": "master", "commit": "e3c148905c334c886453df1490360ebb1a2ba2ed" },
"nerdy.nvim": { "branch": "main", "commit": "826a74b0e2d86548190ac4575cccd8d5b159c0a1" },
"nginx.vim": { "branch": "master", "commit": "cffaec54f0c7f9518de053634413a20e90eac825" },
"nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
"nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" },
"nvim-lspconfig": { "branch": "master", "commit": "1bc83418927003552505ec66fa5d6cffae953f6a" },
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-lint": { "branch": "master", "commit": "2b0039b8be9583704591a13129c600891ac2c596" },
"nvim-lspconfig": { "branch": "master", "commit": "6bba673aa8993eceec233be17b42ddfb9540794b" },
"nvim-luaref": { "branch": "main", "commit": "9cd3ed50d5752ffd56d88dd9e395ddd3dc2c7127" },
"nvim-tree.lua": { "branch": "master", "commit": "8cbb1db8e90b62fc56f379992e622e9f919792ce" },
"nvim-treesitter": { "branch": "master", "commit": "b444afa1dacd3d031c0ffe4763671d89afda5ddb" },
"nvim-treesitter-refactor": { "branch": "master", "commit": "65ad2eca822dfaec2a3603119ec3cc8826a7859e" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "dd0b2036c3a27cb6e6486f8bd24188c6ca43af0b" },
"nvim-web-devicons": { "branch": "master", "commit": "313d9e7193354c5de7cdb1724f9e2d3f442780b0" },
"oil.nvim": { "branch": "master", "commit": "bf753c3e3f8736939ad5597f92329dfe7b1df4f5" },
"omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "4be2e8689067494ed7e5a4f1221adc31d1a07783" },
"nvim-notify": { "branch": "master", "commit": "a22f5d7ac511c2df2fd3290a9f04c48d5a822e2e" },
"nvim-tree.lua": { "branch": "master", "commit": "b0b49552c9462900a882fe772993b01d780445fe" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-treesitter-refactor": { "branch": "master", "commit": "d8b74fa87afc6a1e97b18da23e762efb032dc270" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "89ebe73cd2836db80a22d9748999ace0241917a5" },
"nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" },
"oil.nvim": { "branch": "master", "commit": "08c2bce8b00fd780fb7999dbffdf7cd174e896fb" },
"omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "ec1a2431f8872f650a85ed71c24f0715df2e49c2" },
"open-browser.vim": { "branch": "master", "commit": "7d4c1d8198e889d513a030b5a83faa07606bac27" },
"plantuml-previewer.vim": { "branch": "master", "commit": "368a1f331c1ff29f6a3ee76facfca39a7f374b13" },
"plantuml-syntax": { "branch": "master", "commit": "9d4900aa16674bf5bb8296a72b975317d573b547" },
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
"plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" },
"swift.vim": { "branch": "master", "commit": "bb62135c4364c84b56499f4b54e1a6b8eca72eec" },
"tabular": { "branch": "master", "commit": "339091ac4dd1f17e225fe7d57b48aff55f99b23a" },
"telescope-file-browser.nvim": { "branch": "master", "commit": "6dd6522bc1a4cbe5883eb0272f5cc7a54ae3858b" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
"telescope.nvim": { "branch": "master", "commit": "236083884cfe6c874e03e6cb4e7cb08809c1333c" },
"text-case.nvim": { "branch": "main", "commit": "5d85b7495c3cf8e842e4d2528edc68e6fe7c92c8" },
"todo-comments.nvim": { "branch": "main", "commit": "833d8dd8b07eeda37a09e99460f72a02616935cb" },
"trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },
"undotree": { "branch": "master", "commit": "7df3be7a261ea31b528aa442b494fcb458f3d968" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"swift.vim": { "branch": "master", "commit": "c76b52c68b633ad397ddab761c47efc7b5c1a6b9" },
"tabular": { "branch": "master", "commit": "12437cd1b53488e24936ec4b091c9324cafee311" },
"telescope-file-browser.nvim": { "branch": "master", "commit": "7bf55ed0ff5be182ad3301cff266581fc1c56cce" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
"undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" },
"vim-applescript": { "branch": "master", "commit": "a39af8fc7e4caf581366e2917d558f6232e4db36" },
"vim-better-whitespace": { "branch": "master", "commit": "029f35c783f1b504f9be086b9ea757a36059c846" },
"vim-commentary": { "branch": "master", "commit": "f67e3e67ea516755005e6cccb178bc8439c6d402" },
"vim-fugitive": { "branch": "master", "commit": "e7bf502a6ae492f42a91d231864e25630286319b" },
"virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" }
"vim-better-whitespace": { "branch": "master", "commit": "de99b55a6fe8c96a69f9376f16b1d5d627a56e81" },
"vim-commentary": { "branch": "master", "commit": "64a654ef4a20db1727938338310209b6a63f60c9" },
"vim-fugitive": { "branch": "master", "commit": "593f831d6f6d779cbabb70a4d1e6b1b1936a88af" },
"virt-column.nvim": { "branch": "master", "commit": "b87e3e0864211a32724a2ebf3be37e24e9e2fa99" }
}

View file

@ -0,0 +1,28 @@
local M = {}
M.setup = function()
local group = vim.api.nvim_create_augroup("custom", { clear = true })
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Briefly highlight yanked text.",
group = group,
pattern = "*",
callback = function(_) vim.highlight.on_yank() end,
})
vim.api.nvim_create_autocmd("InsertEnter", {
desc = "Hide cursor line when entering insert mode.",
group = group,
pattern = "*",
callback = function(_) vim.opt.cursorlineopt = "number" end,
})
vim.api.nvim_create_autocmd("InsertLeave", {
desc = "Show cursor line when leaving insert mode.",
group = group,
pattern = "*",
callback = function(_) vim.opt.cursorlineopt = "both" end,
})
end
return M

View file

@ -0,0 +1,140 @@
local M = {}
---Show diagnostics in a floating window.
---@param opts table|nil: options passed along to `vim.diagnostic.open_float`.
M.open_float = function(opts) vim.diagnostic.open_float(opts) end
---Toggle diagnostics in the given buffer.
---@param bufnr integer|nil: Buffer number (0 for current buffer, nil for all buffers.
M.toggle = function(bufnr)
local filter = { bufnr = bufnr or 0 }
if vim.diagnostic.is_enabled(filter) then
vim.diagnostic.enable(false, filter)
else
vim.diagnostic.enable(true, filter)
end
end
---Hide currently displayed diagnostics.
---@param bufnr integer|nil: Buffer number (0 for current buffer, nil for all buffers.
M.hide = function(bufnr) vim.diagnostic.hide(nil, bufnr or 0) end
local icons = require("util.icons")
---Use `Telescope` to set a new diagnostic severity.
M.set_severity = function()
if not pcall(require, "telescope") then
vim.notify("Telescope not available!", vim.log.levels.ERROR)
return
end
local displayer = require("telescope.pickers.entry_display").create {
separator = "",
items = { { width = 3 }, { width = 3 }, { remaining = true } },
}
local make_display = function(entry)
local severity = vim.F.npcall(
function() return vim.diagnostic.config().signs.severity.min end
)
local marker = severity == entry.value.severity and icons.ui.Checkbox or ""
return displayer {
{ marker, "Comment" },
{ entry.value.icon, entry.value.highlight },
{ entry.value.title, entry.value.highlight },
}
end
local opts = require("telescope.themes").get_dropdown()
require("telescope.pickers")
.new(opts, {
prompt_title = "Min. severity for virtual text:",
finder = require("telescope.finders").new_table {
results = {
{
title = "Off",
severity = 0,
icon = icons.ui.Off,
highlight = "Comment",
},
{
title = "Error",
severity = vim.diagnostic.severity.ERROR,
icon = icons.diagnostics_bold.Error,
highlight = "DiagnosticError",
},
{
title = "Warning",
severity = vim.diagnostic.severity.WARN,
icon = icons.diagnostics_bold.Warn,
highlight = "DiagnosticWarn",
},
{
title = "Info",
severity = vim.diagnostic.severity.INFO,
icon = icons.diagnostics_bold.Info,
highlight = "DiagnosticInfo",
},
{
title = "Hint",
severity = vim.diagnostic.severity.HINT,
icon = icons.diagnostics_bold.Hint,
highlight = "DiagnosticHint",
},
},
entry_maker = function(entry)
return { value = entry, ordinal = entry.title, display = make_display }
end,
},
sorter = require("telescope.config").values.generic_sorter(opts),
attach_mappings = function(prompt_bufnr)
require("telescope.actions.set").select:replace(function()
local selection = require("telescope.actions.state").get_selected_entry()
require("telescope.actions").close(prompt_bufnr)
M.setup { severity = { min = selection.value.severity } }
end)
return true -- Attach default mappings as well.
end,
})
:find()
end
---Customize nvim's diagnostics display.
M.setup = function(opts)
opts = vim.tbl_deep_extend("keep", opts or {}, {
severity = {
min = vim.diagnostic.severity.HINT,
},
})
vim.diagnostic.config {
underline = false,
severity_sort = true,
signs = {
severity = opts.severity,
text = {
[vim.diagnostic.severity.ERROR] = icons.diagnostics.Error,
[vim.diagnostic.severity.WARN] = icons.diagnostics.Warn,
[vim.diagnostic.severity.INFO] = icons.diagnostics.Info,
[vim.diagnostic.severity.HINT] = icons.diagnostics.Hint,
},
},
virtual_text = {
severity = opts.severity,
prefix = function(_, index, total) return index == total and "" or "" end,
},
float = {
border = "rounded",
header = { " " .. icons.ui.Diagnostic .. " Diagnostics:", "Comment" },
prefix = function(_, index, _) return string.format("%2d. ", index), "Comment" end,
},
jump = {
severity = opts.severity,
wrap = false,
float = true,
},
}
end
return M

View file

@ -0,0 +1,26 @@
local M = {}
M.setup = function()
vim.filetype.add {
-- 1. The file path/name is checked first.
filename = {
["clang-format"] = "yaml",
editorconfig = "editorconfig",
},
-- 2. Patterns are checked second.
pattern = {
["${HOME}/.ssh/config.d/.*"] = "sshconfig",
-- Files in my dotfiles repository.
[".*/config/zsh/.*"] = "zsh",
[".*/git/config"] = "gitconfig",
[".*/ssh/config"] = "sshconfig",
},
-- 3. Finally, the extension is checked.
extension = {
gitconfig = "gitconfig",
},
}
end
return M

View file

@ -0,0 +1,19 @@
P = function(v)
print(vim.inspect(v))
return v
end
R = function(module)
require("plenary.reload").reload_module(module)
return require(module)
end
require("config.options").setup()
require("config.keymap").setup()
require("config.diagnostic").setup()
require("config.autocmd").setup()
require("config.filetype").setup()
require("config.lazy").setup()
local colorscheme = vim.env.NVIM_COLORSCHEME or "gruvbox"
vim.cmd("silent! colorscheme " .. colorscheme)

View file

@ -0,0 +1,106 @@
local M = {}
-- stylua: ignore start
M.setup = function()
-- better navigation for wrapped lines
vim.keymap.set("n", "j", "gj")
vim.keymap.set("n", "k", "gk")
-- maintain cursor position when joining lines
vim.keymap.set("n", "J", "mzJ`z")
-- retain selection when making changes in visual mode
vim.keymap.set("v", "<c-a>", "<c-a>gv")
vim.keymap.set("v", "<c-x>", "<c-x>gv")
vim.keymap.set("v", "g<c-a>", "g<c-a>gv")
vim.keymap.set("v", "g<c-x>", "g<c-x>gv")
vim.keymap.set("v", ">", "><cr>gv")
vim.keymap.set("v", "<", "<<cr>gv")
-- place destination of important movements in the center of the screen
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")
vim.keymap.set("n", "*", "*zzzv")
vim.keymap.set("n", "#", "#zzzv")
vim.keymap.set("n", "g*", "g*zzzv")
vim.keymap.set("n", "g#", "g#zzzv")
vim.keymap.set("n", "<c-d>", "<c-d>zzzv")
vim.keymap.set("n", "<c-u>", "<c-u>zzzv")
-- easier window navigation
vim.keymap.set("n", "<c-j>", "<c-w>j")
vim.keymap.set("n", "<c-k>", "<c-w>k")
vim.keymap.set("n", "<c-h>", "<c-w>h")
vim.keymap.set("n", "<c-l>", "<c-w>l")
-- disable highlight until next search
vim.keymap.set("n", "<leader>h", "<cmd>nohlsearch<cr>")
local window = require("util.window")
-- window resizing
vim.keymap.set("n", "<s-Up>", window.resize_up(2), { desc = "Resize window upward" })
vim.keymap.set("n", "<s-Down>", window.resize_down(2), { desc = "Resize window downward" })
vim.keymap.set("n", "<s-Left>", window.resize_left(2), { desc = "Resize window leftward" })
vim.keymap.set("n", "<s-Right>", window.resize_right(2), { desc = "Resize window rightward" })
-- easy tab navigation
vim.keymap.set("n", "<Right>", "<cmd>tabnext<cr>")
vim.keymap.set("n", "<Left>", "<cmd>tabprevious<cr>")
-- move lines up and down
vim.keymap.set("n", "<c-a-j>", [[:move .+1<cr>==]])
vim.keymap.set("n", "<c-a-k>", [[:move .-2<cr>==]])
vim.keymap.set("v", "<c-a-j>", [[:move '>+1<cr>gv=gv]])
vim.keymap.set("v", "<c-a-k>", [[:move '<-2<cr>gv=gv]])
vim.keymap.set("i", "<c-a-j>", [[<esc>:move .+1<cr>==gi]])
vim.keymap.set("i", "<c-a-k>", [[<esc>:move .-2<cr>==gi]])
-- move to begin/end of line in insert mode
vim.keymap.set("i", "<c-a>", "<c-o>^")
vim.keymap.set("i", "<c-e>", "<c-o>$")
-- move to begin of line in command mode (<c-e> moves to end by default)
vim.keymap.set("c", "<c-a>", "<c-b>")
-- more convenient way of entering normal mode from terminal mode
vim.keymap.set("t", [[<c-\><c-\>]], [[<c-\><c-n>]])
-- recall older/recent command-line from history
vim.keymap.set("c", "<c-j>", "<down>")
vim.keymap.set("c", "<c-k>", "<up>")
-- trigger InsertLeave when leaving Insert mode with ctrl-c (see :help i_CTRL-C)
vim.keymap.set("i", "<c-c>", "<esc>")
-- quickly change background
vim.keymap.set("n", "<leader>bg", [[<cmd>let &background = &background ==? "light" ? "dark" : "light"<cr>]])
-- don't loose the original yanked contents when pasting in visual mode
vim.keymap.set("x", "<leader>p", [["_dP]])
local diagnostic = require("config.diagnostic")
local ui = require("util.icons").ui
-- navigate diagnostics
vim.keymap.set("n", "<leader>dd", diagnostic.toggle, { desc = ui.Diagnostic.." [d]iagnostic enable/[d]isable" })
vim.keymap.set("n", "<leader>do", diagnostic.open_float, { desc = ui.Diagnostic.." [d]iagnostic [o]pen" })
vim.keymap.set("n", "<leader>dh", diagnostic.hide, { desc = ui.Diagnostic.." [d]iagnostic [h]ide" })
vim.keymap.set("n", "<leader>ds", diagnostic.set_severity, { desc = ui.Diagnostic.." [d]iagnostic [s]everity" })
-- toggle quickfix and loclist
vim.keymap.set("n", "<leader>q", window.toggle_quickfix, { desc = ui.Toggle.." toggle quickfix" })
vim.keymap.set("n", "<localleader>q", window.toggle_loclist, { desc = ui.Toggle.." toggle loclist" })
local options = require("util.options")
-- toggle options
vim.keymap.set("n", "<leader>sn", options.toggle_number, { desc = ui.Toggle.." toggle 'number'" })
vim.keymap.set("n", "<leader>sr", options.toggle_relativenumber, { desc = ui.Toggle.." toggle 'relativenumber'" })
vim.keymap.set("n", "<leader>sl", options.toggle_list, { desc = ui.Toggle.." toggle 'list'" })
vim.keymap.set("n", "<leader>sw", options.toggle_wrap, { desc = ui.Toggle.." toggle 'wrap'" })
vim.keymap.set("n", "<leader>ss", options.toggle_spell, { desc = ui.Toggle.." toggle 'spell'" })
end
-- stylua: ignore end
return M

View file

@ -0,0 +1,64 @@
local M = {}
local bootstrap = function(path)
if not vim.uv.fs_stat(path) then
vim.fn.system {
"git",
"clone",
"--filter=blob:none",
"--branch=stable",
"https://github.com/folke/lazy.nvim.git",
path,
}
end
vim.opt.rtp:prepend(path)
return vim.F.npcall(require, "lazy")
end
local dev_path = function()
local paths = {
"~/Projects/nvim-plugins",
"~/.local/src",
}
paths = vim.tbl_map(vim.fn.expand, paths)
paths = vim.tbl_filter(vim.uv.fs_stat, paths)
return paths[1]
end
M.setup = function()
local lazy = bootstrap(vim.fn.stdpath("data") .. "/lazy/lazy.nvim")
if not lazy then
vim.notify("Lazy not installed and failed to bootstrap!", vim.log.levels.WARN)
return
end
lazy.setup {
spec = "config.plugins",
dev = {
path = dev_path(),
fallback = true,
},
ui = {
border = "rounded",
title = " Lazy ",
},
change_detection = {
enabled = false,
},
performance = {
rtp = {
disabled_plugins = {
"gzip",
"matchit",
"netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
}
end
return M

View file

@ -1,29 +1,34 @@
local M = {}
-- stylua: ignore start
M.setup = function()
vim.g.mapleader = ' '
vim.g.maplocalleader = ','
vim.g.mapleader = " "
vim.g.maplocalleader = ","
vim.cmd [[let &t_8f = "\<ESC>[38:2:%lu:%lu:%lum"]]
vim.cmd [[let &t_8b = "\<ESC>[48:2:%lu:%lu:%lum"]]
local o = vim.opt
-- General
o.belloff = 'all' -- never ring bells
o.hidden = true -- hide abandoned buffers
o.clipboard = 'unnamedplus' -- synchronize with system clipboard
o.lazyredraw = true -- don't redraw screen during macros
o.modelines = 0 -- never use modelines
o.fileformats = 'unix,mac,dos' -- prioritize unix <EOL> format
o.pastetoggle = '<F20>' -- toggle paste with P on Moonlander
-- Use `rg` for :grep if installed.
if vim.fn.executable("rg") == 1 then
o.grepprg = "rg --vimgrep --no-heading --smart-case"
o.grepformat = "%f:%l:%c:%m,%f:%l:%m"
end
o.swapfile = false -- don't use swap files
-- General
o.belloff = "all" -- never ring bells
o.hidden = true -- hide abandoned buffers
o.lazyredraw = true -- don"t redraw screen during macros
o.modelines = 0 -- never use modelines
o.fileformats = "unix,mac,dos" -- prioritize unix <EOL> format
o.winblend = 8 -- minimum transparency for floating windows
o.swapfile = false -- don"t use swap files
o.writebackup = true -- Make a backup before writing a file...
o.backup = false -- ...but don't keep it around.
o.backup = false -- ...but don"t keep it around.
o.undofile = true -- write undo history
o.shortmess:append 'I' -- no intro message when starting Vim
o.shortmess:append("I") -- no intro message when starting Vim
o.shada = {
"'1000", -- remember marks for this many files
"/1000", -- remember this many search patterns
@ -33,6 +38,23 @@ M.setup = function()
"s100", -- limit size of remembered items to this many KiB
}
--- Clipboard
if vim.fn.has("wsl") == 1 then
vim.g.clipboard = {
name = "WslClipboard",
copy = {
["+"] = "clip.exe",
["*"] = "clip.exe",
},
paste = {
["+"] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
["*"] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
},
cache_enabled = 0,
}
end
o.clipboard = "unnamedplus" -- synchronize with system clipboard
-- Searching
o.ignorecase = true -- Ignore case when searching...
o.smartcase = true -- ...unless pattern contains uppercase characters.
@ -43,29 +65,29 @@ M.setup = function()
o.tabstop = 4 -- tabs are 4 spaces
o.shiftwidth = 0 -- (auto)indent using 'tabstop' spaces
o.smartindent = true -- use smart autoindenting
o.inccommand = 'split' -- preview command partial results
o.inccommand = "split" -- preview command partial results
o.joinspaces = false -- use one space after a period whe joining lines
o.showmatch = true -- briefly jump to matching bracket if insert one
o.virtualedit = 'block' -- position the cursor anywhere in Visual Block mode
o.virtualedit = "block" -- position the cursor anywhere in Visual Block mode
o.formatlistpat = [[^\s*\(\d\+[\]:.)}\t ]\|[-+*]\|[\[(][ x][\])]\)\s*]]
o.completeopt = {
'menu', -- show completions in a popup menu
'preview', -- show extra information about the selected match
'noinsert', -- don't insert text until I select a match
'noselect', -- don't pre-select the first match in the menu
"menu", -- show completions in a popup menu
"preview", -- show extra information about the selected match
"noinsert", -- don"t insert text until I select a match
"noselect", -- don"t pre-select the first match in the menu
}
local fmt = o.formatoptions
fmt:remove 't' -- Don't auto-wrap on 'textwidth'...
fmt:append 'c' -- ...but do it within comment blocks...
fmt:append 'l' -- ...but not if line was already long before entering Insert mode.
fmt:append 'r' -- Insert comment leader when pressing Enter...
fmt:remove 'o' -- ...but not when opening a new line with o & O.
fmt:append 'q' -- allow formatting of comments with gq
fmt:remove 'a' -- don't auto-format every time text is inserted
fmt:append 'n' -- indent lists automatically acc. 'formatlistpat'
fmt:append 'j' -- remove comment leader when joining lines
fmt:append '1' -- don't break lines after a one letter word but rather before it
fmt:remove("t") -- Don't auto-wrap on 'textwidth'...
fmt:append("c") -- ...but do it within comment blocks...
fmt:append("l") -- ...but not if line was already long before entering Insert mode.
fmt:append("r") -- Insert comment leader when pressing Enter...
fmt:remove("o") -- ...but not when opening a new line with o & O.
fmt:append("q") -- allow formatting of comments with gq
fmt:remove("a") -- don"t auto-format every time text is inserted
fmt:append("n") -- indent lists automatically acc. 'formatlistpat'
fmt:append("j") -- remove comment leader when joining lines
fmt:append("1") -- don"t break lines after a one letter word but rather before it
-- Appearance
o.termguicolors = true -- use "gui" :higlight instead of "cterm"
@ -74,49 +96,49 @@ M.setup = function()
o.number = true -- ...but real number for current line.
o.wrap = false -- don't wrap long lines initially
o.textwidth = 80 -- maximum width for text being inserted
o.colorcolumn = '' -- highlight column after 'textwidth'
o.colorcolumn = "" -- highlight column after 'textwidth'
o.cursorline = true -- highlight the line of the cursor
o.showbreak = '' -- prefix for wrapped lines
o.showbreak = "" -- prefix for wrapped lines
o.scrolloff = 3 -- min. # of lines above and below cursor
o.sidescrolloff = 3 -- min. # of columns to left and right of cursor
o.signcolumn = 'yes' -- always display the signs column
o.signcolumn = "yes" -- always display the signs column
o.list = false -- don't show invisible characters initially
o.listchars = {
eol = '',
tab = '󰌒 ', -- »
extends = '',
precedes = '',
trail = '·',
conceal = '',
eol = "",
tab = "󰌒 ", -- »
extends = "",
precedes = "",
trail = "·",
conceal = "",
}
o.fillchars = {
diff = '',
diff = "",
}
-- Wildcard Expansion
o.wildignore = {
'.git',
'.svn',
'__pycache__',
'**/tmp/**',
'*.DS_Store',
'*.dll',
'*.egg-info',
'*.exe',
'*.gif',
'*.jpeg',
'*.jpg',
'*.o',
'*.obj',
'*.out',
'*.png',
'*.pyc',
'*.so',
'*.zip',
'*~',
".git",
".svn",
"__pycache__",
"**/tmp/**",
"*.DS_Store",
"*.dll",
"*.egg-info",
"*.exe",
"*.gif",
"*.jpeg",
"*.jpg",
"*.o",
"*.obj",
"*.out",
"*.png",
"*.pyc",
"*.so",
"*.zip",
"*~",
}
o.wildignorecase = true -- ignore case when completing file names
o.wildmode = 'longest:full' -- longest common prefix first, then wildmenu
o.wildmode = "longest:full" -- longest common prefix first, then wildmenu
-- Window Splitting
o.splitbelow = true -- :split below current window
@ -126,16 +148,16 @@ M.setup = function()
-- Folding
o.foldenable = true -- enable folding
o.foldlevelstart = 100 -- start with all folds open
o.foldmethod = 'syntax' -- fold based on syntax by default
o.foldmethod = "syntax" -- fold based on syntax by default
o.foldnestmax = 10 -- limit nested folds to 10 levels
-- Options for diff mode
o.diffopt = { -- better side-by-side diffs
'filler', -- show filler lines (so text is vertically synced)
'vertical', -- use vertical splits (files side-by-side)
'closeoff', -- disable diff mode when one window is closed
"filler", -- show filler lines (so text is vertically synced)
"vertical", -- use vertical splits (files side-by-side)
"closeoff", -- disable diff mode when one window is closed
}
end
-- stylua: ignore end
return M

View file

@ -0,0 +1,58 @@
return {
"FabijanZulj/blame.nvim",
cmd = "BlameToggle",
keys = {
{
"<leader>gb",
"<cmd>BlameToggle<cr>",
desc = require("util.icons").ui.Git .. " [g]it [b]lame (blame.nvim)",
},
},
opts = {
-- Using  (0xEACC) instead of - (0x2D) in `date_format` because `blame.nvim`
-- constructs each line and then uses `string.find({s}, {pattern})` to find
-- the position of the date in order to set the highlight. The normal dash
-- (0x2D) is a magic character in {pattern} and prevents the date from being
-- found and thus the highlight fails. Escaping the dash doesn't work because
-- the escape sequence would be visible in the final output, so my
-- workaround is to use a symbol that _looks like_ a dash, but isn't one.
date_format = "%Y%m%d",
commit_detail_view = "tab", -- Open commits in a new tab.
mappings = {
commit_info = { "i", "K" },
},
-- The default format uses _committer_ time, but I want _author_ time
-- (when I do rebases, I am interested in the original commit). A custom
-- formatting function also allows me to slightly tweak the final output.
format_fn = function(commit, config, idx)
local hash = string.sub(commit.hash, 1, 7)
if hash == "0000000" then
return {
idx = idx,
values = {
{ textValue = "·······", hl = "Comment" },
{ textValue = "Not commited", hl = "Comment" },
},
format = "%s %s",
}
end
return {
idx = idx,
values = {
{ textValue = hash, hl = hash },
{ textValue = os.date(config.date_format, commit.author_time), hl = hash },
{ textValue = commit.author, hl = hash },
},
format = "%s %s %s",
}
end,
},
}

View file

@ -0,0 +1,14 @@
return {
"norcalli/nvim-colorizer.lua",
cond = function(_) return vim.o.termguicolors end,
event = { "BufNewFile", "BufReadPost" },
opts = {
css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
mode = "foreground",
},
config = function(_, opts) require("colorizer").setup(nil, opts) end,
}

View file

@ -0,0 +1,49 @@
local colorscheme = function(tbl)
return vim.tbl_deep_extend("keep", tbl, { lazy = false, priority = 1000 })
end
return {
colorscheme { "fschauen/gruvbox.nvim", dev = true },
colorscheme { "fschauen/solarized.nvim", dev = true },
colorscheme {
"catppuccin/nvim",
name = "catppuccin",
opts = {
flavor = "mocha",
show_end_of_buffer = true,
dim_inactive = { enabled = true },
integrations = { notify = true },
},
},
colorscheme {
"rebelot/kanagawa.nvim",
opts = {
dimInactive = true,
theme = "dragon",
overrides = function(colors)
local palette = colors.palette
return {
-- stylua: ignore start
Normal = { bg = palette.sumiInk2 },
CursorLine = { bg = palette.sumiInk3 },
LineNr = { bg = palette.sumiInk2 },
CursorLineNr = { bg = palette.sumiInk2 },
SignColumn = { bg = palette.sumiInk2 },
-- stylua: ignore end
}
end,
},
},
colorscheme {
"folke/tokyonight.nvim",
opts = {
style = "night",
dim_inactive = true,
on_colors = function(colors) colors.bg_highlight = "#1d212f" end,
},
},
}

View file

@ -0,0 +1,16 @@
return {
"tpope/vim-commentary",
cmd = "Commentary",
keys = function()
local icon = require("util.icons").ui.Comment
return {
-- stylua: ignore start
{ "gc", "<Plug>Commentary", mode = {"n", "x", "o"}, desc = icon.." Comment in/out" },
{ "gcc", "<Plug>CommentaryLine", desc = icon.." Comment in/out line" },
{ "gcu", "<Plug>Commentary<Plug>Commentary", desc = icon.." Undo comment in/out" },
-- stylua: ignore end
}
end,
}

View file

@ -0,0 +1,129 @@
local make_keymap = function(cmp)
local if_visible = function(yes, no)
no = no or function(fallback) fallback() end
return function(fallback)
if cmp.visible() then
yes(fallback)
else
no(fallback)
end
end
end
local m = cmp.mapping
local select = { behavior = cmp.SelectBehavior.Select }
local next_or_complete = if_visible(m.select_next_item(select), m.complete())
local prev_or_complete = if_visible(m.select_prev_item(select), m.complete())
local next = if_visible(m.select_next_item(select))
local prev = if_visible(m.select_prev_item(select))
local abort = if_visible(m.abort())
local confirm = if_visible(m.confirm { select = true })
local confirm_or_complete = if_visible(m.confirm { select = true }, m.complete())
local scroll_docs_down = m.scroll_docs(3)
local scroll_docs_up = m.scroll_docs(-3)
-- Mappings that should work in both command line and Insert mode.
return {
-- stylua: ignore start
["<c-n>"] = { i = next_or_complete, c = next_or_complete },
["<c-p>"] = { i = prev_or_complete, c = prev_or_complete },
["<c-j>"] = { i = next_or_complete, c = next },
["<c-k>"] = { i = prev_or_complete, c = prev },
["<down>"] = { i = next_or_complete, c = next },
["<up>"] = { i = prev_or_complete, c = prev },
["<s-down>"] = { i = scroll_docs_down, c = scroll_docs_down },
["<s-up>"] = { i = scroll_docs_up, c = scroll_docs_up },
["<c-c>"] = { i = abort, c = abort },
["<c-e>"] = { i = abort, c = abort },
["<c-y>"] = { i = confirm, c = confirm },
["<tab>"] = { i = confirm, c = confirm_or_complete },
-- stylua: ignore end
}
end
return {
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-path",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-cmdline",
"onsails/lspkind-nvim",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
},
event = { "CmdlineEnter", "InsertEnter" },
config = function()
local cmp = require("cmp")
local keymap = make_keymap(cmp)
cmp.setup {
mapping = keymap,
enabled = function()
local ctx = require("cmp.config.context")
return not ctx.in_treesitter_capture("comment")
and not ctx.in_syntax_group("Comment")
end,
snippet = {
expand = function(args) require("luasnip").lsp_expand(args.body) end,
},
formatting = {
format = require("lspkind").cmp_format {
mode = "symbol_text",
symbol_map = require("util.icons").kind,
menu = {
buffer = "buf",
nvim_lsp = "LSP",
nvim_lua = "lua",
path = "",
},
},
},
sources = cmp.config.sources({
{ name = "nvim_lua" },
{ name = "nvim_lsp" },
{ name = "luasnip" },
}, {
{ name = "path" },
{ name = "buffer", keyword_length = 5 },
}),
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
experimental = { ghost_text = true },
}
cmp.setup.cmdline(":", {
mapping = keymap,
completion = { autocomplete = false },
sources = cmp.config.sources({
{ name = "path" },
}, {
{ name = "cmdline" },
}),
})
cmp.setup.filetype("TelescopePrompt", {
enabled = false,
})
end,
}

View file

@ -0,0 +1,71 @@
return {
"monaqa/dial.nvim",
keys = function()
---Create a right hand side for `dial` key maps.
---@param cmd string: name of a function from `dial.map`.
---@param suffix? string: keys to add after `dial`s mapping.
---@return function
local dial_cmd = function(cmd, suffix)
suffix = suffix or ""
return function() return require("dial.map")[cmd]() .. suffix end
end
local icons = require("util.icons")
local inc, dec = icons.ui.Increment, icons.ui.Decrement
return {
-- stylua: ignore start
{ "<c-a>", dial_cmd("inc_normal"), expr = true, desc = inc.." Increment" },
{ "<c-x>", dial_cmd("dec_normal"), expr = true, desc = dec.." Decrement" },
{ "<c-a>", dial_cmd("inc_visual", "gv"), expr = true, desc = inc.." Increment", mode = "v" },
{ "<c-x>", dial_cmd("dec_visual", "gv"), expr = true, desc = dec.." Decrement", mode = "v" },
{ "g<c-a>", dial_cmd("inc_gvisual", "gv"), expr = true, desc = inc.." Increment", mode = "v" },
{ "g<c-x>", dial_cmd("dec_gvisual", "gv"), expr = true, desc = dec.." Decrement", mode = "v" },
-- stylua: ignore end
}
end,
config = function()
---Make a new augend that cycles over the given elements.
---@param elements string[]: the elements to cycle.
---@return table: @see `dial.types.Augend`
local cycle = function(elements)
return require("dial.augend").constant.new {
elements = elements,
word = true,
cyclic = true,
}
end
local weekdays = {
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday",
}
local weekdays_short = vim.tbl_map(function(s) return s:sub(1, 3) end, weekdays)
local augend = require("dial.augend")
require("dial.config").augends:register_group {
default = {
augend.integer.alias.decimal_int,
augend.integer.alias.hex,
augend.integer.alias.binary,
augend.constant.alias.bool,
augend.semver.alias.semver,
augend.date.alias["%Y-%m-%d"],
augend.date.alias["%d/%m/%Y"],
augend.date.alias["%d.%m.%Y"],
cycle(weekdays),
cycle(weekdays_short),
},
}
end,
}

View file

@ -0,0 +1,21 @@
return {
"stevearc/dressing.nvim",
-- `vim.ui.select()` and `vim.ui.input()` can be used from the start.
lazy = false,
opts = {
input = {
insert_only = false, -- <esc> changes to Normal mode
mappings = {
n = {
["<C-c>"] = "Close",
},
i = {
["<c-k>"] = "HistoryPrev",
["<c-j>"] = "HistoryNext",
},
},
},
},
}

View file

@ -0,0 +1,32 @@
return {
"j-hui/fidget.nvim",
branch = "legacy",
event = "LspAttach",
opts = {
text = {
done = require("util.icons").ui.Checkmark,
spinner = {
"▱▱▱▱▱▱▱",
"▰▱▱▱▱▱▱",
"▰▰▱▱▱▱▱",
"▰▰▰▱▱▱▱",
"▰▰▰▰▱▱▱",
"▰▰▰▰▰▱▱",
"▰▰▰▰▰▰▱",
"▰▰▰▰▰▰▰",
"▱▰▰▰▰▰▰",
"▱▱▰▰▰▰▰",
"▱▱▱▰▰▰▰",
"▱▱▱▱▰▰▰",
"▱▱▱▱▱▰▰",
"▱▱▱▱▱▱▰",
},
},
timer = { spinner_rate = 75 },
window = { blend = 50 },
fmt = { max_messages = 10 },
},
}

View file

@ -0,0 +1,75 @@
local shfmt = function()
local indent = 0 -- Assume tabs initially.
if vim.o.expandtab then
local shiftwidth = vim.opt.shiftwidth:get()
if shiftwidth == 0 then
indent = vim.o.tabstop
else
indent = shiftwidth
end
end
return {
exe = "shfmt",
-- stylua: ignore start
args = {
"--indent", indent, -- 0 for tabs, >0 for number of spaces.
"--keep-padding", -- Keep column alignment paddings.
},
-- stylua: ignore end
stdin = true,
}
end
return {
"mhartington/formatter.nvim",
cmd = {
"Format",
"FormatLock",
"FormatWrite",
"FormatWriteLock",
},
keys = function()
local icon = require("util.icons").ui.Format
return {
{
"<leader>F",
require("util.autoformat").toggle,
desc = icon .. " Toggle auto [F]ormat on write",
},
{
"<leader>=",
"<cmd>Format<cr>",
desc = icon .. " format file",
},
{
"<c-f>",
"<cmd>Format<cr>",
mode = "i",
desc = icon .. " [f]ormat file",
},
}
end,
opts = function()
local builtin = require("formatter.filetypes")
return {
filetype = {
-- stylua: ignore start
c = { builtin.c.clangformat },
cmake = { builtin.cmake.cmakeformat },
cpp = { builtin.cpp.clangformat },
cs = { builtin.cs.clangformat },
json = { builtin.cs.prettier },
lua = { builtin.lua.stylua },
markdown = { builtin.markdown.prettier },
python = {}, -- TODO: pick one
sh = { shfmt() },
zsh = { builtin.zsh.beautysh },
-- stylua: ignore end
},
}
end,
}

View file

@ -0,0 +1,15 @@
return {
"tpope/vim-fugitive",
cmd = { "G", "Git" },
keys = function()
local icon = require("util.icons").ui.Git
return {
-- stylua: ignore start
{ "<leader>gS", "<cmd>tab Git<cr>", desc = icon.." [g]it [S]status (fugitive)" },
{ "<leader>gB", "<cmd>Git blame<cr>", desc = icon.." [g]it [B]lame (fugitive)" },
-- stylua: ignore end
}
end,
}

View file

@ -0,0 +1,33 @@
return {
"rhysd/git-messenger.vim",
cmd = "GitMessenger",
keys = function()
local icon = require("util.icons").ui.Git
return {
-- stylua: ignore start
{ "<leader>gm", "<cmd>GitMessenger<cr>", desc = icon.." [g]it [m]essenger" },
-- stylua: ignore end
}
end,
init = function()
-- Disable default mappings, as I have my own for lazy-loading.
vim.g.git_messenger_no_default_mappings = true
-- Always move cursor into pop-up window immediately.
vim.g.git_messenger_always_into_popup = true
-- Add a border to the floating window, otherwise it's confusing.
vim.g.git_messenger_floating_win_opts = {
border = "rounded",
}
-- Make the UI a bit more compact by removing margins.
vim.g.git_messenger_popup_content_margins = false
-- Extra arguments passed to `git blame`:
-- vim.g.git_messenger_extra_blame_args = '-w'
end,
}

View file

@ -0,0 +1,51 @@
return {
"ruifm/gitlinker.nvim",
dependencies = "nvim-lua/plenary.nvim",
keys = function()
local open_repo = function()
require("gitlinker").get_repo_url {
action_callback = require("gitlinker.actions").open_in_browser,
}
end
local browser = function(mode)
return function()
require("gitlinker").get_buf_range_url(mode, {
action_callback = require("gitlinker.actions").open_in_browser,
})
end
end
local clipboard = function(mode)
return function()
require("gitlinker").get_buf_range_url(mode, {
action_callback = require("gitlinker.actions").copy_to_clipboard,
})
end
end
local icon = require("util.icons").ui.Git
return {
-- stylua: ignore start
{ "<leader>gr", open_repo, desc = icon.." open [r]epository in browser" },
{ "<leader>gl", clipboard("n"), desc = icon.." copy perma[l]ink to clipboard" },
{ "<leader>gl", clipboard("v"), desc = icon.." copy perma[l]ink to clipboard", mode = "v" },
{ "<leader>gL", browser("n"), desc = icon.." open perma[L]ink in browser" },
{ "<leader>gL", browser("v"), desc = icon.." open perma[L]ink in browser", mode = "v" },
-- stylua: ignore end
}
end,
-- This really does need to be a function, because we need to defer requiring
-- the `gitlinker.hosts` module until after the plugin is loaded.
opts = function()
return {
mappings = nil, -- I'm defining my own mappings above.
callbacks = {
["git.schauenburg.me"] = require("gitlinker.hosts").get_gitea_type_url,
},
}
end,
}

View file

@ -0,0 +1,34 @@
return {
"lukas-reineke/headlines.nvim",
dependencies = "nvim-treesitter/nvim-treesitter",
ft = "markdown",
opts = function()
-- These work well with gruvbox.
vim.cmd([[highlight Headline1 guibg=#161613]])
vim.cmd([[highlight Headline2 guibg=#191915]])
vim.cmd([[highlight Headline3 guibg=#1c1c17]])
vim.cmd([[highlight Headline4 guibg=#1a1b19]])
vim.cmd([[highlight Headline5 guibg=#171a1b]])
vim.cmd([[highlight CodeBlock guibg=#121717]])
vim.cmd([[highlight Quote guifg=#076678]])
vim.cmd([[highlight Dash guifg=#d5c4a1]])
return {
markdown = {
headline_highlights = {
"Headline1",
"Headline2",
"Headline3",
"Headline4",
"Headline5",
},
bullets = "",
dash_string = "",
fat_headlines = false,
},
}
end,
}

View file

@ -0,0 +1,34 @@
local ui = require("util.icons").ui
return {
"lukas-reineke/indent-blankline.nvim",
cmd = {
"IBLEnable",
"IBLDisable",
"IBLToggle",
"IBLEnableScope",
"IBLDisableScope",
"IBLToggleScope",
},
keys = {
-- stylua: ignore start
{ "<leader>si", "<cmd>IBLToggle<cr>", desc = ui.Toggle.." toggle [i]ndent lines" },
{ "<leader>so", "<cmd>IBLToggleScope<cr>", desc = ui.Toggle.." toggle indent line sc[o]pe" },
-- stylua: ignore end
},
main = "ibl",
opts = {
enabled = false,
indent = { char = ui.LineLeft },
scope = {
char = ui.LineLeftBold,
enabled = false,
show_start = false,
show_end = false,
},
},
}

View file

@ -0,0 +1,76 @@
local toggle_inlay_hints = function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end
local map_local = function(mode, lhs, rhs, opts)
opts = vim.tbl_deep_extend("force", opts or {}, { buffer = 0 })
vim.keymap.set(mode, lhs, rhs, opts)
end
local lsp_on_attach = function(args)
-- stylua: ignore start
map_local("n", "<leader>sh", toggle_inlay_hints, { desc = "LSP: toggle inlay hints" } )
map_local("n", "<localleader>c", vim.lsp.buf.code_action, { desc = "LSP: code action" } )
map_local("n", "<localleader>f", vim.lsp.buf.format, { desc = "LSP: format" } )
map_local("n", "gd", vim.lsp.buf.definition, { desc = "LSP: go to definition" } )
map_local("n", "gD", vim.lsp.buf.declaration, { desc = "LSP: go to declaration" } )
map_local("n", "gi", vim.lsp.buf.implementation, { desc = "LSP: go to implementation" } )
map_local("n", "grr", vim.lsp.buf.rename, { desc = "LSP: rename" } )
map_local("n", "gt", vim.lsp.buf.type_definition, { desc = "LSP: go to type definition" } )
map_local("n", "gs", vim.lsp.buf.signature_help, { desc = "LSP: show signature help" } )
map_local("i", "<c-s>", vim.lsp.buf.signature_help, { desc = "LSP: show signature help" } )
map_local("n", "K", vim.lsp.buf.hover, { desc = "LSP: display hover information" } )
-- stylua: ignore end
-- Opt out of semantic highlighting because it has been causing issues
-- https://github.com/neovim/nvim-lspconfig/issues/2542#issuecomment-1547019213
local client = vim.lsp.get_client_by_id(args.data.client_id)
if client and client.server_capabilities then
client.server_capabilities.semanticTokensProvider = nil
end
end
local make_lsp_builtins_use_rounded_border = function()
local patch = function(name)
local builtin = vim.lsp.buf[name]
vim.lsp.buf[name] = function(opts)
builtin(vim.tbl_deep_extend("force", opts or {}, { border = "rounded" }))
end
end
patch("signature_help")
patch("hover")
end
return {
"neovim/nvim-lspconfig",
dependencies = {
"Hoffs/omnisharp-extended-lsp.nvim",
},
event = { "BufReadPre", "BufNewFile" },
config = function()
make_lsp_builtins_use_rounded_border()
local capabilities = (function()
local cmp_nvim_lsp = vim.F.npcall(require, "cmp_nvim_lsp")
if cmp_nvim_lsp then
return cmp_nvim_lsp.default_capabilities()
else
return vim.lsp.protocol.make_client_capabilities()
end
end)()
vim.lsp.config("*", { capabilities = capabilities })
vim.lsp.enable("clangd")
vim.lsp.enable("cmake")
vim.lsp.enable("lua_ls")
vim.lsp.enable("omnisharp")
vim.lsp.enable("pyright")
vim.api.nvim_create_autocmd("LspAttach", { callback = lsp_on_attach })
end,
}

View file

@ -0,0 +1,98 @@
return {
"nvim-lualine/lualine.nvim",
dependencies = "nvim-tree/nvim-web-devicons",
opts = function()
local icons = require("util.icons")
local colored_when_focused = require("util.lualine").colored_when_focused
local indicator = require("util.lualine").indicator
local window = require("util.window")
local orange = "#d65d0e"
local is_diagnostics_enabled = function(bufnr)
return vim.diagnostic.is_enabled { bufnr = bufnr or 0 }
end
--
-- Components
--
local autoformat = indicator {
icon = icons.ui.Format,
cond = require("util.autoformat").is_enabled,
}
local branch = {
"branch",
icon = icons.git.Branch,
cond = window.is_medium,
}
local diagnostics = {
colored_when_focused("diagnostics"),
cond = is_diagnostics_enabled,
}
local diag_status = indicator {
icon = icons.ui.Diagnostic,
cond = is_diagnostics_enabled,
}
local fileformat = {
"fileformat",
cond = window.is_medium,
}
local filename = "custom.filename"
local filetype = {
colored_when_focused("filetype"),
cond = window.is_medium,
}
local mode = "custom.mode"
local searchcount = "custom.searchcount"
local spell = indicator {
icon = icons.ui.SpellCheck,
cond = function() return vim.o.spell end,
}
local status = {
colored_when_focused("custom.status"),
color = { fg = orange },
padding = 0,
}
local whitespace = {
colored_when_focused("custom.whitespace"),
cond = window.is_wide,
}
local wrap = indicator {
icon = icons.ui.TextWrap,
cond = function() return vim.o.wrap end,
}
--
-- Sections
--
local sections = {
lualine_a = { mode },
lualine_b = { branch },
lualine_c = { filename, status },
lualine_x = { diagnostics, searchcount, whitespace, filetype },
lualine_y = { diag_status, spell, wrap, autoformat, fileformat, "progress" },
lualine_z = { "location" },
}
return {
options = {
icons_enabled = true,
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
},
sections = sections,
inactive_sections = sections,
extensions = {
"fugitive",
"quickfix",
"nvim-tree",
"lazy",
"man",
"trouble",
},
}
end,
}

View file

@ -0,0 +1 @@
return { "milisims/nvim-luaref" }

View file

@ -0,0 +1,40 @@
return {
"iamcco/markdown-preview.nvim",
build = function() vim.fn["mkdp#util#install"]() end,
cmd = {
"MarkdownPreview",
"MarkdownPreviewStop",
"MarkdownPreviewToggle",
},
ft = "markdown",
init = function()
vim.g.mkdp_theme = "dark"
-- Don't close the preview when switching to another buffer.
vim.g.mkdp_auto_close = 0
-- Show preview page URL in command line when opening preview page.
vim.g.mkdp_echo_preview_url = 1
end,
config = function()
local icon = require("util.icons").ui.Markdown
vim.api.nvim_create_autocmd("FileType", {
desc = "Create key map to toggle markdown preview.",
group = vim.api.nvim_create_augroup("custom.markdown", { clear = true }),
pattern = "markdown",
callback = function()
vim.keymap.set(
"n",
"<leader>P",
"<cmd>MarkdownPreviewToggle<cr>",
{ buffer = true, desc = icon .. " toggle [P]review" }
)
end,
})
end,
}

View file

@ -0,0 +1,22 @@
return {
"williamboman/mason.nvim",
cmd = "Mason",
event = { "BufReadPre", "BufNewFile" },
config = function()
local icons = require("util.icons")
require("mason").setup {
ui = {
border = "rounded",
icons = {
package_installed = icons.git.file.Staged,
package_pending = icons.git.file.Unstaged,
package_uninstalled = icons.git.file.Deleted,
},
},
}
end,
}

View file

@ -0,0 +1,38 @@
return {
"danymat/neogen",
keys = function()
local icon = require("util.icons").ui.Annotation
return {
{
"<leader>aa",
function() require("neogen").generate() end,
desc = icon .. " generate [a]nnotation [a]utomatically",
},
{
"<leader>ac",
function() require("neogen").generate { type = "class" } end,
desc = icon .. " generate [a]nnotation for [c]lass",
},
{
"<leader>af",
function() require("neogen").generate { type = "func" } end,
desc = icon .. " generate [a]nnotation for [f]unction",
},
{
"<c-l>",
function() require("neogen").jump_next() end,
mode = "i",
desc = icon .. " next annotation placeholder",
},
{
"<c-h>",
function() require("neogen").jump_prev() end,
mode = "i",
desc = icon .. " previous annotation placeholder",
},
}
end,
config = true,
}

View file

@ -0,0 +1,47 @@
local ui = require("util.icons").ui
return {
"NeogitOrg/neogit",
cmd = "Neogit",
dependencies = "nvim-lua/plenary.nvim",
keys = {
{ "<leader>gs", "<cmd>Neogit<cr>", desc = ui.Git .. " [g]it [s]tatus (Neogit)" },
},
opts = {
commit_editor = {
kind = "tab",
show_staged_diff = false,
},
disable_insert_on_commit = true,
disable_hint = true,
graph_style = "unicode",
signs = {
section = {
ui.Folder,
ui.EmptyFolderOpen,
},
item = {
ui.ChevronRight,
ui.ChevronDown,
},
hunk = {
ui.ChevronSmallRight,
ui.ChevronSmallDown,
},
},
mappings = {
status = {
o = "GoToFile",
["="] = "Toggle",
},
},
},
}

View file

@ -0,0 +1,16 @@
local keymap = require("config.plugins.telescope").keymap
return {
"2kabhishek/nerdy.nvim",
cmd = "Nerdy",
dependencies = {
"stevearc/dressing.nvim",
"nvim-telescope/telescope.nvim",
},
keys = {
keymap { "i", "<cmd>Nerdy<cr>", desc = "Nerd [i]cons" },
},
}

View file

@ -0,0 +1,20 @@
return {
"mfussenegger/nvim-lint",
keys = function()
return {
{
"<leader>L",
function() require("lint").try_lint() end,
desc = require("util.icons").ui.Lint .. " [L]int file",
},
}
end,
config = function()
require("lint").linters_by_ft = {
markdown = { "markdownlint" },
sh = { "shellcheck" },
}
end,
}

View file

@ -0,0 +1,58 @@
return {
"rcarriga/nvim-notify",
keys = function()
local telescope_notifications = function()
local telescope = vim.F.npcall(require, "telescope")
if not telescope then
vim.notify("Telescope is not installed!", vim.log.levels.WARN)
return
end
local theme = require("telescope.themes").get_dropdown {
results_title = " Results ",
prompt_title = "  Notifications ",
}
telescope.load_extension("notify").notify(theme)
end
local dismiss_notifications = function() require("notify").dismiss() end
local keymap = require("config.plugins.telescope").keymap
return {
-- stylua: ignore start
{ "<leader>n", "<cmd>Notifications<cr>", desc = "Display notification history" },
{ "<c-q>", dismiss_notifications, desc = "Dismiss notifications" },
keymap { "n", telescope_notifications, desc = "[n]otifications" },
-- stylua: ignore end
}
end,
lazy = false,
config = function()
local notify = require("notify")
local icons = require("util.icons")
notify.setup {
icons = {
ERROR = icons.diagnostics_bold.Error,
WARN = icons.diagnostics_bold.Warn,
INFO = icons.diagnostics.Info,
DEBUG = icons.diagnostics.Debug,
TRACE = icons.diagnostics.Trace,
},
fps = 24,
max_width = 50,
minimum_width = 50,
render = "wrapped-compact",
stages = "fade",
time_formats = {
notification_history = "%F %T │ ",
},
}
vim.notify = notify
end,
}

View file

@ -0,0 +1,92 @@
local on_attach = function(buffer)
local api = require("nvim-tree.api")
-- Give me the default mappings except <c-x>, which I replace with <c-s>.
api.config.mappings.default_on_attach(buffer)
vim.keymap.del("n", "<c-x>", { buffer = buffer })
local map = vim.keymap.set
local opts = function(desc)
return {
desc = "󰙅 nvim-tree: " .. desc,
buffer = buffer,
silent = true,
}
end
-- stylua: ignore start
map("n", "l", api.node.open.edit, opts("Open"))
map("n", "<cr>", api.node.open.edit, opts("Open"))
map("n", "<c-s>", api.node.open.horizontal, opts("Open: Horizontal Split"))
map("n", "h", api.node.navigate.parent_close, opts("Close directory"))
-- stylua: ignore end
end
local icons = require("util.icons")
return {
"nvim-tree/nvim-tree.lua",
dependencies = "nvim-tree/nvim-web-devicons",
keys = {
-- stylua: ignore start
{ "<leader>tt", "<cmd>NvimTreeToggle<cr>", desc = icons.ui.FileTree.." [t]oggle [t]ree" },
{ "<leader>tf", "<cmd>NvimTreeFindFile<cr>", desc = icons.ui.FileTree.." Open [t]ree to current [f]ile " },
-- stylua: ignore end
},
opts = {
disable_netrw = true, -- replace netrw with nvim-tree
hijack_cursor = true, -- keep the cursor on begin of the filename
sync_root_with_cwd = true, -- watch for `DirChanged` and refresh the tree
on_attach = on_attach,
git = {
ignore = false, -- don't hide files from .gitignore
show_on_open_dirs = false, -- don't show indication if dir is open
},
view = {
adaptive_size = true, -- resize the window based on the longest line
cursorline = false, -- don't enable 'cursorline' in the tree
width = 35, -- a little wider than the default 30
},
filters = {
dotfiles = false, -- show files starting with a .
custom = { "^\\.git" }, -- don't show .git directory
},
renderer = {
add_trailing = true, -- add trailing / to folders
highlight_git = true, -- enable highlight based on git attributes
icons = {
webdev_colors = false, -- highlight icons with NvimTreeFileIcon
git_placement = "signcolumn",
-- stylua: ignore start
glyphs = {
default = icons.ui.File,
symlink = icons.ui.FileSymlink,
modified = icons.ui.Circle,
folder = {
arrow_closed = icons.ui.ChevronSmallRight,
arrow_open = icons.ui.ChevronSmallDown,
default = icons.ui.Folder,
open = icons.ui.FolderOpen,
empty = icons.ui.EmptyFolder,
empty_open = icons.ui.EmptyFolderOpen,
symlink = icons.ui.FolderSymlink,
symlink_open = icons.ui.FolderSymlink,
},
git = {
untracked = icons.git.file.Untracked,
unstaged = icons.git.file.Unstaged,
staged = icons.git.file.Staged,
deleted = icons.git.file.Deleted,
unmerged = icons.git.file.Unmerged,
renamed = icons.git.file.Renamed,
ignored = icons.git.file.Ignored,
},
},
-- stylua: ignore end
},
},
},
}

View file

@ -0,0 +1,63 @@
return {
"stevearc/oil.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
cmd = "Oil",
lazy = false,
keys = {
{ "-", "<cmd>Oil<cr>", desc = "Open Oil" },
},
config = function()
require("oil").setup {
columns = {
"icon",
"permissions",
"size",
"mtime",
},
keymaps = {
["<c-s>"] = {
"actions.select",
opts = {
horizontal = true,
split = "belowright",
},
},
["<c-b>"] = { -- Not using <c-v> so that I can use Visual Block mode.
"actions.select",
opts = {
vertical = true,
split = "belowright",
},
},
["<c-r>"] = "actions.refresh",
-- Remove default keymaps that I use for navigation.
-- NOTE: the C must be capitalized (bug in Oil)
["<C-h>"] = false, -- use <c-s> intead
["<C-l>"] = false, -- use <c-r> instead
["<leader>:"] = {
"actions.open_cmdline",
opts = {
shorten_path = true,
},
desc = "Open command line with current entry as an argument",
},
["q"] = "actions.close",
},
view_options = {
show_hidden = true,
},
}
end,
}

View file

@ -0,0 +1,23 @@
return {
"tyru/open-browser.vim",
cmd = {
"OpenBrowser",
"OpenBrowserSearch",
"OpenBrowserSmartSearch",
},
keys = function()
local icon = require("util.icons").ui.Web
return {
{
"<leader>o",
"<Plug>(openbrowser-smart-search)",
desc = icon .. " [o]pen URL under cursor or search the web",
mode = { "n", "v" },
},
}
end,
init = function() vim.g.openbrowser_default_search = "duckduckgo" end,
}

View file

@ -0,0 +1,42 @@
return {
"weirongxu/plantuml-previewer.vim",
dependencies = "tyru/open-browser.vim",
cmd = {
"PlantumlOpen",
"PlantumlStart",
"PlantumlStop",
"PlantumlSave",
},
ft = "plantuml",
init = function()
-- Prefer the system PlantUML (if any) over the one bundled with the plugin.
local cmdline = [[which plantuml | xargs cat | grep plantuml.jar]]
local regex = [[\v\s['"]?(\S+/plantuml\.jar)]]
local jar = vim.fn.matchlist(vim.fn.system(cmdline), regex)[2]
if jar and vim.uv.fs_stat(jar) then
vim.g["plantuml_previewer#plantuml_jar_path"] = jar
end
end,
config = function()
local icon = require("util.icons").ui.Graph
local group = vim.api.nvim_create_augroup("custom.plantuml", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
desc = "Create key map to toggle plantuml preview.",
group = group,
pattern = "plantuml",
callback = function()
vim.keymap.set(
"n",
"<leader>P",
"<cmd>PlantumlToggle<cr>",
{ buffer = true, desc = icon .. " toggle PlantUML [P]review" }
)
end,
})
end,
}

View file

@ -0,0 +1,6 @@
return {
{ "mityu/vim-applescript", ft = "applescript" },
{ "chr4/nginx.vim", ft = "nginx" },
{ "keith/swift.vim", ft = "swift" },
{ "aklt/plantuml-syntax", ft = "plantuml" },
}

View file

@ -0,0 +1,17 @@
return {
"godlygeek/tabular",
cmd = {
"AddTabularPattern",
"AddTabularPipeline",
"Tabularize",
},
config = function()
if vim.fn.exists("g:tabular_loaded") == 1 then
vim.cmd([[ AddTabularPattern! first_comma /^[^,]*\zs,/ ]])
vim.cmd([[ AddTabularPattern! first_colon /^[^:]*\zs:/ ]])
vim.cmd([[ AddTabularPattern! first_equal /^[^=]*\zs=/ ]])
end
end,
}

View file

@ -0,0 +1,16 @@
local keymap = require("config.plugins.telescope").keymap
return {
"nvim-telescope/telescope-file-browser.nvim",
dependencies = "nvim-telescope/telescope.nvim",
keys = {
keymap {
"B",
"<cmd>Telescope file_browser theme=ivy<cr>",
desc = "file [B]rowser",
},
},
config = function() require("config.plugins.telescope").load_extension("file_browser") end,
}

View file

@ -0,0 +1,216 @@
local ui = require("util.icons").ui
local builtin = function(name, opts)
return function(title)
return function()
local picker = require("telescope.builtin")[name]
picker(vim.tbl_extend("force", opts or {}, {
prompt_title = title,
}))
end
end
end
local pickers = setmetatable({
all_files = builtin("find_files", {
hidden = true,
no_ignore = true,
no_ignore_parent = true,
}),
document_diagnostics = builtin("diagnostics", { bufnr = 0 }),
workspace_diagnostics = builtin("diagnostics"),
dotfiles = builtin("find_files", {
cwd = "~/.dotfiles",
hidden = true,
}),
plugins = builtin("find_files", {
cwd = vim.fn.stdpath("data") .. "/lazy",
}),
selection = function(title)
return function()
local text = require("util").get_selected_text()
return require("telescope.builtin").grep_string {
prompt_title = string.format(title .. ": %s ", text),
search = text,
}
end
end,
}, {
-- Fall back to telescope's built-in pickers if a custom one is not defined
-- above, but make sure to keep the title we defined.
__index = function(_, key) return builtin(key) end,
})
---@class LazyKeysSpec
---@field desc string
---Create consistent key maps with the same prefix and description style.
---@param spec LazyKeysSpec lazy.nvim key spec to modify
---@return LazyKeysSpec modified key spec with prefix and description
local keymap = function(spec)
vim.validate("Telescope key spec", spec, "table")
vim.validate("Telescope key lhs", spec[1], "string")
vim.validate("Telescope key rhs", spec[2], { "string", "function" })
vim.validate("Telescope key description", spec.desc, "string")
return vim.tbl_extend("force", spec, {
"<leader>f" .. spec[1], -- lhs
spec[2], -- rhs
desc = ui.Telescope .. " Telescope " .. spec.desc,
})
end
return {
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-telescope/telescope-fzf-native.nvim",
build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release "
.. "&& cmake --build build --config Release "
.. "&& cmake --install build --prefix build",
},
cmd = "Telescope",
keys = vim
.iter({
-- stylua: ignore start
{ "a", pickers.autocommands " Autocommands" , desc = "[a]utocommands" },
{ "b", pickers.buffers " Buffers" , desc = "[b]uffers" },
--"B" used in telescope-file-browser
{ "c", pickers.colorscheme " Colorschemes" , desc = "[c]olorschemes" },
{ "C", pickers.commands " Commands" , desc = "[C]ommands" },
{ "d", pickers.document_diagnostics "󰀪 Document Diagnostics" , desc = "document [d]iagnostics" },
{ "D", pickers.workspace_diagnostics "󰀪 Workspace Diagnostics", desc = "workspace [d]iagnostics" },
--"e"
{ "f", pickers.find_files " Files" , desc = "[f]ind files" },
{ "F", pickers.all_files " ALL files" , desc = "all [F]iles" },
{ "gr", pickers.live_grep " Live grep" , desc = "Live [gr]ep" },
{ "gf", pickers.git_files " Git files" , desc = "[g]it [f]iles" },
{ "gc", pickers.git_commits " Commits" , desc = "[g]it [c]ommits" },
{ "h", pickers.current_buffer_fuzzy_find " Current buffer" , desc = "[h]ere (currenf buffer)" },
{ "H", pickers.highlights "󰌶 Highlights" , desc = "[H]ighlights" },
--"i" used in nerdy
{ "j", pickers.jumplist " Jumplist" , desc = "[j]umplist" },
{ "k", pickers.keymaps " Keymaps" , desc = "[k]eymaps" },
{ "K", pickers.help_tags " Help tags" , desc = "[K] help/documentation" },
{ "l", pickers.loclist " Location list" , desc = "[l]ocation List" },
{ "m", pickers.man_pages " Man pages" , desc = "[m]an pages" },
--"n" used in vim-notify
{ "o", pickers.vim_options " Vim options" , desc = "[o]ptions" },
{ "p", pickers.plugins " Installed Plugins" , desc = "[p]lugins" },
{ "q", pickers.quickfix " Quickfix" , desc = "[q]uickfix" },
{ "r", pickers.lsp_references " References" , desc = "[r]eferences" },
{ "R", pickers.registers "󱓥 Registers" , desc = "[R]registers" },
{ "s", pickers.lsp_document_symbols "󰫧 Document Symbols " , desc = "LSP document [s]ymbols" },
{ "S", pickers.lsp_workspace_symbols "󱄑 Workspace Symbols " , desc = "LSP workspace [S]ymbols" },
--"t" used in todo_comments
{ "T", pickers.treesitter " Treesitter symbols" , desc = "[T]reesitter Symbols" },
--"u"
--"v"
{ "w", pickers.selection " Grep" , desc = "[w]word under cursor" },
{ "w", pickers.selection " Grep", mode = "v" , desc = "[w]ord(s) selected" },
--"x"
--"y"
{ "z", pickers.spell_suggest "󰓆 Spelling suggestions" , desc = "[z] spell suggestions" },
{ ".", pickers.dotfiles " Dotfiles" , desc = "[.]dotfiles" },
{ ":", pickers.command_history " Command history" , desc = "[:]command history" },
{ "/", pickers.search_history " Search history" , desc = "[/]search history" },
{ " ", pickers.resume "󰐎 Resume" , desc = "Resume " },
-- stylua: ignore end
})
:map(keymap)
:totable(),
-- Export this function so we can use in other plugins.
keymap = keymap,
opts = function()
local actions = require("telescope.actions")
local layout = require("telescope.actions.layout")
local state = require("telescope.actions.state")
local clear_prompt = function(prompt_bufnr)
state.get_current_picker(prompt_bufnr):reset_prompt()
end
local mappings = {
["<c-y>"] = layout.cycle_layout_next,
["<c-u>"] = clear_prompt,
["<c-i>"] = actions.toggle_selection + actions.move_selection_next,
["<c-o>"] = actions.toggle_selection + actions.move_selection_previous,
["<c-p>"] = layout.toggle_preview,
["<c-j>"] = actions.move_selection_next,
["<c-k>"] = actions.move_selection_previous,
["<c-f>"] = actions.results_scrolling_down,
["<c-b>"] = actions.results_scrolling_up,
["<s-down>"] = actions.preview_scrolling_down,
["<s-up>"] = actions.preview_scrolling_up,
["<c-s>"] = actions.select_horizontal,
["<c-x>"] = false,
["<c-c>"] = actions.close,
["<c-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
["<c-l>"] = actions.smart_send_to_loclist + actions.open_loclist,
}
return {
defaults = {
mappings = { i = mappings, n = mappings },
prompt_prefix = " " .. ui.Telescope .. " ",
selection_caret = ui.Play .. " ",
multi_icon = ui.Checkbox .. " ",
scroll_strategy = "limit", -- Don't wrap around in results.
dynamic_preview_title = true,
layout_strategy = "flex",
layout_config = {
width = 0.9,
height = 0.9,
flex = { flip_columns = 180 },
horizontal = { preview_width = 0.5 },
vertical = { preview_height = 0.5 },
},
cycle_layout_list = {
"horizontal",
"vertical",
},
},
pickers = {
buffers = {
mappings = {
n = { x = actions.delete_buffer },
i = { ["<c-x>"] = actions.delete_buffer },
},
},
colorscheme = {
enable_preview = true,
theme = "dropdown",
},
man_pages = {
sections = { "ALL" },
},
spell_suggest = {
theme = "cursor",
},
},
}
end,
config = function(_, opts)
require("telescope").setup(opts)
require("telescope").load_extension("fzf")
vim.api.nvim_create_autocmd("User", {
desc = "Enable line number in Telescope previewers.",
group = vim.api.nvim_create_augroup("custom.telescope", { clear = true }),
pattern = "TelescopePreviewerLoaded",
command = "setlocal number",
})
end,
}

Some files were not shown because too many files have changed in this diff Show more