Public Access
Compare commits
79
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1714279ff | ||
|
|
94972506c2 | ||
|
|
0ac228d0c3 | ||
|
|
e8027c8c7f | ||
|
|
a0e45a6dec | ||
|
|
18931930a2 | ||
|
|
dda48dc457 | ||
|
|
cbe9447671 | ||
|
|
c67352a14d | ||
|
|
0e8f4bc7a5 | ||
|
|
292961ae93 | ||
|
|
9a01804f2f | ||
|
|
d41c23b9aa | ||
|
|
75eae3f174 | ||
|
|
c71d6ae982 | ||
|
|
7c24bf6c94 | ||
|
|
da7f9d0bdb | ||
|
|
83561baf1f | ||
|
|
5b7df5dfb4 | ||
|
|
3ba2f15222 | ||
|
|
7ed28b5abf | ||
|
|
53da8295f9 | ||
|
|
56b1e1bb58 | ||
|
|
dda59e048e | ||
|
|
3769e95cf0 | ||
|
|
9ce38fd7ca | ||
|
|
564083cc45 | ||
|
|
26293351e3 | ||
|
|
124c108a70 | ||
|
|
d4aef6e19e | ||
|
|
036621bd62 | ||
|
|
68574f891d | ||
|
|
5aa5b9443c | ||
|
|
5ed83362f0 | ||
|
|
b18692000e | ||
|
|
aa7c712c62 | ||
|
|
43a703eb26 | ||
|
|
6a1753b021 | ||
|
|
8e42b0e503 | ||
|
|
c3806dfd61 | ||
|
|
1b250f4500 | ||
|
|
0ef267297e | ||
|
|
17c19d3452 | ||
|
|
da91033d53 | ||
|
|
1c6f0a0e46 | ||
|
|
1c2b5f8a0e | ||
|
|
db120ff9e3 | ||
|
|
35ea810bd8 | ||
|
|
379881887c | ||
|
|
ac6b9739a5 | ||
|
|
199c37fe89 | ||
|
|
6fabafacf1 | ||
|
|
3678a14632 | ||
|
|
35fb1cfc59 | ||
|
|
4d26049347 | ||
|
|
7897d5169f | ||
|
|
74fa81f857 | ||
|
|
baf089a8e5 | ||
|
|
f23aa495a4 | ||
|
|
af9c944768 | ||
|
|
165d3ccc20 | ||
|
|
8b3598b821 | ||
|
|
a9c8c0bef7 | ||
|
|
5243e672c8 | ||
|
|
6bbeab55d1 | ||
|
|
3b0f8b92bb | ||
|
|
a40c9588a0 | ||
|
|
683215d09d | ||
|
|
453e599a57 | ||
|
|
02721b097e | ||
|
|
26c53fe210 | ||
|
|
7521292d38 | ||
|
|
c0a6c5848a | ||
|
|
e41cd21a1d | ||
|
|
8ceabee7cd | ||
|
|
09a4e3e322 | ||
|
|
dbcab8ada3 | ||
|
|
d66b0a8fb5 | ||
|
|
cfe6ea12f7 |
@@ -1,10 +1,10 @@
|
|||||||
# prefer this if stow is available
|
# prefer this if stow is available
|
||||||
.PHONY: stow unstow
|
.PHONY: stow unstow
|
||||||
stow:
|
stow:
|
||||||
stow nvim
|
stow nvim ghostty
|
||||||
|
|
||||||
unstow:
|
unstow:
|
||||||
stow -D nvim
|
stow -D nvim ghostty
|
||||||
|
|
||||||
LN := ln -svf
|
LN := ln -svf
|
||||||
LNDIR := ln -sv
|
LNDIR := ln -sv
|
||||||
@@ -13,6 +13,7 @@ DOTFILES_DIR := $(shell pwd)
|
|||||||
TARGET_DIR := $(HOME)
|
TARGET_DIR := $(HOME)
|
||||||
|
|
||||||
# if stow is not available, symlink configs instead
|
# if stow is not available, symlink configs instead
|
||||||
|
# this is currently outdated
|
||||||
.PHONY: link unlink
|
.PHONY: link unlink
|
||||||
link: nvim
|
link: nvim
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
font-feature = -calt, -liga, -dlig
|
||||||
|
|
||||||
|
# Allow terminal applications to read the clipboard without confirmation
|
||||||
|
clipboard-read = allow
|
||||||
|
|
||||||
|
# Use Alt for multi-teriminal management
|
||||||
|
keybind = ctrl+shift+t=unbind
|
||||||
|
keybind = alt+t=new_tab
|
||||||
|
keybind = ctrl+shift+w=unbind
|
||||||
|
keybind = alt+w=close_tab:this
|
||||||
|
keybind = ctrl+enter=unbind
|
||||||
|
keybind = alt+enter=toggle_fullscreen
|
||||||
|
|
||||||
|
# Disable touchpad horizontal-swipe tab switching.
|
||||||
|
# Will come in next version
|
||||||
|
# gtk-horizontal-tab-scroll = false
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
[source](https://pervoj.cz/blog/flutter-on-linux-installation)
|
||||||
|
|
||||||
|
# Intall Java
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo apt install openjdk-17-jdk
|
||||||
|
```
|
||||||
|
|
||||||
|
## Check it
|
||||||
|
|
||||||
|
```sh
|
||||||
|
java --version
|
||||||
|
javac --version
|
||||||
|
```
|
||||||
|
|
||||||
|
# Android SDK
|
||||||
|
|
||||||
|
[Download from here](https://developer.android.com/studio#command-line-tools-only)
|
||||||
|
|
||||||
|
## Unzip exactly like this :)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
zip_file="$HOME/Downloads/commandlinetools-linux-15859902_latest.zip"
|
||||||
|
sdk_dir="$HOME/.local/share/android-sdk"
|
||||||
|
|
||||||
|
temp_dir=$(mktemp -d)
|
||||||
|
unzip "$zip_file" -d "$temp_dir"
|
||||||
|
mkdir -p "$sdk_dir/cmdline-tools"
|
||||||
|
mv "$temp_dir/cmdline-tools" "$sdk_dir/cmdline-tools/latest"
|
||||||
|
rmdir "$temp_dir"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Check nothing got messed up
|
||||||
|
|
||||||
|
`ls -la ~/.local/share/android-sdk/cmdline-tools/latest`
|
||||||
|
|
||||||
|
## Add this to `~/.bashrc`
|
||||||
|
|
||||||
|
```text
|
||||||
|
export ANDROID_SDK_ROOT="$HOME/.local/share/android-sdk"
|
||||||
|
export ANDROID_HOME="$ANDROID_SDK_ROOT"
|
||||||
|
export PATH="$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/platform-tools:$PATH"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Post install
|
||||||
|
|
||||||
|
```sh
|
||||||
|
source ~/.bashrc
|
||||||
|
|
||||||
|
sdkmanager \
|
||||||
|
"platform-tools" \
|
||||||
|
"platforms;android-36" \
|
||||||
|
"build-tools;36.0.0"
|
||||||
|
|
||||||
|
sdkmanager --licenses
|
||||||
|
```
|
||||||
|
|
||||||
|
## Validate
|
||||||
|
|
||||||
|
```sh
|
||||||
|
fvm flutter doctor
|
||||||
|
```
|
||||||
|
|
||||||
|
# Run like this
|
||||||
|
|
||||||
|
```sh
|
||||||
|
adb devices
|
||||||
|
fvm flutter devices
|
||||||
|
fvm flutter run
|
||||||
|
```
|
||||||
+44
-48
@@ -1,34 +1,42 @@
|
|||||||
# romanzy neovim config
|
# romanzy neovim config
|
||||||
|
|
||||||
Inspirations:
|
Inspirations:
|
||||||
|
|
||||||
- [illya](https://codeberg.org/42nerds/nvim)
|
- [illya](https://codeberg.org/42nerds/nvim)
|
||||||
- [nolan](https://github.com/Hrumble/sneaky-nvim-config)
|
- [nolan](https://github.com/Hrumble/sneaky-nvim-config)
|
||||||
- [mats](https://github.com/BeerB34r/dotfiles)
|
- [mats](https://github.com/BeerB34r/dotfiles)
|
||||||
|
|
||||||
|
[Great guide on vim.pack](https://echasnovski.com/blog/2026-03-13-a-guide-to-vim-pack#delete)
|
||||||
|
|
||||||
|
To remove a plugin run `:lua vim.pack.del({ "<plugin name>" })`.
|
||||||
|
|
||||||
# Neovim Notes
|
# Neovim Notes
|
||||||
|
|
||||||
See custom keymaps with short descriptions with `<leader><leader>h`.
|
See custom keymaps with short descriptions with `<leader><leader>h`.
|
||||||
|
|
||||||
Split shortcuts:
|
General shortcuts:
|
||||||
|
|
||||||
|
- `<leader>e` opens the file browser
|
||||||
|
- `gx` opens an external viewer
|
||||||
|
- `gR`, `<F5>` refresh
|
||||||
|
|
||||||
|
Windowing shortcuts:
|
||||||
|
|
||||||
- `<leader>sv` open a vertical split
|
- `<leader>sv` open a vertical split
|
||||||
- `<leader>sh` open a horizontal split
|
- `<leader>sh` open a horizontal split
|
||||||
- `<leader>se` equalize split sizes
|
- `<leader>se` equalize split sizes
|
||||||
- `<leader>sc` close the current window
|
- `<leader>sc` close the current window
|
||||||
|
- `<leader>r-hjkl` to resize
|
||||||
Resize shortcuts:
|
|
||||||
|
|
||||||
- `<leader>rh` make the current window narrower
|
|
||||||
- `<leader>rl` make the current window wider
|
|
||||||
- `<leader>rj` make the current window shorter
|
|
||||||
- `<leader>rk` make the current window taller
|
|
||||||
- `<leader>re` equalize split sizes
|
- `<leader>re` equalize split sizes
|
||||||
|
- `<C-hjkl>` move between windows
|
||||||
|
|
||||||
Buffer shortcuts:
|
Buffer shortcuts:
|
||||||
|
|
||||||
- `<leader>bp` previous buffer
|
- `<leader>bp` previous buffer
|
||||||
- `<leader>bn` next buffer
|
- `<leader>bn` next buffer
|
||||||
- `<leader>bd` delete the current buffer
|
- `<leader>bd` delete the current buffer
|
||||||
|
- `<leader>bc` force close all non-visible buffers
|
||||||
|
- `<leader>bf` find buffers
|
||||||
|
|
||||||
Telescope shortcuts:
|
Telescope shortcuts:
|
||||||
|
|
||||||
@@ -37,48 +45,35 @@ Telescope shortcuts:
|
|||||||
- `<leader>fb` list buffers
|
- `<leader>fb` list buffers
|
||||||
- `<leader>fh` browse help tags
|
- `<leader>fh` browse help tags
|
||||||
|
|
||||||
Oil usage:
|
Git shortcuts:
|
||||||
|
|
||||||
- `<leader>dl` opens the file browser
|
- `:Git` to run commands directly (`:Git status`, `:Git log --oneline`)
|
||||||
- `<CR>` opens a file or enters a directory
|
- `<leader>lg` open LazyGit
|
||||||
- `-` goes to the parent directory
|
- `<leader>dv` open Diffview
|
||||||
- `<BS>` also goes to the parent directory
|
- `<leader>dc` close Diffview
|
||||||
- `<A-h>` also goes to the parent directory
|
- `[h`, `]h`, `[H`, `]H` jump to hunks
|
||||||
- `<A-l>` opens the selected file or enters the selected directory
|
- `<leader>th` — toggle the expanded hunk view
|
||||||
- `<C-p>` previews the selected entry
|
|
||||||
- `go` opens the file in external viewer
|
|
||||||
|
|
||||||
## Window Navigation
|
Toggle shortcuts:
|
||||||
|
|
||||||
Move between windows with:
|
- `<leader>tw` toggle soft wrap
|
||||||
|
- `<leader>ts` toggle spell checking
|
||||||
```vim
|
- `<leader>ti` toggle inline diagnostics
|
||||||
<C-h> left
|
- `<leader>tv` toggle virtual diagnostics
|
||||||
<C-j> down
|
- `<leader>th` — toggle the expanded hunk view
|
||||||
<C-k> up
|
|
||||||
<C-l> right
|
|
||||||
```
|
|
||||||
|
|
||||||
Cycle through windows:
|
|
||||||
|
|
||||||
```vim
|
|
||||||
<C-w>w
|
|
||||||
```
|
|
||||||
|
|
||||||
## Terminal
|
## Terminal
|
||||||
|
|
||||||
Leave terminal mode and return to normal mode:
|
Two options to leave terminal mode and return to normal mode:
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
<Esc>
|
<\\-Esc>
|
||||||
|
|
||||||
|
<C-Esc>
|
||||||
```
|
```
|
||||||
|
|
||||||
## LSP
|
## LSP
|
||||||
|
|
||||||
Mason is installed through `vim.pack` together with `mason-lspconfig.nvim` and `nvim-lspconfig`.
|
|
||||||
|
|
||||||
This config automatically installs and enables the managed language servers on first start. The current managed set is `bashls`, `clangd`, `jsonls`, `lua_ls`, `marksman`, `taplo`, `ts_ls`, and `yamlls`.
|
|
||||||
|
|
||||||
Useful Mason commands:
|
Useful Mason commands:
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
@@ -87,29 +82,30 @@ Useful Mason commands:
|
|||||||
:checkhealth mason
|
:checkhealth mason
|
||||||
```
|
```
|
||||||
|
|
||||||
`ts_ls` provides TypeScript and JavaScript language server support after Mason installs `typescript-language-server`.
|
Useful LSP commands:
|
||||||
|
|
||||||
When an LSP server is attached to the current buffer:
|
|
||||||
|
|
||||||
|
- `K` show the type and documentation for the symbol under the cursor
|
||||||
- `gd` go to definition
|
- `gd` go to definition
|
||||||
- `gD` go to declaration
|
- `gD` go to declaration
|
||||||
- `grd` list references
|
- `grd` list references
|
||||||
- `grn` rename symbol
|
- `grn` rename symbol
|
||||||
- `<C-Space>` trigger completion
|
- `<leader>ca` show code actions
|
||||||
|
- `<leader>cf` apply quick fixes
|
||||||
|
- `<leader>cs` show source actions
|
||||||
|
|
||||||
Diagnostics:
|
Diagnostics:
|
||||||
|
|
||||||
- `g.` open diagnostic float
|
- `g.` open diagnostic float
|
||||||
- `gl` send diagnostics to the location list
|
- `gl` send diagnostics to the location list
|
||||||
- `gle` display error information
|
- `gld` display diagnostic information
|
||||||
- `gie` toggle inline errors
|
- `]g`, `[g` jump to warning or error
|
||||||
- `gve` toggle virtual line errors
|
- `<leader>ti` toggle inline diagnostics
|
||||||
- `g]` jump to next error
|
- `<leader>tv` toggle virtual diagnostics
|
||||||
- `g[` jump to previous error
|
- `<leader>xx` toggle project warnings and errors
|
||||||
|
|
||||||
## Tree-sitter
|
## Tree-sitter
|
||||||
|
|
||||||
Tree-sitter is managed with `nvim-treesitter` via `vim.pack`. `tree-sitter-cli` and a C compiler is required to be installed.
|
`tree-sitter-cli` and a C compiler is required to be installed.
|
||||||
|
|
||||||
Useful commands:
|
Useful commands:
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1,4 @@
|
|||||||
vim.opt_local.textwidth = 80
|
local o = vim.opt_local
|
||||||
|
|
||||||
|
o.textwidth = 80
|
||||||
|
o.expandtab = false
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
local o = vim.opt_local
|
||||||
|
|
||||||
|
o.expandtab = false
|
||||||
@@ -2,10 +2,8 @@ local uc = vim.api.nvim_create_user_command
|
|||||||
local ac = vim.api.nvim_create_autocmd
|
local ac = vim.api.nvim_create_autocmd
|
||||||
local aug = vim.api.nvim_create_augroup
|
local aug = vim.api.nvim_create_augroup
|
||||||
|
|
||||||
-- User commands
|
|
||||||
uc("W", "w|e", { desc = "write file then refresh buffer" })
|
uc("W", "w|e", { desc = "write file then refresh buffer" })
|
||||||
|
|
||||||
-- Auto commands
|
|
||||||
ac("TextYankPost", {
|
ac("TextYankPost", {
|
||||||
desc = "Highlight when yanking text",
|
desc = "Highlight when yanking text",
|
||||||
group = aug("highlight-yank", { clear = true }),
|
group = aug("highlight-yank", { clear = true }),
|
||||||
@@ -13,30 +11,14 @@ ac("TextYankPost", {
|
|||||||
vim.highlight.on_yank()
|
vim.highlight.on_yank()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
ac("LspAttach", {
|
|
||||||
desc = "Notify user about attached LSP clients",
|
|
||||||
group = aug("LSPOnAttach", { clear = true }),
|
|
||||||
callback = function(event)
|
|
||||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
|
||||||
if client then
|
|
||||||
vim.notify(client.name .. " attached", vim.log.levels.INFO, {})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
-- ac("LspAttach", {
|
-- ac("LspAttach", {
|
||||||
-- group = aug("lsp_attach_disable_ruff_hover", { clear = true }),
|
-- desc = "Notify user about attached LSP clients",
|
||||||
-- callback = function(args)
|
-- group = aug("LSPOnAttach", { clear = true }),
|
||||||
-- local client = vim.lsp.get_client_by_id(args.data.client_id)
|
-- callback = function(event)
|
||||||
-- if client == nil then
|
-- local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||||
-- return
|
-- if client then
|
||||||
-- end
|
-- vim.notify(client.name .. " attached", vim.log.levels.INFO, {})
|
||||||
-- if client.name == "ruff" then
|
|
||||||
-- client.server_capabilities.hoverProvider = false
|
|
||||||
-- end
|
-- end
|
||||||
-- end,
|
-- end,
|
||||||
-- desc = "LSP: Disable hover capabilties for ruff",
|
|
||||||
-- })
|
-- })
|
||||||
|
|
||||||
|
|
||||||
-- Only show the invisible characters inside the code editing buffers
|
|
||||||
vim.cmd([[autocmd BufWinEnter * if &buftype != '' | setlocal nolist | endif]])
|
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.close_hidden()
|
||||||
|
local visible_buffers = {}
|
||||||
|
local closed_count = 0
|
||||||
|
|
||||||
|
for _, tabpage in ipairs(vim.api.nvim_list_tabpages()) do
|
||||||
|
for _, window in ipairs(vim.api.nvim_tabpage_list_wins(tabpage)) do
|
||||||
|
visible_buffers[vim.api.nvim_win_get_buf(window)] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, buffer in ipairs(vim.api.nvim_list_bufs()) do
|
||||||
|
if vim.bo[buffer].buflisted and not visible_buffers[buffer] then
|
||||||
|
vim.api.nvim_buf_delete(buffer, { force = true })
|
||||||
|
closed_count = closed_count + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if closed_count == 0 then
|
||||||
|
vim.notify("No hidden buffers to close", vim.log.levels.INFO)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local buffer_label = closed_count == 1 and "buffer" or "buffers"
|
||||||
|
vim.notify(string.format("Closed %d hidden %s", closed_count, buffer_label), vim.log.levels.INFO)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
-- This function returns project local dart, or fallsback to global
|
||||||
|
function M.executable(path)
|
||||||
|
local directory = vim.fn.isdirectory(path) == 1 and path or vim.fs.dirname(path)
|
||||||
|
local root = vim.fs.root(directory, { "pubspec.yaml" })
|
||||||
|
|
||||||
|
if root then
|
||||||
|
local fvm_dart = root .. "/.fvm/flutter_sdk/bin/dart"
|
||||||
|
if vim.fn.executable(fvm_dart) == 1 then
|
||||||
|
return fvm_dart
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return "dart"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,426 @@
|
|||||||
|
-- Custom module to config a few things for the mini.files:
|
||||||
|
-- - git highlighting
|
||||||
|
-- - refresh
|
||||||
|
-- - file open in external programs
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local uv = vim.uv or vim.loop
|
||||||
|
local cache_ttl_ms = 1000
|
||||||
|
|
||||||
|
local status_cache = {}
|
||||||
|
local git_root_cache = {}
|
||||||
|
local known_git_roots = {}
|
||||||
|
|
||||||
|
local function is_path_inside(path, root)
|
||||||
|
return path == root or vim.startswith(path, root .. "/")
|
||||||
|
end
|
||||||
|
|
||||||
|
local function new_status_node()
|
||||||
|
return {
|
||||||
|
children = {},
|
||||||
|
status = nil,
|
||||||
|
priority = 0,
|
||||||
|
is_dir_ignored = false,
|
||||||
|
is_dir_untracked = false,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
local function is_conflict(status)
|
||||||
|
if #status < 2 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local index_status = status:sub(1, 1)
|
||||||
|
local worktree_status = status:sub(2, 2)
|
||||||
|
return index_status == "U"
|
||||||
|
or worktree_status == "U"
|
||||||
|
or status == "AA"
|
||||||
|
or status == "DD"
|
||||||
|
end
|
||||||
|
|
||||||
|
local function status_priority(status)
|
||||||
|
-- Folder aggregation follows the Zed-inspired order create < edit <
|
||||||
|
-- delete. `subtree_status()` uses the greatest priority, so deletion
|
||||||
|
-- must outrank every create or edit status.
|
||||||
|
if #status < 2 then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
if is_conflict(status) then
|
||||||
|
return 8
|
||||||
|
end
|
||||||
|
if status == "!!" then
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
if status == "??" then
|
||||||
|
return 2
|
||||||
|
end
|
||||||
|
|
||||||
|
local index_status = status:sub(1, 1)
|
||||||
|
local worktree_status = status:sub(2, 2)
|
||||||
|
|
||||||
|
if index_status == "D" or worktree_status == "D" then
|
||||||
|
return 4
|
||||||
|
end
|
||||||
|
if index_status == "A" then
|
||||||
|
return 2
|
||||||
|
end
|
||||||
|
if index_status == "R" or index_status == "C" then
|
||||||
|
return 3
|
||||||
|
end
|
||||||
|
if index_status == "M" or worktree_status == "M" then
|
||||||
|
return 3
|
||||||
|
end
|
||||||
|
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
local function status_highlight(status)
|
||||||
|
if not status then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
if status == "!!" then
|
||||||
|
return "Comment"
|
||||||
|
end
|
||||||
|
if is_conflict(status) then
|
||||||
|
return "MiniDiffSignDelete"
|
||||||
|
end
|
||||||
|
if status == "??" or status:sub(1, 1) == "A" then
|
||||||
|
return "MiniDiffSignAdd"
|
||||||
|
end
|
||||||
|
if status:sub(1, 1) == "D" or status:sub(2, 2) == "D" then
|
||||||
|
return "MiniDiffSignDelete"
|
||||||
|
end
|
||||||
|
if status:sub(1, 1) == "M"
|
||||||
|
or status:sub(1, 1) == "R"
|
||||||
|
or status:sub(1, 1) == "C"
|
||||||
|
or status:sub(2, 2) == "M"
|
||||||
|
then
|
||||||
|
return "MiniDiffSignChange"
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local function insert_status(root, relative_path, status, is_directory)
|
||||||
|
local priority = status_priority(status)
|
||||||
|
if priority == 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local node = root
|
||||||
|
local segments = vim.split(relative_path, "/", { plain = true, trimempty = true })
|
||||||
|
for index, segment in ipairs(segments) do
|
||||||
|
node.children[segment] = node.children[segment] or new_status_node()
|
||||||
|
node = node.children[segment]
|
||||||
|
|
||||||
|
if index == #segments then
|
||||||
|
if priority > node.priority then
|
||||||
|
node.status = status
|
||||||
|
node.priority = priority
|
||||||
|
end
|
||||||
|
if is_directory and status == "!!" then
|
||||||
|
node.is_dir_ignored = true
|
||||||
|
end
|
||||||
|
if is_directory and status == "??" then
|
||||||
|
node.is_dir_untracked = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function subtree_status(node)
|
||||||
|
local best_status = node.status
|
||||||
|
local best_priority = node.priority
|
||||||
|
|
||||||
|
for _, child in pairs(node.children) do
|
||||||
|
local child_status, child_priority = subtree_status(child)
|
||||||
|
if child_priority > best_priority then
|
||||||
|
best_status = child_status
|
||||||
|
best_priority = child_priority
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return best_status, best_priority
|
||||||
|
end
|
||||||
|
|
||||||
|
local function parse_status(output, root)
|
||||||
|
local data = {
|
||||||
|
root = root,
|
||||||
|
statuses = {},
|
||||||
|
trie = new_status_node(),
|
||||||
|
timestamp = uv.now(),
|
||||||
|
}
|
||||||
|
|
||||||
|
local records = vim.split(output, "\0", { plain = true, trimempty = true })
|
||||||
|
local record_index = 1
|
||||||
|
while record_index <= #records do
|
||||||
|
local record = records[record_index]
|
||||||
|
if #record >= 4 then
|
||||||
|
local status = record:sub(1, 2)
|
||||||
|
local relative_path = record:sub(4)
|
||||||
|
|
||||||
|
-- With -z, rename/copy output contains the new path followed by
|
||||||
|
-- the old path. Oil highlights the new path only.
|
||||||
|
if status:sub(1, 1) == "R" or status:sub(1, 1) == "C" then
|
||||||
|
record_index = record_index + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
local is_directory = relative_path:sub(-1) == "/"
|
||||||
|
relative_path = relative_path:gsub("^%./", ""):gsub("/$", "")
|
||||||
|
if relative_path ~= "" then
|
||||||
|
local absolute_path = vim.fs.normalize(vim.fs.joinpath(root, relative_path))
|
||||||
|
data.statuses[absolute_path] = status
|
||||||
|
insert_status(data.trie, relative_path, status, is_directory)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
record_index = record_index + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
return data
|
||||||
|
end
|
||||||
|
|
||||||
|
local function find_cached_root(path)
|
||||||
|
local result
|
||||||
|
for root in pairs(known_git_roots) do
|
||||||
|
if is_path_inside(path, root) and (result == nil or #root > #result) then
|
||||||
|
result = root
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
local function find_git_root(path)
|
||||||
|
local cached_root = find_cached_root(path)
|
||||||
|
if cached_root ~= nil then
|
||||||
|
return cached_root
|
||||||
|
end
|
||||||
|
|
||||||
|
local cached = git_root_cache[path]
|
||||||
|
if cached ~= nil then
|
||||||
|
return cached or nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local result = vim.system({ "git", "-C", path, "rev-parse", "--show-toplevel" }, { text = true }):wait()
|
||||||
|
if result.code ~= 0 then
|
||||||
|
git_root_cache[path] = false
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local root = vim.trim(result.stdout)
|
||||||
|
if root == "" then
|
||||||
|
git_root_cache[path] = false
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
root = vim.fs.normalize(root)
|
||||||
|
git_root_cache[path] = root
|
||||||
|
known_git_roots[root] = true
|
||||||
|
return root
|
||||||
|
end
|
||||||
|
|
||||||
|
local function get_status_data(fs_entry)
|
||||||
|
local path = fs_entry.path
|
||||||
|
if fs_entry.fs_type ~= "directory" then
|
||||||
|
path = vim.fs.dirname(path)
|
||||||
|
end
|
||||||
|
path = vim.fs.normalize(path)
|
||||||
|
|
||||||
|
local root = find_git_root(path)
|
||||||
|
if root == nil then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local cached = status_cache[root]
|
||||||
|
if cached ~= nil and uv.now() - cached.timestamp < cache_ttl_ms then
|
||||||
|
return cached
|
||||||
|
end
|
||||||
|
|
||||||
|
local result = vim.system({
|
||||||
|
"git",
|
||||||
|
"-C",
|
||||||
|
root,
|
||||||
|
"--no-optional-locks",
|
||||||
|
"status",
|
||||||
|
"--porcelain",
|
||||||
|
"--ignored",
|
||||||
|
"-z",
|
||||||
|
}, { text = true }):wait()
|
||||||
|
if result.code ~= 0 then
|
||||||
|
status_cache[root] = parse_status("", root)
|
||||||
|
return status_cache[root]
|
||||||
|
end
|
||||||
|
|
||||||
|
local data = parse_status(result.stdout, root)
|
||||||
|
status_cache[root] = data
|
||||||
|
return data
|
||||||
|
end
|
||||||
|
|
||||||
|
local function lookup_status(data, fs_entry)
|
||||||
|
local path = vim.fs.normalize(fs_entry.path)
|
||||||
|
local direct_status = data.statuses[path]
|
||||||
|
if fs_entry.fs_type ~= "directory" and direct_status ~= nil then
|
||||||
|
return direct_status
|
||||||
|
end
|
||||||
|
|
||||||
|
if not is_path_inside(path, data.root) then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local relative_path = path:sub(#data.root + 2)
|
||||||
|
local node = data.trie
|
||||||
|
for _, segment in ipairs(vim.split(relative_path, "/", { plain = true, trimempty = true })) do
|
||||||
|
if node.is_dir_ignored then
|
||||||
|
return "!!"
|
||||||
|
end
|
||||||
|
if node.is_dir_untracked then
|
||||||
|
return "??"
|
||||||
|
end
|
||||||
|
|
||||||
|
node = node.children[segment]
|
||||||
|
if node == nil then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if node.is_dir_ignored then
|
||||||
|
return "!!"
|
||||||
|
end
|
||||||
|
if node.is_dir_untracked then
|
||||||
|
return "??"
|
||||||
|
end
|
||||||
|
if next(node.children) == nil then
|
||||||
|
return node.status
|
||||||
|
end
|
||||||
|
|
||||||
|
local status = subtree_status(node)
|
||||||
|
-- Match the Oil configuration: an ignored descendant does not grey its
|
||||||
|
-- parent directory unless Git reported that directory as ignored.
|
||||||
|
if fs_entry.fs_type == "directory" and status == "!!" then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
return status
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.filter(fs_entry)
|
||||||
|
return fs_entry.name ~= ".git"
|
||||||
|
end
|
||||||
|
|
||||||
|
local function get_entry_status(fs_entry)
|
||||||
|
local data = get_status_data(fs_entry)
|
||||||
|
if data == nil then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
return lookup_status(data, fs_entry)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.highlight(fs_entry)
|
||||||
|
local status = get_entry_status(fs_entry)
|
||||||
|
return status_highlight(status)
|
||||||
|
or (fs_entry.fs_type == "directory" and "MiniFilesDirectory" or "MiniFilesFile")
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.invalidate()
|
||||||
|
status_cache = {}
|
||||||
|
git_root_cache = {}
|
||||||
|
known_git_roots = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
local function refresh()
|
||||||
|
M.invalidate()
|
||||||
|
if _G.MiniFiles == nil or MiniFiles.get_explorer_state() == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.schedule(function()
|
||||||
|
if MiniFiles.get_explorer_state() ~= nil then
|
||||||
|
MiniFiles.refresh()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function refresh_filetree()
|
||||||
|
M.invalidate()
|
||||||
|
if _G.MiniFiles == nil or MiniFiles.get_explorer_state() == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.schedule(function()
|
||||||
|
if MiniFiles.get_explorer_state() ~= nil then
|
||||||
|
MiniFiles.refresh({
|
||||||
|
content = {
|
||||||
|
filter = M.filter,
|
||||||
|
highlight = M.highlight,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function open_external()
|
||||||
|
local fs_entry = MiniFiles.get_fs_entry()
|
||||||
|
if fs_entry == nil then
|
||||||
|
vim.notify("No file system entry under the cursor", vim.log.levels.WARN)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.ui.open(fs_entry.path)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
local group = vim.api.nvim_create_augroup("romanzy_mini_files_git", { clear = true })
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
group = group,
|
||||||
|
pattern = "MiniFilesBufferCreate",
|
||||||
|
callback = function(args)
|
||||||
|
if args.data == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, lhs in ipairs({ "gR", "<F5>" }) do
|
||||||
|
vim.keymap.set("n", lhs, refresh_filetree, {
|
||||||
|
buffer = args.data.buf_id,
|
||||||
|
desc = "refresh mini.files filetree",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
vim.keymap.set("n", "gx", open_external, {
|
||||||
|
buffer = args.data.buf_id,
|
||||||
|
desc = "open mini.files entry externally",
|
||||||
|
})
|
||||||
|
vim.keymap.set("n", "<CR>", "L", {
|
||||||
|
buffer = args.data.buf_id,
|
||||||
|
remap = true,
|
||||||
|
desc = "go in entry plus (extra)",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
vim.api.nvim_create_autocmd({ "BufWritePost", "FocusGained", "TermClose" }, {
|
||||||
|
group = group,
|
||||||
|
callback = refresh,
|
||||||
|
})
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
group = group,
|
||||||
|
pattern = {
|
||||||
|
"GitSignsUpdate",
|
||||||
|
"LazyGitClosed",
|
||||||
|
"MiniFilesActionCreate",
|
||||||
|
"MiniFilesActionDelete",
|
||||||
|
"MiniFilesActionRename",
|
||||||
|
"MiniFilesActionCopy",
|
||||||
|
"MiniFilesActionMove",
|
||||||
|
},
|
||||||
|
callback = refresh,
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
content = {
|
||||||
|
filter = M.filter,
|
||||||
|
highlight = M.highlight,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
--- Toggle spell checking for the current window.
|
||||||
|
function M.toggle()
|
||||||
|
if vim.bo.buftype == "terminal" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.opt_local.spell = not vim.wo.spell
|
||||||
|
vim.cmd("redrawstatus")
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
vim.opt.spelllang = { "en_us" }
|
||||||
|
vim.opt.spell = true
|
||||||
|
|
||||||
|
local group = vim.api.nvim_create_augroup("RomanzySpell", { clear = true })
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
group = group,
|
||||||
|
pattern = "terminal",
|
||||||
|
callback = function()
|
||||||
|
vim.opt_local.spell = false
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("TermOpen", {
|
||||||
|
group = group,
|
||||||
|
callback = function()
|
||||||
|
vim.cmd("setfiletype terminal")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.render()
|
||||||
|
local current = vim.fn.tabpagenr()
|
||||||
|
local last = vim.fn.tabpagenr("$")
|
||||||
|
local parts = {}
|
||||||
|
|
||||||
|
for index = 1, last do
|
||||||
|
parts[#parts + 1] = index == current and "%#TabLineSel#" or "%#TabLine#"
|
||||||
|
parts[#parts + 1] = "%" .. index .. "T"
|
||||||
|
parts[#parts + 1] = " " .. index .. " "
|
||||||
|
end
|
||||||
|
|
||||||
|
parts[#parts + 1] = "%#TabLineFill#%T"
|
||||||
|
|
||||||
|
return table.concat(parts)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
_G.RomanzyTabline = M.render
|
||||||
|
vim.opt.tabline = "%!v:lua.RomanzyTabline()"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
--- Toggle wrapping, or force it to the provided state.
|
||||||
|
--- @param enabled? boolean
|
||||||
|
function M.toggle(enabled)
|
||||||
|
if enabled == nil then
|
||||||
|
enabled = not vim.wo.wrap
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.wo.wrap = enabled
|
||||||
|
vim.wo.linebreak = enabled
|
||||||
|
vim.wo.breakindent = enabled
|
||||||
|
vim.wo.colorcolumn = enabled and "" or "80"
|
||||||
|
vim.bo.textwidth = enabled and 0 or 80
|
||||||
|
vim.bo.wrapmargin = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -18,19 +18,36 @@ local function telescope_picker(picker)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function open_mini_files_at_current_buffer()
|
||||||
|
local current_path = vim.api.nvim_buf_get_name(0)
|
||||||
|
if vim.bo.buftype ~= "" or current_path == "" then
|
||||||
|
current_path = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
MiniFiles.open(current_path)
|
||||||
|
end
|
||||||
|
|
||||||
map("n", "<leader><leader>r", ":source ~/.config/nvim/init.lua<CR>", { desc = "reload init.lua" })
|
map("n", "<leader><leader>r", ":source ~/.config/nvim/init.lua<CR>", { desc = "reload init.lua" })
|
||||||
map("n", "<leader><leader>h", telescope_picker("keymaps"), { desc = "show keymaps" })
|
map("n", "<leader><leader>h", telescope_picker("keymaps"), { desc = "show keymaps" })
|
||||||
map("n", "<leader>dl", "<Cmd>Oil<CR>", { desc = "open oil" })
|
map("n", "<leader>e", open_mini_files_at_current_buffer, { desc = "open mini.files" })
|
||||||
map("n", "<leader>ff", telescope_picker("find_files"), { desc = "find files" })
|
map("n", "<leader>ff", telescope_picker("find_files"), { desc = "find files" })
|
||||||
map("n", "<leader>fg", telescope_picker("live_grep"), { desc = "live grep" })
|
map("n", "<leader>fg", telescope_picker("live_grep"), { desc = "live grep" })
|
||||||
map("n", "<leader>fb", telescope_picker("buffers"), { desc = "find buffers" })
|
map("n", "<leader>fb", telescope_picker("buffers"), { desc = "find buffers" })
|
||||||
map("n", "<leader>fh", telescope_picker("help_tags"), { desc = "help tags" })
|
map("n", "<leader>fh", telescope_picker("help_tags"), { desc = "help tags" })
|
||||||
|
map("n", "<leader>lg", "<Cmd>LazyGit<CR>", { desc = "open lazygit" })
|
||||||
|
map("n", "<leader>dv", "<Cmd>DiffviewOpen<CR>", { desc = "open diffview" })
|
||||||
|
map("n", "<leader>dc", "<Cmd>DiffviewClose<CR>", { desc = "close diffview" })
|
||||||
|
map("n", "<leader>tw", require("romanzy.custom.wrap").toggle, { desc = "toggle soft wrap" })
|
||||||
|
map("n", "<leader>ts", require("romanzy.custom.spell").toggle, { desc = "toggle spell checking" })
|
||||||
|
map("n", "<leader>th", function()
|
||||||
|
MiniDiff.toggle_overlay()
|
||||||
|
end, { desc = "toggle hunk view" })
|
||||||
|
|
||||||
-- map("n", "<leader>s", ":set spell!<CR>", { desc = "toggle spell" })
|
|
||||||
map("n", "<leader>sv", "<Cmd>vs<CR>", { desc = "split vertical" })
|
map("n", "<leader>sv", "<Cmd>vs<CR>", { desc = "split vertical" })
|
||||||
map("n", "<leader>sh", "<Cmd>sp<CR>", { desc = "split horizontal" })
|
map("n", "<leader>sh", "<Cmd>sp<CR>", { desc = "split horizontal" })
|
||||||
map("n", "<leader>se", "<C-w>=", { desc = "equalize splits" })
|
map("n", "<leader>se", "<C-w>=", { desc = "equalize splits" })
|
||||||
map("n", "<leader>sc", "<C-w>c", { desc = "close split" })
|
map("n", "<leader>sc", "<C-w>c", { desc = "close split" })
|
||||||
|
|
||||||
map("n", "<leader>rh", "<Cmd>vertical resize -10<CR>", { desc = "make buffer narrower" })
|
map("n", "<leader>rh", "<Cmd>vertical resize -10<CR>", { desc = "make buffer narrower" })
|
||||||
map("n", "<leader>rl", "<Cmd>vertical resize +10<CR>", { desc = "make buffer wider" })
|
map("n", "<leader>rl", "<Cmd>vertical resize +10<CR>", { desc = "make buffer wider" })
|
||||||
map("n", "<leader>rj", "<Cmd>resize -5<CR>", { desc = "make buffer shorter" })
|
map("n", "<leader>rj", "<Cmd>resize -5<CR>", { desc = "make buffer shorter" })
|
||||||
@@ -40,13 +57,22 @@ map("n", "<leader>re", "<C-w>=", { desc = "equalize buffer sizes" })
|
|||||||
map("n", "<leader>bp", "<Cmd>bprevious<CR>", { desc = "prev buffer" })
|
map("n", "<leader>bp", "<Cmd>bprevious<CR>", { desc = "prev buffer" })
|
||||||
map("n", "<leader>bn", "<Cmd>bnext<CR>", { desc = "next buffer" })
|
map("n", "<leader>bn", "<Cmd>bnext<CR>", { desc = "next buffer" })
|
||||||
map("n", "<leader>bd", "<Cmd>bdelete<CR>", { desc = "delete buffer" })
|
map("n", "<leader>bd", "<Cmd>bdelete<CR>", { desc = "delete buffer" })
|
||||||
|
map("n", "<leader>bc", require("romanzy.custom.buffers").close_hidden, { desc = "close hidden buffers" })
|
||||||
|
map("n", "<leader>bf", telescope_picker("buffers"), { desc = "find buffers" })
|
||||||
|
|
||||||
map("t", "\\<Esc>", "<C-\\><C-n>", { desc = "exit terminal" })
|
map({ "n", "v" }, "<leader>y", '"+y', { desc = "yank to system clipboard" })
|
||||||
|
map("n", "<leader>Y", '"+Y', { desc = "yank line to system clipboard" })
|
||||||
|
map("n", "<leader>p", '"+p', { desc = "paste from system clipboard" })
|
||||||
|
map("n", "<leader>P", '"+P', { desc = "paste before from system clipboard" })
|
||||||
|
|
||||||
|
-- experimenting
|
||||||
|
map("t", { "\\\\", "<C-\\><C-\\>", "<C-Esc>", "\\<Esc>" }, "<C-\\><C-n>", { desc = "exit terminal" })
|
||||||
|
|
||||||
map("n", "<C-h>", "<C-w>h", { desc = "window left" })
|
map("n", "<C-h>", "<C-w>h", { desc = "window left" })
|
||||||
map("n", "<C-j>", "<C-w>j", { desc = "window down" })
|
map("n", "<C-j>", "<C-w>j", { desc = "window down" })
|
||||||
map("n", "<C-k>", "<C-w>k", { desc = "window up" })
|
map("n", "<C-k>", "<C-w>k", { desc = "window up" })
|
||||||
map("n", "<C-l>", "<C-w>l", { desc = "window right" })
|
map("n", "<C-l>", "<C-w>l", { desc = "window right" })
|
||||||
|
map("n", { "gR", "<F5>" }, "<Cmd>edit<CR>", { desc = "refresh current buffer" })
|
||||||
|
|
||||||
-- this is needed to disable refresh behavior for <C-l> for navigation
|
-- this is needed to disable refresh behavior for <C-l> for navigation
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
@@ -60,25 +86,10 @@ vim.api.nvim_create_autocmd("FileType", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- hjkl supremacy
|
-- hjkl supremacy
|
||||||
map({ "n", "i", "v", "x", "s", "o", "c" }, { "<left>", "<right>", "<up>", "<down>" }, function()
|
map({ "n", "v", "i" }, { "<left>", "<right>", "<up>", "<down>" }, function()
|
||||||
vim.notify('hjkl supremacy', vim.log.levels.ERROR)
|
vim.notify('hjkl supremacy', vim.log.levels.ERROR)
|
||||||
end, { desc = "hjkl supremacy" })
|
end, { desc = "hjkl supremacy" })
|
||||||
|
|
||||||
map("n", "g.", vim.diagnostic.open_float, { desc = "line diagnostics" })
|
|
||||||
map("n", "gl", vim.diagnostic.setloclist, { desc = "diagnostic list" })
|
|
||||||
|
|
||||||
-- diagnostics only on error.
|
|
||||||
map("n", "g]", function()
|
|
||||||
vim.diagnostic.goto_next({
|
|
||||||
severity = vim.diagnostic.severity.ERROR,
|
|
||||||
})
|
|
||||||
end, { desc = "next error" })
|
|
||||||
map("n", "g[", function()
|
|
||||||
vim.diagnostic.goto_prev({
|
|
||||||
severity = vim.diagnostic.severity.ERROR,
|
|
||||||
})
|
|
||||||
end, { desc = "prev error" })
|
|
||||||
|
|
||||||
local function rename_without_default()
|
local function rename_without_default()
|
||||||
vim.ui.input({
|
vim.ui.input({
|
||||||
prompt = "New Name: ",
|
prompt = "New Name: ",
|
||||||
@@ -93,19 +104,75 @@ local function rename_without_default()
|
|||||||
end
|
end
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("LspAttach", {
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
-- defaults are:
|
||||||
|
-- grn → Rename symbol
|
||||||
|
-- gra → Code actions
|
||||||
|
-- grr → Find references
|
||||||
|
-- gri → Go to implementation
|
||||||
|
-- grt → Go to type definition
|
||||||
|
-- gO → Document symbols
|
||||||
callback = function(ev)
|
callback = function(ev)
|
||||||
map("n", "gd", vim.lsp.buf.definition, { buffer = ev.buf, desc = "goto definition" })
|
map("n", "gd", vim.lsp.buf.definition, { buffer = ev.buf, desc = "goto definition" })
|
||||||
map("n", "gD", vim.lsp.buf.declaration, { buffer = ev.buf, desc = "goto declaration" })
|
map("n", "gD", vim.lsp.buf.declaration, { buffer = ev.buf, desc = "goto declaration" })
|
||||||
map("n", "grd", vim.lsp.buf.references, { buffer = ev.buf, desc = "list references" })
|
map("n", "gfr", vim.lsp.buf.references, { buffer = ev.buf, desc = "find references" })
|
||||||
map("n", "grn", rename_without_default, { buffer = ev.buf, desc = "rename symbol" })
|
map("n", "grn", rename_without_default, { buffer = ev.buf, desc = "rename symbol (from empty)" })
|
||||||
map("i", "<C-Space>", vim.lsp.completion.get, { buffer = ev.buf, desc = "trigger completion" })
|
map("n", "grN", vim.lsp.buf.rename, { buffer = ev.buf, desc = "rename symbol (from current)" })
|
||||||
|
|
||||||
|
map({ "n", "x" }, "<leader>ca", vim.lsp.buf.code_action, { buffer = ev.buf, desc = "code actions" })
|
||||||
|
map("n", "<leader>cf", function()
|
||||||
|
vim.lsp.buf.code_action({
|
||||||
|
apply = true,
|
||||||
|
context = {
|
||||||
|
only = { "quickfix" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end, { buffer = ev.buf, desc = "quick fixes" })
|
||||||
|
map({ "n", "x" }, "<leader>cs", function()
|
||||||
|
vim.lsp.buf.code_action({
|
||||||
|
context = {
|
||||||
|
only = { "source" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end, { buffer = ev.buf, desc = "source actions" })
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
map("n", "gle", vim.diagnostic.setloclist, { desc = "display error information" })
|
-- diagnostics
|
||||||
map("n", "gie", function()
|
map("n", "<leader>xx", function()
|
||||||
|
require("trouble").toggle({
|
||||||
|
mode = "diagnostics",
|
||||||
|
filter = {
|
||||||
|
severity = {
|
||||||
|
vim.diagnostic.severity.ERROR,
|
||||||
|
vim.diagnostic.severity.WARN,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end, { desc = "toggle project warnings and errors" })
|
||||||
|
map("n", "g.", vim.diagnostic.open_float, { desc = "line diagnostics" })
|
||||||
|
map("n", "gl", vim.diagnostic.setloclist, { desc = "diagnostic list" })
|
||||||
|
|
||||||
|
map("n", "]g", function()
|
||||||
|
vim.diagnostic.jump({
|
||||||
|
count = 1,
|
||||||
|
severity = {
|
||||||
|
min = vim.diagnostic.severity.WARN,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end, { desc = "next warning/error" })
|
||||||
|
map("n", "[g", function()
|
||||||
|
vim.diagnostic.jump({
|
||||||
|
count = -1,
|
||||||
|
severity = {
|
||||||
|
min = vim.diagnostic.severity.WARN,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end, { desc = "prev warning/error" })
|
||||||
|
|
||||||
|
map("n", "gld", vim.diagnostic.setloclist, { desc = "display diagnostic information" })
|
||||||
|
map("n", "<leader>ti", function()
|
||||||
vim.diagnostic.config({ virtual_text = not vim.diagnostic.config().virtual_text })
|
vim.diagnostic.config({ virtual_text = not vim.diagnostic.config().virtual_text })
|
||||||
end, { desc = "toggle inline errors" })
|
end, { desc = "toggle inline diagnostics" })
|
||||||
map("n", "gve", function()
|
map("n", "<leader>tv", function()
|
||||||
vim.diagnostic.config({ virtual_lines = not vim.diagnostic.config().virtual_lines })
|
vim.diagnostic.config({ virtual_lines = not vim.diagnostic.config().virtual_lines })
|
||||||
end, { desc = "toggle virtual line errors" })
|
end, { desc = "toggle virtual diagnostics" })
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
local g = vim.g
|
local g = vim.g
|
||||||
local o = vim.opt
|
local o = vim.opt
|
||||||
|
|
||||||
-- Leaders
|
|
||||||
g.mapleader = " " -- Uses space as the global leader key.
|
g.mapleader = " " -- Uses space as the global leader key.
|
||||||
g.maplocalleader = " " -- Uses space as the local leader key.
|
g.maplocalleader = " " -- Uses space as the local leader key.
|
||||||
|
g.clipboard = "osc52" -- Routes the + and * registers through OSC52 in terminal Neovim.
|
||||||
|
|
||||||
-- Interface
|
|
||||||
o.number = true -- Shows absolute line numbers.
|
o.number = true -- Shows absolute line numbers.
|
||||||
o.relativenumber = true -- Shows relative numbers for easier motion.
|
o.relativenumber = true -- Shows relative numbers for easier motion.
|
||||||
|
o.cursorline = true -- Highlights the line under the cursor.
|
||||||
|
o.textwidth = 80 -- Wraps inserted text after 80 columns when formatting is active.
|
||||||
o.scrolloff = 8 -- Keeps context lines visible around the cursor.
|
o.scrolloff = 8 -- Keeps context lines visible around the cursor.
|
||||||
o.signcolumn = "yes" -- Always reserves space for signs in the gutter.
|
o.signcolumn = "yes" -- Always reserves space for signs in the gutter.
|
||||||
o.colorcolumn = "+1" -- Highlights the preferred maximum line width.
|
o.colorcolumn = "80" -- Highlights the preferred maximum line width.
|
||||||
o.wrap = false -- Prevents long lines from wrapping on screen.
|
o.wrap = false -- Prevents long lines from wrapping on screen.
|
||||||
o.list = true -- Displays whitespace characters using listchars.
|
o.list = true -- Displays whitespace characters using listchars.
|
||||||
o.listchars = {
|
o.listchars = {
|
||||||
@@ -22,20 +22,17 @@ o.listchars = {
|
|||||||
} -- Defines how invisible characters are rendered.
|
} -- Defines how invisible characters are rendered.
|
||||||
o.termguicolors = true -- Enables full RGB color support.
|
o.termguicolors = true -- Enables full RGB color support.
|
||||||
o.mouse = "" -- Disables mouse support.
|
o.mouse = "" -- Disables mouse support.
|
||||||
|
|
||||||
-- Editing
|
|
||||||
o.tabstop = 4 -- Renders tab characters as four columns.
|
o.tabstop = 4 -- Renders tab characters as four columns.
|
||||||
o.softtabstop = 4 -- Makes tab/backspace feel like four spaces.
|
o.softtabstop = 4 -- Makes tab/backspace feel like four spaces.
|
||||||
o.shiftwidth = 4 -- Uses four columns for each indent step.
|
o.shiftwidth = 4 -- Uses four columns for each indent step.
|
||||||
o.expandtab = false -- Keeps literal tab characters instead of spaces.
|
o.expandtab = true -- Inserts spaces when indenting by default.
|
||||||
o.smartindent = true -- Adds indentation automatically on new lines.
|
o.smartindent = true -- Adds indentation automatically on new lines.
|
||||||
o.swapfile = false -- Disables swapfile creation.
|
o.swapfile = false -- Disables swapfile creation.
|
||||||
|
|
||||||
-- Search and update behavior
|
|
||||||
o.incsearch = true -- Updates search matches as you type.
|
o.incsearch = true -- Updates search matches as you type.
|
||||||
|
o.completeopt = { "menuone", "noinsert", "fuzzy", "nosort" } -- Enables fuzzy completion matching.
|
||||||
|
o.pumheight = 8 -- Limits the completion popup menu size.
|
||||||
o.updatetime = 50 -- Reduces idle delay for swap and CursorHold events.
|
o.updatetime = 50 -- Reduces idle delay for swap and CursorHold events.
|
||||||
o.spelllang = { "en_us" } -- Uses US English for spell checking.
|
|
||||||
|
|
||||||
-- Shell
|
|
||||||
o.shell = "bash" -- Runs shell commands through bash.
|
o.shell = "bash" -- Runs shell commands through bash.
|
||||||
|
|
||||||
|
-- Only show the invisible characters inside the code editing buffers
|
||||||
|
vim.cmd([[autocmd BufWinEnter * if &buftype != '' | setlocal nolist | endif]])
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
require("romanzy.plugins.rose-pine")
|
require("romanzy.plugins.rose-pine")
|
||||||
require("romanzy.plugins.mini")
|
require("romanzy.plugins.mini")
|
||||||
|
require("romanzy.plugins.lazygit")
|
||||||
|
require("romanzy.plugins.diffview")
|
||||||
|
require("romanzy.plugins.trouble")
|
||||||
require("romanzy.plugins.oil")
|
require("romanzy.plugins.oil")
|
||||||
require("romanzy.plugins.telescope")
|
require("romanzy.plugins.telescope")
|
||||||
require("romanzy.plugins.nvim-treesitter")
|
require("romanzy.plugins.nvim-treesitter")
|
||||||
|
require("romanzy.plugins.conform")
|
||||||
require("romanzy.plugins.lsp")
|
require("romanzy.plugins.lsp")
|
||||||
require("romanzy.plugins.header42")
|
require("romanzy.plugins.codamheader")
|
||||||
|
require("romanzy.custom.spell").setup()
|
||||||
|
require("romanzy.custom.tabline").setup()
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
vim.pack.add({
|
||||||
|
{ src = "https://github.com/BeerB34r/codam-header.nvim" },
|
||||||
|
})
|
||||||
|
|
||||||
|
require("codamheader").setup({
|
||||||
|
default_map = false,
|
||||||
|
auto_update = true,
|
||||||
|
user = "rvolovoy",
|
||||||
|
mail = "rvolovoy@student.codam.nl",
|
||||||
|
exascii = {},
|
||||||
|
-- exascii = {
|
||||||
|
-- "—————No norm compliance?——————",
|
||||||
|
-- "⠀⣞⢽⢪⢣⢣⢣⢫⡺⡵⣝⡮⣗⢷⢽⢽⢽⣮⡷⡽⣜⣜⢮⢺⣜⢷⢽⢝⡽⣝",
|
||||||
|
-- "⠸⡸⠜⠕⠕⠁⢁⢇⢏⢽⢺⣪⡳⡝⣎⣏⢯⢞⡿⣟⣷⣳⢯⡷⣽⢽⢯⣳⣫⠇",
|
||||||
|
-- "⠀⠀⢀⢀⢄⢬⢪⡪⡎⣆⡈⠚⠜⠕⠇⠗⠝⢕⢯⢫⣞⣯⣿⣻⡽⣏⢗⣗⠏⠀",
|
||||||
|
-- "⠀⠪⡪⡪⣪⢪⢺⢸⢢⢓⢆⢤⢀⠀⠀⠀⠀⠈⢊⢞⡾⣿⡯⣏⢮⠷⠁⠀⠀⠀",
|
||||||
|
-- "⠀⠀⠀⠈⠊⠆⡃⠕⢕⢇⢇⢇⢇⢇⢏⢎⢎⢆⢄⠀⢑⣽⣿⢝⠲⠉⠀⠀⠀⠀",
|
||||||
|
-- "⠀⠀⠀⠀⠀⡿⠂⠠⠀⡇⢇⠕⢈⣀⠀⠁⠡⠣⡣⡫⣂⣿⠯⢪⠰⠂⠀⠀⠀⠀",
|
||||||
|
-- "⠀⠀⠀⠀⡦⡙⡂⢀⢤⢣⠣⡈⣾⡃⠠⠄⠀⡄⢱⣌⣶⢏⢊⠂⠀⠀⠀⠀⠀⠀",
|
||||||
|
-- "⠀⠀⠀⠀⢝⡲⣜⡮⡏⢎⢌⢂⠙⠢⠐⢀⢘⢵⣽⣿⡿⠁⠁⠀⠀⠀⠀⠀⠀⠀",
|
||||||
|
-- "⠀⠀⠀⠀⠨⣺⡺⡕⡕⡱⡑⡆⡕⡅⡕⡜⡼⢽⡻⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||||
|
-- "⠀⠀⠀⠀⣼⣳⣫⣾⣵⣗⡵⡱⡡⢣⢑⢕⢜⢕⡝⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||||
|
-- "⠀⠀⠀⣴⣿⣾⣿⣿⣿⡿⡽⡑⢌⠪⡢⡣⣣⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||||
|
-- "⠀⠀⠀⡟⡾⣿⢿⢿⢵⣽⣾⣼⣘⢸⢸⣞⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||||
|
-- "⠀⠀⠀⠀⠁⠇⠡⠩⡫⢿⣝⡻⡮⣒⢽⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||||
|
-- "——————————————————————————————",
|
||||||
|
-- },
|
||||||
|
-- exascii_left = false,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command("Header42", function()
|
||||||
|
require("codamheader.utils.header").stdheader()
|
||||||
|
end, {})
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
vim.pack.add({
|
||||||
|
{
|
||||||
|
src = "https://github.com/stevearc/conform.nvim",
|
||||||
|
name = "conform.nvim",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
local dart = require("romanzy.custom.dart")
|
||||||
|
|
||||||
|
require("conform").setup({
|
||||||
|
formatters_by_ft = {
|
||||||
|
dart = { "dart_format" },
|
||||||
|
javascript = { "prettier" },
|
||||||
|
javascriptreact = { "prettier" },
|
||||||
|
typescript = { "prettier" },
|
||||||
|
typescriptreact = { "prettier" },
|
||||||
|
markdown = { "prettier" },
|
||||||
|
c = { filter = function() return false end },
|
||||||
|
cpp = { filter = function() return false end },
|
||||||
|
h = { filter = function() return false end }
|
||||||
|
},
|
||||||
|
formatters = {
|
||||||
|
prettier = {
|
||||||
|
prepend_args = function(_, ctx)
|
||||||
|
if vim.bo[ctx.buf].filetype == "markdown" then
|
||||||
|
return { "--prose-wrap=always", "--print-width=80" }
|
||||||
|
end
|
||||||
|
return {}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
dart_format = {
|
||||||
|
command = function(_, ctx)
|
||||||
|
return dart.executable(ctx.filename)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
format_on_save = {
|
||||||
|
lsp_format = "fallback",
|
||||||
|
timeout_ms = 2000,
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
vim.pack.add({
|
||||||
|
{
|
||||||
|
src = "https://github.com/sindrets/diffview.nvim",
|
||||||
|
name = "diffview.nvim",
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
vim.pack.add({
|
|
||||||
{ src = "https://codeberg.org/42nerds/header42.nvim" },
|
|
||||||
})
|
|
||||||
|
|
||||||
local function load_header42()
|
|
||||||
-- Prevent double loading
|
|
||||||
if _G.header42_loaded then return end
|
|
||||||
_G.header42_loaded = true
|
|
||||||
|
|
||||||
-- Configure the plugin
|
|
||||||
require("header42").setup({
|
|
||||||
-- autocmd = { create = false },
|
|
||||||
username = "rvolovoy",
|
|
||||||
email = "rvolovoy@student.codam.nl",
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- load it right away
|
|
||||||
-- load_header42();
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
|
||||||
pattern = { "c", "cpp", "python" },
|
|
||||||
once = true,
|
|
||||||
callback = function()
|
|
||||||
load_header42()
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
vim.pack.add({
|
||||||
|
{
|
||||||
|
src = "https://github.com/kdheepak/lazygit.nvim",
|
||||||
|
name = "lazygit.nvim",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src = "https://github.com/nvim-lua/plenary.nvim",
|
||||||
|
name = "plenary.nvim",
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -15,28 +15,13 @@ vim.pack.add({
|
|||||||
|
|
||||||
local mason_lspconfig = require("mason-lspconfig")
|
local mason_lspconfig = require("mason-lspconfig")
|
||||||
|
|
||||||
vim.opt.completeopt = { "menu", "menuone", "noselect", "popup", "fuzzy" }
|
|
||||||
vim.opt.pumheight = 8
|
|
||||||
|
|
||||||
local diag_inline_enabled = true
|
|
||||||
|
|
||||||
local function diag_virtual_text()
|
|
||||||
if not diag_inline_enabled then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
severity = vim.diagnostic.severity.ERROR,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
local function configure_diagnostics()
|
local function configure_diagnostics()
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
severity_sort = true,
|
severity_sort = true,
|
||||||
signs = true,
|
signs = true,
|
||||||
underline = true,
|
underline = true,
|
||||||
update_in_insert = false,
|
update_in_insert = false,
|
||||||
virtual_text = diag_virtual_text(),
|
virtual_text = true,
|
||||||
float = {
|
float = {
|
||||||
border = "rounded",
|
border = "rounded",
|
||||||
source = "if_many",
|
source = "if_many",
|
||||||
@@ -46,37 +31,32 @@ end
|
|||||||
|
|
||||||
configure_diagnostics()
|
configure_diagnostics()
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("LspAttach", {
|
local capabilities = require("mini.completion").get_lsp_capabilities()
|
||||||
callback = function(ev)
|
local dart = require("romanzy.custom.dart")
|
||||||
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
|
||||||
if not client then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.lsp.completion.enable(true, client.id, ev.buf, {
|
|
||||||
autotrigger = true,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
local managed_servers = {
|
local managed_servers = {
|
||||||
"bashls",
|
"bashls",
|
||||||
"clangd",
|
"clangd",
|
||||||
|
"gopls",
|
||||||
"jsonls",
|
"jsonls",
|
||||||
"lua_ls",
|
"lua_ls",
|
||||||
"marksman",
|
"marksman",
|
||||||
"taplo",
|
"taplo",
|
||||||
"ts_ls",
|
|
||||||
"yamlls",
|
"yamlls",
|
||||||
|
"ts_ls",
|
||||||
|
"tailwindcss",
|
||||||
|
"eslint",
|
||||||
|
"tinymist",
|
||||||
|
}
|
||||||
|
local managed_tools = {
|
||||||
|
"prettier",
|
||||||
}
|
}
|
||||||
local servers = {
|
local servers = {
|
||||||
bashls = {},
|
bashls = {},
|
||||||
clangd = {},
|
clangd = {},
|
||||||
|
gopls = {},
|
||||||
jsonls = {},
|
jsonls = {},
|
||||||
marksman = {},
|
marksman = {},
|
||||||
taplo = {},
|
taplo = {},
|
||||||
ts_ls = {},
|
|
||||||
yamlls = {},
|
yamlls = {},
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
settings = {
|
settings = {
|
||||||
@@ -94,6 +74,22 @@ local servers = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
ts_ls = {},
|
||||||
|
tailwindcss = {},
|
||||||
|
eslint = {},
|
||||||
|
tinymist = {},
|
||||||
|
dartls = {
|
||||||
|
cmd = function(dispatchers, config)
|
||||||
|
return vim.lsp.rpc.start({
|
||||||
|
dart.executable(config.root_dir),
|
||||||
|
"language-server",
|
||||||
|
"--protocol=lsp",
|
||||||
|
}, dispatchers, {
|
||||||
|
cwd = config.root_dir,
|
||||||
|
detached = config.detached,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for server_name, config in pairs(servers) do
|
for server_name, config in pairs(servers) do
|
||||||
@@ -107,3 +103,15 @@ mason_lspconfig.setup({
|
|||||||
ensure_installed = managed_servers,
|
ensure_installed = managed_servers,
|
||||||
automatic_enable = managed_servers,
|
automatic_enable = managed_servers,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
vim.lsp.enable("dartls")
|
||||||
|
|
||||||
|
local mason_registry = require("mason-registry")
|
||||||
|
mason_registry.refresh(vim.schedule_wrap(function()
|
||||||
|
for _, tool_name in ipairs(managed_tools) do
|
||||||
|
local tool = mason_registry.get_package(tool_name)
|
||||||
|
if not tool:is_installed() and not tool:is_installing() then
|
||||||
|
tool:install()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end))
|
||||||
|
|||||||
@@ -6,24 +6,34 @@ vim.pack.add({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
local clue = require("mini.clue")
|
|
||||||
local icons = require("mini.icons")
|
local icons = require("mini.icons")
|
||||||
|
local input = require("mini.input")
|
||||||
|
local clue = require("mini.clue")
|
||||||
|
local completion = require("mini.completion")
|
||||||
|
local files = require("mini.files")
|
||||||
local git = require("mini.git")
|
local git = require("mini.git")
|
||||||
local diff = require("mini.diff")
|
local diff = require("mini.diff")
|
||||||
local statusline = require("mini.statusline")
|
local statusline = require("mini.statusline")
|
||||||
|
local cmdline = require("mini.cmdline")
|
||||||
local hipatterns = require("mini.hipatterns")
|
local hipatterns = require("mini.hipatterns")
|
||||||
|
local pairs = require("mini.pairs")
|
||||||
local ai = require("mini.ai")
|
local ai = require("mini.ai")
|
||||||
local notify = require("mini.notify")
|
local notify = require("mini.notify")
|
||||||
local surround = require("mini.surround")
|
local surround = require("mini.surround")
|
||||||
|
|
||||||
local function set_mini_diff_highlights()
|
icons.setup({})
|
||||||
vim.api.nvim_set_hl(0, "MiniDiffSignAdd", { fg = "#9ccf8d" })
|
|
||||||
vim.api.nvim_set_hl(0, "MiniDiffSignChange", { fg = "#f6c177" })
|
local input_view = input.gen_view.floatwin({
|
||||||
vim.api.nvim_set_hl(0, "MiniDiffSignDelete", { fg = "#eb6f92" })
|
-- other interesting symbols for the caret `▏` `⎕` `░` `▒` `▓`
|
||||||
vim.api.nvim_set_hl(0, "MiniDiffOverAdd", { fg = "#9ccf8d" })
|
to_chunks = function(state, max_width)
|
||||||
vim.api.nvim_set_hl(0, "MiniDiffOverChange", { fg = "#f6c177" })
|
return input.state_to_chunks(state, max_width, {
|
||||||
vim.api.nvim_set_hl(0, "MiniDiffOverDelete", { fg = "#eb6f92" })
|
include_prompt = false,
|
||||||
end
|
include_hint = false,
|
||||||
|
symbol_caret = "█",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
input.setup({ handlers = { view = input_view } })
|
||||||
|
|
||||||
clue.setup({
|
clue.setup({
|
||||||
triggers = {
|
triggers = {
|
||||||
@@ -46,25 +56,103 @@ clue.setup({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
icons.setup({})
|
files.setup(require("romanzy.custom.mini_files").setup())
|
||||||
|
|
||||||
git.setup({})
|
git.setup({})
|
||||||
|
|
||||||
diff.setup({})
|
diff.setup({})
|
||||||
|
local function set_mini_diff_highlights()
|
||||||
|
vim.api.nvim_set_hl(0, "MiniDiffSignAdd", { fg = "#9ccf8d", bold = true })
|
||||||
|
vim.api.nvim_set_hl(0, "MiniDiffSignChange", { fg = "#f6c177", bold = true })
|
||||||
|
vim.api.nvim_set_hl(0, "MiniDiffSignDelete", { fg = "#eb6f92", bold = true })
|
||||||
|
vim.api.nvim_set_hl(0, "MiniDiffOverAdd", { fg = "#9ccf8d", bg = "#333c48", bold = true })
|
||||||
|
vim.api.nvim_set_hl(0, "MiniDiffOverChange", { fg = "#eb6f92", bg = "#43293a", bold = true })
|
||||||
|
vim.api.nvim_set_hl(0, "MiniDiffOverChangeBuf", { fg = "#9ccf8d", bg = "#333c48", bold = true })
|
||||||
|
vim.api.nvim_set_hl(0, "MiniDiffOverContext", { fg = "#908caa", bg = "#26233a" })
|
||||||
|
vim.api.nvim_set_hl(0, "MiniDiffOverContextBuf", { fg = "#e0def4", bg = "#1f1d2e" })
|
||||||
|
vim.api.nvim_set_hl(0, "MiniDiffOverDelete", { fg = "#eb6f92", bg = "#43293a", bold = true })
|
||||||
|
end
|
||||||
set_mini_diff_highlights()
|
set_mini_diff_highlights()
|
||||||
vim.api.nvim_create_autocmd("ColorScheme", {
|
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||||
callback = set_mini_diff_highlights,
|
callback = set_mini_diff_highlights,
|
||||||
})
|
})
|
||||||
statusline.setup({ use_icons = true })
|
|
||||||
|
-- Custom de-cluttered status line output. The default was waaay to noisy
|
||||||
|
local function statusline_active()
|
||||||
|
local function statusline_filetype()
|
||||||
|
local filetype = vim.bo.filetype
|
||||||
|
if filetype == "" then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
local icon = MiniIcons.get("filetype", filetype)
|
||||||
|
return icon .. " " .. filetype
|
||||||
|
end
|
||||||
|
|
||||||
|
local function statusline_spell()
|
||||||
|
return vim.wo.spell and "spell" or ""
|
||||||
|
end
|
||||||
|
|
||||||
|
local mode, mode_hl = statusline.section_mode({ trunc_width = 120 })
|
||||||
|
local git_info = statusline.section_git({ trunc_width = 40 })
|
||||||
|
-- local diff_info = statusline.section_diff({ trunc_width = 75 })
|
||||||
|
-- local diagnostics = statusline.section_diagnostics({ trunc_width = 75 })
|
||||||
|
local lsp = statusline.section_lsp({ trunc_width = 75 })
|
||||||
|
local filename = statusline.section_filename({ trunc_width = 140 })
|
||||||
|
local spell = statusline_spell()
|
||||||
|
local fileinfo = statusline_filetype()
|
||||||
|
local search = statusline.section_searchcount({ trunc_width = 75 })
|
||||||
|
|
||||||
|
return statusline.combine_groups({
|
||||||
|
{ hl = mode_hl, strings = { mode } },
|
||||||
|
{ hl = "MiniStatuslineDevinfo", strings = { git_info, lsp } },
|
||||||
|
"%<",
|
||||||
|
{ hl = "MiniStatuslineFilename", strings = { filename } },
|
||||||
|
"%=",
|
||||||
|
{ hl = "MiniStatuslineFileinfo", strings = { spell, fileinfo } },
|
||||||
|
{ hl = mode_hl, strings = { search } },
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
statusline.setup({
|
||||||
|
use_icons = true,
|
||||||
|
content = { active = statusline_active },
|
||||||
|
})
|
||||||
|
|
||||||
|
cmdline.setup({})
|
||||||
|
|
||||||
hipatterns.setup({
|
hipatterns.setup({
|
||||||
highlighters = {
|
highlighters = {
|
||||||
fixme = { pattern = "%f[%w]()FIXME()%f[%W]", group = "MiniHipatternsFixme" },
|
fixme = { pattern = "%f[%w]()FIXME()%f[%W]", group = "MiniHipatternsFixme" },
|
||||||
hack = { pattern = "%f[%w]()HACK()%f[%W]", group = "MiniHipatternsHack" },
|
hack = { pattern = "%f[%w]()HACK()%f[%W]", group = "MiniHipatternsHack" },
|
||||||
todo = { pattern = "%f[%w]()TODO()%f[%W]", group = "MiniHipatternsTodo" },
|
todo = { pattern = "%f[%w]()TODO()%f[%W]", group = "MiniHipatternsTodo" },
|
||||||
note = { pattern = "%f[%w]()NOTE()%f[%W]", group = "MiniHipatternsNote" },
|
note = { pattern = "%f[%w]()NOTE()%f[%W]", group = "MiniHipatternsNote" },
|
||||||
file = { pattern = "%f[%w]()FILE()%f[%W]", group = "MiniHipatternsNote" },
|
|
||||||
hex_color = hipatterns.gen_highlighter.hex_color(),
|
hex_color = hipatterns.gen_highlighter.hex_color(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
pairs.setup({
|
||||||
|
modes = { insert = true, command = true, terminal = false },
|
||||||
|
})
|
||||||
|
|
||||||
|
completion.setup({})
|
||||||
|
vim.keymap.set("i", "<CR>", function()
|
||||||
|
if vim.fn.complete_info({ "selected" }).selected ~= -1 then
|
||||||
|
return "\25"
|
||||||
|
end
|
||||||
|
|
||||||
|
return MiniPairs.cr()
|
||||||
|
end, { expr = true })
|
||||||
|
|
||||||
ai.setup({})
|
ai.setup({})
|
||||||
notify.setup({})
|
|
||||||
|
notify.setup({
|
||||||
|
lsp_progress = {
|
||||||
|
-- the message "lua_ls: processing completion..." and
|
||||||
|
-- "lua_ls: Diagnosing" is very annoying
|
||||||
|
-- enable = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
vim.notify = notify.make_notify()
|
vim.notify = notify.make_notify()
|
||||||
|
|
||||||
surround.setup({})
|
surround.setup({})
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ local parsers = {
|
|||||||
"bash",
|
"bash",
|
||||||
"c",
|
"c",
|
||||||
"gitcommit",
|
"gitcommit",
|
||||||
|
"go",
|
||||||
"javascript",
|
"javascript",
|
||||||
"json",
|
"json",
|
||||||
"lua",
|
"lua",
|
||||||
@@ -18,6 +19,7 @@ local filetypes = {
|
|||||||
"bash",
|
"bash",
|
||||||
"c",
|
"c",
|
||||||
"gitcommit",
|
"gitcommit",
|
||||||
|
"go",
|
||||||
"javascript",
|
"javascript",
|
||||||
"json",
|
"json",
|
||||||
"lua",
|
"lua",
|
||||||
|
|||||||
@@ -1,58 +1,89 @@
|
|||||||
vim.pack.add({
|
-- vim.pack.add({
|
||||||
{
|
-- {
|
||||||
src = "https://github.com/stevearc/oil.nvim",
|
-- src = "https://github.com/stevearc/oil.nvim",
|
||||||
name = "oil.nvim",
|
-- name = "oil.nvim",
|
||||||
},
|
-- },
|
||||||
{
|
-- {
|
||||||
src = "https://github.com/malewicz1337/oil-git.nvim",
|
-- src = "https://github.com/malewicz1337/oil-git.nvim",
|
||||||
name = "oil-git.nvim",
|
-- name = "oil-git.nvim",
|
||||||
},
|
-- },
|
||||||
})
|
-- })
|
||||||
|
--
|
||||||
local function set_oil_git_highlights()
|
-- local function set_oil_git_highlights()
|
||||||
vim.api.nvim_set_hl(0, "OilGitAdded", { link = "MiniDiffSignAdd" })
|
-- vim.api.nvim_set_hl(0, "OilGitAdded", { link = "MiniDiffSignAdd" })
|
||||||
vim.api.nvim_set_hl(0, "OilGitUntracked", { link = "MiniDiffSignAdd" })
|
-- vim.api.nvim_set_hl(0, "OilGitUntracked", { link = "MiniDiffSignAdd" })
|
||||||
vim.api.nvim_set_hl(0, "OilGitModifiedStaged", { link = "MiniDiffSignChange" })
|
-- vim.api.nvim_set_hl(0, "OilGitModifiedStaged", { link = "MiniDiffSignChange" })
|
||||||
vim.api.nvim_set_hl(0, "OilGitModifiedUnstaged", { link = "MiniDiffSignChange" })
|
-- vim.api.nvim_set_hl(0, "OilGitModifiedUnstaged", { link = "MiniDiffSignChange" })
|
||||||
vim.api.nvim_set_hl(0, "OilGitRenamed", { link = "MiniDiffSignChange" })
|
-- vim.api.nvim_set_hl(0, "OilGitRenamed", { link = "MiniDiffSignChange" })
|
||||||
vim.api.nvim_set_hl(0, "OilGitCopied", { link = "MiniDiffSignChange" })
|
-- vim.api.nvim_set_hl(0, "OilGitCopied", { link = "MiniDiffSignChange" })
|
||||||
vim.api.nvim_set_hl(0, "OilGitDeleted", { link = "MiniDiffSignDelete" })
|
-- vim.api.nvim_set_hl(0, "OilGitDeleted", { link = "MiniDiffSignDelete" })
|
||||||
vim.api.nvim_set_hl(0, "OilGitConflict", { link = "MiniDiffSignDelete" })
|
-- vim.api.nvim_set_hl(0, "OilGitConflict", { link = "MiniDiffSignDelete" })
|
||||||
end
|
-- vim.api.nvim_set_hl(0, "OilGitIgnored", { link = "Comment" })
|
||||||
|
-- end
|
||||||
require("oil").setup({
|
--
|
||||||
keymaps = {
|
-- require("oil").setup({
|
||||||
["<C-h>"] = false,
|
-- keymaps = {
|
||||||
["<C-j>"] = false,
|
-- ["<C-h>"] = false,
|
||||||
["<C-k>"] = false,
|
-- ["<C-j>"] = false,
|
||||||
["<C-l>"] = false,
|
-- ["<C-k>"] = false,
|
||||||
["<C-s>"] = false,
|
-- ["<C-l>"] = false,
|
||||||
["<C-p>"] = { "actions.preview", opts = { vertical = true, split = "belowright" } },
|
-- ["gR"] = "actions.refresh", -- replaces default <C-l> behavior
|
||||||
["<BS>"] = { "actions.parent", mode = "n" },
|
-- ["<F5>"] = "actions.refresh",
|
||||||
["<A-h>"] = { "actions.parent", mode = "n" },
|
-- ["<C-s>"] = false,
|
||||||
["<A-l>"] = "actions.select",
|
-- ["<C-p>"] = { "actions.preview", opts = { vertical = true, split = "belowright" } },
|
||||||
},
|
-- ["<BS>"] = { "actions.parent", mode = "n" },
|
||||||
view_options = {
|
-- },
|
||||||
show_hidden = true,
|
-- view_options = {
|
||||||
is_hidden_file = function(name, _)
|
-- show_hidden = true,
|
||||||
return vim.startswith(name, ".")
|
-- is_hidden_file = function(_, _)
|
||||||
end,
|
-- return false
|
||||||
is_always_hidden = function(name, _)
|
-- end,
|
||||||
return name == ".git"
|
-- is_always_hidden = function(name, _)
|
||||||
end,
|
-- return name == ".git"
|
||||||
},
|
-- end,
|
||||||
})
|
-- },
|
||||||
|
-- })
|
||||||
require("oil-git").setup({
|
--
|
||||||
show_file_highlights = true,
|
-- local oil_git_trie = require("oil-git.trie")
|
||||||
show_directory_highlights = true,
|
-- local oil_git_lookup = oil_git_trie.lookup
|
||||||
show_file_symbols = true,
|
--
|
||||||
show_directory_symbols = true,
|
-- -- ugly internal monkey patch to not show partially git-ignored foldres as grey
|
||||||
symbol_position = "none",
|
-- rawset(oil_git_trie, "lookup", function(root, entry_path, git_root, exclude_ignored)
|
||||||
})
|
-- local status = oil_git_lookup(root, entry_path, git_root, exclude_ignored)
|
||||||
|
-- if status ~= "!!" or exclude_ignored then
|
||||||
set_oil_git_highlights()
|
-- return status
|
||||||
vim.api.nvim_create_autocmd("ColorScheme", {
|
-- end
|
||||||
group = vim.api.nvim_create_augroup("romanzy_oil_git_highlights", { clear = true }),
|
--
|
||||||
callback = set_oil_git_highlights,
|
-- local relative_path = entry_path:sub(#git_root + 2)
|
||||||
})
|
-- local node = root
|
||||||
|
-- for segment in relative_path:gmatch("[^/\\]+") do
|
||||||
|
-- node = node.children[segment]
|
||||||
|
-- if not node then
|
||||||
|
-- return nil
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- -- oil-git normally propagates an ignored child's status to every parent.
|
||||||
|
-- -- Only grey a directory when Git reported that directory itself as ignored.
|
||||||
|
-- if not node.is_dir_ignored then
|
||||||
|
-- return nil
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- return status
|
||||||
|
-- end)
|
||||||
|
--
|
||||||
|
-- require("oil-git").setup({
|
||||||
|
-- show_file_highlights = true,
|
||||||
|
-- show_directory_highlights = true,
|
||||||
|
-- show_ignored_files = true,
|
||||||
|
-- show_ignored_directories = true,
|
||||||
|
-- show_file_symbols = true,
|
||||||
|
-- show_directory_symbols = true,
|
||||||
|
-- symbol_position = "none",
|
||||||
|
-- })
|
||||||
|
--
|
||||||
|
-- set_oil_git_highlights()
|
||||||
|
-- vim.api.nvim_create_autocmd("ColorScheme", {
|
||||||
|
-- group = vim.api.nvim_create_augroup("romanzy_oil_git_highlights", { clear = true }),
|
||||||
|
-- callback = set_oil_git_highlights,
|
||||||
|
-- })
|
||||||
|
|||||||
@@ -15,13 +15,10 @@ require("telescope").setup({
|
|||||||
filesize_limit = 0.1, -- in MB
|
filesize_limit = 0.1, -- in MB
|
||||||
},
|
},
|
||||||
initial_mode = "insert",
|
initial_mode = "insert",
|
||||||
winblend = 30,
|
-- winblend = 50,
|
||||||
file_ignore_patterns = {
|
file_ignore_patterns = {
|
||||||
"%.git/.*",
|
"%.git/.*",
|
||||||
"^%./lib/.*",
|
|
||||||
"^%./bin/.*",
|
|
||||||
"%.cache/.*",
|
"%.cache/.*",
|
||||||
".*%.[od]",
|
|
||||||
},
|
},
|
||||||
layout_strategy = "flex",
|
layout_strategy = "flex",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
vim.pack.add({
|
||||||
|
{
|
||||||
|
src = "https://github.com/folke/trouble.nvim",
|
||||||
|
name = "trouble.nvim",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
require("trouble").setup()
|
||||||
@@ -1,11 +1,23 @@
|
|||||||
{
|
{
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"header42.nvim": {
|
"codam-header.nvim": {
|
||||||
"rev": "d41468df1c53081c909fc78248cf233893b59809",
|
"rev": "a8fbd2a7003eecbf6e85693e85d7d4d464625193",
|
||||||
"src": "https://codeberg.org/42nerds/header42.nvim"
|
"src": "https://github.com/BeerB34r/codam-header.nvim"
|
||||||
|
},
|
||||||
|
"conform.nvim": {
|
||||||
|
"rev": "619363c30309d29ffa631e67c8183f2a72caa373",
|
||||||
|
"src": "https://github.com/stevearc/conform.nvim"
|
||||||
|
},
|
||||||
|
"diffview.nvim": {
|
||||||
|
"rev": "4516612fe98ff56ae0415a259ff6361a89419b0a",
|
||||||
|
"src": "https://github.com/sindrets/diffview.nvim"
|
||||||
|
},
|
||||||
|
"lazygit.nvim": {
|
||||||
|
"rev": "a04ad0dbc725134edbee3a5eea29290976695357",
|
||||||
|
"src": "https://github.com/kdheepak/lazygit.nvim"
|
||||||
},
|
},
|
||||||
"mason-lspconfig.nvim": {
|
"mason-lspconfig.nvim": {
|
||||||
"rev": "21c5b3ebeaa0412e28096bb0701434c51c1fbf76",
|
"rev": "47059d71b42d74b0a1e9f61c1d99d301039c3b5b",
|
||||||
"src": "https://github.com/mason-org/mason-lspconfig.nvim"
|
"src": "https://github.com/mason-org/mason-lspconfig.nvim"
|
||||||
},
|
},
|
||||||
"mason.nvim": {
|
"mason.nvim": {
|
||||||
@@ -13,11 +25,11 @@
|
|||||||
"src": "https://github.com/mason-org/mason.nvim"
|
"src": "https://github.com/mason-org/mason.nvim"
|
||||||
},
|
},
|
||||||
"mini.nvim": {
|
"mini.nvim": {
|
||||||
"rev": "1599a473aa6f5290a5d740b1144846e6f0c3963d",
|
"rev": "c5cdbadeb423ff724e27a42ab2d1c504d1d6fc5a",
|
||||||
"src": "https://github.com/echasnovski/mini.nvim"
|
"src": "https://github.com/echasnovski/mini.nvim"
|
||||||
},
|
},
|
||||||
"nvim-lspconfig": {
|
"nvim-lspconfig": {
|
||||||
"rev": "bfcc0171a43f22afa61d927ffe9fcb6cb85dc99e",
|
"rev": "292f44408498103c47996ff5c18fd366293840d8",
|
||||||
"src": "https://github.com/neovim/nvim-lspconfig"
|
"src": "https://github.com/neovim/nvim-lspconfig"
|
||||||
},
|
},
|
||||||
"nvim-treesitter": {
|
"nvim-treesitter": {
|
||||||
@@ -43,6 +55,10 @@
|
|||||||
"telescope.nvim": {
|
"telescope.nvim": {
|
||||||
"rev": "427b576c16792edad01a92b89721d923c19ad60f",
|
"rev": "427b576c16792edad01a92b89721d923c19ad60f",
|
||||||
"src": "https://github.com/nvim-telescope/telescope.nvim"
|
"src": "https://github.com/nvim-telescope/telescope.nvim"
|
||||||
|
},
|
||||||
|
"trouble.nvim": {
|
||||||
|
"rev": "bd67efe408d4816e25e8491cc5ad4088e708a69a",
|
||||||
|
"src": "https://github.com/folke/trouble.nvim"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user