mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-01-27 20:45:31 +00:00
Compare commits
53 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9697c200f9 | ||
| fd11f9966b | |||
| 722b3c0cde | |||
| 4fcb9d9741 | |||
| fc232f26f7 | |||
| 8b078309cf | |||
| 5a8f990e52 | |||
| c76c5d08b0 | |||
| b2857e226c | |||
| dfbac0c736 | |||
| fdd713908c | |||
| 60210c9bec | |||
| eaf8d2bdca | |||
| cc00055626 | |||
|
|
567de68844 | ||
|
|
ed0b229757 | ||
| c8b6243c0b | |||
|
|
21a92eb145 | ||
| 8ec317f582 | |||
|
|
42201d8b68 | ||
|
|
0c003ae5b9 | ||
| d383031ec8 | |||
|
|
fa5e5f16da | ||
| f82396236e | |||
| b127c2514d | |||
|
|
b06ac3bc0f | ||
|
|
7e4ea90a05 | ||
|
|
d264a33d21 | ||
| 224ee56461 | |||
|
|
8147490c65 | ||
|
|
c6d501347a | ||
|
|
d8044f2b6a | ||
|
|
1b3fe6d12e | ||
| 76b66d8c61 | |||
| 9c8644de17 | |||
| 120345b562 | |||
| 8accd4a60b | |||
| 8fb03660ad | |||
| 8b2dc74f2a | |||
| 8fa63e63bb | |||
| 4ca5b63b75 | |||
| 5a59872377 | |||
| 38419eda28 | |||
| fc85dbaa6c | |||
| 250e7f5666 | |||
| 8f96922033 | |||
| 4c4de2dc26 | |||
| b8c163e028 | |||
| 0a974c2a17 | |||
| fd8d72ab38 | |||
| 0908a23231 | |||
| 2e070eed83 | |||
| e22762255d |
23
.github/workflows/pre-commit-autoupdate.yml
vendored
Normal file
23
.github/workflows/pre-commit-autoupdate.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
name: Pre-commit autoupdate
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
auto-update:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5.3.0
|
||||
- run: pip install pre-commit && pre-commit autoupdate
|
||||
- uses: peter-evans/create-pull-request@v7
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: update/pre-commit-hooks
|
||||
title: "chore: update pre-commit hooks"
|
||||
commit-message: "chore: update pre-commit hooks"
|
||||
body: Update versions of pre-commit hooks to latest version.
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -26,4 +26,6 @@ config/iterm2/AppSupport
|
||||
config/gnupg/S.*
|
||||
config/gnupg/s
|
||||
config/gnupg/private-keys-v1.d
|
||||
config/nvim/spell/*
|
||||
!config/nvim/spell/.gitkeep
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.6.0
|
||||
rev: v5.0.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
args: [--markdown-linebreak-ext=md]
|
||||
@@ -19,7 +19,7 @@ repos:
|
||||
args: [--autofix, --no-sort-keys]
|
||||
|
||||
- repo: https://github.com/igorshubovych/markdownlint-cli
|
||||
rev: v0.41.0
|
||||
rev: v0.42.0
|
||||
hooks:
|
||||
- id: markdownlint
|
||||
args: [-c, .markdownlint.yaml, --fix]
|
||||
@@ -40,11 +40,11 @@ repos:
|
||||
- id: shellcheck
|
||||
|
||||
- repo: https://github.com/scop/pre-commit-shfmt
|
||||
rev: v3.9.0-1
|
||||
rev: v3.10.0-1
|
||||
hooks:
|
||||
- id: shfmt
|
||||
|
||||
- repo: https://github.com/rhysd/actionlint
|
||||
rev: v1.7.1
|
||||
rev: v1.7.3
|
||||
hooks:
|
||||
- id: actionlint
|
||||
|
||||
@@ -2,8 +2,8 @@ column_width = 120
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
quote_style = "AutoPreferDouble"
|
||||
call_parentheses = "Always"
|
||||
quote_style = "AutoPreferSingle"
|
||||
call_parentheses = "None"
|
||||
collapse_simple_statement = "Always"
|
||||
|
||||
[sort_requires]
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
python 3.12.6
|
||||
nodejs 22.9.0
|
||||
python 3.13.0
|
||||
nodejs 22.11.0
|
||||
|
||||
@@ -1,30 +1,28 @@
|
||||
asdf-plugin-manager 1.3.1
|
||||
nodejs 22.8.0
|
||||
golang 1.23.1
|
||||
python 3.12.6
|
||||
asdf-plugin-manager 1.4.0
|
||||
nodejs 23.0.0
|
||||
golang 1.23.2
|
||||
python 3.12.7
|
||||
ruby 3.3.4
|
||||
rust 1.81.0
|
||||
direnv 2.34.0
|
||||
eza 0.19.3
|
||||
rust 1.82.0
|
||||
direnv 2.35.0
|
||||
fd 10.2.0
|
||||
1password-cli 2.30.0
|
||||
age 1.2.0
|
||||
bottom 0.10.2
|
||||
dotenv-linter 3.3.0
|
||||
editorconfig-checker 2.8.0
|
||||
github-cli 2.56.0
|
||||
github-cli 2.59.0
|
||||
hadolint 2.12.0
|
||||
kubectl 1.31.1
|
||||
pipx 1.7.1
|
||||
pre-commit 3.8.0
|
||||
pre-commit 4.0.1
|
||||
ripgrep 14.1.1
|
||||
shellcheck 0.10.0
|
||||
shfmt 3.9.0
|
||||
terragrunt 0.67.5
|
||||
tf-summarize 0.3.10
|
||||
terragrunt 0.67.15
|
||||
tf-summarize 0.3.11
|
||||
yamllint 1.35.1
|
||||
yq 4.44.3
|
||||
bats 1.11.0
|
||||
gitleaks 8.18.4
|
||||
delta 0.18.1
|
||||
lazygit 0.44.0
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
export DOTFILES="$HOME/.dotfiles"
|
||||
LOCAL_SHARE="$HOME/.local/share"
|
||||
export PATH="$HOME/.local/bin:$DOTFILES/local/bin:$LOCAL_SHARE/nvim-kickstart/mason/bin:$LOCAL_SHARE/bob/nvim-bin:$LOCAL_SHARE/cargo/bin:/opt/homebrew/bin:/usr/local/bin:$PATH"
|
||||
export PATH="$HOME/.local/bin:$DOTFILES/local/bin:$LOCAL_SHARE/nvim/mason/bin:$LOCAL_SHARE/bob/nvim-bin:$LOCAL_SHARE/cargo/bin:/opt/homebrew/bin:/usr/local/bin:$PATH"
|
||||
export SHARED_SCRIPTS_SOURCED=0
|
||||
|
||||
source "$DOTFILES/config/shared.sh"
|
||||
|
||||
@@ -19,3 +19,7 @@ bob-nvim
|
||||
// bottom, btm - A cross-platform graphical process/system monitor with
|
||||
// a customizable interface and a multitude of features.
|
||||
bottom
|
||||
// A modern alternative to ls
|
||||
eza
|
||||
// Tmux Sessionizer: A tool for opening git repositories as tmux sessions
|
||||
tmux-sessionizer
|
||||
|
||||
@@ -17,3 +17,5 @@ github.com/charmbracelet/glow@v1.5.1
|
||||
github.com/rhysd/actionlint/cmd/actionlint@v1.7.1
|
||||
// Cleans up your $HOME from those pesky dotfiles
|
||||
github.com/doron-cohen/antidot@v0.6.3
|
||||
// FZF is a general-purpose command-line fuzzy finder.
|
||||
github.com/junegunn/fzf@latest
|
||||
|
||||
@@ -1,27 +1,29 @@
|
||||
1password-cli https://github.com/NeoHsu/asdf-1password-cli.git f5d5aab
|
||||
age https://github.com/threkk/asdf-age.git 4df80a0
|
||||
asdf-plugin-manager https://github.com/asdf-community/asdf-plugin-manager.git ecd1642
|
||||
bottom https://github.com/carbonteq/asdf-btm.git fd8a55a
|
||||
direnv https://github.com/asdf-community/asdf-direnv.git a2219c2
|
||||
dotenv-linter https://github.com/wesleimp/asdf-dotenv-linter.git 1369f53
|
||||
editorconfig-checker https://github.com/gabitchov/asdf-editorconfig-checker.git 585c1d5
|
||||
eza https://github.com/lwiechec/asdf-eza.git eee3d59
|
||||
fd https://gitlab.com/wt0f/asdf-fd.git 17d56e0
|
||||
github-cli https://github.com/bartlomiejdanek/asdf-github-cli.git e0605b7
|
||||
golang https://github.com/asdf-community/asdf-golang.git 0e86b1d
|
||||
hadolint https://github.com/devlincashman/asdf-hadolint.git 335e230
|
||||
kubectl https://github.com/asdf-community/asdf-kubectl.git cbe6df4
|
||||
lazygit https://github.com/nklmilojevic/asdf-lazygit.git 78e04f1
|
||||
nodejs https://github.com/asdf-vm/asdf-nodejs.git c5b7c40
|
||||
pipx https://github.com/yozachar/asdf-pipx.git 31db618
|
||||
pre-commit https://github.com/jonathanmorley/asdf-pre-commit.git 26bfc42
|
||||
python https://github.com/asdf-community/asdf-python 7b0af87
|
||||
ripgrep https://gitlab.com/wt0f/asdf-ripgrep.git e836665
|
||||
ruby https://github.com/asdf-vm/asdf-ruby.git 27f78c9
|
||||
rust https://github.com/code-lever/asdf-rust.git 95acf4f
|
||||
shellcheck https://github.com/luizm/asdf-shellcheck.git 780d78d
|
||||
shfmt https://github.com/luizm/asdf-shfmt.git a42c5ff
|
||||
terragrunt https://github.com/ohmer/asdf-terragrunt.git 4a6651a
|
||||
tf-summarize https://github.com/adamcrews/asdf-tf-summarize.git 880ad26
|
||||
yamllint https://github.com/ericcornelissen/asdf-yamllint.git 2f4fd4c
|
||||
yq https://github.com/sudermanjr/asdf-yq.git 772992f
|
||||
1password-cli https://github.com/NeoHsu/asdf-1password-cli.git f5d5aab
|
||||
age https://github.com/threkk/asdf-age.git 396bdf6
|
||||
asdf-plugin-manager https://github.com/asdf-community/asdf-plugin-manager.git c721275
|
||||
bats https://github.com/timgluz/asdf-bats.git 299551f
|
||||
bottom https://github.com/carbonteq/asdf-btm.git fd8a55a
|
||||
delta https://github.com/andweeb/asdf-delta.git 501318b
|
||||
direnv https://github.com/asdf-community/asdf-direnv.git 6ff3dbe
|
||||
dotenv-linter https://github.com/wesleimp/asdf-dotenv-linter.git 1369f53
|
||||
editorconfig-checker https://github.com/gabitchov/asdf-editorconfig-checker.git 585c1d5
|
||||
fd https://gitlab.com/wt0f/asdf-fd.git 17d56e0
|
||||
github-cli https://github.com/bartlomiejdanek/asdf-github-cli.git e0605b7
|
||||
gitleaks https://github.com/jmcvetta/asdf-gitleaks.git 0cc0d7e
|
||||
golang https://github.com/asdf-community/asdf-golang.git e2527a3
|
||||
hadolint https://github.com/devlincashman/asdf-hadolint.git 335e230
|
||||
kubectl https://github.com/asdf-community/asdf-kubectl.git 2fb3b57
|
||||
nodejs https://github.com/asdf-vm/asdf-nodejs.git c36e6f0
|
||||
php https://github.com/asdf-community/asdf-php.git 52c669a
|
||||
pipx https://github.com/yozachar/asdf-pipx.git 31db618
|
||||
pre-commit https://github.com/jonathanmorley/asdf-pre-commit.git 26bfc42
|
||||
python https://github.com/asdf-community/asdf-python a3a0185
|
||||
ripgrep https://gitlab.com/wt0f/asdf-ripgrep.git e836665
|
||||
ruby https://github.com/asdf-vm/asdf-ruby.git e955978
|
||||
rust https://github.com/code-lever/asdf-rust.git 95acf4f
|
||||
shellcheck https://github.com/luizm/asdf-shellcheck.git 66200ff
|
||||
shfmt https://github.com/luizm/asdf-shfmt.git a42c5ff
|
||||
terragrunt https://github.com/ohmer/asdf-terragrunt.git 4a6651a
|
||||
tf-summarize https://github.com/adamcrews/asdf-tf-summarize.git 880ad26
|
||||
yamllint https://github.com/ericcornelissen/asdf-yamllint.git 2f825d9
|
||||
yq https://github.com/sudermanjr/asdf-yq.git 772992f
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
ansible
|
||||
pipenv
|
||||
semgrep
|
||||
neovim
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
[global]
|
||||
disable_stdin = true
|
||||
disable_stdin = false
|
||||
load_dotenv = true
|
||||
hide_env_diff = true
|
||||
hide_env_diff = false
|
||||
|
||||
[whitelist]
|
||||
prefix = [
|
||||
"~/Code/ivuorinen/"
|
||||
"~/Code/"
|
||||
]
|
||||
exact = [
|
||||
"~/.dotfiles/.envrc"
|
||||
|
||||
@@ -25,12 +25,11 @@ fi
|
||||
# Load asdf
|
||||
export ASDF_DIR="$XDG_BIN_HOME/asdf"
|
||||
if [[ -d $ASDF_DIR ]]; then
|
||||
[[ -d $ASDF_DIR/bin ]] && x-path-prepend "$ASDF_DIR/bin"
|
||||
[[ -d $ASDF_DIR/shims ]] && x-path-prepend "$ASDF_DIR/shims"
|
||||
[[ -d $ASDF_DIR/completions ]] && fpath=("$ASDF_DIR/completions" $fpath)
|
||||
[[ -d $ASDF_DIR/plugins ]] && fpath=("$ASDF_DIR/plugins" $fpath)
|
||||
source "$ASDF_DIR/asdf.sh"
|
||||
fi
|
||||
export PATH="$ASDF_DIR/bin:$ASDF_DIR/shims:$PATH"
|
||||
|
||||
if ! command -v msg &> /dev/null; then
|
||||
# Function to print messages if VERBOSE is enabled
|
||||
@@ -400,6 +399,9 @@ x-dc "$DOCKER_CONFIG"
|
||||
# Docker: Disable snyk ad
|
||||
export DOCKER_SCAN_SUGGEST=false
|
||||
|
||||
# fzf
|
||||
export FZF_DEFAULT_OPTS='--height 40% --tmux bottom,40% --layout reverse --border top'
|
||||
|
||||
# GnuPG
|
||||
# https://gnupg.org/documentation/manuals/gnupg/Invoking-GPG.html
|
||||
msg "Setting up GnuPG configuration"
|
||||
|
||||
@@ -204,8 +204,6 @@ cask "font-open-sans"
|
||||
cask "font-roboto"
|
||||
cask "font-source-code-pro"
|
||||
cask "font-source-code-pro-for-powerline"
|
||||
cask "font-source-sans-pro"
|
||||
cask "font-source-serif-pro"
|
||||
# GIT client
|
||||
cask "fork"
|
||||
# HTTP and GraphQL Client
|
||||
|
||||
@@ -9,3 +9,9 @@ insert_final_newline = true
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
max_line_length = 120
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
3
config/nvim/.gitignore
vendored
Normal file
3
config/nvim/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
spell/*
|
||||
!spell/.gitkeep
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"diagnostics.globals": [
|
||||
"vim"
|
||||
]
|
||||
}
|
||||
@@ -1,7 +1,11 @@
|
||||
column_width = 160
|
||||
column_width = 80
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
quote_style = "AutoPreferSingle"
|
||||
call_parentheses = "None"
|
||||
collapse_simple_statement = "Always"
|
||||
|
||||
[sort_requires]
|
||||
enabled = true
|
||||
|
||||
|
||||
@@ -1,67 +1,61 @@
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
-- ╭─────────────────────────────────────────────────────────╮
|
||||
-- │ ivuorinen's Neovim configuration │
|
||||
-- ╰─────────────────────────────────────────────────────────╯
|
||||
|
||||
-- Install lazylazy
|
||||
-- ── Install lazylazy ────────────────────────────────────────────────
|
||||
-- https://github.com/folke/lazy.nvim
|
||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system {
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
||||
local out = vim.fn.system {
|
||||
'git',
|
||||
'clone',
|
||||
'--filter=blob:none',
|
||||
'https://github.com/folke/lazy.nvim.git',
|
||||
'--branch=stable', -- latest stable release
|
||||
'--branch=stable',
|
||||
lazyrepo,
|
||||
lazypath,
|
||||
}
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ 'Failed to clone lazy.nvim:\n', 'ErrorMsg' },
|
||||
{ out, 'WarningMsg' },
|
||||
{ '\nPress any key to exit...' },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- ── Add ~/.local/bin to the PATH ────────────────────────────────────
|
||||
vim.fn.setenv(
|
||||
'PATH',
|
||||
vim.fn.expand '$HOME/.local/bin' .. ':' .. vim.fn.expand '$PATH'
|
||||
)
|
||||
|
||||
require 'options'
|
||||
require 'keymaps'
|
||||
require 'autogroups'
|
||||
|
||||
require('lazy').setup {
|
||||
checker = {
|
||||
-- Automatically check for updates
|
||||
enabled = true,
|
||||
},
|
||||
spec = {
|
||||
-- Useful plugin to show you pending keybinds.
|
||||
-- https://github.com/folke/which-key.nvim
|
||||
{
|
||||
'folke/which-key.nvim',
|
||||
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
|
||||
priority = 1001, -- Make sure to load this as soon as possible
|
||||
config = function() -- This is the function that runs, AFTER loading
|
||||
local wk = require 'which-key'
|
||||
wk.setup()
|
||||
|
||||
wk.add {
|
||||
{ '<leader>b', group = '[b] Buffer' },
|
||||
{ '<leader>c', group = '[c] Code' },
|
||||
{ '<leader>d', group = '[d] Document' },
|
||||
{ '<leader>f', group = '[f] File' },
|
||||
{ '<leader>g', group = '[g] Git' },
|
||||
{ '<leader>l', group = '[l] LSP' },
|
||||
{ '<leader>o', group = '[o] Open' },
|
||||
{ '<leader>p', group = '[p] Project' },
|
||||
{ '<leader>q', group = '[q] Quit' },
|
||||
{ '<leader>s', group = '[s] Search' },
|
||||
{ '<leader>t', group = '[t] Toggle' },
|
||||
{ '<leader>w', group = '[w] Workspace' },
|
||||
{ '<leader>z', group = '[x] FZF' },
|
||||
{ '<leader>?', group = '[?] Help' },
|
||||
{
|
||||
'<leader>?w',
|
||||
function()
|
||||
wk.show { global = false }
|
||||
end,
|
||||
desc = 'Buffer Local Keymaps (which-key)',
|
||||
},
|
||||
}
|
||||
end,
|
||||
-- ── Load plugins ────────────────────────────────────────────────────
|
||||
require('lazy').setup(
|
||||
-- Automatically load plugins from lua/plugins
|
||||
'plugins',
|
||||
-- Lazy Configuration
|
||||
{
|
||||
checker = {
|
||||
-- Automatically check for updates
|
||||
enabled = true,
|
||||
-- We don't want to be notified about updates
|
||||
notify = false,
|
||||
},
|
||||
-- Import plugins from `lua/plugins` directory
|
||||
{ import = 'plugins' },
|
||||
},
|
||||
}
|
||||
change_detection = {
|
||||
-- No need to notify about changes
|
||||
notify = false,
|
||||
},
|
||||
install = {
|
||||
colorscheme = { vim.g.colors_theme },
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
require 'config.misc'
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
|
||||
54
config/nvim/lua/autogroups.lua
Normal file
54
config/nvim/lua/autogroups.lua
Normal file
@@ -0,0 +1,54 @@
|
||||
-- ╭─────────────────────────────────────────────────────────╮
|
||||
-- │ Autogroups │
|
||||
-- ╰─────────────────────────────────────────────────────────╯
|
||||
|
||||
local augroup = vim.api.nvim_create_augroup -- Create/get autocommand group
|
||||
local autocmd = vim.api.nvim_create_autocmd -- Create autocommand
|
||||
|
||||
-- ── Highlight on yank ───────────────────────────────────────────────
|
||||
-- See `:help vim.highlight.on_yank()`
|
||||
autocmd('TextYankPost', {
|
||||
callback = function() vim.highlight.on_yank() end,
|
||||
group = augroup('YankHighlight', { clear = true }),
|
||||
pattern = '*',
|
||||
})
|
||||
|
||||
-- ── Windows to close with "q" ───────────────────────────────────────
|
||||
autocmd('FileType', {
|
||||
group = augroup('close_with_q', { clear = true }),
|
||||
pattern = {
|
||||
'PlenaryTestPopup',
|
||||
'checkhealth',
|
||||
'dbout',
|
||||
'gitsigns.blame',
|
||||
'grug-far',
|
||||
'help',
|
||||
'lspinfo',
|
||||
'man',
|
||||
'neotest-output',
|
||||
'neotest-output-panel',
|
||||
'neotest-summary',
|
||||
'notify',
|
||||
'qf',
|
||||
'spectre_panel',
|
||||
'startuptime',
|
||||
'tsplayground',
|
||||
},
|
||||
callback = function(event)
|
||||
vim.bo[event.buf].buflisted = false
|
||||
vim.keymap.set('n', 'q', '<cmd>close<cr>', {
|
||||
buffer = event.buf,
|
||||
silent = true,
|
||||
desc = 'Quit buffer',
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- ── make it easier to close man-files when opened inline ────────────
|
||||
autocmd('FileType', {
|
||||
group = augroup('man_unlisted', { clear = true }),
|
||||
pattern = { 'man' },
|
||||
callback = function(event) vim.bo[event.buf].buflisted = false end,
|
||||
})
|
||||
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
@@ -1,10 +0,0 @@
|
||||
-- Go
|
||||
local format_sync_grp = vim.api.nvim_create_augroup('GoFormat', {})
|
||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||
pattern = '*.go',
|
||||
callback = function()
|
||||
require('go.format').goimport()
|
||||
end,
|
||||
group = format_sync_grp,
|
||||
})
|
||||
require('go').setup()
|
||||
@@ -1,78 +0,0 @@
|
||||
vim.api.nvim_set_keymap('i', 'jj', '<Esc>', { noremap = false })
|
||||
|
||||
-- twilight
|
||||
vim.api.nvim_set_keymap('n', 'tw', ':Twilight<enter>', { noremap = false })
|
||||
|
||||
-- buffers
|
||||
vim.api.nvim_set_keymap('n', '<leader>bk', ':blast<enter>', { desc = 'Last', noremap = false })
|
||||
vim.api.nvim_set_keymap('n', '<leader>bj', ':bfirst<enter>', { desc = 'First', noremap = false })
|
||||
vim.api.nvim_set_keymap('n', '<leader>bh', ':bprev<enter>', { desc = 'Prev', noremap = false })
|
||||
vim.api.nvim_set_keymap('n', '<leader>bl', ':bnext<enter>', { desc = 'Next', noremap = false })
|
||||
vim.api.nvim_set_keymap('n', '<leader>bd', ':bdelete<enter>', { desc = 'Delete', noremap = false })
|
||||
vim.api.nvim_set_keymap('n', '<C-w>', ':bdelete<enter>', { desc = 'Delete buffer', noremap = false })
|
||||
|
||||
-- files
|
||||
vim.api.nvim_set_keymap('n', 'QQ', ':q!<enter>', { desc = 'Quickly Quit', noremap = false })
|
||||
vim.api.nvim_set_keymap('n', 'WW', ':w!<enter>', { desc = 'Force write', noremap = false })
|
||||
vim.api.nvim_set_keymap('n', 'E', '$', { noremap = false })
|
||||
vim.api.nvim_set_keymap('n', 'B', '^', { noremap = false })
|
||||
vim.api.nvim_set_keymap('n', 'tT', ':TransparentToggle<CR>', { desc = 'Toggle Transparency', noremap = true })
|
||||
vim.api.nvim_set_keymap('n', 'ss', ':noh<CR>', { noremap = true })
|
||||
|
||||
-- splits
|
||||
vim.api.nvim_set_keymap('n', '<C-W>,', ':vertical resize -10<CR>', { desc = 'V Resize -', noremap = true })
|
||||
vim.api.nvim_set_keymap('n', '<C-W>.', ':vertical resize +10<CR>', { desc = 'V Resize +', noremap = true })
|
||||
|
||||
-- Quicker close split
|
||||
vim.keymap.set('n', '<leader>qf', ':q<CR>', { desc = 'Quicker close split', silent = true, noremap = true })
|
||||
|
||||
-- Keymaps for better default experience
|
||||
-- See `:help vim.keymap.set()`
|
||||
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
||||
|
||||
-- Remap for dealing with word wrap
|
||||
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||
|
||||
-- Noice
|
||||
vim.api.nvim_set_keymap('n', '<leader>nn', ':Noice dismiss<CR>', { desc = 'Noice dismiss', noremap = true })
|
||||
|
||||
vim.keymap.set('n', '<leader>xe', '<cmd>GoIfErr<cr>', { desc = 'Go If Error', silent = true, noremap = true })
|
||||
|
||||
-- TIP: Disable arrow keys in normal mode
|
||||
vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
||||
vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
||||
vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
||||
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
||||
|
||||
-- Keybinds to make split navigation easier.
|
||||
-- Use CTRL+<hjkl> to switch between windows
|
||||
--
|
||||
-- See `:help wincmd` for a list of all window commands
|
||||
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
|
||||
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
|
||||
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
||||
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||
|
||||
-- Old habits
|
||||
vim.keymap.set('n', '<C-s>', '<cmd>w<CR>', { desc = 'Save file' })
|
||||
vim.keymap.set('n', '<leader>qq', '<cmd>wq!<CR>', { desc = '[qq] Quickly Quit' })
|
||||
|
||||
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
||||
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
|
||||
-- is not what someone will guess without a bit more experience.
|
||||
--
|
||||
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
|
||||
-- or just use <C-\><C-n> to exit terminal mode
|
||||
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
|
||||
|
||||
-- [[ Highlight on yank ]]
|
||||
-- See `:help vim.highlight.on_yank()`
|
||||
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
group = highlight_group,
|
||||
pattern = '*',
|
||||
})
|
||||
@@ -1,16 +1,25 @@
|
||||
-- ╭─────────────────────────────────────────────────────────╮
|
||||
-- │ neovim configuration options │
|
||||
-- ╰─────────────────────────────────────────────────────────╯
|
||||
-- See `:help vim.opt`
|
||||
-- For more options, you can see `:help option-list`
|
||||
|
||||
-- Enables the experimental nvim 0.5 features
|
||||
vim.loader.enable()
|
||||
|
||||
-- Map leader and local leader
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = ' '
|
||||
|
||||
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
||||
vim.g.have_nerd_font = true
|
||||
-- Set the colorscheme and variants
|
||||
vim.g.colors_theme = 'tokyonight'
|
||||
vim.g.colors_variant_light = 'tokyonight-day'
|
||||
vim.g.colors_variant_dark = 'tokyonight-storm'
|
||||
|
||||
-- Make sure editorconfig support is enabled
|
||||
vim.g.editorconfig = true
|
||||
|
||||
-- [[ Setting options ]]
|
||||
-- See `:help vim.opt`
|
||||
-- For more options, you can see `:help option-list`
|
||||
|
||||
-- Enable line numbers and relative line numbers
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
@@ -22,10 +31,10 @@ vim.opt.showmode = false
|
||||
|
||||
-- Sync clipboard between OS and Neovim.
|
||||
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
||||
-- Remove this option if you want your OS clipboard to remain independent.
|
||||
-- See `:help 'clipboard'`
|
||||
vim.schedule(function()
|
||||
vim.opt.clipboard = 'unnamedplus'
|
||||
local c = vim.env.SSH_TTY and '' or 'unnamedplus'
|
||||
vim.opt.clipboard = c
|
||||
end)
|
||||
|
||||
vim.opt.breakindent = true -- Enable break indent
|
||||
@@ -34,7 +43,8 @@ vim.opt.smartindent = true -- Insert indents automatically
|
||||
-- Save undo history
|
||||
vim.opt.undofile = true
|
||||
|
||||
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
||||
-- Case-insensitive searching UNLESS \C or one or
|
||||
-- more capital letters in the search term
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
|
||||
@@ -47,7 +57,7 @@ vim.wo.signcolumn = 'yes'
|
||||
|
||||
-- Decrease mapped sequence wait time
|
||||
-- Displays which-key popup sooner
|
||||
vim.opt.timeoutlen = 300
|
||||
vim.opt.timeoutlen = 250
|
||||
|
||||
-- Configure how new splits should be opened
|
||||
vim.opt.splitright = true
|
||||
@@ -66,15 +76,56 @@ vim.opt.inccommand = 'split'
|
||||
vim.opt.cursorline = true
|
||||
|
||||
-- Minimal number of screen lines to keep above and below the cursor.
|
||||
vim.opt.scrolloff = 10
|
||||
|
||||
-- Enable break indent
|
||||
vim.o.breakindent = true
|
||||
|
||||
-- Save undo history
|
||||
vim.o.undofile = true
|
||||
vim.opt.scrolloff = 15
|
||||
|
||||
-- Set completeopt to have a better completion experience
|
||||
vim.o.completeopt = 'menuone,noselect'
|
||||
|
||||
-- Fixes Notify opacity issues
|
||||
vim.o.termguicolors = true
|
||||
|
||||
-- Set spell checking
|
||||
vim.o.spell = true
|
||||
vim.o.spelllang = 'en_us'
|
||||
|
||||
-- Tree-sitter settings
|
||||
vim.g.loaded_perl_provider = 0
|
||||
vim.g.loaded_ruby_provider = 0
|
||||
|
||||
-- kevinhwang91/nvim-ufo settings
|
||||
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
|
||||
vim.o.foldcolumn = '1' -- '0' is not bad
|
||||
-- Using ufo provider need a large value, feel free to decrease the value
|
||||
vim.o.foldlevel = 99
|
||||
vim.o.foldlevelstart = 99
|
||||
vim.o.foldenable = true
|
||||
|
||||
-- anuvyklack/windows.nvim settings
|
||||
vim.o.winwidth = 15
|
||||
vim.o.winminwidth = 10
|
||||
vim.o.equalalways = false
|
||||
|
||||
-- folke/noice.nvim settings
|
||||
vim.g.noice_ignored_filetypes = {
|
||||
'fugitiveblame',
|
||||
'fugitive',
|
||||
'gitcommit',
|
||||
'noice',
|
||||
}
|
||||
|
||||
-- ── Deal with word wrap ───────────────────────────────────────────────────────
|
||||
local m = vim.api.nvim_set_keymap
|
||||
m(
|
||||
'n',
|
||||
'k',
|
||||
"v:count == 0 ? 'gk' : 'k'",
|
||||
{ desc = 'Move up', noremap = true, expr = true }
|
||||
)
|
||||
m(
|
||||
'n',
|
||||
'j',
|
||||
"v:count == 0 ? 'gj' : 'j'",
|
||||
{ desc = 'Move down', noremap = true, expr = true }
|
||||
)
|
||||
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
-- Autoformat
|
||||
-- https://github.com/stevearc/conform.nvim
|
||||
return {
|
||||
'stevearc/conform.nvim',
|
||||
event = { 'BufWritePre' },
|
||||
cmd = { 'ConformInfo' },
|
||||
keys = {
|
||||
{
|
||||
'<leader>f',
|
||||
function()
|
||||
require('conform').format { async = true, lsp_fallback = true }
|
||||
end,
|
||||
mode = '',
|
||||
desc = '[f] Format buffer',
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
notify_on_error = false,
|
||||
format_on_save = function(bufnr)
|
||||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
||||
-- have a well standardized coding style. You can add additional
|
||||
-- languages here or re-enable it for the disabled ones.
|
||||
local disable_filetypes = { c = true, cpp = true }
|
||||
return {
|
||||
timeout_ms = 500,
|
||||
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
|
||||
}
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
-- Conform can also run multiple formatters sequentially
|
||||
-- python = { "isort", "black" },
|
||||
--
|
||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
||||
javascript = { 'prettierd', 'prettier', stop_after_first = true },
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1,51 +1,141 @@
|
||||
-- Auto completion
|
||||
-- https://github.com/hrsh7th/nvim-cmp
|
||||
return {
|
||||
-- Autocompletion
|
||||
-- https://github.com/hrsh7th/nvim-cmp
|
||||
{
|
||||
'hrsh7th/nvim-cmp',
|
||||
lazy = false,
|
||||
version = false, -- Use the latest version of the plugin
|
||||
event = 'InsertEnter',
|
||||
dependencies = {
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'L3MON4D3/LuaSnip',
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
-- Adds other completion capabilities.
|
||||
-- nvim-cmp does not ship with all sources by default. They are split
|
||||
-- into multiple repos for maintenance purposes.
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-path',
|
||||
'onsails/lspkind.nvim',
|
||||
|
||||
-- ── LuaSnip Dependencies ────────────────────────────────────────────
|
||||
-- Snippet Engine for Neovim written in Lua.
|
||||
-- https://github.com/L3MON4D3/LuaSnip
|
||||
{
|
||||
'L3MON4D3/LuaSnip',
|
||||
version = '*',
|
||||
event = 'BufReadPre',
|
||||
build = 'make install_jsregexp',
|
||||
dependencies = {
|
||||
-- luasnip completion source for nvim-cmp
|
||||
-- https://github.com/saadparwaiz1/cmp_luasnip
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
'rafamadriz/friendly-snippets',
|
||||
'molleweide/LuaSnip-snippets.nvim',
|
||||
},
|
||||
},
|
||||
|
||||
-- ── Adds other completion capabilities. ─────────────────────────────
|
||||
-- ── nvim-cmp does not ship with all sources by default.
|
||||
-- ── They are split into multiple repos for maintenance purposes.
|
||||
{ 'hrsh7th/cmp-nvim-lsp' },
|
||||
{ 'hrsh7th/cmp-buffer' },
|
||||
{ 'hrsh7th/cmp-path' },
|
||||
{ 'hrsh7th/cmp-nvim-lsp-signature-help' },
|
||||
{ 'hrsh7th/cmp-emoji' },
|
||||
{ 'hrsh7th/cmp-cmdline' },
|
||||
-- cmp import and use all environment variables from .env.* and system
|
||||
-- https://github.com/SergioRibera/cmp-dotenv
|
||||
{ 'SergioRibera/cmp-dotenv' },
|
||||
-- A dictionary completion source for nvim-cmp
|
||||
-- https://github.com/uga-rosa/cmp-dictionary
|
||||
{ 'uga-rosa/cmp-dictionary' },
|
||||
-- An additional source for nvim-cmp to autocomplete packages and its versions
|
||||
-- https://github.com/David-Kunz/cmp-npm
|
||||
{
|
||||
'David-Kunz/cmp-npm',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
ft = 'json',
|
||||
opts = {},
|
||||
},
|
||||
-- https://github.com/chrisgrieser/cmp-nerdfont
|
||||
{ 'chrisgrieser/cmp-nerdfont' },
|
||||
|
||||
-- ── Other deps ──────────────────────────────────────────────────────
|
||||
-- vscode-like pictograms for neovim lsp completion items
|
||||
-- https://github.com/onsails/lspkind.nvim
|
||||
{ 'onsails/lspkind.nvim' },
|
||||
-- Lua plugin to turn github copilot into a cmp source
|
||||
-- https://github.com/zbirenbaum/copilot-cmp
|
||||
{
|
||||
'zbirenbaum/copilot-cmp',
|
||||
dependencies = {
|
||||
'zbirenbaum/copilot.lua',
|
||||
-- Fully featured & enhanced replacement for copilot.vim complete
|
||||
-- with API for interacting with Github Copilot
|
||||
-- https://github.com/zbirenbaum/copilot.lua
|
||||
{
|
||||
'zbirenbaum/copilot.lua',
|
||||
cmd = 'Copilot',
|
||||
build = ':Copilot setup',
|
||||
event = { 'InsertEnter', 'LspAttach' },
|
||||
opts = {
|
||||
fix_pairs = true,
|
||||
suggestion = { enabled = false },
|
||||
panel = { enabled = false },
|
||||
filetypes = {
|
||||
markdown = true,
|
||||
help = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require('copilot_cmp').setup()
|
||||
end,
|
||||
config = function() require('copilot_cmp').setup() end,
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
-- nvim-cmp setup
|
||||
local cmp = require 'cmp'
|
||||
local luasnip = require 'luasnip'
|
||||
local lspkind = require 'lspkind'
|
||||
luasnip.config.setup {}
|
||||
luasnip.snippets = require('luasnip_snippets').load_snippets()
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
|
||||
require('copilot_cmp').setup()
|
||||
|
||||
require('cmp_dictionary').setup {
|
||||
paths = { '/usr/share/dict/words' },
|
||||
exact_length = 2,
|
||||
}
|
||||
|
||||
local has_words_before = function()
|
||||
if vim.api.nvim_get_option_value('buftype', {}) == 'prompt' then
|
||||
return false
|
||||
end
|
||||
local line, col = table.unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0
|
||||
and vim.api
|
||||
.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]
|
||||
:match '^%s*$'
|
||||
== nil
|
||||
end
|
||||
|
||||
cmp.setup {
|
||||
formatting = {
|
||||
format = lspkind.cmp_format {
|
||||
mode = 'symbol',
|
||||
max_width = 50,
|
||||
symbol_map = { Copilot = '' },
|
||||
max_width = function() return math.floor(0.45 * vim.o.columns) end,
|
||||
show_labelDetails = true,
|
||||
symbol_map = {
|
||||
Copilot = '',
|
||||
Text = '',
|
||||
Constructor = '',
|
||||
},
|
||||
},
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
view = {
|
||||
entries = 'native',
|
||||
width = function(_, _) return math.min(80, vim.o.columns) end,
|
||||
-- entries = {
|
||||
-- name = 'custom',
|
||||
-- selection_order = 'near_cursor',
|
||||
-- },
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
expand = function(args) luasnip.lsp_expand(args.body) end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
@@ -53,14 +143,14 @@ return {
|
||||
-- Manually trigger a completion from nvim-cmp.
|
||||
-- Generally you don't need this, because nvim-cmp will display
|
||||
-- completions whenever it has completion options available.
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-c>'] = cmp.mapping.complete(),
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
if cmp.visible() and has_words_before() then
|
||||
cmp.select_next_item { behavior = cmp.SelectBehavior.Select }
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
@@ -78,13 +168,67 @@ return {
|
||||
end, { 'i', 's' }),
|
||||
},
|
||||
sources = {
|
||||
-- function arg popups while typing
|
||||
{ name = 'nvim_lsp_signature_help', group_index = 2 },
|
||||
|
||||
-- Copilot Source
|
||||
{ name = 'copilot', group_index = 2 },
|
||||
-- Other Sources
|
||||
{ name = 'dictionary', keyword_length = 2, group_index = 2 },
|
||||
{ name = 'npm', keyword_length = 4, group_index = 2 },
|
||||
{ name = 'nvim_lsp', group_index = 2 },
|
||||
{ name = 'path', group_index = 2 },
|
||||
{ name = 'luasnip', group_index = 2 },
|
||||
{ name = 'dotenv', group_index = 2 },
|
||||
{ name = 'path', group_index = 2 },
|
||||
{ name = 'emoji', group_index = 2 },
|
||||
{ name = 'nerdfont', group_index = 2 },
|
||||
},
|
||||
sorting = {
|
||||
priority_weight = 2,
|
||||
comparators = {
|
||||
require('copilot_cmp.comparators').prioritize,
|
||||
|
||||
-- Below is the default comparator list and order for nvim-cmp
|
||||
cmp.config.compare.offset,
|
||||
cmp.config.compare.scopes, --this is commented in nvim-cmp too
|
||||
cmp.config.compare.exact,
|
||||
cmp.config.compare.score,
|
||||
cmp.config.compare.recently_used,
|
||||
cmp.config.compare.locality,
|
||||
cmp.config.compare.kind,
|
||||
cmp.config.compare.sort_text,
|
||||
cmp.config.compare.length,
|
||||
cmp.config.compare.order,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
cmp.setup.cmdline({ '/', '?' }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' },
|
||||
},
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' },
|
||||
}, {
|
||||
{ name = 'cmdline' },
|
||||
}),
|
||||
matching = { disallow_symbol_nonprefix_matching = false },
|
||||
})
|
||||
end,
|
||||
},
|
||||
-- Luasnip choice node completion source for nvim-cmp
|
||||
-- https://github.com/doxnit/cmp-luasnip-choice
|
||||
{
|
||||
'doxnit/cmp-luasnip-choice',
|
||||
config = function()
|
||||
require('cmp_luasnip_choice').setup {
|
||||
auto_open = true, -- Automatically open nvim-cmp on choice node (default: true)
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
9
config/nvim/lua/plugins/comment.lua
Normal file
9
config/nvim/lua/plugins/comment.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
-- Commenting
|
||||
-- "gc" to comment visual regions/lines
|
||||
-- https://github.com/numToStr/Comment.nvim
|
||||
return {
|
||||
'numToStr/Comment.nvim',
|
||||
version = '*',
|
||||
event = { 'BufRead', 'BufNewFile' },
|
||||
opts = {},
|
||||
}
|
||||
84
config/nvim/lua/plugins/conform.lua
Normal file
84
config/nvim/lua/plugins/conform.lua
Normal file
@@ -0,0 +1,84 @@
|
||||
-- ── Formatting ──────────────────────────────────────────────────────
|
||||
-- Lightweight yet powerful formatter plugin for Neovim
|
||||
-- https://github.com/stevearc/conform.nvim
|
||||
return {
|
||||
'stevearc/conform.nvim',
|
||||
event = { 'BufWritePre' },
|
||||
cmd = { 'ConformInfo' },
|
||||
config = function()
|
||||
-- Select first conform formatter that is available
|
||||
---@param bufnr integer
|
||||
---@param ... string
|
||||
---@return string
|
||||
local function first(bufnr, ...)
|
||||
local conform = require 'conform'
|
||||
for i = 1, select('#', ...) do
|
||||
local formatter = select(i, ...)
|
||||
if conform.get_formatter_info(formatter, bufnr).available then
|
||||
return formatter
|
||||
end
|
||||
end
|
||||
return select(1, ...)
|
||||
end
|
||||
|
||||
require('conform').setup {
|
||||
-- Enable or disable logging
|
||||
notify_on_error = true,
|
||||
-- Set the default formatter for all filetypes
|
||||
default_formatter = 'injected',
|
||||
-- Set the default formatter for all filetypes
|
||||
default_formatter_opts = {
|
||||
lsp_format = 'fallback',
|
||||
-- Set the default formatter for all filetypes
|
||||
-- formatter = 'injected',
|
||||
-- Set the default formatter for all filetypes
|
||||
-- formatter_opts = {},
|
||||
},
|
||||
formatters_by_ft = {
|
||||
markdown = function(bufnr)
|
||||
return { first(bufnr, 'prettierd', 'prettier'), 'injected' }
|
||||
end,
|
||||
javascript = function(bufnr)
|
||||
return { first(bufnr, 'prettier', 'eslint'), 'injected' }
|
||||
end,
|
||||
lua = { 'stylua' },
|
||||
-- Conform will run multiple formatters sequentially
|
||||
-- python = { 'isort', 'black', lsp_format = 'fallback' },
|
||||
-- You can customize some of the format options for the filetype (:help conform.format)
|
||||
-- rust = { 'rustfmt', lsp_format = 'fallback' },
|
||||
},
|
||||
format_on_save = function(bufnr)
|
||||
-- Disable autoformat on certain filetypes
|
||||
local ignore_filetypes = {
|
||||
'c',
|
||||
'cpp',
|
||||
'sql',
|
||||
'java',
|
||||
}
|
||||
if vim.tbl_contains(ignore_filetypes, vim.bo[bufnr].filetype) then
|
||||
return
|
||||
end
|
||||
-- Disable with a global or buffer-local variable
|
||||
if
|
||||
vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat
|
||||
then
|
||||
return
|
||||
end
|
||||
-- Disable autoformat for files in a certain path
|
||||
local bufname = vim.api.nvim_buf_get_name(bufnr)
|
||||
if bufname:match '/node_modules/' then return end
|
||||
if bufname:match '/vendor/' then return end
|
||||
if bufname:match '/dist/' then return end
|
||||
if bufname:match '/build/' then return end
|
||||
|
||||
return { timeout_ms = 500, lsp_format = 'fallback' }
|
||||
end,
|
||||
}
|
||||
end,
|
||||
init = function()
|
||||
-- If you want the formatexpr, here is the place to set it
|
||||
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
|
||||
end,
|
||||
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
-- CoPilot
|
||||
-- https://github.com/zbirenbaum/copilot.lua
|
||||
return {
|
||||
'zbirenbaum/copilot.lua',
|
||||
cmd = 'Copilot',
|
||||
build = ':Copilot setup',
|
||||
event = { 'InsertEnter', 'LspAttach' },
|
||||
fix_pairs = true,
|
||||
opts = {
|
||||
suggestion = { enabled = false },
|
||||
panel = { enabled = false },
|
||||
filetypes = {
|
||||
markdown = true,
|
||||
help = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1,29 +1,25 @@
|
||||
return {
|
||||
|
||||
'ray-x/go.nvim',
|
||||
'ray-x/guihua.lua',
|
||||
|
||||
{
|
||||
'rcarriga/nvim-dap-ui',
|
||||
dependencies = {
|
||||
'mfussenegger/nvim-dap',
|
||||
'nvim-neotest/nvim-nio',
|
||||
'theHamsta/nvim-dap-virtual-text',
|
||||
'ray-x/go.nvim',
|
||||
'ray-x/guihua.lua',
|
||||
'leoluz/nvim-dap-go',
|
||||
},
|
||||
setup = function()
|
||||
require('dapui').setup()
|
||||
require('dap-go').setup()
|
||||
require('nvim-dap-virtual-text').setup()
|
||||
require('nvim-dap-virtual-text').setup {}
|
||||
|
||||
vim.fn.sign_define('DapBreakpoint', { text = '🔴', texthl = 'DapBreakpoint', linehl = 'DapBreakpoint', numhl = 'DapBreakpoint' })
|
||||
|
||||
-- Debugger
|
||||
vim.api.nvim_set_keymap('n', '<leader>dt', ':DapUiToggle<CR>', { noremap = true })
|
||||
vim.api.nvim_set_keymap('n', '<leader>db', ':DapToggleBreakpoint<CR>', { noremap = true })
|
||||
vim.api.nvim_set_keymap('n', '<leader>dc', ':DapContinue<CR>', { noremap = true })
|
||||
vim.api.nvim_set_keymap('n', '<leader>dr', ":lua require('dapui').open({reset = true})<CR>", { noremap = true })
|
||||
vim.api.nvim_set_keymap('n', '<leader>ht', ":lua require('harpoon.ui').toggle_quick_menu()<CR>", { noremap = true })
|
||||
vim.fn.sign_define('DapBreakpoint', {
|
||||
text = '🔴',
|
||||
texthl = 'DapBreakpoint',
|
||||
linehl = 'DapBreakpoint',
|
||||
numhl = 'DapBreakpoint',
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
39
config/nvim/lua/plugins/flash.lua
Normal file
39
config/nvim/lua/plugins/flash.lua
Normal file
@@ -0,0 +1,39 @@
|
||||
return {
|
||||
'folke/flash.nvim',
|
||||
event = 'VeryLazy',
|
||||
opts = {},
|
||||
keys = {
|
||||
{
|
||||
'zk',
|
||||
mode = { 'n', 'x', 'o' },
|
||||
function() require('flash').jump() end,
|
||||
desc = 'Flash',
|
||||
},
|
||||
{
|
||||
'Zk',
|
||||
mode = { 'n', 'x', 'o' },
|
||||
function() require('flash').treesitter() end,
|
||||
desc = 'Flash Treesitter',
|
||||
},
|
||||
{
|
||||
'r',
|
||||
mode = 'o',
|
||||
function() require('flash').remote() end,
|
||||
desc = 'Remote Flash',
|
||||
},
|
||||
{
|
||||
'R',
|
||||
mode = { 'o', 'x' },
|
||||
function() require('flash').treesitter_search() end,
|
||||
desc = 'Treesitter Search',
|
||||
},
|
||||
{
|
||||
'<m-s>',
|
||||
mode = { 'c' },
|
||||
function() require('flash').toggle() end,
|
||||
desc = 'Toggle Flash Search',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
@@ -1,32 +0,0 @@
|
||||
return {
|
||||
-- fzf <3 vim
|
||||
-- https://github.com/junegunn/fzf.vim
|
||||
'junegunn/fzf.vim',
|
||||
dependencies = {
|
||||
{ 'junegunn/fzf', run = ':call fzf#install()' },
|
||||
},
|
||||
config = function()
|
||||
-- Stolen from https://github.com/erikw/dotfiles/blob/d68d6274d67ac47afa20b9a0b9f3b0fa54bcdaf3/.config/nvim/lua/plugins.lua
|
||||
-- Comment must be on line of its own...
|
||||
-- Search for files in given path.
|
||||
vim.keymap.set('n', '<Leader>zf', ':FZF<space>', { silent = true, desc = 'FZF: search for files in given path.' })
|
||||
-- Sublime-like shortcut 'go to file' ctrl+p.
|
||||
vim.keymap.set('n', '<C-p>', ':Files<CR>', { silent = true, desc = 'FZF: search for files starting at current directory.' })
|
||||
vim.keymap.set('n', '<Leader>zc', ':Commands<CR>', { silent = true, desc = 'FZF: search commands.' })
|
||||
vim.keymap.set('n', '<Leader>zt', ':Tags<CR>', { silent = true, desc = 'FZF: search in tags file' })
|
||||
vim.keymap.set('n', '<Leader>zb', ':Buffers<CR>', { silent = true, desc = 'FZF: search open buffers.' })
|
||||
-- Ref: https://medium.com/@paulodiovani/vim-buffers-windows-and-tabs-an-overview-8e2a57c57afa).
|
||||
vim.keymap.set('n', '<Leader>zt', ':Windows<CR>', { silent = true, desc = 'FZF: search open tabs.' })
|
||||
vim.keymap.set('n', '<Leader>zh', ':History<CR>', { silent = true, desc = 'FZF: search history of opened files' })
|
||||
vim.keymap.set('n', '<Leader>zm', ':Maps<CR>', { silent = true, desc = 'FZF: search mappings.' })
|
||||
vim.keymap.set('n', '<Leader>zg', ':Rg<CR>', { silent = true, desc = 'FZF: search with rg (aka live grep).' })
|
||||
|
||||
-- To ignore a certain path in a git project from both RG and FD used by FZF,
|
||||
-- the eaiest way is to create ignore files and exclude the in local git clone.
|
||||
-- Ref: https://stackoverflow.com/a/1753078/265508
|
||||
-- $ cd git_proj/
|
||||
-- $ echo "path/to/exclude" > .rgignore
|
||||
-- $ echo "path/to/exclude" > .fdignore
|
||||
-- $ printf ".rgignore\n.fdignore" >> .git/info/exclude
|
||||
end,
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
return {
|
||||
|
||||
-- fugitive.vim: A Git wrapper so awesome, it should be illegal
|
||||
-- https://github.com/tpope/vim-fugitive
|
||||
{ 'tpope/vim-fugitive' },
|
||||
|
||||
-- Git integration for buffers
|
||||
-- https://github.com/lewis6991/gitsigns.nvim
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
config = function()
|
||||
require('gitsigns').setup {
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
current_line_blame = false,
|
||||
on_attach = function(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', ']c', function()
|
||||
if vim.wo.diff then
|
||||
return ']c'
|
||||
end
|
||||
vim.schedule(function()
|
||||
gs.next_hunk()
|
||||
end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true })
|
||||
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then
|
||||
return '[c'
|
||||
end
|
||||
vim.schedule(function()
|
||||
gs.prev_hunk()
|
||||
end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true })
|
||||
|
||||
-- Actions
|
||||
map({ 'n', 'v' }, '<leader>hs', ':Gitsigns stage_hunk<CR>')
|
||||
map({ 'n', 'v' }, '<leader>hr', ':Gitsigns reset_hunk<CR>')
|
||||
map('n', '<leader>hS', gs.stage_buffer)
|
||||
map('n', '<leader>ha', gs.stage_hunk)
|
||||
map('n', '<leader>hu', gs.undo_stage_hunk)
|
||||
map('n', '<leader>hR', gs.reset_buffer)
|
||||
map('n', '<leader>hp', gs.preview_hunk)
|
||||
map('n', '<leader>hb', function()
|
||||
gs.blame_line { full = true }
|
||||
end)
|
||||
map('n', '<leader>tB', gs.toggle_current_line_blame)
|
||||
map('n', '<leader>hd', gs.diffthis)
|
||||
map('n', '<leader>hD', function()
|
||||
gs.diffthis '~'
|
||||
end)
|
||||
|
||||
-- Text object
|
||||
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||
end,
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- git-worktree.nvim: Manage git worktrees
|
||||
-- https://github.com/ThePrimeagen/git-worktree.nvim
|
||||
{
|
||||
'ThePrimeagen/git-worktree.nvim',
|
||||
config = function()
|
||||
require('git-worktree').setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- An interactive and powerful Git interface for Neovim, inspired by Magit
|
||||
-- https://github.com/NeogitOrg/neogit
|
||||
{
|
||||
'NeogitOrg/neogit',
|
||||
config = function()
|
||||
-- This contains mainly Neogit but also a bunch of Git settings
|
||||
-- like fetching branches with telescope or blaming with fugitive
|
||||
local neogit = require 'neogit'
|
||||
|
||||
vim.keymap.set('n', '<leader>gs', neogit.open, { silent = true, noremap = true })
|
||||
vim.keymap.set('n', '<leader>gc', ':Neogit commit<CR>', { silent = true, noremap = true })
|
||||
vim.keymap.set('n', '<leader>gp', ':Neogit pull<CR>', { silent = true, noremap = true })
|
||||
vim.keymap.set('n', '<leader>gP', ':Neogit push<CR>', { silent = true, noremap = true })
|
||||
vim.keymap.set('n', '<leader>gb', ':Telescope git_branches<CR>', { silent = true, noremap = true })
|
||||
vim.keymap.set('n', '<leader>gB', ':G blame<CR>', { silent = true, noremap = true })
|
||||
|
||||
neogit.setup {
|
||||
disable_commit_confirmation = true,
|
||||
disable_signs = false,
|
||||
disable_context_highlighting = false,
|
||||
disable_builtin_notifications = false,
|
||||
signs = {
|
||||
section = { '', '' },
|
||||
item = { '', '' },
|
||||
hunk = { '', '' },
|
||||
},
|
||||
integrations = {
|
||||
diffview = true,
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -1,29 +1,30 @@
|
||||
-- A small Neovim plugin for previewing definitions using floating windows.
|
||||
-- https://github.com/rmagatti/goto-preview
|
||||
return {
|
||||
-- A small Neovim plugin for previewing definitions using floating windows.
|
||||
-- https://github.com/rmagatti/goto-preview
|
||||
'rmagatti/goto-preview',
|
||||
config = function()
|
||||
require('goto-preview').setup {
|
||||
width = 120, -- Width of the floating window
|
||||
height = 15, -- Height of the floating window
|
||||
border = { '↖', '─', '┐', '│', '┘', '─', '└', '│' }, -- Border characters of the floating window
|
||||
default_mappings = true,
|
||||
debug = false, -- Print debug information
|
||||
opacity = nil, -- 0-100 opacity level of the floating window where 100 is fully transparent.
|
||||
resizing_mappings = false, -- Binds arrow keys to resizing the floating window.
|
||||
post_open_hook = nil, -- A function taking two arguments, a buffer and a window to be ran as a hook.
|
||||
references = { -- Configure the telescope UI for slowing the references cycling window.
|
||||
telescope = require('telescope.themes').get_dropdown {
|
||||
hide_preview = false,
|
||||
},
|
||||
dependencies = {
|
||||
{ 'nvim-telescope/telescope.nvim' },
|
||||
},
|
||||
opts = {
|
||||
width = 120, -- Width of the floating window
|
||||
height = 15, -- Height of the floating window
|
||||
border = { '↖', '─', '┐', '│', '┘', '─', '└', '│' }, -- Border characters of the floating window
|
||||
default_mappings = true,
|
||||
debug = false, -- Print debug information
|
||||
opacity = nil, -- 0-100 opacity level of the floating window where 100 is fully transparent.
|
||||
resizing_mappings = false, -- Binds arrow keys to resizing the floating window.
|
||||
post_open_hook = nil, -- A function taking two arguments, a buffer and a window to be ran as a hook.
|
||||
references = { -- Configure the telescope UI for slowing the references cycling window.
|
||||
telescope = require('telescope.themes').get_dropdown {
|
||||
hide_preview = false,
|
||||
},
|
||||
-- These two configs can also be passed down to the goto-preview definition and implementation calls for one off "peak" functionality.
|
||||
focus_on_open = true, -- Focus the floating window when opening it.
|
||||
dismiss_on_move = false, -- Dismiss the floating window when moving the cursor.
|
||||
force_close = true, -- passed into vim.api.nvim_win_close's second argument. See :h nvim_win_close
|
||||
bufhidden = 'wipe', -- the bufhidden option to set on the floating window. See :h bufhidden
|
||||
stack_floating_preview_windows = true, -- Whether to nest floating windows
|
||||
preview_window_title = { enable = true, position = 'left' },
|
||||
}
|
||||
end,
|
||||
},
|
||||
-- These two configs can also be passed down to the goto-preview definition and implementation calls for one off "peak" functionality.
|
||||
focus_on_open = true, -- Focus the floating window when opening it.
|
||||
dismiss_on_move = false, -- Dismiss the floating window when moving the cursor.
|
||||
force_close = true, -- passed into vim.api.nvim_win_close's second argument. See :h nvim_win_close
|
||||
bufhidden = 'wipe', -- the bufhidden option to set on the floating window. See :h bufhidden
|
||||
stack_floating_preview_windows = true, -- Whether to nest floating windows
|
||||
preview_window_title = { enable = true, position = 'left' },
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,31 +1,25 @@
|
||||
-- Getting you where you want with the fewest keystrokes.
|
||||
-- https://github.com/ThePrimeagen/harpoon
|
||||
return {
|
||||
-- Getting you where you want with the fewest keystrokes.
|
||||
-- https://github.com/ThePrimeagen/harpoon
|
||||
{
|
||||
'ThePrimeagen/harpoon',
|
||||
branch = 'harpoon2',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-telescope/telescope.nvim',
|
||||
},
|
||||
config = function()
|
||||
local harpoon = require 'harpoon'
|
||||
'ThePrimeagen/harpoon',
|
||||
branch = 'harpoon2',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-telescope/telescope.nvim',
|
||||
},
|
||||
config = function()
|
||||
local harpoon = require 'harpoon'
|
||||
harpoon:setup {}
|
||||
|
||||
harpoon:setup {}
|
||||
-- basic telescope configuration
|
||||
local conf = require('telescope.config').values
|
||||
local function toggle_telescope(harpoon_files)
|
||||
local file_paths = {}
|
||||
for _, item in ipairs(harpoon_files.items) do
|
||||
table.insert(file_paths, item.value)
|
||||
end
|
||||
|
||||
vim.keymap.set('n', '<leader>ht', function()
|
||||
harpoon.ui:toggle_quick_menu(harpoon:list())
|
||||
end)
|
||||
|
||||
-- basic telescope configuration
|
||||
local conf = require('telescope.config').values
|
||||
local function toggle_telescope(harpoon_files)
|
||||
local file_paths = {}
|
||||
for _, item in ipairs(harpoon_files.items) do
|
||||
table.insert(file_paths, item.value)
|
||||
end
|
||||
|
||||
require('telescope.pickers')
|
||||
require('telescope.pickers')
|
||||
.new({}, {
|
||||
prompt_title = 'Harpoon',
|
||||
finder = require('telescope.finders').new_table {
|
||||
@@ -35,69 +29,19 @@ return {
|
||||
sorter = conf.generic_sorter {},
|
||||
})
|
||||
:find()
|
||||
end
|
||||
end
|
||||
|
||||
vim.keymap.set('n', '<leader>xa', function()
|
||||
toggle_telescope(harpoon:list())
|
||||
end, { desc = 'Open harpoon window' })
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
'<leader>xa',
|
||||
function()
|
||||
require('harpoon'):list():add()
|
||||
end,
|
||||
desc = 'harpoon file',
|
||||
},
|
||||
{
|
||||
'<leader>xN',
|
||||
function()
|
||||
require('harpoon'):list():prev()
|
||||
end,
|
||||
desc = 'harpoon to previous file',
|
||||
},
|
||||
{
|
||||
'<leader>xn',
|
||||
function()
|
||||
require('harpoon'):list():next()
|
||||
end,
|
||||
desc = 'harpoon to next file',
|
||||
},
|
||||
{
|
||||
'<leader>1',
|
||||
function()
|
||||
require('harpoon'):list():select(1)
|
||||
end,
|
||||
desc = 'harpoon to file 1',
|
||||
},
|
||||
{
|
||||
'<leader>2',
|
||||
function()
|
||||
require('harpoon'):list():select(2)
|
||||
end,
|
||||
desc = 'harpoon to file 2',
|
||||
},
|
||||
{
|
||||
'<leader>3',
|
||||
function()
|
||||
require('harpoon'):list():select(3)
|
||||
end,
|
||||
desc = 'harpoon to file 3',
|
||||
},
|
||||
{
|
||||
'<leader>4',
|
||||
function()
|
||||
require('harpoon'):list():select(4)
|
||||
end,
|
||||
desc = 'harpoon to file 4',
|
||||
},
|
||||
{
|
||||
'<leader>5',
|
||||
function()
|
||||
require('harpoon'):list():select(5)
|
||||
end,
|
||||
desc = 'harpoon to file 5',
|
||||
},
|
||||
},
|
||||
},
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader>hw',
|
||||
function() toggle_telescope(harpoon:list()) end,
|
||||
{ desc = 'Open harpoon window with telescope' }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader>ht',
|
||||
function() harpoon.ui:toggle_quick_menu(harpoon:list()) end,
|
||||
{ desc = 'Open Harpoon Quick menu' }
|
||||
)
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
return {
|
||||
-- vscode-like pictograms for neovim lsp completion items
|
||||
-- https://github.com/onsails/lspkind-nvim
|
||||
{ 'onsails/lspkind.nvim' },
|
||||
|
||||
-- Rethinking Vim as a tool for writing
|
||||
-- https://github.com/preservim/vim-pencil
|
||||
{ 'preservim/vim-pencil' },
|
||||
|
||||
-- obsession.vim: continuously updated session files
|
||||
-- https://github.com/tpope/vim-obsession
|
||||
{ 'tpope/vim-obsession' },
|
||||
|
||||
-- surround.vim: Delete/change/add parentheses/quotes/XML-tags/much more with ease
|
||||
-- https://github.com/tpope/vim-surround
|
||||
{ 'tpope/vim-surround' },
|
||||
|
||||
-- Highlight, list and search todo comments in your projects
|
||||
-- https://github.com/folke/todo-comments.nvim
|
||||
{
|
||||
'folke/todo-comments.nvim',
|
||||
dependencies = 'nvim-lua/plenary.nvim',
|
||||
config = function()
|
||||
require('todo-comments').setup {}
|
||||
end,
|
||||
},
|
||||
|
||||
-- LSP Configuration & Plugins
|
||||
-- Meta type definitions for the Lua platform Luvit.
|
||||
-- https://github.com/Bilal2453/luvit-meta
|
||||
{ 'Bilal2453/luvit-meta', lazy = true },
|
||||
|
||||
-- Indent guides for Neovim
|
||||
-- https://github.com/lukas-reineke/indent-blankline.nvim
|
||||
{
|
||||
'lukas-reineke/indent-blankline.nvim',
|
||||
main = 'ibl',
|
||||
opts = {},
|
||||
},
|
||||
|
||||
-- Commenting
|
||||
-- https://github.com/numToStr/Comment.nvim
|
||||
{
|
||||
'numToStr/Comment.nvim', -- "gc" to comment visual regions/lines
|
||||
event = { 'BufRead', 'BufNewFile' },
|
||||
config = function()
|
||||
require('Comment').setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- Detect tabstop and shiftwidth automatically
|
||||
-- https://github.com/tpope/vim-sleuth
|
||||
{ 'tpope/vim-sleuth' },
|
||||
|
||||
-- Vim plugin for automatic time tracking and metrics
|
||||
-- generated from your programming activity.
|
||||
-- https://github.com/wakatime/vim-wakatime
|
||||
{ 'wakatime/vim-wakatime', lazy = false, enabled = true },
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
return {
|
||||
|
||||
{ -- Linting
|
||||
'mfussenegger/nvim-lint',
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
config = function()
|
||||
local lint = require 'lint'
|
||||
lint.linters_by_ft = {
|
||||
markdown = { 'markdownlint' },
|
||||
}
|
||||
|
||||
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
||||
-- instead set linters_by_ft like this:
|
||||
-- lint.linters_by_ft = lint.linters_by_ft or {}
|
||||
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
|
||||
--
|
||||
-- However, note that this will enable a set of default linters,
|
||||
-- which will cause errors unless these tools are available:
|
||||
-- {
|
||||
-- clojure = { "clj-kondo" },
|
||||
-- dockerfile = { "hadolint" },
|
||||
-- inko = { "inko" },
|
||||
-- janet = { "janet" },
|
||||
-- json = { "jsonlint" },
|
||||
-- markdown = { "vale" },
|
||||
-- rst = { "vale" },
|
||||
-- ruby = { "ruby" },
|
||||
-- terraform = { "tflint" },
|
||||
-- text = { "vale" }
|
||||
-- }
|
||||
--
|
||||
-- You can disable the default linters by setting their filetypes to nil:
|
||||
-- lint.linters_by_ft['clojure'] = nil
|
||||
-- lint.linters_by_ft['dockerfile'] = nil
|
||||
-- lint.linters_by_ft['inko'] = nil
|
||||
-- lint.linters_by_ft['janet'] = nil
|
||||
-- lint.linters_by_ft['json'] = nil
|
||||
-- lint.linters_by_ft['markdown'] = nil
|
||||
-- lint.linters_by_ft['rst'] = nil
|
||||
-- lint.linters_by_ft['ruby'] = nil
|
||||
-- lint.linters_by_ft['terraform'] = nil
|
||||
-- lint.linters_by_ft['text'] = nil
|
||||
|
||||
-- Create autocommand which carries out the actual linting
|
||||
-- on the specified events.
|
||||
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
||||
group = lint_augroup,
|
||||
callback = function()
|
||||
lint.try_lint()
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
21
config/nvim/lua/plugins/lsp-saga.lua
Normal file
21
config/nvim/lua/plugins/lsp-saga.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
-- improve neovim lsp experience
|
||||
-- https://github.com/nvimdev/lspsaga.nvim
|
||||
-- https://nvimdev.github.io/lspsaga/
|
||||
return {
|
||||
'nvimdev/lspsaga.nvim',
|
||||
event = 'LspAttach',
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter', -- optional
|
||||
'nvim-tree/nvim-web-devicons', -- optional
|
||||
},
|
||||
opts = {
|
||||
code_action = {
|
||||
show_server_name = true,
|
||||
},
|
||||
diagnostic = {
|
||||
keys = {
|
||||
quit = { 'q', '<ESC>' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1,254 +1,239 @@
|
||||
-- Quickstart configs for Nvim LSP
|
||||
-- https://github.com/neovim/nvim-lspconfig
|
||||
-- ── Mason and LSPConfig integration ────────────────────────────────────
|
||||
|
||||
-- ── LSP settings. ───────────────────────────────────────────────
|
||||
-- This function gets run when an LSP connects to a particular buffer.
|
||||
|
||||
-- Make runtime files discoverable to the server
|
||||
local runtime_path = vim.split(package.path, ';')
|
||||
table.insert(runtime_path, 'lua/?.lua')
|
||||
table.insert(runtime_path, 'lua/?/init.lua')
|
||||
|
||||
-- nvim-cmp supports additional completion capabilities
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
||||
-- Tell the server the capability of foldingRange,
|
||||
-- Neovim hasn't added foldingRange to default capabilities, users must add it manually
|
||||
capabilities.textDocument.foldingRange = {
|
||||
dynamicRegistration = true,
|
||||
lineFoldingOnly = true,
|
||||
}
|
||||
|
||||
return {
|
||||
'neovim/nvim-lspconfig',
|
||||
dependencies = {
|
||||
-- Automatically install LSPs to stdpath for neovim
|
||||
{
|
||||
'folke/neoconf.nvim',
|
||||
cmd = 'Neoconf',
|
||||
opts = {},
|
||||
},
|
||||
-- Portable package manager for Neovim that runs everywhere Neovim runs.
|
||||
-- Easily install and manage LSP servers, DAP servers, linters, and formatters.
|
||||
-- https://github.com/williamboman/mason.nvim
|
||||
{
|
||||
'williamboman/mason.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||
-- Useful status updates for LSP
|
||||
{
|
||||
'j-hui/fidget.nvim',
|
||||
opts = {
|
||||
notification = {
|
||||
window = {
|
||||
winblend = 50,
|
||||
align = 'top',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
'b0o/schemastore.nvim',
|
||||
{
|
||||
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
|
||||
-- used for completion, annotations and signatures of Neovim apis
|
||||
'folke/lazydev.nvim',
|
||||
ft = 'lua',
|
||||
opts = {
|
||||
library = {
|
||||
-- Load luvit types when the `vim.uv` word is found
|
||||
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
|
||||
},
|
||||
cmd = 'Mason',
|
||||
run = ':MasonUpdate',
|
||||
opts = {
|
||||
PATH = 'prepend',
|
||||
-- Mason servers to install
|
||||
-- See: https://mason-registry.dev/registry/list
|
||||
ensure_installed = {
|
||||
'clang-format',
|
||||
'codespell',
|
||||
'commitlint',
|
||||
'editorconfig-checker',
|
||||
'fixjson',
|
||||
'jsonlint',
|
||||
'luacheck',
|
||||
'phpcbf',
|
||||
'phpcs',
|
||||
'phpmd',
|
||||
'prettier',
|
||||
'shellcheck',
|
||||
'shfmt',
|
||||
'stylua',
|
||||
'yamllint',
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set('n', 'dp', vim.diagnostic.goto_prev, { desc = 'Diagnostic: Goto Prev' })
|
||||
vim.keymap.set('n', 'dn', vim.diagnostic.goto_next, { desc = 'Diagnostic: Goto Next' })
|
||||
vim.keymap.set('n', '<leader>do', vim.diagnostic.open_float, { desc = 'Diagnostic: Open float' })
|
||||
vim.keymap.set('n', '<leader>dq', vim.diagnostic.setloclist, { desc = 'Diagnostic: Set loc list' })
|
||||
|
||||
-- LSP settings.
|
||||
-- This function gets run when an LSP connects to a particular buffer.
|
||||
local on_attach = function(_, bufnr)
|
||||
local nmap = function(keys, func, desc)
|
||||
if desc then
|
||||
desc = 'LSP: ' .. desc
|
||||
end
|
||||
|
||||
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
|
||||
end
|
||||
|
||||
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
||||
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
|
||||
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
||||
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
|
||||
-- See `:help K` for why this keymap
|
||||
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
||||
|
||||
-- Lesser used LSP functionality
|
||||
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
|
||||
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
||||
nmap('<leader>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, '[W]orkspace [L]ist Folders')
|
||||
|
||||
-- Create a command `:Format` local to the LSP buffer
|
||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
||||
if vim.lsp.buf.format then
|
||||
vim.lsp.buf.format()
|
||||
elseif vim.lsp.buf.formatting then
|
||||
vim.lsp.buf.formatting()
|
||||
end
|
||||
end, { desc = 'Format current buffer with LSP' })
|
||||
end
|
||||
|
||||
-- Setup mason so it can manage external tooling
|
||||
require('mason').setup()
|
||||
|
||||
-- Enable the following language servers
|
||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||
local servers = {
|
||||
-- Extension to mason.nvim that makes it easier to use lspconfig with mason.nvim.
|
||||
-- https://github.com/williamboman/mason-lspconfig.nvim
|
||||
{
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
opts = {
|
||||
-- ── Enable the following language servers ───────────────────────────
|
||||
-- :help lspconfig-all for all pre-configured LSPs
|
||||
ast_grep = {},
|
||||
|
||||
actionlint = {}, -- GitHub Actions
|
||||
ansiblels = {}, -- Ansible
|
||||
bashls = {}, -- Bash
|
||||
css_variables = {}, -- CSS
|
||||
cssls = {}, -- CSS
|
||||
docker_compose_language_service = {}, -- Docker compose
|
||||
dockerls = {}, -- Docker
|
||||
eslint = {}, -- ESLint
|
||||
gitlab_ci_ls = {}, -- GitLab CI
|
||||
gopls = {}, -- Go
|
||||
grammarly = {}, -- Grammar and better writing
|
||||
html = {}, -- HTML
|
||||
intelephense = {}, -- PHP
|
||||
jinja_lsp = {}, -- Jinja templates
|
||||
pest_ls = {}, -- Pest (PHP)
|
||||
phpactor = {}, -- PHP
|
||||
psalm = {}, -- PHP
|
||||
pyright = {}, -- Python
|
||||
semgrep = {}, -- Security
|
||||
shellcheck = {}, -- Shell scripts
|
||||
shfmt = {}, -- Shell scripts formatting
|
||||
stylelint_lsp = {}, -- Stylelint for S/CSS
|
||||
stylua = {}, -- Used to format Lua code
|
||||
tailwindcss = {}, -- Tailwind CSS
|
||||
terraformls = {}, -- Terraform
|
||||
tflint = {}, -- Terraform
|
||||
ts_ls = {}, -- TypeScript/JS
|
||||
typos_lsp = {}, -- Better writing
|
||||
volar = {}, -- Vue
|
||||
yamlls = {}, -- YAML
|
||||
|
||||
lua_ls = {
|
||||
-- cmd = {...},
|
||||
-- filetypes = { ...},
|
||||
-- capabilities = {},
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = 'Replace',
|
||||
},
|
||||
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
||||
diagnostics = { disable = { 'missing-fields' } },
|
||||
},
|
||||
},
|
||||
ensure_installed = {
|
||||
'bashls',
|
||||
-- 'csharp_ls',
|
||||
'diagnosticls',
|
||||
'gopls',
|
||||
'html',
|
||||
'intelephense',
|
||||
'jsonls',
|
||||
'lua_ls',
|
||||
'tailwindcss',
|
||||
'ts_ls',
|
||||
'vimls',
|
||||
'volar',
|
||||
},
|
||||
jsonls = {
|
||||
settings = {
|
||||
json = {
|
||||
schemas = require('schemastore').json.schemas(),
|
||||
validate = { enable = true },
|
||||
},
|
||||
yaml = {
|
||||
schemaStore = {
|
||||
-- You must disable built-in schemaStore support if you want to use
|
||||
-- this plugin and its advanced options like `ignore`.
|
||||
enable = false,
|
||||
-- Avoid TypeError: Cannot read properties of undefined (reading 'length')
|
||||
url = '',
|
||||
},
|
||||
schemas = require('schemastore').yaml.schemas(),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, {
|
||||
'actionlint',
|
||||
'ansible-language-server',
|
||||
'ansible-lint',
|
||||
'bash-language-server',
|
||||
'blade-formatter',
|
||||
'codespell',
|
||||
'commitlint',
|
||||
'diagnostic-languageserver',
|
||||
'docker-compose-language-service',
|
||||
'dockerfile-language-server',
|
||||
'editorconfig-checker',
|
||||
'fixjson',
|
||||
'flake8',
|
||||
'html-lsp',
|
||||
'jq',
|
||||
'jsonlint',
|
||||
'luacheck',
|
||||
'php-cs-fixer',
|
||||
'phpcs',
|
||||
'phpmd',
|
||||
'semgrep',
|
||||
'shellcheck',
|
||||
'shfmt',
|
||||
'stylelint',
|
||||
'stylua',
|
||||
'yamllint',
|
||||
})
|
||||
require('mason-tool-installer').setup {
|
||||
ensure_installed = ensure_installed,
|
||||
auto_update = true,
|
||||
}
|
||||
|
||||
-- Ensure the servers above are installed
|
||||
require('mason-lspconfig').setup {
|
||||
automatic_installation = true,
|
||||
ensure_installed = servers,
|
||||
}
|
||||
handlers = {
|
||||
-- The first entry (without a key) will be the default handler
|
||||
-- and will be called for each installed server that doesn't have
|
||||
-- a dedicated handler.
|
||||
function(server_name) -- default handler (optional)
|
||||
require('lspconfig')[server_name].setup {
|
||||
on_attach = function(_, bufnr)
|
||||
-- Create a command `:Format` local to the LSP buffer
|
||||
vim.api.nvim_buf_create_user_command(
|
||||
bufnr,
|
||||
'Format',
|
||||
function(_)
|
||||
require('conform').format {
|
||||
formatters = { 'injected' },
|
||||
async = true,
|
||||
lsp_fallback = true,
|
||||
}
|
||||
end,
|
||||
{ desc = 'Format current buffer with LSP' }
|
||||
)
|
||||
end,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end,
|
||||
-- Next, you can provide targeted overrides for specific servers.
|
||||
['lua_ls'] = function()
|
||||
require('lspconfig')['lua_ls'].setup {
|
||||
on_attach = function(_, bufnr)
|
||||
-- Create a command `:Format` local to the LSP buffer
|
||||
vim.api.nvim_buf_create_user_command(
|
||||
bufnr,
|
||||
'Format',
|
||||
function(_)
|
||||
require('conform').format {
|
||||
formatters = { 'injected' },
|
||||
async = true,
|
||||
lsp_fallback = true,
|
||||
}
|
||||
end,
|
||||
{ desc = 'Format current buffer with LSP' }
|
||||
)
|
||||
end,
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're
|
||||
-- using (most likely LuaJIT)
|
||||
version = 'LuaJIT',
|
||||
-- Setup your lua path
|
||||
path = runtime_path,
|
||||
},
|
||||
diagnostics = {
|
||||
globals = { 'vim' },
|
||||
disable = {
|
||||
-- Ignore lua_ls noisy `missing-fields` warnings
|
||||
'missing-fields',
|
||||
},
|
||||
},
|
||||
workspace = {
|
||||
library = vim.api.nvim_get_runtime_file('', true),
|
||||
checkThirdParty = false,
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized
|
||||
-- but unique identifier
|
||||
telemetry = { enable = false },
|
||||
|
||||
-- nvim-cmp supports additional completion capabilities
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
||||
|
||||
for _, lsp in ipairs(servers) do
|
||||
require('lspconfig')[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end
|
||||
|
||||
-- Turn on lsp status information
|
||||
require('fidget').setup()
|
||||
|
||||
-- Example custom configuration for lua
|
||||
--
|
||||
-- Make runtime files discoverable to the server
|
||||
local runtime_path = vim.split(package.path, ';')
|
||||
table.insert(runtime_path, 'lua/?.lua')
|
||||
table.insert(runtime_path, 'lua/?/init.lua')
|
||||
|
||||
require('lspconfig').lua_ls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT)
|
||||
version = 'LuaJIT',
|
||||
-- Setup your lua path
|
||||
path = runtime_path,
|
||||
},
|
||||
diagnostics = {
|
||||
globals = { 'vim' },
|
||||
},
|
||||
workspace = {
|
||||
library = vim.api.nvim_get_runtime_file('', true),
|
||||
checkThirdParty = false,
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
completion = {
|
||||
callSnippet = 'Replace',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
['jsonls'] = function()
|
||||
require('lspconfig')['jsonls'].setup {
|
||||
on_attach = function(_, bufnr)
|
||||
-- Create a command `:Format` local to the LSP buffer
|
||||
vim.api.nvim_buf_create_user_command(
|
||||
bufnr,
|
||||
'Format',
|
||||
function(_)
|
||||
require('conform').format {
|
||||
formatters = { 'injected' },
|
||||
async = true,
|
||||
lsp_fallback = true,
|
||||
}
|
||||
end,
|
||||
{ desc = 'Format current buffer with LSP' }
|
||||
)
|
||||
end,
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
json = {
|
||||
schemas = require('schemastore').json.schemas(),
|
||||
validate = { enable = true },
|
||||
},
|
||||
yaml = {
|
||||
schemaStore = {
|
||||
-- You must disable built-in SchemaStore support if you want to use
|
||||
-- this plugin and its advanced options like `ignore`.
|
||||
enable = false,
|
||||
-- Avoid TypeError: Cannot read properties of undefined (reading 'length')
|
||||
url = '',
|
||||
},
|
||||
schemas = require('schemastore').yaml.schemas(),
|
||||
validate = { enable = true },
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
['ts_ls'] = function()
|
||||
local mason_registry = require 'mason-registry'
|
||||
local ts_plugin_location = mason_registry
|
||||
.get_package('vue-language-server')
|
||||
:get_install_path() .. '/node_modules/@vue/typescript-plugin'
|
||||
require('lspconfig')['volar'].setup {
|
||||
init_options = {
|
||||
plugins = {
|
||||
{
|
||||
name = '@vue/typescript-plugin',
|
||||
location = ts_plugin_location,
|
||||
languages = { 'javascript', 'typescript', 'vue' },
|
||||
},
|
||||
},
|
||||
},
|
||||
filetypes = {
|
||||
'typescript',
|
||||
'javascript',
|
||||
'javascriptreact',
|
||||
'typescriptreact',
|
||||
'vue',
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = 'sh',
|
||||
callback = function()
|
||||
vim.lsp.start {
|
||||
name = 'bash-language-server',
|
||||
cmd = { 'bash-language-server', 'start' },
|
||||
}
|
||||
end,
|
||||
})
|
||||
end,
|
||||
-- ── Misc ───────────────────────────────────────────────────
|
||||
-- vscode-like pictograms for neovim lsp completion items
|
||||
-- https://github.com/onsails/lspkind-nvim
|
||||
{ 'onsails/lspkind.nvim', opts = {} },
|
||||
-- JSON schemas for Neovim
|
||||
-- https://github.com/b0o/SchemaStore.nvim
|
||||
{ 'b0o/schemastore.nvim' },
|
||||
|
||||
-- ── LSP ────────────────────────────────────────────────────
|
||||
-- Quick start configs for Nvim LSP
|
||||
-- https://github.com/neovim/nvim-lspconfig
|
||||
{ 'neovim/nvim-lspconfig', dependencies = { 'folke/neoconf.nvim' } },
|
||||
|
||||
-- Garbage collector that stops inactive LSP clients to free RAM
|
||||
-- https://github.com/Zeioth/garbage-day.nvim
|
||||
{
|
||||
'zeioth/garbage-day.nvim',
|
||||
dependencies = 'neovim/nvim-lspconfig',
|
||||
event = 'VeryLazy',
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -2,32 +2,71 @@
|
||||
-- https://github.com/nvim-lualine/lualine.nvim
|
||||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = {
|
||||
'kyazdani42/nvim-web-devicons',
|
||||
'folke/noice.nvim',
|
||||
},
|
||||
config = function()
|
||||
local function diff_source()
|
||||
local gitsigns = vim.b.gitsigns_status_dict
|
||||
if gitsigns then
|
||||
return {
|
||||
added = gitsigns.added,
|
||||
modified = gitsigns.changed,
|
||||
removed = gitsigns.removed,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
component_separators = '|',
|
||||
section_separators = '',
|
||||
},
|
||||
-- Sections
|
||||
-- +-------------------------------------------------+
|
||||
-- | A | B | C X | Y | Z |
|
||||
-- +-------------------------------------------------+
|
||||
sections = {
|
||||
lualine_a = {
|
||||
'mode',
|
||||
},
|
||||
lualine_b = {
|
||||
{ 'b:gitsigns_head', icon = '' },
|
||||
{ 'diff', source = diff_source },
|
||||
'diagnostics',
|
||||
},
|
||||
lualine_c = {
|
||||
'buffers',
|
||||
-- 'filename',
|
||||
},
|
||||
lualine_x = {
|
||||
-- 'fileformat',
|
||||
'filetype',
|
||||
},
|
||||
lualine_y = {
|
||||
-- 'progress'
|
||||
},
|
||||
lualine_z = {
|
||||
{
|
||||
require('noice').api.statusline.mode.get,
|
||||
cond = require('noice').api.statusline.mode.has,
|
||||
-- color = { fg = '#ff9e64' },
|
||||
},
|
||||
{
|
||||
require('noice').api.status.command.get,
|
||||
cond = require('noice').api.status.command.has,
|
||||
-- color = { fg = '#ff9e64' },
|
||||
},
|
||||
},
|
||||
lualine_a = {
|
||||
{
|
||||
'buffers',
|
||||
},
|
||||
},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { 'filename' },
|
||||
lualine_x = { 'location' },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
||||
8
config/nvim/lua/plugins/neogen.lua
Normal file
8
config/nvim/lua/plugins/neogen.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
-- A better annotation generator.
|
||||
-- Supports multiple languages and annotation conventions.
|
||||
-- https://github.com/danymat/neogen
|
||||
return {
|
||||
'danymat/neogen',
|
||||
version = '*',
|
||||
opts = { enabled = true, snippet_engine = 'luasnip' },
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
-- Neo-tree is a Neovim plugin to browse the file system
|
||||
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
||||
|
||||
return {
|
||||
'nvim-neo-tree/neo-tree.nvim',
|
||||
version = '*',
|
||||
@@ -9,29 +8,27 @@ return {
|
||||
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
||||
'MunifTanjim/nui.nvim',
|
||||
{
|
||||
-- This plugins prompts the user to pick a window and returns
|
||||
-- the window id of the picked window
|
||||
-- https://github.com/s1n7ax/nvim-window-picker
|
||||
's1n7ax/nvim-window-picker',
|
||||
version = '2.*',
|
||||
config = function()
|
||||
require('window-picker').setup {
|
||||
filter_rules = {
|
||||
include_current_win = false,
|
||||
autoselect_one = true,
|
||||
-- filter using buffer options
|
||||
bo = {
|
||||
-- if the file type is one of following, the window will be ignored
|
||||
filetype = { 'neo-tree', 'neo-tree-popup', 'notify' },
|
||||
-- if the buffer type is one of following, the window will be ignored
|
||||
buftype = { 'terminal', 'quickfix' },
|
||||
},
|
||||
opts = {
|
||||
filter_rules = {
|
||||
include_current_win = false,
|
||||
autoselect_one = true,
|
||||
-- filter using buffer options
|
||||
bo = {
|
||||
-- if the file type is one of following, the window will be ignored
|
||||
filetype = { 'neo-tree', 'neo-tree-popup', 'notify' },
|
||||
-- if the buffer type is one of following, the window will be ignored
|
||||
buftype = { 'terminal', 'quickfix' },
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
cmd = 'Neotree',
|
||||
keys = {
|
||||
{ '<leader>e', ':Neotree reveal<CR>', { desc = 'NeoTree reveal' } },
|
||||
},
|
||||
opts = {
|
||||
close_if_last_window = true,
|
||||
filesystem = {
|
||||
|
||||
@@ -1,80 +1,85 @@
|
||||
-- Highly experimental plugin that completely replaces the UI
|
||||
-- for messages, cmdline and the popupmenu.
|
||||
-- https://github.com/folke/noice.nvim
|
||||
return {
|
||||
-- Highly experimental plugin that completely replaces the UI
|
||||
-- for messages, cmdline and the popupmenu.
|
||||
-- https://github.com/folke/noice.nvim
|
||||
{
|
||||
'folke/noice.nvim',
|
||||
dependencies = {
|
||||
'MunifTanjim/nui.nvim',
|
||||
-- A fancy, configurable, notification manager for NeoVim
|
||||
-- https://github.com/rcarriga/nvim-notify
|
||||
{
|
||||
'rcarriga/nvim-notify',
|
||||
config = function()
|
||||
require('notify').setup {
|
||||
background_colour = '#000000',
|
||||
enabled = false,
|
||||
}
|
||||
end,
|
||||
'folke/noice.nvim',
|
||||
lazy = false,
|
||||
enabled = true,
|
||||
dependencies = {
|
||||
'MunifTanjim/nui.nvim',
|
||||
-- A fancy, configurable, notification manager for NeoVim
|
||||
-- https://github.com/rcarriga/nvim-notify
|
||||
'rcarriga/nvim-notify',
|
||||
'hrsh7th/nvim-cmp',
|
||||
},
|
||||
opts = {
|
||||
lsp = {
|
||||
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||
override = {
|
||||
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
|
||||
['vim.lsp.util.stylize_markdown'] = true,
|
||||
['cmp.entry.get_documentation'] = true, -- requires hrsh7th/nvim-cmp
|
||||
},
|
||||
},
|
||||
setup = function()
|
||||
vim.g.noice_ignored_filetypes = { 'fugitiveblame', 'fugitive', 'gitcommit' }
|
||||
require('noice').setup {
|
||||
-- you can enable a preset for easier configuration
|
||||
presets = {
|
||||
bottom_search = true, -- use a classic bottom cmdline for search
|
||||
command_palette = true, -- position the cmdline and popupmenu together
|
||||
long_message_to_split = true, -- long messages will be sent to a split
|
||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||
},
|
||||
views = {
|
||||
cmdline_popup = {
|
||||
position = {
|
||||
row = 5,
|
||||
col = '50%',
|
||||
},
|
||||
size = {
|
||||
width = 60,
|
||||
height = 'auto',
|
||||
},
|
||||
},
|
||||
popupmenu = {
|
||||
relative = 'editor',
|
||||
position = {
|
||||
row = 8,
|
||||
col = '50%',
|
||||
},
|
||||
size = {
|
||||
width = 60,
|
||||
height = 10,
|
||||
},
|
||||
border = {
|
||||
style = 'rounded',
|
||||
padding = { 0, 1 },
|
||||
},
|
||||
win_options = {
|
||||
winhighlight = { Normal = 'Normal', FloatBorder = 'DiagnosticInfo' },
|
||||
},
|
||||
-- you can enable a preset for easier configuration
|
||||
presets = {
|
||||
bottom_search = false, -- use a classic bottom cmdline for search
|
||||
command_palette = true, -- position the cmdline and popupmenu together
|
||||
long_message_to_split = true, -- long messages will be sent to a split
|
||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||
},
|
||||
routes = {
|
||||
{
|
||||
filter = {
|
||||
event = 'msg_show',
|
||||
any = {
|
||||
{ find = '%d+L, %d+B' },
|
||||
{ find = '; after #%d+' },
|
||||
{ find = '; before #%d+' },
|
||||
{ find = '%d fewer lines' },
|
||||
{ find = '%d more lines' },
|
||||
},
|
||||
},
|
||||
routes = {
|
||||
{
|
||||
filter = {
|
||||
event = 'msg_show',
|
||||
any = {
|
||||
{ find = '%d+L, %d+B' },
|
||||
{ find = '; after #%d+' },
|
||||
{ find = '; before #%d+' },
|
||||
{ find = '%d fewer lines' },
|
||||
{ find = '%d more lines' },
|
||||
},
|
||||
},
|
||||
opts = { skip = true },
|
||||
},
|
||||
opts = { skip = true },
|
||||
},
|
||||
{
|
||||
filter = {
|
||||
event = 'notify',
|
||||
find = 'No information available',
|
||||
},
|
||||
}
|
||||
end,
|
||||
opts = { skip = true },
|
||||
},
|
||||
},
|
||||
views = {
|
||||
cmdline_popup = {
|
||||
position = {
|
||||
row = 5,
|
||||
col = '50%',
|
||||
},
|
||||
size = {
|
||||
width = 60,
|
||||
height = 'auto',
|
||||
},
|
||||
},
|
||||
popupmenu = {
|
||||
relative = 'editor',
|
||||
position = {
|
||||
row = 8,
|
||||
col = '50%',
|
||||
},
|
||||
size = {
|
||||
width = 60,
|
||||
height = 10,
|
||||
},
|
||||
border = {
|
||||
style = 'rounded',
|
||||
padding = { 0, 1 },
|
||||
},
|
||||
win_options = {
|
||||
winhighlight = { Normal = 'Normal', FloatBorder = 'DiagnosticInfo' },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
return {
|
||||
'epwalsh/obsidian.nvim',
|
||||
version = '*', -- recommended, use latest release instead of latest commit
|
||||
lazy = true,
|
||||
ft = 'markdown',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
},
|
||||
config = function()
|
||||
require('obsidian').setup {
|
||||
workspaces = {
|
||||
{
|
||||
name = 'Notes',
|
||||
path = vim.fn.expand '$HOME/Code/ivuorinen/obsidian',
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
||||
8
config/nvim/lua/plugins/refactoring.lua
Normal file
8
config/nvim/lua/plugins/refactoring.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
-- The Refactoring library based off the Refactoring book by Martin Fowler
|
||||
-- https://github.com/ThePrimeagen/refactoring.nvim
|
||||
return {
|
||||
'ThePrimeagen/refactoring.nvim',
|
||||
version = '*',
|
||||
dependencies = { 'nvim-lua/plenary.nvim', 'nvim-treesitter/nvim-treesitter' },
|
||||
opts = {},
|
||||
}
|
||||
8
config/nvim/lua/plugins/surround.lua
Normal file
8
config/nvim/lua/plugins/surround.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Add/change/delete surrounding delimiter pairs with ease.
|
||||
-- https://github.com/kylechui/nvim-surround
|
||||
return {
|
||||
'kylechui/nvim-surround',
|
||||
version = '*',
|
||||
event = 'VeryLazy',
|
||||
opts = {},
|
||||
}
|
||||
@@ -1,85 +1,105 @@
|
||||
return {
|
||||
-- Fuzzy Finder (files, lsp, etc)
|
||||
-- https://github.com/nvim-telescope/telescope.nvim
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
version = '*',
|
||||
dependencies = {
|
||||
{ 'nvim-lua/plenary.nvim' },
|
||||
{ 'nvim-telescope/telescope-symbols.nvim' },
|
||||
'nvim-telescope/telescope.nvim',
|
||||
version = '*',
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
{ 'nvim-lua/plenary.nvim' },
|
||||
{ 'nvim-telescope/telescope-symbols.nvim' },
|
||||
{ 'folke/which-key.nvim' },
|
||||
|
||||
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
|
||||
-- Only load if `make` is available
|
||||
{
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
build = 'make',
|
||||
cond = vim.fn.executable 'make' == 1,
|
||||
},
|
||||
-- A Telescope picker to quickly access configurations
|
||||
-- of plugins managed by lazy.nvim.
|
||||
-- https://github.com/polirritmico/telescope-lazy-plugins.nvim
|
||||
{ 'polirritmico/telescope-lazy-plugins.nvim' },
|
||||
|
||||
-- Neovim plugin. Telescope.nvim extension that adds LuaSnip integration.
|
||||
-- https://github.com/benfowler/telescope-luasnip.nvim
|
||||
{ 'benfowler/telescope-luasnip.nvim' },
|
||||
|
||||
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
|
||||
-- Only load if `make` is available
|
||||
{
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
build = 'make',
|
||||
cond = vim.fn.executable 'make' == 1,
|
||||
},
|
||||
setup = function()
|
||||
local t = require 'telescope'
|
||||
local a = require 'telescope.actions'
|
||||
local b = require 'telescope.builtin'
|
||||
local themes = require 'telescope.themes'
|
||||
require('telescope').load_extension 'harpoon'
|
||||
t.load_extension 'git_worktree'
|
||||
|
||||
-- [[ Configure Telescope ]]
|
||||
-- See `:help telescope` and `:help telescope.setup()`
|
||||
t.setup {
|
||||
defaults = {
|
||||
layout_strategy = 'horizontal',
|
||||
layout_config = {
|
||||
preview_width = 0.65,
|
||||
horizontal = {
|
||||
size = {
|
||||
width = '95%',
|
||||
height = '95%',
|
||||
},
|
||||
},
|
||||
-- Import modules with ease
|
||||
-- https://github.com/piersolenski/telescope-import.nvim
|
||||
{ 'piersolenski/telescope-import.nvim' },
|
||||
},
|
||||
config = function()
|
||||
local t = require 'telescope'
|
||||
local a = require 'telescope.actions'
|
||||
local themes = require 'telescope.themes'
|
||||
|
||||
-- [[ Configure Telescope ]]
|
||||
-- See `:help telescope` and `:help telescope.setup()`
|
||||
t.setup {
|
||||
defaults = {
|
||||
layout_strategy = 'horizontal',
|
||||
pickers = {
|
||||
find_files = {
|
||||
theme = 'dropdown',
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
theme = 'dropdown',
|
||||
},
|
||||
},
|
||||
mappings = {
|
||||
i = {
|
||||
['<C-u>'] = false,
|
||||
['<C-j>'] = a.move_selection_next,
|
||||
['<C-k>'] = a.move_selection_previous,
|
||||
['<C-d>'] = a.move_selection_previous,
|
||||
},
|
||||
mappings = {
|
||||
i = {
|
||||
['<C-u>'] = false,
|
||||
['<C-j>'] = a.move_selection_next,
|
||||
['<C-k>'] = a.move_selection_previous,
|
||||
['<C-d>'] = a.move_selection_previous,
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
lazy_plugins = {
|
||||
-- Must be a valid path to the file containing the lazy spec and setup() call.
|
||||
lazy_config = vim.fn.stdpath 'config' .. '/init.lua',
|
||||
},
|
||||
import = {
|
||||
-- Imports can be added at a specified line whilst keeping the cursor in place
|
||||
insert_at_top = true,
|
||||
-- Optionally support additional languages or modify existing languages...
|
||||
custom_languages = {
|
||||
{
|
||||
-- The filetypes that ripgrep supports (find these via `rg --type-list`)
|
||||
extensions = { 'js', 'ts' },
|
||||
-- The Vim filetypes
|
||||
filetypes = { 'vue' },
|
||||
-- Optionally set a line other than 1
|
||||
insert_at_line = 2, ---@type function|number
|
||||
-- The regex pattern for the import statement
|
||||
regex = [[^(?:import(?:[\"'\s]*([\w*{}\n, ]+)from\s*)?[\"'\s](.*?)[\"'\s].*)]],
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(t.load_extension, 'fzf')
|
||||
-- Load extensions
|
||||
pcall(t.load_extension, 'harpoon')
|
||||
pcall(t.load_extension, 'git_worktree')
|
||||
pcall(t.load_extension, 'lazy_plugins')
|
||||
pcall(t.load_extension, 'luasnip')
|
||||
pcall(t.load_extension, 'import')
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
vim.keymap.set('n', '<leader>so', b.oldfiles, { desc = '[?] Find recently opened files' })
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||
b.current_buffer_fuzzy_find(themes.get_dropdown {
|
||||
winblend = 10,
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(t.load_extension, 'fzf')
|
||||
|
||||
-- [[ Telescope Keymaps ]]
|
||||
-- See `:help telescope.builtin`
|
||||
-- See `:help telescope.keymap`
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||
require('telescope.builtin').current_buffer_fuzzy_find(
|
||||
themes.get_dropdown {
|
||||
winblend = 20,
|
||||
previewer = true,
|
||||
})
|
||||
end, { desc = '[/] Fuzzily search in current buffer]' })
|
||||
|
||||
vim.keymap.set('n', '<leader>sf', b.find_files, { desc = '[S]earch [F]iles' })
|
||||
vim.keymap.set('n', '<leader>sw', b.grep_string, { desc = '[S]earch current [W]ord' })
|
||||
vim.keymap.set('n', '<leader>sg', b.live_grep, { desc = '[S]earch by [G]rep' })
|
||||
vim.keymap.set('n', '<leader>sd', b.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||
vim.keymap.set('n', '<leader>sb', b.buffers, { desc = '[ ] Find existing buffers' })
|
||||
vim.keymap.set('n', '<leader>sS', b.git_status, { desc = '' })
|
||||
vim.keymap.set('n', '<leader>sm', ':Telescope harpoon marks<CR>', { desc = 'Harpoon [M]arks' })
|
||||
vim.keymap.set('n', '<Leader>sr', "<CMD>lua require('telescope').extensions.git_worktree.git_worktrees()<CR>")
|
||||
vim.keymap.set('n', '<Leader>sR', "<CMD>lua require('telescope').extensions.git_worktree.create_git_worktree()<CR>")
|
||||
vim.keymap.set('n', '<Leader>sn', "<CMD>lua require('telescope').extensions.notify.notify()<CR>")
|
||||
|
||||
vim.api.nvim_set_keymap('n', 'st', ':TodoTelescope<CR>', { noremap = true })
|
||||
vim.api.nvim_set_keymap('n', '<Leader><tab>', "<Cmd>lua require('telescope.builtin').commands()<CR>", { noremap = false })
|
||||
end,
|
||||
},
|
||||
}
|
||||
)
|
||||
end, { desc = '[/] Fuzzily search in current buffer]' })
|
||||
end,
|
||||
}
|
||||
|
||||
8
config/nvim/lua/plugins/todo-comments.lua
Normal file
8
config/nvim/lua/plugins/todo-comments.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Highlight, list and search todo comments in your projects
|
||||
-- https://github.com/folke/todo-comments.nvim
|
||||
return {
|
||||
'folke/todo-comments.nvim',
|
||||
version = '*',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
opts = {},
|
||||
}
|
||||
@@ -1,15 +1,23 @@
|
||||
-- Highlight, edit, and navigate code
|
||||
-- https://github.com/nvim-treesitter/nvim-treesitter
|
||||
return {
|
||||
-- Highlight, edit, and navigate code
|
||||
-- https://github.com/nvim-treesitter/nvim-treesitter
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
version = false, -- last release is way too old and doesn't work on Windows
|
||||
build = function()
|
||||
pcall(require('nvim-treesitter.install').update { with_sync = true })
|
||||
end,
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
'nvim-treesitter/nvim-treesitter-refactor',
|
||||
'nvim-treesitter/nvim-treesitter-context',
|
||||
'JoosepAlviste/nvim-ts-context-commentstring',
|
||||
},
|
||||
config = function()
|
||||
require('nvim-treesitter.configs').setup {
|
||||
auto_install = true,
|
||||
ignore_install = {},
|
||||
sync_install = true,
|
||||
modules = {},
|
||||
|
||||
-- Add languages to be installed here that you want installed for treesitter
|
||||
ensure_installed = {
|
||||
@@ -42,13 +50,39 @@ return {
|
||||
'yaml',
|
||||
},
|
||||
|
||||
refactor = {
|
||||
navigation = {
|
||||
enable = true,
|
||||
-- Assign keymaps to false to disable them, e.g. `goto_definition = false`.
|
||||
keymaps = {
|
||||
goto_definition = '<leader>gnd',
|
||||
list_definitions = '<leader>gnD',
|
||||
list_definitions_toc = '<leader>gO',
|
||||
goto_next_usage = '<a-*>',
|
||||
goto_previous_usage = '<a-#>',
|
||||
},
|
||||
},
|
||||
smart_rename = {
|
||||
enable = true,
|
||||
-- Assign keymaps to false to disable them, e.g. `smart_rename = false`.
|
||||
keymaps = {
|
||||
smart_rename = 'grr',
|
||||
},
|
||||
},
|
||||
highlight_definitions = {
|
||||
enable = true,
|
||||
-- Set to false if you have an `updatetime` of ~100.
|
||||
clear_on_cursor_move = true,
|
||||
},
|
||||
highlight_current_scope = { enable = false },
|
||||
},
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = '<c-space>',
|
||||
node_incremental = '<c-space>',
|
||||
init_selection = '<a-space>',
|
||||
node_incremental = '<a-space>',
|
||||
scope_incremental = '<c-s>',
|
||||
node_decremental = '<c-backspace>',
|
||||
},
|
||||
@@ -95,10 +129,10 @@ return {
|
||||
swap = {
|
||||
enable = true,
|
||||
swap_next = {
|
||||
['<leader>a'] = '@parameter.inner',
|
||||
['<leader>cn'] = '@parameter.inner',
|
||||
},
|
||||
swap_previous = {
|
||||
['<leader>A'] = '@parameter.inner',
|
||||
['<leader>cP'] = '@parameter.inner',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
9
config/nvim/lua/plugins/treesj.lua
Normal file
9
config/nvim/lua/plugins/treesj.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
-- Neovim plugin for splitting/joining blocks of code
|
||||
-- https://github.com/Wansmer/treesj
|
||||
return {
|
||||
'Wansmer/treesj',
|
||||
dependencies = { 'nvim-treesitter/nvim-treesitter' },
|
||||
opts = {
|
||||
use_default_keymaps = false,
|
||||
},
|
||||
}
|
||||
@@ -1,32 +1,15 @@
|
||||
-- A pretty diagnostics, references, telescope results,
|
||||
-- quickfix and location list to help you solve all the
|
||||
-- trouble your code is causing.
|
||||
-- https://github.com/folke/trouble.nvim
|
||||
return {
|
||||
'folke/trouble.nvim',
|
||||
lazy = false,
|
||||
dependencies = 'nvim-tree/nvim-web-devicons',
|
||||
config = function()
|
||||
require('trouble').setup {
|
||||
auto_preview = false,
|
||||
auto_fold = true,
|
||||
auto_close = true,
|
||||
use_lsp_diagnostic_signs = true,
|
||||
}
|
||||
vim.keymap.set('n', '<leader>xx', '<cmd>TroubleToggle<cr>', { silent = true, noremap = true })
|
||||
vim.keymap.set('n', '<leader>xw', '<cmd>TroubleToggle workspace_diagnostics<cr>', { silent = true, noremap = true })
|
||||
vim.keymap.set('n', '<leader>xd', '<cmd>TroubleToggle document_diagnostics<cr>', { silent = true, noremap = true })
|
||||
vim.keymap.set('n', '<leader>xl', '<cmd>TroubleToggle loclist<cr>', { silent = true, noremap = true })
|
||||
vim.keymap.set('n', '<leader>xq', '<cmd>TroubleToggle quickfix<cr>', { silent = true, noremap = true })
|
||||
vim.keymap.set('n', 'gR', '<cmd>TroubleToggle lsp_references<cr>', { silent = true, noremap = true })
|
||||
|
||||
-- Diagnostic signs
|
||||
-- https://github.com/folke/trouble.nvim/issues/52
|
||||
local signs = {
|
||||
Error = ' ',
|
||||
Warning = ' ',
|
||||
Hint = ' ',
|
||||
Information = ' ',
|
||||
}
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = 'DiagnosticSign' .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||
end
|
||||
end,
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
opts = {
|
||||
auto_preview = true,
|
||||
auto_fold = true,
|
||||
auto_close = true,
|
||||
use_lsp_diagnostic_signs = true,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,65 +1,58 @@
|
||||
local handler = function(virtText, lnum, endLnum, width, truncate)
|
||||
local newVirtText = {}
|
||||
local suffix = (' %d '):format(endLnum - lnum)
|
||||
local sufWidth = vim.fn.strdisplaywidth(suffix)
|
||||
local targetWidth = width - sufWidth
|
||||
local curWidth = 0
|
||||
for _, chunk in ipairs(virtText) do
|
||||
local chunkText = chunk[1]
|
||||
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||
if targetWidth > curWidth + chunkWidth then
|
||||
table.insert(newVirtText, chunk)
|
||||
else
|
||||
chunkText = truncate(chunkText, targetWidth - curWidth)
|
||||
local hlGroup = chunk[2]
|
||||
table.insert(newVirtText, { chunkText, hlGroup })
|
||||
chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||
-- str width returned from truncate() may less than 2nd argument, need padding
|
||||
if curWidth + chunkWidth < targetWidth then
|
||||
suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth)
|
||||
end
|
||||
break
|
||||
end
|
||||
curWidth = curWidth + chunkWidth
|
||||
end
|
||||
table.insert(newVirtText, { suffix, 'MoreMsg' })
|
||||
return newVirtText
|
||||
end
|
||||
|
||||
-- Not UFO in the sky, but an ultra fold in Neovim.
|
||||
-- https://github.com/kevinhwang91/nvim-ufo/
|
||||
return {
|
||||
-- Not UFO in the sky, but an ultra fold in Neovim.
|
||||
-- https://github.com/kevinhwang91/nvim-ufo/
|
||||
{
|
||||
'kevinhwang91/nvim-ufo',
|
||||
lazy = false,
|
||||
enabled = true,
|
||||
version = '*',
|
||||
dependencies = {
|
||||
'kevinhwang91/promise-async',
|
||||
{ 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' },
|
||||
{
|
||||
'luukvbaal/statuscol.nvim',
|
||||
config = function()
|
||||
local builtin = require 'statuscol.builtin'
|
||||
require('statuscol').setup {
|
||||
relculright = true,
|
||||
segments = {
|
||||
{ text = { builtin.foldfunc }, click = 'v:lua.ScFa' },
|
||||
{ text = { '%s' }, click = 'v:lua.ScSa' },
|
||||
{ text = { builtin.lnumfunc, ' ' }, click = 'v:lua.ScLa' },
|
||||
'kevinhwang91/nvim-ufo',
|
||||
version = '*',
|
||||
dependencies = {
|
||||
{ 'neovim/nvim-lspconfig' },
|
||||
{ 'kevinhwang91/promise-async' },
|
||||
{ 'nvim-treesitter/nvim-treesitter' },
|
||||
{
|
||||
-- Status column plugin that provides a configurable
|
||||
-- 'statuscolumn' and click handlers.
|
||||
-- https://github.com/luukvbaal/statuscol.nvim
|
||||
'luukvbaal/statuscol.nvim',
|
||||
config = function()
|
||||
local builtin = require 'statuscol.builtin'
|
||||
require('statuscol').setup {
|
||||
relculright = true,
|
||||
segments = {
|
||||
{
|
||||
text = { builtin.foldfunc },
|
||||
click = 'v:lua.ScFa',
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
sign = {
|
||||
namespace = { 'diagnostic/signs' },
|
||||
maxwidth = 2,
|
||||
-- auto = true,
|
||||
},
|
||||
click = 'v:lua.ScSa',
|
||||
},
|
||||
{
|
||||
text = { builtin.lnumfunc, ' ' },
|
||||
click = 'v:lua.ScLa',
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
init = function()
|
||||
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
|
||||
vim.o.foldcolumn = '1' -- '0' is not bad
|
||||
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
|
||||
vim.o.foldlevelstart = 99
|
||||
vim.o.foldenable = true
|
||||
end,
|
||||
opts = {
|
||||
},
|
||||
config = function()
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.foldingRange = {
|
||||
dynamicRegistration = false,
|
||||
lineFoldingOnly = true,
|
||||
}
|
||||
local language_servers = require('lspconfig').util.available_servers() -- or list servers manually like {'gopls', 'clangd'}
|
||||
for _, ls in ipairs(language_servers) do
|
||||
require('lspconfig')[ls].setup {
|
||||
capabilities = capabilities,
|
||||
-- you can add other fields for setting up lsp server in this table
|
||||
}
|
||||
end
|
||||
|
||||
require('ufo').setup {
|
||||
open_fold_hl_timeout = 150,
|
||||
close_fold_kinds_for_ft = { 'imports', 'comment' },
|
||||
preview = {
|
||||
@@ -75,10 +68,49 @@ return {
|
||||
jumpBot = ']',
|
||||
},
|
||||
},
|
||||
|
||||
provider_selector = function(_, _, _) -- bufnr, filetype, buftype
|
||||
return { 'treesitter', 'indent' }
|
||||
end,
|
||||
fold_virt_text_handler = handler,
|
||||
},
|
||||
},
|
||||
|
||||
-- fold_virt_text_handler
|
||||
--
|
||||
-- This handler is called when the fold text is too long to fit in the window.
|
||||
-- It is expected to truncate the text and return a new list of virtual text.
|
||||
--
|
||||
---@param virtText table The current virtual text list.
|
||||
---@param lnum number The line number of the first line in the fold.
|
||||
---@param endLnum number The line number of the last line in the fold.
|
||||
---@param width number The width of the window.
|
||||
---@param truncate function Truncate function
|
||||
---@return table
|
||||
fold_virt_text_handler = function(virtText, lnum, endLnum, width, truncate)
|
||||
local newVirtText = {}
|
||||
local suffix = (' %d '):format(endLnum - lnum)
|
||||
local sufWidth = vim.fn.strdisplaywidth(suffix)
|
||||
local targetWidth = width - sufWidth
|
||||
local curWidth = 0
|
||||
for _, chunk in ipairs(virtText) do
|
||||
local chunkText = chunk[1]
|
||||
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||
if targetWidth > curWidth + chunkWidth then
|
||||
table.insert(newVirtText, chunk)
|
||||
else
|
||||
chunkText = truncate(chunkText, targetWidth - curWidth)
|
||||
local hlGroup = chunk[2]
|
||||
table.insert(newVirtText, { chunkText, hlGroup })
|
||||
chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||
-- str width returned from truncate() may less than 2nd argument, need padding
|
||||
if curWidth + chunkWidth < targetWidth then
|
||||
suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth)
|
||||
end
|
||||
break
|
||||
end
|
||||
curWidth = curWidth + chunkWidth
|
||||
end
|
||||
table.insert(newVirtText, { suffix, 'MoreMsg' })
|
||||
return newVirtText
|
||||
end,
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@ return {
|
||||
{
|
||||
'folke/tokyonight.nvim',
|
||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
||||
init = function()
|
||||
vim.cmd.colorscheme 'tokyonight'
|
||||
end,
|
||||
init = function() vim.cmd.colorscheme(vim.g.colors_theme) end,
|
||||
opts = {
|
||||
transparent = true,
|
||||
},
|
||||
@@ -20,33 +18,155 @@ return {
|
||||
update_interval = 1000,
|
||||
set_dark_mode = function()
|
||||
vim.api.nvim_set_option_value('background', 'dark', {})
|
||||
vim.cmd 'colorscheme tokyonight-storm'
|
||||
vim.cmd.colorscheme(vim.g.colors_variant_dark)
|
||||
end,
|
||||
set_light_mode = function()
|
||||
vim.api.nvim_set_option_value('background', 'light', {})
|
||||
vim.cmd 'colorscheme tokyonight-day'
|
||||
vim.cmd.colorscheme(vim.g.colors_variant_light)
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
||||
-- Extensible Neovim Scrollbar
|
||||
-- https://github.com/petertriho/nvim-scrollbar
|
||||
{ 'petertriho/nvim-scrollbar', opts = {} },
|
||||
|
||||
-- vim dashboard
|
||||
-- https://github.com/nvimdev/dashboard-nvim
|
||||
{
|
||||
'nvimdev/dashboard-nvim',
|
||||
event = 'VimEnter',
|
||||
config = function()
|
||||
require('dashboard').setup {
|
||||
theme = 'doom',
|
||||
config = {
|
||||
disable_move = true,
|
||||
week_header = {
|
||||
enable = true,
|
||||
},
|
||||
shortcut = {},
|
||||
center = {
|
||||
{
|
||||
icon = ' ',
|
||||
icon_hl = '@variable',
|
||||
desc = 'Files',
|
||||
group = 'Label',
|
||||
action = 'Telescope find_files',
|
||||
key = 'f',
|
||||
},
|
||||
{
|
||||
icon = ' ',
|
||||
desc = 'Marks',
|
||||
group = 'DiagnosticHint',
|
||||
action = 'Telescope harpoon marks',
|
||||
key = 'a',
|
||||
},
|
||||
{
|
||||
icon = '⚑ ',
|
||||
desc = 'TODO',
|
||||
group = 'DiagnosticOptions',
|
||||
action = 'TodoTelescope',
|
||||
key = 't',
|
||||
},
|
||||
{
|
||||
icon = ' ',
|
||||
desc = 'Search',
|
||||
group = 'Number',
|
||||
action = 'Telescope live_grep',
|
||||
key = 's',
|
||||
},
|
||||
{
|
||||
icon = ' ',
|
||||
desc = 'Lazy Update',
|
||||
group = '@property',
|
||||
action = 'Lazy update',
|
||||
key = 'u',
|
||||
},
|
||||
{
|
||||
icon = '☉ ',
|
||||
desc = 'Quit',
|
||||
group = 'DiagnosticError',
|
||||
action = 'q',
|
||||
key = 'q',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
dependencies = { { 'nvim-tree/nvim-web-devicons' } },
|
||||
},
|
||||
|
||||
-- Remove all background colors to make nvim transparent
|
||||
-- https://github.com/xiyaowong/nvim-transparent
|
||||
{ 'xiyaowong/nvim-transparent' },
|
||||
{ 'xiyaowong/nvim-transparent', opts = {} },
|
||||
|
||||
-- Twilight is a Lua plugin for Neovim 0.5 that dims inactive
|
||||
-- portions of the code you're editing using TreeSitter.
|
||||
-- https://github.com/folke/twilight.nvim
|
||||
{ 'folke/twilight.nvim', opts = {} },
|
||||
|
||||
-- Indent guides for Neovim
|
||||
-- https://github.com/lukas-reineke/indent-blankline.nvim
|
||||
{
|
||||
'folke/twilight.nvim',
|
||||
ft = 'markdown', -- Highlight markdown files
|
||||
'lukas-reineke/indent-blankline.nvim',
|
||||
main = 'ibl',
|
||||
config = function()
|
||||
require('ibl').setup {
|
||||
indent = {
|
||||
char = '│',
|
||||
},
|
||||
exclude = {
|
||||
filetypes = { 'terminal', 'dashboard' },
|
||||
buftypes = { 'dashboard' },
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- Git integration for buffers
|
||||
-- https://github.com/lewis6991/gitsigns.nvim
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
version = false,
|
||||
lazy = false,
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
current_line_blame = false,
|
||||
on_attach = function(bufnr)
|
||||
local gs = require 'gitsigns'
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', 'gn', function()
|
||||
if vim.wo.diff then return ']c' end
|
||||
vim.schedule(function() gs.next_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true })
|
||||
|
||||
map('n', 'gp', function()
|
||||
if vim.wo.diff then return '[c' end
|
||||
vim.schedule(function() gs.prev_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true })
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
||||
-- Seamless navigation between tmux panes and vim splits
|
||||
-- https://github.com/christoomey/vim-tmux-navigator
|
||||
{
|
||||
'christoomey/vim-tmux-navigator',
|
||||
lazy = false,
|
||||
enabled = true,
|
||||
cmd = {
|
||||
'TmuxNavigateLeft',
|
||||
'TmuxNavigateDown',
|
||||
@@ -54,60 +174,48 @@ return {
|
||||
'TmuxNavigateRight',
|
||||
'TmuxNavigatePrevious',
|
||||
},
|
||||
keys = {
|
||||
{ '<c-h>', '<cmd><C-U>TmuxNavigateLeft<cr>' },
|
||||
{ '<c-j>', '<cmd><C-U>TmuxNavigateDown<cr>' },
|
||||
{ '<c-k>', '<cmd><C-U>TmuxNavigateUp<cr>' },
|
||||
{ '<c-l>', '<cmd><C-U>TmuxNavigateRight<cr>' },
|
||||
{ '<c-\\>', '<cmd><C-U>TmuxNavigatePrevious<cr>' },
|
||||
},
|
||||
},
|
||||
|
||||
-- Cloak allows you to overlay *'s over defined patterns in defined files.
|
||||
-- https://github.com/laytan/cloak.nvim
|
||||
{
|
||||
'laytan/cloak.nvim',
|
||||
enabled = true,
|
||||
lazy = false,
|
||||
version = '*',
|
||||
config = function()
|
||||
require('cloak').setup {
|
||||
enabled = true,
|
||||
cloak_character = '*',
|
||||
-- The applied highlight group (colors) on the cloaking, see `:h highlight`.
|
||||
highlight_group = 'Comment',
|
||||
patterns = {
|
||||
{
|
||||
-- Match any file starting with ".env".
|
||||
-- This can be a table to match multiple file patterns.
|
||||
file_pattern = {
|
||||
'.env*',
|
||||
'wrangler.toml',
|
||||
'.dev.vars',
|
||||
},
|
||||
-- Match an equals sign and any character after it.
|
||||
-- This can also be a table of patterns to cloak,
|
||||
-- example: cloak_pattern = { ":.+", "-.+" } for yaml files.
|
||||
cloak_pattern = '=.+',
|
||||
opts = {
|
||||
enabled = true,
|
||||
cloak_character = '*',
|
||||
-- The applied highlight group (colors) on the cloaking, see `:h highlight`.
|
||||
highlight_group = 'Comment',
|
||||
patterns = {
|
||||
{
|
||||
-- Match any file starting with ".env".
|
||||
-- This can be a table to match multiple file patterns.
|
||||
file_pattern = {
|
||||
'.env*',
|
||||
'wrangler.toml',
|
||||
'.dev.vars',
|
||||
},
|
||||
-- Match an equals sign and any character after it.
|
||||
-- This can also be a table of patterns to cloak,
|
||||
-- example: cloak_pattern = { ":.+", "-.+" } for yaml files.
|
||||
cloak_pattern = '=.+',
|
||||
},
|
||||
}
|
||||
end,
|
||||
keys = {
|
||||
{ '<leader>tc', '<cmd>CloakToggle<cr>', desc = '[tc] Toggle Cloak' },
|
||||
},
|
||||
},
|
||||
},
|
||||
-- Close buffer without messing up with the window.
|
||||
-- https://github.com/famiu/bufdelete.nvim
|
||||
{ 'famiu/bufdelete.nvim' },
|
||||
|
||||
-- Neovim plugin for locking a buffer to a window
|
||||
-- https://github.com/stevearc/stickybuf.nvim
|
||||
{ 'stevearc/stickybuf.nvim', opts = {} },
|
||||
|
||||
-- Describe the regexp under the cursor
|
||||
-- https://github.com/bennypowers/nvim-regexplainer
|
||||
{
|
||||
'bennypowers/nvim-regexplainer',
|
||||
lazy = false,
|
||||
enabled = true,
|
||||
event = 'BufEnter',
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
'MunifTanjim/nui.nvim',
|
||||
@@ -117,24 +225,11 @@ return {
|
||||
auto = true,
|
||||
},
|
||||
},
|
||||
|
||||
-- Clarify and beautify your comments using boxes and lines.
|
||||
-- https://github.com/LudoPinelli/comment-box.nvim
|
||||
{
|
||||
'LudoPinelli/comment-box.nvim',
|
||||
opts = {},
|
||||
init = function()
|
||||
local wk = require 'which-key'
|
||||
{ 'LudoPinelli/comment-box.nvim', opts = {} },
|
||||
|
||||
wk.add {
|
||||
{ '<leader>cb', group = 'CommentBox' },
|
||||
{ '<Leader>cbt', '<Cmd>CBccbox<CR>', desc = 'CommentBox: Box Title' },
|
||||
{ '<Leader>cbd', '<Cmd>CBd<CR>', desc = 'Remove a box' },
|
||||
{ '<Leader>cbl', '<Cmd>CBline<CR>', desc = 'CommentBox: Simple Line' },
|
||||
{ '<Leader>cbm', '<Cmd>CBllbox14<CR>', desc = 'CommentBox: Marked' },
|
||||
{ '<Leader>cbt', '<Cmd>CBllline<CR>', desc = 'CommentBox: Titled Line' },
|
||||
}
|
||||
end,
|
||||
},
|
||||
-- Automatically expand width of the current window.
|
||||
-- Maximizes and restore it. And all this with nice animations!
|
||||
-- https://github.com/anuvyklack/windows.nvim
|
||||
@@ -144,11 +239,18 @@ return {
|
||||
'anuvyklack/middleclass',
|
||||
'anuvyklack/animation.nvim',
|
||||
},
|
||||
config = function()
|
||||
vim.o.winwidth = 15
|
||||
vim.o.winminwidth = 10
|
||||
vim.o.equalalways = false
|
||||
require('windows').setup()
|
||||
end,
|
||||
opts = {},
|
||||
},
|
||||
|
||||
-- Plugin to improve viewing Markdown files in Neovim
|
||||
-- https://github.com/MeanderingProgrammer/render-markdown.nvim
|
||||
{
|
||||
'MeanderingProgrammer/render-markdown.nvim',
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
ft = 'markdown',
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
|
||||
3
config/nvim/lua/plugins/vim-sleuth.lua
Normal file
3
config/nvim/lua/plugins/vim-sleuth.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
-- Detect tabstop and shiftwidth automatically
|
||||
-- https://github.com/tpope/vim-sleuth
|
||||
return { 'tpope/vim-sleuth' }
|
||||
4
config/nvim/lua/plugins/wakatime.lua
Normal file
4
config/nvim/lua/plugins/wakatime.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
-- Vim plugin for automatic time tracking and metrics
|
||||
-- generated from your programming activity.
|
||||
-- https://github.com/wakatime/vim-wakatime
|
||||
return { 'wakatime/vim-wakatime', lazy = false, enabled = true }
|
||||
626
config/nvim/lua/plugins/which-key.lua
Normal file
626
config/nvim/lua/plugins/which-key.lua
Normal file
@@ -0,0 +1,626 @@
|
||||
-- Useful plugin to show you pending keybinds.
|
||||
-- https://github.com/folke/which-key.nvim
|
||||
return {
|
||||
'folke/which-key.nvim',
|
||||
lazy = false,
|
||||
version = '*',
|
||||
priority = 1001, -- Make sure to load this as soon as possible
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'echasnovski/mini.icons',
|
||||
},
|
||||
config = function()
|
||||
local wk = require 'which-key'
|
||||
wk.setup()
|
||||
|
||||
wk.add {
|
||||
-- ╭─────────────────────────────────────────────────────────╮
|
||||
-- │ With leader │
|
||||
-- ╰─────────────────────────────────────────────────────────╯
|
||||
|
||||
-- ── Buffer ──────────────────────────────────────────────────────────
|
||||
{
|
||||
'<leader>b',
|
||||
group = '[b] Buffer',
|
||||
-- Add the current buffers to the menu
|
||||
expand = function() return require('which-key.extras').expand.buf() end,
|
||||
},
|
||||
{
|
||||
{ '<leader>bk', '<cmd>blast<cr>', desc = 'Buffer: Last' },
|
||||
{ '<leader>bj', '<cmd>bfirst<cr>', desc = 'Buffer: First' },
|
||||
{ '<leader>bh', '<cmd>bprev<cr>', desc = 'Buffer: Prev' },
|
||||
{ '<leader>bl', '<cmd>bnext<cr>', desc = 'Buffer: Next' },
|
||||
{ '<leader>bd', '<cmd>Bdelete<cr>', desc = 'Buffer: Delete' },
|
||||
{ '<leader>bw', '<cmd>Bwipeout<cr>', desc = 'Buffer: Wipeout' },
|
||||
},
|
||||
|
||||
-- ── Code ────────────────────────────────────────────────────────────
|
||||
{ '<leader>c', group = '[c] Code' },
|
||||
{
|
||||
'<leader>ca',
|
||||
'<cmd>lua vim.lsp.buf.code_action()<CR>',
|
||||
desc = 'LSP: Code Action',
|
||||
},
|
||||
{
|
||||
'<leader>cg',
|
||||
'<cmd>lua require("neogen").generate()<CR>',
|
||||
desc = 'Generate annotations',
|
||||
},
|
||||
|
||||
-- Code: treesj
|
||||
{ '<leader>cc', group = 'Code Split/Join' },
|
||||
-- see: lua/plugins/treesj.lua
|
||||
{ '<leader>cct', '<cmd>TSJToggle<CR>', desc = 'Split/Join: Toggle' },
|
||||
{ '<leader>ccs', '<cmd>TSJSplit<CR>', desc = 'Split/Join: Split' },
|
||||
{ '<leader>ccj', '<cmd>TSJJoin<CR>', desc = 'Split/Join: Join' },
|
||||
|
||||
-- ── Code: CommentBox ────────────────────────────────────────────────
|
||||
{ '<leader>cb', group = 'CommentBox' },
|
||||
{ '<leader>cbb', '<Cmd>CBccbox<CR>', desc = 'CommentBox: Box Title' },
|
||||
{ '<leader>cbd', '<Cmd>CBd<CR>', desc = 'CommentBox: Remove a box' },
|
||||
{ '<leader>cbl', '<Cmd>CBline<CR>', desc = 'CommentBox: Simple Line' },
|
||||
{ '<leader>cbm', '<Cmd>CBllbox14<CR>', desc = 'CommentBox: Marked' },
|
||||
{ '<leader>cbt', '<Cmd>CBllline<CR>', desc = 'CommentBox: Titled Line' },
|
||||
|
||||
-- ── Code: Refactoring ───────────────────────────────────────────────
|
||||
{ '<leader>cx', group = '[x] Refactoring' },
|
||||
{
|
||||
mode = { 'x' },
|
||||
-- Extract function supports only visual mode
|
||||
{
|
||||
'<leader>cxe',
|
||||
"<cmd>lua require('refactoring').refactor('Extract Function')<cr>",
|
||||
desc = 'Extract Function',
|
||||
},
|
||||
{
|
||||
'<leader>cxf',
|
||||
"<cmd>lua require('refactoring').refactor('Extract Function To File')<cr>",
|
||||
desc = 'Extract Function to File',
|
||||
},
|
||||
-- Extract variable supports only visual mode
|
||||
{
|
||||
'<leader>cxv',
|
||||
"<cmd>lua require('refactoring').refactor('Extract Variable')<cr>",
|
||||
desc = 'Extract Variable',
|
||||
},
|
||||
},
|
||||
-- Inline func supports only normal
|
||||
{
|
||||
'<leader>cxif',
|
||||
"<cmd>lua require('refactoring').refactor('Inline Function')<cr>",
|
||||
desc = 'Inline Function',
|
||||
},
|
||||
-- Extract block supports only normal mode
|
||||
{
|
||||
'<leader>cxb',
|
||||
"<cmd>lua require('refactoring').refactor('Extract Block')<cr>",
|
||||
desc = 'Extract Block',
|
||||
},
|
||||
{
|
||||
'<leader>cxbf',
|
||||
"<cmd>lua require('refactoring').refactor('Extract Block To File')<cr>",
|
||||
desc = 'Extract Block to File',
|
||||
},
|
||||
{
|
||||
mode = { 'n', 'x' },
|
||||
-- Inline var supports both normal and visual mode
|
||||
{
|
||||
'<leader>cxiv',
|
||||
"<cmd>lua require('refactoring').refactor('Inline Variable')<cr>",
|
||||
desc = 'Inline Variable',
|
||||
},
|
||||
},
|
||||
|
||||
-- ── Code: LSPSaga ───────────────────────────────────────────────────
|
||||
-- See: lua/plugins/lsp.lua
|
||||
{
|
||||
'<C-a>',
|
||||
'<cmd>Lspsaga term_toggle<cr>',
|
||||
desc = 'LSPSaga: Open Floaterm',
|
||||
},
|
||||
{
|
||||
'<leader>ca',
|
||||
'<cmd>Lspsaga code_action<cr>',
|
||||
desc = 'LSPSaga: Code Actions',
|
||||
},
|
||||
{
|
||||
'<leader>cci',
|
||||
'<cmd>Lspsaga incoming_calls<cr>',
|
||||
desc = 'LSPSaga: Incoming Calls',
|
||||
},
|
||||
{
|
||||
'<leader>cco',
|
||||
'<cmd>Lspsaga outgoing_calls<cr>',
|
||||
desc = 'LSPSaga: Outgoing Calls',
|
||||
},
|
||||
{
|
||||
'<leader>cd',
|
||||
'<cmd>Lspsaga show_line_diagnostics<cr>',
|
||||
desc = 'LSPSaga: Show Line Diagnostics',
|
||||
},
|
||||
{
|
||||
'<leader>cf',
|
||||
'<cmd>lua require("conform").format({ async = true, lsp_fallback = true })<cr>',
|
||||
mode = { 'n', 'v' },
|
||||
desc = 'Format buffer',
|
||||
},
|
||||
{
|
||||
'<leader>ci',
|
||||
'<cmd>Lspsaga implement<cr>',
|
||||
desc = 'LSPSaga: Implementations',
|
||||
},
|
||||
{
|
||||
'<leader>cl',
|
||||
'<cmd>Lspsaga show_cursor_diagnostics<cr>',
|
||||
desc = 'LSPSaga: Show Cursor Diagnostics',
|
||||
},
|
||||
{
|
||||
'<leader>cp',
|
||||
'<cmd>Lspsaga peek_definition<cr>',
|
||||
desc = 'LSPSaga: Peek Definition',
|
||||
},
|
||||
{ '<leader>cr', '<cmd>Lspsaga rename<cr>', desc = 'LSPSaga: Rename' },
|
||||
{
|
||||
'<leader>cR',
|
||||
'<cmd>Lspsaga rename ++project<cr>',
|
||||
desc = 'LSPSaga: Rename Project wide',
|
||||
},
|
||||
{
|
||||
'<leader>cs',
|
||||
'<cmd>Lspsaga signature_help<cr>',
|
||||
desc = 'LSPSaga: Signature Documentation',
|
||||
},
|
||||
{
|
||||
'<leader>ct',
|
||||
'<cmd>Lspsaga peek_type_definition<cr>',
|
||||
desc = 'LSPSaga: Peek Type Definition',
|
||||
},
|
||||
{
|
||||
'<leader>cu',
|
||||
'<cmd>Lspsaga preview_definition<cr>',
|
||||
desc = 'LSPSaga: Preview Definition',
|
||||
},
|
||||
{
|
||||
'<leader>cv',
|
||||
'<cmd>Lspsaga diagnostic_jump_prev<cr>',
|
||||
desc = 'LSPSaga: Diagnostic Jump Prev',
|
||||
},
|
||||
{
|
||||
'<leader>cw',
|
||||
'<cmd>Lspsaga diagnostic_jump_next<cr>',
|
||||
desc = 'LSPSaga: Diagnostic Jump Next',
|
||||
},
|
||||
{
|
||||
'<leader>cx',
|
||||
'<cmd>Telescope import<cr>',
|
||||
desc = 'Telescope import',
|
||||
},
|
||||
|
||||
-- ── DAP ─────────────────────────────────────────────────────────────
|
||||
{ '<leader>d', group = '[d] DAP' },
|
||||
{
|
||||
{
|
||||
'<leader>db',
|
||||
'<cmd>DapToggleBreakpoint',
|
||||
desc = 'DAP: Toggle Breakpoint',
|
||||
},
|
||||
{ '<leader>dc', '<cmd>DapContinue', desc = 'DAP: Continue' },
|
||||
{
|
||||
'<leader>do',
|
||||
'<cmd>lua vim.diagnostic.open_float()<CR>',
|
||||
desc = 'Diagnostic: Open float',
|
||||
},
|
||||
{
|
||||
'<leader>dq',
|
||||
'<cmd>lua vim.diagnostic.setloclist()<CR>',
|
||||
desc = 'Diagnostic: Set loc list',
|
||||
},
|
||||
{
|
||||
'<leader>dr',
|
||||
"<cmd>lua require('dapui').open({reset = true})<CR>",
|
||||
desc = 'DAP: Reset',
|
||||
},
|
||||
{
|
||||
'<leader>ds',
|
||||
'<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>',
|
||||
desc = 'LSP: Document Symbols',
|
||||
},
|
||||
{ '<leader>dt', '<cmd>DapUiToggle', desc = 'DAP: Toggle UI' },
|
||||
},
|
||||
|
||||
-- ── Harpoon ─────────────────────────────────────────────────────────
|
||||
-- See: lua/plugins/telescope.lua
|
||||
{ '<leader>h', group = '[h] Harpoon' },
|
||||
{
|
||||
{
|
||||
'<leader>ha',
|
||||
'<cmd>lua require("harpoon"):list():add()<cr>',
|
||||
desc = 'harpoon file',
|
||||
},
|
||||
{
|
||||
'<leader>hn',
|
||||
'<cmd>lua require("harpoon"):list():next()<cr>',
|
||||
desc = 'harpoon to next file',
|
||||
},
|
||||
{
|
||||
'<leader>hp',
|
||||
'<cmd>lua require("harpoon"):list():prev()<cr>',
|
||||
desc = 'harpoon to previous file',
|
||||
},
|
||||
{
|
||||
'<leader>ht',
|
||||
"<cmd>lua require('harpoon.ui').toggle_quick_menu()<CR>",
|
||||
desc = 'DAP: Harpoon UI',
|
||||
},
|
||||
},
|
||||
|
||||
-- ── LSP ─────────────────────────────────────────────────────────────
|
||||
{ '<leader>l', group = '[l] LSP' },
|
||||
-- See: lua/plugins/lsp.lua
|
||||
|
||||
-- ── Quit ────────────────────────────────────────────────────────────
|
||||
{ '<leader>q', group = '[q] Quit' },
|
||||
{
|
||||
{ '<leader>qf', '<cmd>q<CR>', desc = 'Quicker close split' },
|
||||
{ '<leader>qq', '<cmd>wq!<CR>', desc = 'Quit with force saving' },
|
||||
{ '<leader>qw', '<cmd>wq<CR>', desc = 'Write and quit' },
|
||||
},
|
||||
|
||||
-- ── Search ──────────────────────────────────────────────────────────
|
||||
{ '<leader>s', group = '[s] Search' },
|
||||
-- See: lua/plugins/telescope.lua
|
||||
{
|
||||
'<leader><space>',
|
||||
'<cmd>Telescope buffers<cr>',
|
||||
desc = 'Find existing buffers',
|
||||
},
|
||||
{
|
||||
'<leader>sc',
|
||||
'<cmd>Telescope commands<CR>',
|
||||
desc = 'Telescope: Commands',
|
||||
},
|
||||
{
|
||||
'<leader>sd',
|
||||
'<cmd>Telescope diagnostics<cr>',
|
||||
desc = 'Search Diagnostics',
|
||||
},
|
||||
{
|
||||
'<leader>sg',
|
||||
'<cmd>Telescope live_grep<cr>',
|
||||
desc = 'Search by Grep',
|
||||
},
|
||||
{
|
||||
'<leader>sh',
|
||||
'<cmd>Telescope highlights<cr>',
|
||||
desc = 'List highlights',
|
||||
},
|
||||
{
|
||||
'<leader>sl',
|
||||
'<cmd>Telescope luasnip<CR>',
|
||||
desc = 'Search LuaSnip',
|
||||
},
|
||||
{
|
||||
'<leader>sm',
|
||||
'<cmd>Telescope harpoon marks<CR>',
|
||||
desc = 'Harpoon Marks',
|
||||
},
|
||||
{
|
||||
'<leader>sn',
|
||||
"<cmd>lua require('telescope').extensions.notify.notify()<CR>",
|
||||
desc = 'Show Notifications',
|
||||
},
|
||||
{
|
||||
'<leader>so',
|
||||
'<cmd>Telescope oldfiles<cr>',
|
||||
desc = 'Find recently Opened files',
|
||||
},
|
||||
{
|
||||
'<leader>sp',
|
||||
"<cmd>lua require('telescope').extensions.lazy_plugins.lazy_plugins()<cr>",
|
||||
desc = 'Find neovim/lazy configs',
|
||||
},
|
||||
{
|
||||
'<leader>sq',
|
||||
'<cmd>Telescope quickfix<cr>',
|
||||
desc = 'Quickfix list',
|
||||
},
|
||||
{
|
||||
'<leader>sr',
|
||||
group = 'References',
|
||||
{
|
||||
'<leader>srd',
|
||||
'<cmd>Telescope lsp_definitions<CR>',
|
||||
desc = 'Definitions',
|
||||
},
|
||||
{
|
||||
'<leader>sri',
|
||||
'<cmd>Telescope lsp_implementations<CR>',
|
||||
desc = 'Implementations',
|
||||
},
|
||||
{
|
||||
'<leader>srp',
|
||||
'<cmd>Telescope lsp_document_symbols<CR>',
|
||||
desc = 'Document Symbols',
|
||||
},
|
||||
{
|
||||
'<leader>srr',
|
||||
'<cmd>Telescope lsp_references<CR>',
|
||||
desc = 'LSP References',
|
||||
},
|
||||
{
|
||||
'<leader>srt',
|
||||
'<cmd>Telescope lsp_type_definitions<CR>',
|
||||
desc = 'Type Definitions',
|
||||
},
|
||||
{
|
||||
'<leader>srw',
|
||||
'<cmd>Telescope lsp_workspace_symbols<CR>',
|
||||
desc = 'Workspace Symbols',
|
||||
},
|
||||
},
|
||||
{
|
||||
'<leader>ss',
|
||||
'<cmd>Telescope treesitter',
|
||||
desc = 'Treesitter symbols',
|
||||
},
|
||||
{ '<leader>st', '<cmd>TodoTelescope<CR>', desc = 'Telescope: Show Todo' },
|
||||
{
|
||||
'<leader>sw',
|
||||
'<cmd>Telescope grep_string<cr>',
|
||||
desc = 'Search current Word',
|
||||
},
|
||||
|
||||
-- ── Toggle ──────────────────────────────────────────────────────────
|
||||
{ '<leader>t', group = '[t] Toggle' },
|
||||
{
|
||||
{ '<leader>tc', '<cmd>CloakToggle<cr>', desc = 'Toggle Cloak' },
|
||||
{ '<leader>tn', '<cmd>Noice dismiss<CR>', desc = 'Noice dismiss' },
|
||||
{ '<leader>ts', '<cmd>noh<CR>', desc = 'Toggle Search Highlighting' },
|
||||
{
|
||||
'<leader>tt',
|
||||
'<cmd>TransparentToggle<CR>',
|
||||
desc = 'Toggle Transparency',
|
||||
},
|
||||
{ '<leader>tw', '<cmd>Twilight<cr>', desc = 'Toggle Twilight' },
|
||||
},
|
||||
|
||||
-- ── Workspace ───────────────────────────────────────────────────────
|
||||
{ '<leader>w', group = '[w] Workspace' },
|
||||
{
|
||||
{
|
||||
'<leader>wa',
|
||||
'<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>',
|
||||
desc = 'LSP: Workspace Add Folder',
|
||||
},
|
||||
{
|
||||
'<leader>wl',
|
||||
'<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>',
|
||||
desc = 'LSP: Workspace List Folders',
|
||||
},
|
||||
{
|
||||
'<leader>wr',
|
||||
'<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>',
|
||||
desc = 'LSP: Workspace Remove Folder',
|
||||
},
|
||||
{
|
||||
'<leader>ws',
|
||||
'<cmd>lua require("telescope.builtin").lsp_dynamic_workspace_symbols()<CR>',
|
||||
desc = 'LSP: Workspace Symbols',
|
||||
},
|
||||
},
|
||||
|
||||
-- ── Trouble ─────────────────────────────────────────────────────────
|
||||
{ '<leader>x', group = '[x] Trouble' },
|
||||
{
|
||||
{
|
||||
'<leader>xx',
|
||||
'<cmd>Trouble diagnostics<cr>',
|
||||
desc = 'Toggle Trouble Diagnostics',
|
||||
},
|
||||
{
|
||||
'<leader>xw',
|
||||
'<cmd>Trouble workspace_diagnostics<cr>',
|
||||
desc = 'Toggle Workspace Diagnostics',
|
||||
},
|
||||
{
|
||||
'<leader>xd',
|
||||
'<cmd>Trouble document_diagnostics<cr>',
|
||||
desc = 'Toggle Document Diagnostics',
|
||||
},
|
||||
{ '<leader>xl', '<cmd>Trouble loclist<cr>', desc = 'Toggle Loclist' },
|
||||
{ '<leader>xq', '<cmd>Trouble quickfix<cr>', desc = 'Toggle Quickfix' },
|
||||
},
|
||||
|
||||
-- ── Help ────────────────────────────────────────────────────────────
|
||||
{ '<leader>?', group = '[?] Help & Cheat sheets' },
|
||||
{
|
||||
{
|
||||
'<leader>?h',
|
||||
'<cmd>Telescope help_tags<cr>',
|
||||
desc = 'Help tags',
|
||||
},
|
||||
{
|
||||
'<leader>?m',
|
||||
'<cmd>Telescope man_pages<cr>',
|
||||
desc = 'Man pages',
|
||||
},
|
||||
{
|
||||
'<leader>?w',
|
||||
'<cmd>lua require("which-key").show({global = true})<cr>',
|
||||
desc = 'Buffer Local Keymaps (which-key)',
|
||||
},
|
||||
},
|
||||
|
||||
-- ── Misc ────────────────────────────────────────────────────────────
|
||||
{
|
||||
'<leader>D',
|
||||
'<cmd>lua vim.lsp.buf.type_definition()<CR>',
|
||||
desc = 'LSP: Type Definition',
|
||||
},
|
||||
{ '<leader>e', '<cmd>Neotree reveal<CR>', desc = 'NeoTree reveal' },
|
||||
|
||||
-- ╭─────────────────────────────────────────────────────────╮
|
||||
-- │ Without leader │
|
||||
-- ╰─────────────────────────────────────────────────────────╯
|
||||
{ 'y', group = 'Yank & Surround' },
|
||||
|
||||
{ 'gp', group = 'Goto Preview' },
|
||||
{
|
||||
{
|
||||
'gpd',
|
||||
'<cmd>lua require("goto-preview").goto_preview_definition()<CR>',
|
||||
desc = 'Goto: Preview Definition',
|
||||
},
|
||||
{
|
||||
'gpi',
|
||||
'<cmd>lua require("goto-preview").goto_preview_implementation()<CR>',
|
||||
desc = 'Goto: Preview Implementation',
|
||||
},
|
||||
{
|
||||
'gpP',
|
||||
'<cmd>lua require("goto-preview").close_all_windows()<CR>',
|
||||
desc = 'Goto: Close All Preview Windows',
|
||||
},
|
||||
},
|
||||
|
||||
-- ── tmux navigation ─────────────────────────────────────────────────
|
||||
{
|
||||
{
|
||||
'<c-h>',
|
||||
'<cmd><C-U>TmuxNavigateLeft<cr>',
|
||||
desc = 'tmux: Navigate Left',
|
||||
},
|
||||
{
|
||||
'<c-j>',
|
||||
'<cmd><C-U>TmuxNavigateDown<cr>',
|
||||
desc = 'tmux: Navigate Down',
|
||||
},
|
||||
{ '<c-k>', '<cmd><C-U>TmuxNavigateUp<cr>', desc = 'tmux: Navigate Up' },
|
||||
{
|
||||
'<c-l>',
|
||||
'<cmd><C-U>TmuxNavigateRight<cr>',
|
||||
desc = 'tmux: Navigate Right',
|
||||
},
|
||||
{
|
||||
'<c-\\>',
|
||||
'<cmd><C-U>TmuxNavigatePrevious<cr>',
|
||||
desc = 'tmux: Navigate Previous',
|
||||
},
|
||||
},
|
||||
|
||||
-- ── Old habits ──────────────────────────────────────────────────────
|
||||
{ '<C-s>', '<cmd>w<CR>', desc = 'Save file' },
|
||||
|
||||
-- ── Text manipulation in visual mode ────────────────────────────────
|
||||
{
|
||||
mode = 'v',
|
||||
{ '>', '>gv', desc = 'Indent Right' },
|
||||
{ '<', '<gv', desc = 'Indent Left' },
|
||||
{ 'J', "<cmd>m '>+1<CR>gv=gv", desc = 'Move Block Down' },
|
||||
{ 'K', "<cmd>m '<-2<CR>gv=gv", desc = 'Move Block Up' },
|
||||
},
|
||||
|
||||
-- ── LSP ─────────────────────────────────────────────────────────────
|
||||
{
|
||||
'<C-k>',
|
||||
'<cmd>lua vim.lsp.buf.signature_help()<CR>',
|
||||
desc = 'LSP: Signature Documentation',
|
||||
},
|
||||
{
|
||||
'K',
|
||||
'<cmd>Lspsaga hover_doc<cr>',
|
||||
desc = 'LSPSaga: Hover Documentation',
|
||||
},
|
||||
|
||||
{ 'd', group = 'Diagnostics' },
|
||||
{
|
||||
{
|
||||
'dn',
|
||||
'<cmd>lua vim.diagnostic.goto_next()<CR>',
|
||||
desc = 'Diagnostic: Goto Next',
|
||||
},
|
||||
{
|
||||
'dp',
|
||||
'<cmd>lua vim.diagnostic.goto_prev()<CR>',
|
||||
desc = 'Diagnostic: Goto Prev',
|
||||
},
|
||||
},
|
||||
{
|
||||
{ 'g', group = 'Goto' },
|
||||
{
|
||||
'gD',
|
||||
'<cmd>lua vim.lsp.buf.declaration()<CR>',
|
||||
desc = 'LSP: Goto Declaration',
|
||||
},
|
||||
{
|
||||
'gI',
|
||||
'<cmd>lua vim.lsp.buf.implementation()<CR>',
|
||||
desc = 'LSP: Goto Implementation',
|
||||
},
|
||||
{
|
||||
'gR',
|
||||
'<cmd>Trouble lsp_references<cr>',
|
||||
desc = 'Toggle LSP References',
|
||||
},
|
||||
{
|
||||
'gd',
|
||||
'<cmd>lua vim.lsp.buf.definition()<CR>',
|
||||
desc = 'LSP: Goto Definition',
|
||||
},
|
||||
{
|
||||
'gr',
|
||||
'<cmd>lua require("telescope.builtin").lsp_references()<CR>',
|
||||
desc = 'LSP: Goto References',
|
||||
},
|
||||
},
|
||||
|
||||
-- ── Misc keybinds ───────────────────────────────────────────────────
|
||||
-- Sublime-like shortcut 'go to file' ctrl+p.
|
||||
{
|
||||
'<C-p>',
|
||||
'<cmd>Telescope find_files<CR>',
|
||||
desc = 'Search for files starting at current directory.',
|
||||
},
|
||||
{ 'QQ', '<cmd>q!<CR>', desc = 'Quit without saving' },
|
||||
{ 'WW', '<cmd>w!<CR>', desc = 'Force write to file' },
|
||||
{ 'ss', '<cmd>noh<CR>', desc = 'Clear Search Highlighting' },
|
||||
{
|
||||
'jj',
|
||||
'<Esc>',
|
||||
desc = 'Esc without touching esc in insert mode',
|
||||
mode = 'i',
|
||||
},
|
||||
|
||||
-- ── Splits ──────────────────────────────────────────────────────────
|
||||
-- Use CTRL+<hjkl> to switch between windows in normal mode
|
||||
-- See `:help wincmd` for a list of all window commands
|
||||
{ '<C-h>', '<C-w><C-h>', desc = 'Move focus to the left window' },
|
||||
{ '<C-l>', '<C-w><C-l>', desc = 'Move focus to the right window' },
|
||||
{ '<C-j>', '<C-w><C-j>', desc = 'Move focus to the lower window' },
|
||||
{ '<C-k>', '<C-w><C-k>', desc = 'Move focus to the upper window' },
|
||||
-- Split resizing
|
||||
{ '<C-w>,', '<cmd>vertical resize -10<CR>', desc = 'V Resize -' },
|
||||
{ '<C-w>.', '<cmd>vertical resize +10<CR>', desc = 'V Resize +' },
|
||||
|
||||
-- ── Disable arrow keys in normal mode ───────────────────────────────
|
||||
{ '<left>', '<cmd>echo "Use h to move!!"<CR>' },
|
||||
{ '<right>', '<cmd>echo "Use l to move!!"<CR>' },
|
||||
{ '<up>', '<cmd>echo "Use k to move!!"<CR>' },
|
||||
{ '<down>', '<cmd>echo "Use j to move!!"<CR>' },
|
||||
|
||||
-- ── Terminal ────────────────────────────────────────────────────────
|
||||
-- Exit terminal mode in the builtin terminal with a shortcut that is
|
||||
-- a bit easier for people to discover. Otherwise, you normally need
|
||||
-- to press <C-\><C-n>, which is not what someone will guess without
|
||||
-- a bit more experience.
|
||||
--
|
||||
-- NOTE: This won't work in all terminal emulators/tmux/etc.
|
||||
-- Try your own mapping or just use <C-\><C-n> to exit terminal mode.
|
||||
{ '<Esc><Esc>', '<C-\\><C-n>', desc = 'Exit terminal mode', mode = 't' },
|
||||
|
||||
-- ── Search ──────────────────────────────────────────────────────────
|
||||
-- :noh if you have search highlights
|
||||
{ '<Esc><Esc>', '<cmd>noh<CR>', desc = 'Clear search highlights' },
|
||||
}
|
||||
end,
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#'ve
|
||||
i/!
|
||||
i've/!
|
||||
I've
|
||||
I
|
||||
good
|
||||
#rd
|
||||
#rd/!
|
||||
#rd
|
||||
#rd
|
||||
#rd/!
|
||||
#rd
|
||||
wrd/!
|
||||
462
config/nvim/snippets/javascript.json
Normal file
462
config/nvim/snippets/javascript.json
Normal file
@@ -0,0 +1,462 @@
|
||||
{
|
||||
"While ..": {
|
||||
"body": [
|
||||
"while (${1:condition}) {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"prefix": "while .."
|
||||
},
|
||||
"argv (node)": {
|
||||
"body": "const argv = process.argv.slice(2);",
|
||||
"description": "Arguments from the command line. [0] is the node executable path, [1] the path of the file being executed, making [2] the first positional argument.",
|
||||
"prefix": "argv (node)"
|
||||
},
|
||||
"cast (JSDoc)": {
|
||||
"body": "/** @type {${1:string}} */ (${2:bracketedVar})",
|
||||
"prefix": "cast (JSDoc)"
|
||||
},
|
||||
"class (JSDoc) + typedef (JSDoc)": {
|
||||
"body": [
|
||||
"/** @typedef {Object} ${1:name}",
|
||||
" * @property {${2:string}} ${3:prop1}",
|
||||
" */"
|
||||
],
|
||||
"description": "https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#typedef-callback-and-param",
|
||||
"prefix": [
|
||||
"class (JSDoc)",
|
||||
"typedef (JSDoc)"
|
||||
]
|
||||
},
|
||||
"do .. while ..": {
|
||||
"body": [
|
||||
"do {",
|
||||
"\t$0",
|
||||
"} while (${1:condition});"
|
||||
],
|
||||
"prefix": [
|
||||
"do .. while",
|
||||
"repeat until"
|
||||
]
|
||||
},
|
||||
"ec (export const)": {
|
||||
"body": "export const ${1:CONSTANT}",
|
||||
"prefix": "ec (export const)"
|
||||
},
|
||||
"ef (export function)": {
|
||||
"body": [
|
||||
"export function ${1:name}($2) {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"prefix": "ef (export function)"
|
||||
},
|
||||
"filter ( => )": {
|
||||
"body": "filter(${1:item} => ${1:item}$0)",
|
||||
"prefix": "filter ( => )"
|
||||
},
|
||||
"for (i++)": {
|
||||
"body": [
|
||||
"for (let i = 0; i < ${1:array}.length; i++) {",
|
||||
"\tconst ${2:element} = ${1:array}[i];",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"prefix": "for (i++)"
|
||||
},
|
||||
"for (i--)": {
|
||||
"body": [
|
||||
"for (let i = ${1:array}.length - 1; i >= 0; i--) {",
|
||||
"\tconst ${2:element} = ${1:array}[i];",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"prefix": "for (i--)"
|
||||
},
|
||||
"for (key, value)": {
|
||||
"body": [
|
||||
"for (const [key, value] of Object.entries(${1:dict})) {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"prefix": "for (key, value)"
|
||||
},
|
||||
"for .. in (key)": {
|
||||
"body": [
|
||||
"for (const ${1:key} in ${2:object}) {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"prefix": "for .. in (key)"
|
||||
},
|
||||
"for .. of (array)": {
|
||||
"body": [
|
||||
"for (const ${1:iterator} of ${2:array}) {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"prefix": "for .. of (array)"
|
||||
},
|
||||
"forEach": {
|
||||
"body": [
|
||||
"forEach(${1:item} => {",
|
||||
"\t$0",
|
||||
"});"
|
||||
],
|
||||
"prefix": "forEach =>"
|
||||
},
|
||||
"function_trad": {
|
||||
"body": [
|
||||
"function ${1:name}() {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"prefix": "function"
|
||||
},
|
||||
"if ..": {
|
||||
"body": [
|
||||
"if (${1:condition}) {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"prefix": "if"
|
||||
},
|
||||
"if .. else": {
|
||||
"body": [
|
||||
"if (${1:condition}) {",
|
||||
"\t$0",
|
||||
"} else {",
|
||||
"\t",
|
||||
"}"
|
||||
],
|
||||
"prefix": "if .. else"
|
||||
},
|
||||
"ignore (biome formatter)": {
|
||||
"body": "// biome-ignore format: ${1:explanation}",
|
||||
"description": "Ignores the next block of code.",
|
||||
"prefix": "ignore (biome formatter)"
|
||||
},
|
||||
"ignore file (TypeScript) + nocheck (TypeScript)": {
|
||||
"body": "// @ts-nocheck",
|
||||
"prefix": [
|
||||
"ignore file (TypeScript)",
|
||||
"nocheck (TypeScript)"
|
||||
]
|
||||
},
|
||||
"map ( () => {} )": {
|
||||
"body": [
|
||||
"map(${1:item} => {",
|
||||
"\t$0",
|
||||
"\treturn;",
|
||||
"})"
|
||||
],
|
||||
"prefix": "map ( () => {} )"
|
||||
},
|
||||
"map ( => )": {
|
||||
"body": "map(${1:item} => ${1:item}$0)",
|
||||
"prefix": "map ( => )"
|
||||
},
|
||||
"reduce()": {
|
||||
"body": [
|
||||
".reduce((acc, ${1:item}) => {",
|
||||
"\t$0",
|
||||
"\treturn acc;",
|
||||
"}, ${2:initialValue})"
|
||||
],
|
||||
"prefix": "reduce()"
|
||||
},
|
||||
"relative date": {
|
||||
"body": [
|
||||
"/**",
|
||||
" * @param {string} absoluteDate string to be converted to a date",
|
||||
" * @return {string} relative date",
|
||||
" */",
|
||||
"function relativeDate(absoluteDate) {",
|
||||
"\tconst deltaSecs = (+new Date() - +new Date(absoluteDate)) / 1000;",
|
||||
"\t/** @type {\"year\"|\"month\"|\"week\"|\"day\"|\"hour\"|\"minute\"|\"second\"} */",
|
||||
"\tlet unit;",
|
||||
"\tlet delta;",
|
||||
"\tif (deltaSecs < 60) {",
|
||||
"\t\tunit = \"second\";",
|
||||
"\t\tdelta = deltaSecs;",
|
||||
"\t} else if (deltaSecs < 60 * 60) {",
|
||||
"\t\tunit = \"minute\";",
|
||||
"\t\tdelta = Math.ceil(deltaSecs / 60);",
|
||||
"\t} else if (deltaSecs < 60 * 60 * 24) {",
|
||||
"\t\tunit = \"hour\";",
|
||||
"\t\tdelta = Math.ceil(deltaSecs / 60 / 60);",
|
||||
"\t} else if (deltaSecs < 60 * 60 * 24 * 7) {",
|
||||
"\t\tunit = \"day\";",
|
||||
"\t\tdelta = Math.ceil(deltaSecs / 60 / 60 / 24);",
|
||||
"\t} else if (deltaSecs < 60 * 60 * 24 * 7 * 4) {",
|
||||
"\t\tunit = \"week\";",
|
||||
"\t\tdelta = Math.ceil(deltaSecs / 60 / 60 / 24 / 7);",
|
||||
"\t} else if (deltaSecs < 60 * 60 * 24 * 7 * 4 * 12) {",
|
||||
"\t\tunit = \"month\";",
|
||||
"\t\tdelta = Math.ceil(deltaSecs / 60 / 60 / 24 / 7 / 4);",
|
||||
"\t} else {",
|
||||
"\t\tunit = \"year\";",
|
||||
"\t\tdelta = Math.ceil(deltaSecs / 60 / 60 / 24 / 7 / 4 / 12);",
|
||||
"\t}",
|
||||
"\tconst formatter = new Intl.RelativeTimeFormat(\"en\", { style: \"long\", numeric: \"auto\" });",
|
||||
"\treturn formatter.format(-delta, unit);",
|
||||
"}"
|
||||
],
|
||||
"prefix": "relative date"
|
||||
},
|
||||
"replace": {
|
||||
"body": "replace(/${1:regexp}/, \"$2\")",
|
||||
"prefix": "replace"
|
||||
},
|
||||
"sort ( () => {} )": {
|
||||
"body": [
|
||||
"sort((a, b) => {",
|
||||
"\treturn ${1:b - a};",
|
||||
"})"
|
||||
],
|
||||
"description": "Sort Array with basic a-b-comparator function",
|
||||
"prefix": "sort ( () => {} )"
|
||||
},
|
||||
"split by \\n": {
|
||||
"body": ".split(\"\\n\")",
|
||||
"prefix": ".split by \\n"
|
||||
},
|
||||
"split by \\r": {
|
||||
"body": ".split(\"\\r\")",
|
||||
"description": "required for output from app.doShellScript()",
|
||||
"prefix": ".split by \\r"
|
||||
},
|
||||
"switch .. case": {
|
||||
"body": [
|
||||
"switch (${1:key}) {",
|
||||
"\tcase ${2:value}:",
|
||||
"\t\t$0",
|
||||
"\t\tbreak;",
|
||||
"\tdefault:",
|
||||
"}"
|
||||
],
|
||||
"prefix": "switch .. case"
|
||||
},
|
||||
"ternary": {
|
||||
"body": "${1:condition} ? ${2:value1} : ${3:value2}",
|
||||
"prefix": "ternary"
|
||||
},
|
||||
"thousand separator": {
|
||||
"body": ".toLocaleString(\"de-DE\")",
|
||||
"description": "insert thousand separator into a digit string",
|
||||
"prefix": "thousand separator"
|
||||
},
|
||||
"timeout + delay": {
|
||||
"body": [
|
||||
"setTimeout(() => {",
|
||||
"\t$0",
|
||||
"}, ${1:timeoutMs});"
|
||||
],
|
||||
"prefix": [
|
||||
"timeout",
|
||||
"delay"
|
||||
]
|
||||
},
|
||||
"today as ISO 8601 string": {
|
||||
"body": "new Date().toISOString().slice(0, 10);",
|
||||
"prefix": "ISO date"
|
||||
},
|
||||
"today's date": {
|
||||
"body": "const today = new Date();",
|
||||
"prefix": [
|
||||
"today",
|
||||
"date"
|
||||
]
|
||||
},
|
||||
"tomorrow's date": {
|
||||
"body": [
|
||||
"const tomorrow = new Date();",
|
||||
"tomorrow.setDate(tomorrow.getDate() + 1);"
|
||||
],
|
||||
"prefix": [
|
||||
"tomorrow",
|
||||
"date"
|
||||
]
|
||||
},
|
||||
"try .. catch": {
|
||||
"body": [
|
||||
"try {",
|
||||
"\t$0",
|
||||
"} catch (_error) {",
|
||||
"\t",
|
||||
"}"
|
||||
],
|
||||
"description": "leading underscore so the variable is ignored by biome when not used.",
|
||||
"prefix": "try .. catch"
|
||||
},
|
||||
"type (JSDoc)": {
|
||||
"body": "/** @type {${1:string}} */",
|
||||
"prefix": "type (JSDoc)"
|
||||
},
|
||||
"type: Record (JSDoc)": {
|
||||
"body": "/** @type {Record<string, string>} */",
|
||||
"prefix": "type: Record (JSDoc)"
|
||||
},
|
||||
"unique items": {
|
||||
"body": "${1:arr} = [...new Set(${2:arr})];",
|
||||
"prefix": "unique items"
|
||||
},
|
||||
"Class": {
|
||||
"prefix": [
|
||||
"clax"
|
||||
],
|
||||
"body": [
|
||||
"export class $1 ${2:extends ${3:Parent} }{",
|
||||
"\tconstructor(${4:props}) {",
|
||||
"\t\tthis.$4 = $4;",
|
||||
"\t}",
|
||||
"",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"description": "Class definition template."
|
||||
},
|
||||
"test": {
|
||||
"prefix": [
|
||||
"it"
|
||||
],
|
||||
"body": [
|
||||
"it('${1:should ${2}}', async () => {",
|
||||
"\t$0",
|
||||
"});"
|
||||
],
|
||||
"description": "Test template"
|
||||
},
|
||||
"method": {
|
||||
"prefix": [
|
||||
"mtd"
|
||||
],
|
||||
"body": [
|
||||
"${1:async ${2:method}}(${3:params}) {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"description": "method"
|
||||
},
|
||||
"function": {
|
||||
"prefix": [
|
||||
"fun"
|
||||
],
|
||||
"body": [
|
||||
"${1:async }${2:(${3:params})} => {$0}"
|
||||
],
|
||||
"description": "function"
|
||||
},
|
||||
"const": {
|
||||
"prefix": [
|
||||
"const"
|
||||
],
|
||||
"body": [
|
||||
"const $1 = $0;"
|
||||
],
|
||||
"description": "const"
|
||||
},
|
||||
"let": {
|
||||
"prefix": [
|
||||
"let"
|
||||
],
|
||||
"body": [
|
||||
"let $1 = $0;"
|
||||
],
|
||||
"description": "let"
|
||||
},
|
||||
"Console log": {
|
||||
"prefix": [
|
||||
"cl"
|
||||
],
|
||||
"body": [
|
||||
"console.log($0);"
|
||||
],
|
||||
"description": "Console log"
|
||||
},
|
||||
"Console debug": {
|
||||
"prefix": [
|
||||
"cd"
|
||||
],
|
||||
"body": [
|
||||
"console.debug($0);"
|
||||
],
|
||||
"description": "Console debug"
|
||||
},
|
||||
"Console log all": {
|
||||
"prefix": [
|
||||
"clj"
|
||||
],
|
||||
"body": [
|
||||
"console.log(JSON.stringify($0, null, 2));"
|
||||
],
|
||||
"description": "Console log whole object"
|
||||
},
|
||||
"Console debug all": {
|
||||
"prefix": [
|
||||
"cdj"
|
||||
],
|
||||
"body": [
|
||||
"console.debug(JSON.stringify($0, null, 2));"
|
||||
],
|
||||
"description": "Console debug whole object"
|
||||
},
|
||||
"If": {
|
||||
"prefix": [
|
||||
"if"
|
||||
],
|
||||
"body": [
|
||||
"if (${1:condition}) {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"description": "Console debug whole object"
|
||||
},
|
||||
"If-else": {
|
||||
"prefix": [
|
||||
"ifelse"
|
||||
],
|
||||
"body": [
|
||||
"if (${1:condition}) {",
|
||||
"\t$2",
|
||||
"} else {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"description": "Console debug whole object"
|
||||
},
|
||||
"docblock": {
|
||||
"prefix": [
|
||||
"/**"
|
||||
],
|
||||
"body": [
|
||||
"/**",
|
||||
" * $0",
|
||||
" */"
|
||||
]
|
||||
},
|
||||
"trycatch": {
|
||||
"prefix": [
|
||||
"tc"
|
||||
],
|
||||
"body": [
|
||||
"try {",
|
||||
"\t$0",
|
||||
"} catch (e) {",
|
||||
"\tthrow e;",
|
||||
"}"
|
||||
],
|
||||
"description": "Try catch block"
|
||||
},
|
||||
"Describe test": {
|
||||
"prefix": [
|
||||
"desc"
|
||||
],
|
||||
"body": [
|
||||
"describe('${1}', () => {",
|
||||
"\t$0",
|
||||
"})"
|
||||
],
|
||||
"description": "Describe test"
|
||||
}
|
||||
}
|
||||
262
config/nvim/snippets/lua.json
Normal file
262
config/nvim/snippets/lua.json
Normal file
@@ -0,0 +1,262 @@
|
||||
{
|
||||
"@class (LuaDoc)": {
|
||||
"body": [
|
||||
"---@class (exact) ${1:class_name}",
|
||||
"---@field ${2:field_name} string"
|
||||
],
|
||||
"description": "https://github.com/LuaLS/lua-language-server/wiki/Annotations#class",
|
||||
"prefix": "@class (LuaDoc)"
|
||||
},
|
||||
"@type (LuaDoc)": {
|
||||
"body": "---@type ${1:string}",
|
||||
"prefix": "@type (LuaDoc)"
|
||||
},
|
||||
"Record (type)": {
|
||||
"body": "---@type table<string, string>",
|
||||
"prefix": "Record (type)"
|
||||
},
|
||||
"count occurrences in string": {
|
||||
"body": "local _, count = ${1:str}:gsub(\"${2:find}\", \"\")",
|
||||
"prefix": "count occurrences in string"
|
||||
},
|
||||
"export module": {
|
||||
"body": [
|
||||
"local M = {}",
|
||||
"--------------------------------------------------------------------------------",
|
||||
"",
|
||||
"$0--------------------------------------------------------------------------------",
|
||||
"return M"
|
||||
],
|
||||
"prefix": "export module"
|
||||
},
|
||||
"find all in string": {
|
||||
"body": [
|
||||
"local ${1:matches} = {}",
|
||||
"for match in ${2:str}:gmatch(${3:pattern}) do",
|
||||
"\ttable.insert(${1:matches}, match)",
|
||||
"end"
|
||||
],
|
||||
"prefix": "find all in string"
|
||||
},
|
||||
"for each (list)": {
|
||||
"body": [
|
||||
"for _, ${1:v} in pairs(${2:table}) do",
|
||||
"\t$0",
|
||||
"end"
|
||||
],
|
||||
"prefix": "for each (list)"
|
||||
},
|
||||
"for each line (of file)": {
|
||||
"body": [
|
||||
"for line in io.lines(${1:filepath}) do",
|
||||
"\t$0",
|
||||
"end"
|
||||
],
|
||||
"prefix": [
|
||||
"for each line (file)",
|
||||
"read file (as lines)"
|
||||
]
|
||||
},
|
||||
"home": {
|
||||
"body": "os.getenv(\"HOME\")",
|
||||
"prefix": "home"
|
||||
},
|
||||
"if .. then .. else": {
|
||||
"body": [
|
||||
"if ${1:true} then",
|
||||
"\t$2",
|
||||
"else",
|
||||
"\t$0",
|
||||
"end"
|
||||
],
|
||||
"filetype": "lua",
|
||||
"prefix": "if .. then .. else"
|
||||
},
|
||||
"nodiscard": {
|
||||
"body": "---@nodiscard",
|
||||
"description": "Luadoc Annotation that a function's return value should not be discarded. https://github.com/LuaLS/lua-language-server/wiki/Annotations#nodiscard",
|
||||
"prefix": "nodiscard"
|
||||
},
|
||||
"path of this file": {
|
||||
"body": "local pathOfThisFile = debug.getinfo(1).source:sub(2)",
|
||||
"prefix": "path of this file"
|
||||
},
|
||||
"path separator (os-independent)": {
|
||||
"body": "local osPathSep = package.config:sub(1, 1)",
|
||||
"prefix": "path separator (os-independent)"
|
||||
},
|
||||
"pcall": {
|
||||
"body": [
|
||||
"local success = pcall(${1:func})",
|
||||
"if not success then",
|
||||
"\t$0",
|
||||
"\treturn",
|
||||
"end"
|
||||
],
|
||||
"prefix": [
|
||||
"try",
|
||||
"pcall"
|
||||
]
|
||||
},
|
||||
"read file": {
|
||||
"body": [
|
||||
"---@param filePath string",
|
||||
"---@return string? -- content or error message",
|
||||
"---@return boolean success",
|
||||
"local function readFile(filePath)",
|
||||
"\tlocal file, err = io.open(filePath, \"r\")",
|
||||
"\tif not file then return err, false end",
|
||||
"\tlocal content = file:read(\"*a\")",
|
||||
"\tfile:close()",
|
||||
"\treturn content, true",
|
||||
"end"
|
||||
],
|
||||
"prefix": "read file"
|
||||
},
|
||||
"redirect (metatable __index)": {
|
||||
"body": [
|
||||
"setmetatable(M, {",
|
||||
"\t__index = function(_, key)",
|
||||
"\t\treturn function(...)",
|
||||
"\t\t\trequire(${1:moduleToRedirectTo})[key](...)",
|
||||
"\t\tend",
|
||||
"\tend,",
|
||||
"})"
|
||||
],
|
||||
"prefix": "redirect (metatable __index)"
|
||||
},
|
||||
"round number": {
|
||||
"body": "local roundedNum = tonumber(string.format(\"%.${1:decimals}f\", exactNum))",
|
||||
"prefix": "round number"
|
||||
},
|
||||
"safe require": {
|
||||
"body": [
|
||||
"local ok, ${1:module} = require(\"${1:module}\")",
|
||||
"if not (ok and ${1:module}) then return end",
|
||||
"${1:module}.$0"
|
||||
],
|
||||
"prefix": "safe require"
|
||||
},
|
||||
"sort (table)": {
|
||||
"body": "table.sort(${1:table}, function(a, b) return ${2:a} > ${3:b} end)",
|
||||
"prefix": "sort (table)"
|
||||
},
|
||||
"split (gmatch)": {
|
||||
"body": [
|
||||
"local acc = {}",
|
||||
"for part in ${1:str}:gmatch(\"(.-)\" .. ${2:delimiter}) do",
|
||||
"\ttable.insert(acc, part)",
|
||||
"end"
|
||||
],
|
||||
"filetype": "lua",
|
||||
"prefix": "split (gmatch)"
|
||||
},
|
||||
"ternary": {
|
||||
"body": "${1:condition} and ${2:value1} or ${3:value2}",
|
||||
"prefix": "ternary"
|
||||
},
|
||||
"trim trailing line break": {
|
||||
"body": ":gsub(\"\\n$\", \"\")",
|
||||
"prefix": "trim"
|
||||
},
|
||||
"write file": {
|
||||
"body": [
|
||||
"---@param str string",
|
||||
"---@param filePath string",
|
||||
"---@return string|nil -- error message",
|
||||
"local function overwriteFile(filePath, str)",
|
||||
"\tlocal file, _ = io.open(filePath, \"w\")",
|
||||
"\tif not file then return end",
|
||||
"\tfile:write(str)",
|
||||
"\tfile:close()",
|
||||
"end"
|
||||
],
|
||||
"description": "Overwriting file, for appending use `a` instead of `w`.",
|
||||
"prefix": "write file"
|
||||
},
|
||||
"Create Auto Command": {
|
||||
"prefix": "autocmd",
|
||||
"body": [
|
||||
"vim.api.nvim_create_autocmd(\"${1:event}\", {",
|
||||
" group = vim.api.nvim_create_augroup(\"${2:group}\", { clear = true }),",
|
||||
" callback = function(ev)",
|
||||
" ${0}",
|
||||
" end",
|
||||
"})"
|
||||
]
|
||||
},
|
||||
"Create Auto Command Group": {
|
||||
"prefix": "augroup",
|
||||
"body": [
|
||||
"vim.api.nvim_create_augroup(\"${1:group}\", { clear = true })$0"
|
||||
]
|
||||
},
|
||||
"Current Win": {
|
||||
"prefix": "win",
|
||||
"body": "local win = vim.api.nvim_get_current_win()\n$0"
|
||||
},
|
||||
"Current Buf": {
|
||||
"prefix": "buf",
|
||||
"body": "local buf = vim.api.nvim_get_current_buf()\n$0"
|
||||
},
|
||||
"Buf Valid": {
|
||||
"prefix": "bufvalid",
|
||||
"body": "vim.api.nvim_buf_is_valid(${1:buf})"
|
||||
},
|
||||
"Win Valid": {
|
||||
"prefix": "winvalid",
|
||||
"body": "vim.api.nvim_win_is_valid(${1:win})"
|
||||
},
|
||||
"Win Call": {
|
||||
"prefix": "wincall",
|
||||
"body": [
|
||||
"vim.api.nvim_win_call(${1:win}, function(win)",
|
||||
" ${0}",
|
||||
"end)"
|
||||
]
|
||||
},
|
||||
"Buf Call": {
|
||||
"prefix": "bufcall",
|
||||
"body": [
|
||||
"vim.api.nvim_buf_call(${1:buf}, function(buf)",
|
||||
" ${0}",
|
||||
"end)"
|
||||
]
|
||||
},
|
||||
"Schedule": {
|
||||
"prefix": "schedule",
|
||||
"body": [
|
||||
"vim.schedule(function()",
|
||||
" ${0}",
|
||||
"end)"
|
||||
]
|
||||
},
|
||||
"Table Deep Extend": {
|
||||
"prefix": "deepextend",
|
||||
"body": "vim.tbl_deep_extend(\"force\", ${1:table}, ${2:table})$0"
|
||||
},
|
||||
"Table Filter": {
|
||||
"prefix": "filter",
|
||||
"body": [
|
||||
"vim.tbl_filter(function()",
|
||||
" $0",
|
||||
"end, ${1:table})"
|
||||
]
|
||||
},
|
||||
"Table Map": {
|
||||
"prefix": "map",
|
||||
"body": [
|
||||
"vim.tbl_map(function()",
|
||||
" $0",
|
||||
"end, ${1:table})"
|
||||
]
|
||||
},
|
||||
"Table Values": {
|
||||
"prefix": "values",
|
||||
"body": "vim.tbl_values(${1:table})"
|
||||
},
|
||||
"Table Keys": {
|
||||
"prefix": "keys",
|
||||
"body": "vim.tbl_keys(${1:table})"
|
||||
}
|
||||
}
|
||||
133
config/nvim/snippets/markdown.json
Normal file
133
config/nvim/snippets/markdown.json
Normal file
@@ -0,0 +1,133 @@
|
||||
{
|
||||
"Misc": {
|
||||
"body": "Miscellaneous",
|
||||
"prefix": "Misc"
|
||||
},
|
||||
"bash (Codeblock)": {
|
||||
"body": [
|
||||
"```bash",
|
||||
"$CLIPBOARD$0",
|
||||
"```"
|
||||
],
|
||||
"prefix": "bash (Codeblock)"
|
||||
},
|
||||
"caution (callout)": {
|
||||
"body": [
|
||||
"> [!CAUTION]",
|
||||
"> $0"
|
||||
],
|
||||
"description": "https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts",
|
||||
"prefix": "caution (callout)"
|
||||
},
|
||||
"details & summary": {
|
||||
"body": [
|
||||
"<details>",
|
||||
"<summary>${1:Text}</summary>",
|
||||
"$0",
|
||||
"</details>"
|
||||
],
|
||||
"description": "https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details",
|
||||
"prefix": [
|
||||
"toggle / fold",
|
||||
"details & summary"
|
||||
]
|
||||
},
|
||||
"ignore file (ltex)": {
|
||||
"body": "<!-- LTeX: enabled=false -->",
|
||||
"prefix": "ignore file (ltex)"
|
||||
},
|
||||
"image": {
|
||||
"body": "<img src=\"${1:image_path}\" alt=\"${2:alt text}\" width=\"${3:50%}\">",
|
||||
"description": "HTML syntax for images used to display images with reduced size",
|
||||
"prefix": "image"
|
||||
},
|
||||
"important (callout)": {
|
||||
"body": [
|
||||
"> [!IMPORTANT]",
|
||||
"> $0"
|
||||
],
|
||||
"description": "https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts",
|
||||
"prefix": "important (callout)"
|
||||
},
|
||||
"insert table 2x2": {
|
||||
"body": [
|
||||
"| ${1:Column1} | ${2:Column2} |",
|
||||
"|--------------- | -------------- |",
|
||||
"| ${3:Item1.1} | ${4:Item2.1} |"
|
||||
],
|
||||
"prefix": "table (2x2)"
|
||||
},
|
||||
"insert toc": {
|
||||
"body": [
|
||||
"## Table of Content",
|
||||
"",
|
||||
"<!-- toc -->"
|
||||
],
|
||||
"description": "https://github.com/jonschlinkert/markdown-toc#tocinsert",
|
||||
"prefix": "insert toc"
|
||||
},
|
||||
"js (Codeblock)": {
|
||||
"body": [
|
||||
"```js",
|
||||
"$CLIPBOARD$0",
|
||||
"```"
|
||||
],
|
||||
"prefix": "js (Codeblock)"
|
||||
},
|
||||
"kbd": {
|
||||
"body": "<kbd>$0</kbd>",
|
||||
"description": "HTML tag for keys",
|
||||
"prefix": "kbd"
|
||||
},
|
||||
"lua (Codeblock)": {
|
||||
"body": [
|
||||
"```lua",
|
||||
"$CLIPBOARD$0",
|
||||
"```"
|
||||
],
|
||||
"prefix": "lua (Codeblock)"
|
||||
},
|
||||
"note (GitHub callout)": {
|
||||
"body": [
|
||||
"> [!NOTE]",
|
||||
"> $0"
|
||||
],
|
||||
"description": "https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts",
|
||||
"prefix": [
|
||||
"info (callout)",
|
||||
"note (callout)"
|
||||
]
|
||||
},
|
||||
"py (Codeblock)": {
|
||||
"body": [
|
||||
"```py",
|
||||
"$CLIPBOARD$0",
|
||||
"```"
|
||||
],
|
||||
"prefix": "py (Codeblock)"
|
||||
},
|
||||
"tip (callout)": {
|
||||
"body": [
|
||||
"> [!TIP]",
|
||||
"> $0"
|
||||
],
|
||||
"description": "https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts",
|
||||
"prefix": "tip (callout)"
|
||||
},
|
||||
"ts (Codeblock)": {
|
||||
"body": [
|
||||
"```ts",
|
||||
"$CLIPBOARD$0",
|
||||
"```"
|
||||
],
|
||||
"prefix": "ts (Codeblock)"
|
||||
},
|
||||
"warning (callout)": {
|
||||
"body": [
|
||||
"> [!WARNING]",
|
||||
"> $0"
|
||||
],
|
||||
"description": "https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts",
|
||||
"prefix": "warning (callout)"
|
||||
}
|
||||
}
|
||||
165
config/nvim/snippets/php.snippets
Normal file
165
config/nvim/snippets/php.snippets
Normal file
@@ -0,0 +1,165 @@
|
||||
snippet php "php"
|
||||
<?php
|
||||
${1}
|
||||
|
||||
snippet ec "ec"
|
||||
echo '${1}'${2};
|
||||
|
||||
snippet vd "vd"
|
||||
var_dump(${1});
|
||||
|
||||
# Includes and requires
|
||||
|
||||
snippet inc "inc"
|
||||
include_once '${1}';${2}
|
||||
|
||||
snippet req "req"
|
||||
require_once '${1}';${2}
|
||||
|
||||
# define(...)
|
||||
|
||||
snippet def "def"
|
||||
define('${1}'${2});${3}
|
||||
|
||||
# Doxygen comments
|
||||
|
||||
snippet d "/**"
|
||||
/**
|
||||
* ${1}
|
||||
*/${2}
|
||||
|
||||
snippet code "code"
|
||||
* @code
|
||||
* ${1}
|
||||
* @endcode
|
||||
|
||||
# Class
|
||||
|
||||
snippet cl "cl"
|
||||
class ${1} {
|
||||
${2}
|
||||
function ${3:__construct}(${4}) {
|
||||
${5}
|
||||
}
|
||||
}
|
||||
|
||||
snippet pubf "public method"
|
||||
public function ${1}(${2}): $3
|
||||
{
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet prof "protected method"
|
||||
protected function ${1}(${2}): $3
|
||||
{
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet prif "private method"
|
||||
protected function ${1}(${2}): $3
|
||||
{
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet testt "test method (prefix)"
|
||||
public function test_${1}()
|
||||
{
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet testa "test method (annotation)"
|
||||
/** @test */
|
||||
public function ${1}()
|
||||
{
|
||||
${0}
|
||||
}
|
||||
|
||||
# $this->
|
||||
|
||||
snippet . "$this->" i
|
||||
$this->
|
||||
|
||||
# If statement
|
||||
|
||||
snippet if "if"
|
||||
if (${1}) {
|
||||
${2}
|
||||
}
|
||||
|
||||
snippet ife "ife"
|
||||
if (${1}) {
|
||||
${2}
|
||||
} else {
|
||||
${3}
|
||||
}
|
||||
|
||||
snippet elif "elif"
|
||||
else if (${1}) {
|
||||
${2}
|
||||
}
|
||||
|
||||
snippet el "el"
|
||||
else {
|
||||
${1}
|
||||
}
|
||||
|
||||
# Switch
|
||||
|
||||
snippet sw "sw"
|
||||
switch (${1}) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
snippet case "case"
|
||||
case '${1}':
|
||||
${2}
|
||||
break;${3}
|
||||
|
||||
# Do-while loop
|
||||
|
||||
snippet do "do"
|
||||
do {
|
||||
${2}
|
||||
} while (${1});
|
||||
|
||||
# While loop
|
||||
|
||||
snippet wh "wh"
|
||||
while (${1}) {
|
||||
${2}
|
||||
}
|
||||
|
||||
# For loop
|
||||
|
||||
snippet for "for"
|
||||
for (${1}; ${2}; ${3}) {
|
||||
${4}
|
||||
}
|
||||
|
||||
snippet fore "fore"
|
||||
foreach (${1} as ${2}) {
|
||||
${3}
|
||||
}
|
||||
|
||||
# Functions and methods
|
||||
|
||||
snippet fun "fun"
|
||||
function ${1}(${2}) {
|
||||
${3}
|
||||
}
|
||||
|
||||
snippet met "met"
|
||||
${1}function ${2}(${3}) {
|
||||
${4}
|
||||
}
|
||||
|
||||
# Return
|
||||
|
||||
snippet r "return"
|
||||
return ${1}
|
||||
|
||||
# Todos
|
||||
|
||||
snippet todo "todo"
|
||||
// TODO ${1}
|
||||
334
config/nvim/snippets/sh.json
Normal file
334
config/nvim/snippets/sh.json
Normal file
@@ -0,0 +1,334 @@
|
||||
{
|
||||
"PATH (export)": {
|
||||
"body": "export PATH=/usr/local/lib:/usr/local/bin:/opt/homebrew/bin/:\\$PATH",
|
||||
"description": "Extends PATH in a way that homebrew installed CLIs are recognized in ARM and Intel Macs.",
|
||||
"prefix": "PATH (export)"
|
||||
},
|
||||
"awk (get field)": {
|
||||
"body": "awk '{ print $${1:1} }'",
|
||||
"description": "Retrieve a field from the piped in string, with whitespace as the default field delimiter. `$n` means that the nth field will be used.",
|
||||
"prefix": "awk (field)"
|
||||
},
|
||||
"check device name": {
|
||||
"body": "scutil --get ComputerName | grep -q \"$0\"",
|
||||
"prefix": "device name"
|
||||
},
|
||||
"check if dark mode (macOS)": {
|
||||
"body": "defaults read -g AppleInterfaceStyle &>/dev/null; && echo 'isDark'",
|
||||
"prefix": "check if dark mode (macOS)"
|
||||
},
|
||||
"check if in git repo": {
|
||||
"body": "if ! git rev-parse --is-inside-work-tree &>/dev/null ; then print \"\\e[0;33mfile is not ins a git repository.\\e[0m\" && return 1 ; fi",
|
||||
"prefix": "check if in git repo"
|
||||
},
|
||||
"check if installed": {
|
||||
"body": [
|
||||
"if [[ ! -x \"\\$(command -v ${1:cli})\" ]]; then print \"\\e[0;33m${1:cli} not installed.\\e[0m\" && return 1; fi",
|
||||
"$0"
|
||||
],
|
||||
"description": "https://stackoverflow.com/a/26759734/22114136",
|
||||
"prefix": "check if installed"
|
||||
},
|
||||
"check if on macOS": {
|
||||
"body": "[[ \"\\$OSTYPE\" =~ \"darwin\" ]]",
|
||||
"prefix": "check if on macOS"
|
||||
},
|
||||
"check if process is running": {
|
||||
"body": "pgrep -xq \"${1:process}\" && $0",
|
||||
"prefix": "check if process is running"
|
||||
},
|
||||
"check if sudo user": {
|
||||
"body": "sudo -nv && ${1:some_sudo_action}",
|
||||
"prefix": "check if sudo user"
|
||||
},
|
||||
"confirmation prompt": {
|
||||
"body": [
|
||||
"# confirmation prompt",
|
||||
"print \"\\e[1;34m$0Proceed? (y/n)\\e[0m\"",
|
||||
"read -rk pressed",
|
||||
"echo",
|
||||
"if [[ \"\\$pressed\" != \"y\" ]]; then",
|
||||
"\techo \"Aborted.\"",
|
||||
"\treturn 1",
|
||||
"fi",
|
||||
"echo"
|
||||
],
|
||||
"prefix": "confirmation prompt"
|
||||
},
|
||||
"default value": {
|
||||
"body": "\\${${1:var}:-${2:default_value}}",
|
||||
"prefix": "default value"
|
||||
},
|
||||
"directory of script": {
|
||||
"body": "\"$(dirname \"$(readlink -f \"\\$0\")\")\"",
|
||||
"prefix": "directory of this script"
|
||||
},
|
||||
"elseif": {
|
||||
"body": "elif [[ ${1:condition} ]]; then\n\t${0}",
|
||||
"description": "Add an elseif to an if statement.",
|
||||
"prefix": "elseif"
|
||||
},
|
||||
"extension": {
|
||||
"body": "ext=${${1:file_name}##*.}",
|
||||
"prefix": "get extension"
|
||||
},
|
||||
"filename": {
|
||||
"body": "file_name=$(basename \"$${1:file_path}\")",
|
||||
"prefix": "filename"
|
||||
},
|
||||
"filename w/o ext": {
|
||||
"body": "${1:file_name}=${${1:file_name}%.*}",
|
||||
"prefix": "filename w/o ext"
|
||||
},
|
||||
"find & xargs": {
|
||||
"body": "find . -print0 | xargs -0 -I '{}'",
|
||||
"prefix": "find & xargs"
|
||||
},
|
||||
"find -exec": {
|
||||
"body": "find . $0 -exec open '{}' \\;",
|
||||
"prefix": "find -exec"
|
||||
},
|
||||
"for each file": {
|
||||
"body": [
|
||||
"for filename in *.txt; do",
|
||||
"\techo \"\\$filename\"",
|
||||
"done"
|
||||
],
|
||||
"prefix": "for each file"
|
||||
},
|
||||
"for each line (read)": {
|
||||
"body": [
|
||||
"while read -r line; do",
|
||||
"\techo \"\\$line\"$0",
|
||||
"done < \"\\$${1:input_file}\""
|
||||
],
|
||||
"prefix": "for each line (read)"
|
||||
},
|
||||
"for each line (variable)": {
|
||||
"body": [
|
||||
"echo \"\\$lines\" | while read -r line; do",
|
||||
"\techo \"\\$line\"",
|
||||
"done"
|
||||
],
|
||||
"prefix": "for each line (variable)"
|
||||
},
|
||||
"for i ..": {
|
||||
"body": [
|
||||
"for ((i = 0; i <= ${1:length}; i++)); do",
|
||||
" echo \\$i$0",
|
||||
"done"
|
||||
],
|
||||
"prefix": "for i .."
|
||||
},
|
||||
"function": {
|
||||
"body": "function ${1:name} {\n\t${0}\n}",
|
||||
"prefix": "function"
|
||||
},
|
||||
"get nth line from string": {
|
||||
"body": "line=$(echo \"\\$${1:str}\" | sed -n \"${2:n}p\")",
|
||||
"prefix": "get nth line from string"
|
||||
},
|
||||
"i++": {
|
||||
"body": "((${1:i}++))",
|
||||
"prefix": "i++"
|
||||
},
|
||||
"i--": {
|
||||
"body": "((${1:i}--))",
|
||||
"prefix": "i--"
|
||||
},
|
||||
"if (short)": {
|
||||
"body": "[[ \"\\$${1:var}\" ]] && $0",
|
||||
"prefix": "if (short)"
|
||||
},
|
||||
"if .. then": {
|
||||
"body": [
|
||||
"if [[ \"\\$${1:var}\" ]]; then",
|
||||
"\t$0",
|
||||
"fi"
|
||||
],
|
||||
"prefix": "if .. then"
|
||||
},
|
||||
"if .. then .. else": {
|
||||
"body": [
|
||||
"if [[ \"$${1:cond}\" ]]; then",
|
||||
"\t$0",
|
||||
"else",
|
||||
"\t",
|
||||
"fi"
|
||||
],
|
||||
"prefix": "if .. then .. else"
|
||||
},
|
||||
"input (stdin or $1)": {
|
||||
"body": [
|
||||
"if [[ $# -eq 0 ]]; then",
|
||||
"\tinput=$(< /dev/stdin)",
|
||||
"else",
|
||||
"\tinput=\"$1\"",
|
||||
"fi"
|
||||
],
|
||||
"description": "reads either from STDIN or $1. stdin may have unescaped newlines, which have to be removed, e.g. via `tr -d '\n'`.",
|
||||
"prefix": "input (stdin or $1)"
|
||||
},
|
||||
"notify (msg)": {
|
||||
"body": "osascript -e 'display notification \"\" with title \"${1:msg}\"'",
|
||||
"prefix": "notify (msg)"
|
||||
},
|
||||
"notify (var)": {
|
||||
"body": "osascript -e \"display notification \\\"\\\" with title \\\"$${1:var}\\\"\"",
|
||||
"prefix": "notify (var)"
|
||||
},
|
||||
"null (pipe)": {
|
||||
"body": "&> /dev/null",
|
||||
"prefix": "null (pipe)"
|
||||
},
|
||||
"osascript jxa (run script)": {
|
||||
"body": "osascript -l JavaScript \"${1:file}\"",
|
||||
"prefix": [
|
||||
"jxa (run script)",
|
||||
"osascript -l JavaScript"
|
||||
]
|
||||
},
|
||||
"plist: extract key": {
|
||||
"body": "plutil -extract name.childkey xml1 -o - example.plist | sed -n 4p | cut -d'>' -f2 | cut -d'<' -f1",
|
||||
"prefix": "plist: extract key"
|
||||
},
|
||||
"print in blue": {
|
||||
"body": "print \"\\e[1;34m$0\\e[0m\"",
|
||||
"prefix": "print in blue"
|
||||
},
|
||||
"progress bar": {
|
||||
"body": [
|
||||
"for _ in {1..100}; do",
|
||||
"\tprintf \"🬋\"",
|
||||
"\tsleep 0.5",
|
||||
"done"
|
||||
],
|
||||
"prefix": "progress bar"
|
||||
},
|
||||
"quicklook": {
|
||||
"body": "qlmanage -p \"${1:filepath}\"",
|
||||
"description": "QuickLook the file. MacOS only.",
|
||||
"prefix": "quicklook"
|
||||
},
|
||||
"redirect to stderr": {
|
||||
"body": ">&2",
|
||||
"prefix": "redirect to stderr"
|
||||
},
|
||||
"resolve home": {
|
||||
"body": "${1:path}=\"\\${${1:path}/#\\~/\\$HOME}\"",
|
||||
"prefix": "resolve home"
|
||||
},
|
||||
"restart app": {
|
||||
"body": [
|
||||
"killall \"${1:app_name}\"",
|
||||
"while pgrep -xq \"${1:app_name}\"; do sleep 0.1; done",
|
||||
"open -a \"${1:app_name}\""
|
||||
],
|
||||
"description": "safely restart app, avoiding race condition",
|
||||
"prefix": "restart app"
|
||||
},
|
||||
"sed substitution": {
|
||||
"body": "sed 's/$0//'",
|
||||
"prefix": "sed substitution"
|
||||
},
|
||||
"shebang": {
|
||||
"body": "#!/usr/bin/env zsh",
|
||||
"prefix": "shebang"
|
||||
},
|
||||
"slice": {
|
||||
"body": "${1:var}=\"${${1:var}:${2:from}:${3:to}}\"",
|
||||
"prefix": "slice"
|
||||
},
|
||||
"spinner": {
|
||||
"body": [
|
||||
"# spinner with 20s timeout",
|
||||
"spinner=\"⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏\"",
|
||||
"for i in {1..100}; do",
|
||||
"\tpos=\\$((i % \\${#spinner}))",
|
||||
"\tprintf \"\\r%s\" \"\\${spinner:\\$pos:1}\"",
|
||||
"\tsleep 0.2",
|
||||
"done",
|
||||
"printf \"\\r\" # remove spinner"
|
||||
],
|
||||
"prefix": "spinner"
|
||||
},
|
||||
"stderr (merge with stdout)": {
|
||||
"body": "2>&1",
|
||||
"prefix": "stderr (merge with stdout)"
|
||||
},
|
||||
"stdin": {
|
||||
"body": "stdin=\\$(< /dev/stdin)",
|
||||
"description": "$(cat) also works. See https://stackoverflow.com/questions/32363887/in-a-bash-function-how-do-i-get-stdin-into-a-variable",
|
||||
"prefix": "stdin"
|
||||
},
|
||||
"stdout is to a terminal": {
|
||||
"body": "[[ -t true ]]",
|
||||
"prefix": "stdout is to a terminal"
|
||||
},
|
||||
"substitute": {
|
||||
"body": "\\${${1:var}//${2:search}/${3:replace}}",
|
||||
"description": "one slash for single substitution, two for global",
|
||||
"prefix": "substitute (expansion)"
|
||||
},
|
||||
"suppress stderr": {
|
||||
"body": "2>/dev/null",
|
||||
"prefix": "suppress stderr"
|
||||
},
|
||||
"switch case": {
|
||||
"body": [
|
||||
"case $${1:var} in",
|
||||
"\"one\" | \"two\")",
|
||||
"\techo \"foo\"",
|
||||
"\t;;",
|
||||
"\"three\")",
|
||||
"\techo \"bar\"",
|
||||
"\t;;",
|
||||
"*)",
|
||||
"\techo \"default\"",
|
||||
"\t;;",
|
||||
"esac"
|
||||
],
|
||||
"description": "A case command first expands word, and tries to match it against each pattern in turn.",
|
||||
"prefix": "switch case"
|
||||
},
|
||||
"ternary": {
|
||||
"body": "\\$([[ \"${1:cond}\" ]] && echo \"${2:value1}\" || echo \"${3:value2}\")",
|
||||
"prefix": "ternary"
|
||||
},
|
||||
"then": {
|
||||
"body": "then\n\t$0\nfi",
|
||||
"prefix": "then .. fi"
|
||||
},
|
||||
"today (ISO date) + now": {
|
||||
"body": "${1:now}=\\$(date +\"%Y-%m-%d %H:%M:%S\")",
|
||||
"prefix": [
|
||||
"today (ISO date)",
|
||||
"now"
|
||||
]
|
||||
},
|
||||
"trim whitespace": {
|
||||
"body": "${1:text}=$(echo -n \"$${1:text}\" | sed -e 's/^ *//' -e 's/ *$//')",
|
||||
"prefix": "trim whitespace"
|
||||
},
|
||||
"urlEncode": {
|
||||
"body": "osascript -l JavaScript -e \"encodeURIComponent('${1:text}')\"",
|
||||
"prefix": "urlEncode"
|
||||
},
|
||||
"wait until app running": {
|
||||
"body": "while ! pgrep -xq \"${1:app_name}\"; do sleep 0.1; done",
|
||||
"prefix": "wait until app running"
|
||||
},
|
||||
"wait until app terminated": {
|
||||
"body": "while pgrep -xq \"${1:app_name}\"; do sleep 0.1; done",
|
||||
"prefix": "wait until app terminated"
|
||||
},
|
||||
"while": {
|
||||
"body": "while [[ ${1:condition} ]]; do\n\t${0}\ndone\n",
|
||||
"description": "A while loop by condition.",
|
||||
"prefix": "while"
|
||||
},
|
||||
"xargs (for each line)": {
|
||||
"body": "xargs -I {} ${1:some_cmd} '{}'",
|
||||
"prefix": "xargs (for each line)"
|
||||
}
|
||||
}
|
||||
7
config/nvim/snippets/yaml.json
Normal file
7
config/nvim/snippets/yaml.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"schema (modeline)": {
|
||||
"body": "# yaml-language-server: $$schema=${1:url}",
|
||||
"description": "https://github.com/redhat-developer/yaml-language-server#using-inlined-schema",
|
||||
"prefix": "schema (modeline)"
|
||||
}
|
||||
}
|
||||
0
config/nvim/spell/.gitkeep
Normal file
0
config/nvim/spell/.gitkeep
Normal file
@@ -36,7 +36,6 @@ type = "prompt"
|
||||
type = "git"
|
||||
style = "plain"
|
||||
foreground = "lightGreen"
|
||||
# template = "{{ .UpstreamIcon }}{{ .HEAD }} {{ if or (.Staging.Changed) (.Working.Changed) }}({{if .Behind }}\u2193 {{ .Behind }} {{ end }}{{if .Staging.Changed }}\uF046 {{ .Staging.String }} {{ end }}{{ if and (.Staging.Changed) (.Working.Changed) }}| {{ end }}{{ if .Working.Changed }} {{ .Working.String }}{{ end }}){{ end }}"
|
||||
template = "{{ .UpstreamIcon }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} {{ .StashCount }}{{ end }}"
|
||||
|
||||
[blocks.segments.properties]
|
||||
|
||||
@@ -28,6 +28,15 @@ bind -n M-Down select-pane -D
|
||||
# Reload tmux config with <prefix> + r
|
||||
bind r source-file ~/.dotfiles/config/tmux/tmux.conf \; display "tmux cfg reloaded!"
|
||||
|
||||
# Switch to next client with <prefix>( and previous with <prefix>)
|
||||
bind -r '(' switch-client -p\; refresh-client -S
|
||||
bind -r ')' switch-client -n\; refresh-client -S
|
||||
|
||||
# tms, https://github.com/jrmoulton/tmux-sessionizer
|
||||
bind C-h display-popup -E "tms"
|
||||
bind C-j display-popup -E "tms switch"
|
||||
bind C-k display-popup -E "tms windows"
|
||||
|
||||
# Open a new window with <prefix> + N
|
||||
bind N new-window
|
||||
|
||||
@@ -112,7 +121,7 @@ set-option -g status-left ''
|
||||
set-option -g window-status-format ' #I:#W '
|
||||
set-option -g window-status-current-format ' #I:#W#{?window_zoomed_flag, ◈ ,} '
|
||||
|
||||
set-option -g status-right "#{hostname_short}/#S #{tmux_mode_indicator}"
|
||||
set-option -g status-right "#{hostname_short}/#(tms sessions) #{tmux_mode_indicator}"
|
||||
|
||||
set -g pane-border-style "fg=#3b4261"
|
||||
set -g pane-active-border-style "fg=#7aa2f7"
|
||||
@@ -138,15 +147,15 @@ set -g @tmux_window_name_max_name_len "20"
|
||||
set -g @tmux_window_name_use_tilde "True"
|
||||
set -g @tmux_window_name_shells "['bash', 'fish', 'sh', 'zsh', 'oh-my-posh']"
|
||||
set -g @tmux_window_dir_programs "['nvim', 'vim', 'vi', 'git']"
|
||||
set -g @tmux_window_name_ignored_programs "['sqlite3', 'x-set-php-aliases', 'oh-my-posh', 'antidot']" # Default is []
|
||||
set -g @tmux_window_name_substitute_sets "[('.+ipython2', 'ipython2'), ('.+ipython3', 'ipython3'), ('.+\.local', '.local')]"
|
||||
set -g @tmux_window_name_ignored_programs "['sqlite3', 'x-set-php-aliases', 'oh-my-posh', 'antidot', 'direnv']" # Default is []
|
||||
set -g @tmux_window_name_substitute_sets "[('.+ipython2', 'ipython2'), ('.+ipython3', 'ipython3'), ('.+\.local', '.local'), ('.+asdf', 'asdf')]"
|
||||
|
||||
## https://github.com/tmux-plugins/tmux-continuum
|
||||
set -g @continuum-restore 'on'
|
||||
# set -g @continuum-restore 'on'
|
||||
|
||||
## https://github.com/tmux-plugins/tmux-resurrect
|
||||
set -g @resurrect-strategy-nvim 'session'
|
||||
set -g @resurrect-dir '~/.local/state/tmux/tmux-resurrect'
|
||||
# set -g @resurrect-strategy-nvim 'session'
|
||||
# set -g @resurrect-dir '~/.local/state/tmux/tmux-resurrect'
|
||||
|
||||
## https://github.com/MunifTanjim/tmux-mode-indicator
|
||||
set -g @mode_indicator_prefix_mode_style 'bg=default,fg=#7aa2f7'
|
||||
@@ -160,9 +169,9 @@ set -g @mode_indicator_sync_mode_style 'bg=default,fg=red'
|
||||
|
||||
run-shell ~/.dotfiles/config/tmux/plugins/tmux-sensible/sensible.tmux
|
||||
run-shell ~/.dotfiles/config/tmux/plugins/tmux-window-name/tmux_window_name.tmux
|
||||
run-shell ~/.dotfiles/config/tmux/plugins/tmux-resurrect/resurrect.tmux
|
||||
run-shell ~/.dotfiles/config/tmux/plugins/tmux-continuum/continuum.tmux
|
||||
run-shell ~/.dotfiles/config/tmux/plugins/tmux-sessionist/sessionist.tmux
|
||||
# run-shell ~/.dotfiles/config/tmux/plugins/tmux-resurrect/resurrect.tmux
|
||||
# run-shell ~/.dotfiles/config/tmux/plugins/tmux-continuum/continuum.tmux
|
||||
# run-shell ~/.dotfiles/config/tmux/plugins/tmux-sessionist/sessionist.tmux
|
||||
run-shell ~/.dotfiles/config/tmux/plugins/tmux-mode-indicator/mode_indicator.tmux
|
||||
run-shell ~/.dotfiles/config/tmux/plugins/tmux-suspend/suspend.tmux
|
||||
run-shell ~/.dotfiles/config/tmux/plugins/tmux-yank/yank.tmux
|
||||
|
||||
@@ -2,52 +2,12 @@
|
||||
|
||||
```txt
|
||||
|
||||
n <Esc> * <Cmd>nohlsearch<CR>
|
||||
n <Space>zg * :Rg<CR>
|
||||
FZF: search with rg (aka live grep).
|
||||
n <Space>zm * :Maps<CR>
|
||||
FZF: search mappings.
|
||||
n <Space>zh * :History<CR>
|
||||
FZF: search history of opened files
|
||||
n <Space>zb * :Buffers<CR>
|
||||
FZF: search open buffers.
|
||||
n <Space>zt * :Windows<CR>
|
||||
FZF: search open tabs.
|
||||
n <Space>zc * :Commands<CR>
|
||||
FZF: search commands.
|
||||
n <Space>zf * :FZF<Space>
|
||||
FZF: search for files in given path.
|
||||
n <Space>tc * <Cmd>CloakToggle<CR>
|
||||
[tc] Toggle Cloak
|
||||
n <Space>4 * <Lua 84: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
harpoon to file 4
|
||||
n <Space>3 * <Lua 83: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
harpoon to file 3
|
||||
n <Space>2 * <Lua 82: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
harpoon to file 2
|
||||
n <Space>1 * <Lua 81: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
harpoon to file 1
|
||||
n <Space>xn * <Lua 80: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
harpoon to next file
|
||||
n <Space>xa * <Lua 79: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
harpoon quick menu
|
||||
n <Space>xN * <Lua 78: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
harpoon to previous file
|
||||
n <Space>xA * <Lua 77: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
harpoon file
|
||||
n <Space>5 * <Lua 76: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
harpoon to file 5
|
||||
n <Space>tz * <Lua 51: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
[tz] Toggle ZenMode
|
||||
n <Space>e * <Lua 47: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
<Space>f * <Lua 40: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
[f] Format buffer
|
||||
n <Space>qq * <Cmd>wq!<CR>
|
||||
Quickly Quit
|
||||
n <Space>bq * <Lua 28: ~/.local/share/bob/v0.10.0/nvim-macos-arm64/share/nvim/runtime/lua/vim/diagnostic.lua:1984>
|
||||
Open diagnostic [Q]uickfix list
|
||||
n <Space>be * <Lua 27: ~/.local/share/bob/v0.10.0/nvim-macos-arm64/share/nvim/runtime/lua/vim/diagnostic.lua:1694>
|
||||
Show diagnostic [E]rror messages
|
||||
n <Space>/ * <Lua 196: ~/.config/nvim/lua/plugins/telescope.lua:68>
|
||||
[/] Fuzzily search in current buffer]
|
||||
n <Space>ht * <Lua 192: ~/.config/nvim/lua/plugins/harpoon.lua:43>
|
||||
Open Harpoon Quick menu
|
||||
n <Space>hw * <Lua 189: ~/.config/nvim/lua/plugins/harpoon.lua:37>
|
||||
Open harpoon window with telescope
|
||||
x # * <Lua 7: vim/_defaults.lua:0>
|
||||
:help v_#-default
|
||||
o % <Plug>(MatchitOperationForward)
|
||||
@@ -61,8 +21,18 @@ x @ * mode() == 'V' ? ':normal! @'.getcharstr().'<CR>' : '@'
|
||||
:help v_@-default
|
||||
x Q * mode() == 'V' ? ':normal! @<C-R>=reg_recorded()<CR><CR>' : 'Q'
|
||||
:help v_Q-default
|
||||
x R * <Lua 70: ~/.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
Treesitter Search
|
||||
o R * <Lua 69: ~/.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
Treesitter Search
|
||||
n Y * y$
|
||||
:help Y-default
|
||||
o Zk * <Lua 67: ~/.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
Flash Treesitter
|
||||
x Zk * <Lua 66: ~/.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
Flash Treesitter
|
||||
n Zk * <Lua 59: ~/.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
Flash Treesitter
|
||||
o [% <Plug>(MatchitOperationMultiBackward)
|
||||
x [% <Plug>(MatchitVisualMultiBackward)
|
||||
n [% <Plug>(MatchitNormalMultiBackward)
|
||||
@@ -74,39 +44,23 @@ n ]% <Plug>(MatchitNormalMultiForward)
|
||||
n ]d * <Lua 14: vim/_defaults.lua:0>
|
||||
Jump to the next diagnostic
|
||||
x a% <Plug>(MatchitVisualTextObject)
|
||||
o al <Lua 247: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||
Around last textobject
|
||||
o an <Lua 246: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||
Around next textobject
|
||||
x al <Lua 243: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||
Around last textobject
|
||||
x an <Lua 242: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||
Around next textobject
|
||||
o a <Lua 240: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||
Around textobject
|
||||
x a <Lua 238: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||
Around textobject
|
||||
n dj * <Lua 26: ~/.local/share/bob/v0.10.0/nvim-macos-arm64/share/nvim/runtime/lua/vim/diagnostic.lua:1222>
|
||||
Go to next [D]iagnostic message
|
||||
n dk * <Lua 25: ~/.local/share/bob/v0.10.0/nvim-macos-arm64/share/nvim/runtime/lua/vim/diagnostic.lua:1145>
|
||||
Go to previous [D]iagnostic message
|
||||
n gR * :RegexplainerToggle<CR>
|
||||
Toggle Regexplainer
|
||||
o g% <Plug>(MatchitOperationBackward)
|
||||
x g% <Plug>(MatchitVisualBackward)
|
||||
n g% <Plug>(MatchitNormalBackward)
|
||||
n gR * :RegexplainerToggle<CR>
|
||||
Toggle Regexplainer
|
||||
o g] <Lua 237: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1169>
|
||||
Move to right "around"
|
||||
x g] <Lua 236: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1169>
|
||||
Move to right "around"
|
||||
n g] <Lua 235: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1169>
|
||||
Move to right "around"
|
||||
o g[ <Lua 234: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1168>
|
||||
Move to left "around"
|
||||
x g[ <Lua 233: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1168>
|
||||
Move to left "around"
|
||||
n g[ <Lua 232: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1168>
|
||||
Move to left "around"
|
||||
n gP * <Lua 52: ~/.local/share/nvim/lazy/goto-preview/lua/goto-preview.lua:132>
|
||||
Close preview windows
|
||||
n gpr * <Lua 25: ~/.local/share/nvim/lazy/goto-preview/lua/goto-preview.lua:114>
|
||||
Preview references
|
||||
n gpD * <Lua 244: ~/.local/share/nvim/lazy/goto-preview/lua/goto-preview.lua:105>
|
||||
Preview declaration
|
||||
n gpi * <Lua 242: ~/.local/share/nvim/lazy/goto-preview/lua/goto-preview.lua:91>
|
||||
Preview implementation
|
||||
n gpt * <Lua 241: ~/.local/share/nvim/lazy/goto-preview/lua/goto-preview.lua:77>
|
||||
Preview type definition
|
||||
n gpd * <Lua 237: ~/.local/share/nvim/lazy/goto-preview/lua/goto-preview.lua:63>
|
||||
Preview definition
|
||||
o gc * <Lua 13: vim/_defaults.lua:0>
|
||||
Comment textobject
|
||||
n gcc * <Lua 12: vim/_defaults.lua:0>
|
||||
@@ -119,54 +73,18 @@ x gx * <Lua 9: vim/_defaults.lua:0>
|
||||
Opens filepath or URI under cursor with the system handler (file explorer, web browser, …)
|
||||
n gx * <Lua 8: vim/_defaults.lua:0>
|
||||
Opens filepath or URI under cursor with the system handler (file explorer, web browser, …)
|
||||
o il <Lua 249: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||
Inside last textobject
|
||||
o in <Lua 248: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||
Inside next textobject
|
||||
x il <Lua 245: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||
Inside last textobject
|
||||
x in <Lua 244: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||
Inside next textobject
|
||||
o i <Lua 241: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||
Inside textobject
|
||||
x i <Lua 239: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||
Inside textobject
|
||||
n shn * <Lua 266: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||
Highlight next surrounding
|
||||
n sFn * <Lua 265: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||
Find next left surrounding
|
||||
n sfn * <Lua 264: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||
Find next right surrounding
|
||||
n srn * <Lua 263: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||
Replace next surrounding
|
||||
n sdn * <Lua 262: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||
Delete next surrounding
|
||||
n shl * <Lua 261: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||
Highlight previous surrounding
|
||||
n sFl * <Lua 260: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||
Find previous left surrounding
|
||||
n sfl * <Lua 259: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||
Find previous right surrounding
|
||||
n srl * <Lua 258: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||
Replace previous surrounding
|
||||
n sdl * <Lua 257: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||
Delete previous surrounding
|
||||
x sa * :<C-U>lua MiniSurround.add('visual')<CR>
|
||||
Add surrounding to selection
|
||||
n sn * <Lua 256: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:892>
|
||||
Update `MiniSurround.config.n_lines`
|
||||
n sh * <Lua 255: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||
Highlight surrounding
|
||||
n sF * <Lua 254: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||
Find left surrounding
|
||||
n sf * <Lua 253: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||
Find right surrounding
|
||||
n sr * <Lua 252: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||
Replace surrounding
|
||||
n sd * <Lua 251: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||
Delete surrounding
|
||||
n sa * <Lua 250: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||
Add surrounding
|
||||
n j * v:count == 0 ? 'gj' : 'j'
|
||||
Move down
|
||||
n k * v:count == 0 ? 'gk' : 'k'
|
||||
Move up
|
||||
o r * <Lua 68: ~/.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
Remote Flash
|
||||
o zk * <Lua 65: ~/.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
Flash
|
||||
x zk * <Lua 64: ~/.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
Flash
|
||||
n zk * <Lua 63: ~/.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
Flash
|
||||
x <Plug>(MatchitVisualTextObject) <Plug>(MatchitVisualMultiBackward)o<Plug>(MatchitVisualMultiForward)
|
||||
o <Plug>(MatchitOperationMultiForward) * :<C-U>call matchit#MultiMatch("W", "o")<CR>
|
||||
o <Plug>(MatchitOperationMultiBackward) * :<C-U>call matchit#MultiMatch("bW", "o")<CR>
|
||||
@@ -180,28 +98,29 @@ x <Plug>(MatchitVisualBackward) * :<C-U>call matchit#Match_wrapper('',0,'v')<CR
|
||||
x <Plug>(MatchitVisualForward) * :<C-U>call matchit#Match_wrapper('',1,'v')<CR>:if col("''") != col("$") | exe ":normal! m'" | endif<CR>gv``
|
||||
n <Plug>(MatchitNormalBackward) * :<C-U>call matchit#Match_wrapper('',0,'n')<CR>
|
||||
n <Plug>(MatchitNormalForward) * :<C-U>call matchit#Match_wrapper('',1,'n')<CR>
|
||||
n <C-P> * :Files<CR>
|
||||
FZF: search for files starting at current directory.
|
||||
o <Plug>(fzf-maps-o) * <C-C>:<C-U>call fzf#vim#maps('o', 0)<CR>
|
||||
x <Plug>(fzf-maps-x) * :<C-U>call fzf#vim#maps('x', 0)<CR>
|
||||
n <Plug>(fzf-maps-n) * :<C-U>call fzf#vim#maps('n', 0)<CR>
|
||||
n <Plug>(fzf-normal) * <Nop>
|
||||
n <Plug>(fzf-insert) * i
|
||||
n <C-Bslash> * <Lua 60: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
n <C-S> * <Cmd>w<CR>
|
||||
Save file
|
||||
n <C-K> * <Lua 57: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
n <C-J> * <Lua 56: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
n <C-H> * <Lua 58: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
n <Down> * <Cmd>echo "Use j to move!!"<CR>
|
||||
n <Up> * <Cmd>echo "Use k to move!!"<CR>
|
||||
n <Right> * <Cmd>echo "Use l to move!!"<CR>
|
||||
n <Left> * <Cmd>echo "Use h to move!!"<CR>
|
||||
s <Plug>luasnip-jump-prev * <Lua 315: ~/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:57>
|
||||
LuaSnip: Jump to the previous node
|
||||
s <Plug>luasnip-jump-next * <Lua 314: ~/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:54>
|
||||
LuaSnip: Jump to the next node
|
||||
s <Plug>luasnip-prev-choice * <Lua 313: ~/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:51>
|
||||
LuaSnip: Change to the previous choice from the choiceNode
|
||||
s <Plug>luasnip-next-choice * <Lua 312: ~/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:48>
|
||||
LuaSnip: Change to the next choice from the choiceNode
|
||||
s <Plug>luasnip-expand-snippet * <Lua 311: ~/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:45>
|
||||
LuaSnip: Expand the current snippet
|
||||
s <Plug>luasnip-expand-or-jump * <Lua 310: ~/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:42>
|
||||
LuaSnip: Expand or jump in the current snippet
|
||||
<Plug>luasnip-expand-repeat * <Lua 308: ~/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:35>
|
||||
LuaSnip: Repeat last node expansion
|
||||
n <Plug>luasnip-delete-check * <Lua 306: ~/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:28>
|
||||
LuaSnip: Removes current snippet from jumplist
|
||||
n <Plug>PlenaryTestFile * :lua require('plenary.test_harness').test_file(vim.fn.expand("%:p"))<CR>
|
||||
n <C-W><C-D> <C-W>d
|
||||
Show diagnostics under the cursor
|
||||
n <C-W>d * <Lua 16: vim/_defaults.lua:0>
|
||||
Show diagnostics under the cursor
|
||||
n <C-L> * <Lua 59: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||
n <C-L> * <Cmd>nohlsearch|diffupdate|normal! <C-L><CR>
|
||||
:help CTRL-L-default
|
||||
```
|
||||
|
||||
- Generated on Sat 10 Aug 2024 13:01:59 EEST
|
||||
- Generated on Fri 4 Oct 2024 14:49:00 EEST
|
||||
|
||||
@@ -15,7 +15,7 @@ main()
|
||||
printf "\`\`\`txt"
|
||||
} > "$DEST"
|
||||
|
||||
NVIM_APPNAME="nvim-kickstart" nvim -c "redir! >> $DEST" -c 'silent verbose map' -c 'redir END' -c 'q'
|
||||
nvim -c "redir! >> $DEST" -c 'silent verbose map' -c 'redir END' -c 'q'
|
||||
|
||||
printf "\n\`\`\`\n\n- Generated on %s\n" "$(date)" >> "$DEST"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# It also updates asdf and the plugins, and then reshim asdf.
|
||||
#
|
||||
# Usage: ./install-asdf.sh [both|install|add_plugins]
|
||||
# Usage: ./install-asdf.sh [both|install|update|add_plugins]
|
||||
# Author: Ismo Vuorinen <https://github.com/ivuorinen>
|
||||
# License: MIT
|
||||
#
|
||||
@@ -13,9 +13,40 @@ source "${DOTFILES}/config/shared.sh"
|
||||
export ASDF_DIR="${XDG_BIN_HOME}/asdf"
|
||||
export PATH="${ASDF_DIR}/bin:$PATH"
|
||||
|
||||
# If ASDF_PLUGIN_MANAGER_PLUGIN_VERSIONS_FILENAME is not set, set it
|
||||
if [ -z "${ASDF_PLUGIN_MANAGER_PLUGIN_VERSIONS_FILENAME}" ]; then
|
||||
export ASDF_PLUGIN_MANAGER_PLUGIN_VERSIONS_FILENAME="${XDG_CONFIG_HOME}/asdf/plugin-versions"
|
||||
fi
|
||||
|
||||
msg "Sourcing asdf in your shell"
|
||||
. "$ASDF_DIR/asdf.sh"
|
||||
|
||||
ASDF_INSTALLABLES=(
|
||||
"1password-cli:github.com/NeoHsu/asdf-1password-cli.git"
|
||||
"age:github.com/threkk/asdf-age.git"
|
||||
"bottom:github.com/carbonteq/asdf-btm.git"
|
||||
"direnv:github.com/asdf-community/asdf-direnv.git"
|
||||
"dotenv-linter:github.com/wesleimp/asdf-dotenv-linter.git"
|
||||
"editorconfig-checker:github.com/gabitchov/asdf-editorconfig-checker.git"
|
||||
"fd:gitlab.com/wt0f/asdf-fd.git"
|
||||
"github-cli:github.com/bartlomiejdanek/asdf-github-cli.git"
|
||||
"golang:github.com/asdf-community/asdf-golang.git"
|
||||
"hadolint:github.com/devlincashman/asdf-hadolint.git"
|
||||
"kubectl:github.com/asdf-community/asdf-kubectl.git"
|
||||
"nodejs:github.com/asdf-vm/asdf-nodejs.git"
|
||||
"pipx:github.com/yozachar/asdf-pipx.git"
|
||||
"pre-commit:github.com/jonathanmorley/asdf-pre-commit.git"
|
||||
"python:github.com/asdf-community/asdf-python.git"
|
||||
"ripgrep:gitlab.com/wt0f/asdf-ripgrep.git"
|
||||
"rust:github.com/code-lever/asdf-rust.git"
|
||||
"shellcheck:github.com/luizm/asdf-shellcheck.git"
|
||||
"shfmt:github.com/luizm/asdf-shfmt.git"
|
||||
"terragrunt:github.com/ohmer/asdf-terragrunt.git"
|
||||
"tf-summarize:github.com/adamcrews/asdf-tf-summarize.git"
|
||||
"yamllint:github.com/ericcornelissen/asdf-yamllint.git"
|
||||
"yq:github.com/sudermanjr/asdf-yq.git"
|
||||
)
|
||||
|
||||
# Function to update asdf and plugins
|
||||
update_asdf()
|
||||
{
|
||||
@@ -24,43 +55,24 @@ update_asdf()
|
||||
asdf global asdf-plugin-manager "$(asdf latest asdf-plugin-manager)"
|
||||
asdf-plugin-manager version
|
||||
asdf-plugin-manager add-all
|
||||
asdf-plugin-manager update-all
|
||||
asdf-plugin-manager export > "${ASDF_PLUGIN_MANAGER_PLUGIN_VERSIONS_FILENAME}"
|
||||
|
||||
asdf install
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
update_asdf_commands()
|
||||
{
|
||||
msg "Updating asdf commands using asdf-plugin-manager"
|
||||
asdf-plugin-manager update-all
|
||||
return 0
|
||||
}
|
||||
|
||||
# Function to install asdf plugins
|
||||
install_asdf_plugins()
|
||||
{
|
||||
ASDF_INSTALLABLES=(
|
||||
"1password-cli:github.com/NeoHsu/asdf-1password-cli.git"
|
||||
"age:github.com/threkk/asdf-age.git"
|
||||
"bottom:github.com/carbonteq/asdf-btm.git"
|
||||
"direnv:github.com/asdf-community/asdf-direnv.git"
|
||||
"dotenv-linter:github.com/wesleimp/asdf-dotenv-linter.git"
|
||||
"editorconfig-checker:github.com/gabitchov/asdf-editorconfig-checker.git"
|
||||
"eza:github.com/lwiechec/asdf-eza.git"
|
||||
"fd:gitlab.com/wt0f/asdf-fd.git"
|
||||
"github-cli:github.com/bartlomiejdanek/asdf-github-cli.git"
|
||||
"golang:github.com/asdf-community/asdf-golang.git"
|
||||
"hadolint:github.com/devlincashman/asdf-hadolint.git"
|
||||
"kubectl:github.com/asdf-community/asdf-kubectl.git"
|
||||
"lazygit:github.com/nklmilojevic/asdf-lazygit.git"
|
||||
"nodejs:github.com/asdf-vm/asdf-nodejs.git"
|
||||
"pipx:github.com/yozachar/asdf-pipx.git"
|
||||
"pre-commit:github.com/jonathanmorley/asdf-pre-commit.git"
|
||||
"python:github.com/asdf-community/asdf-python.git"
|
||||
"ripgrep:gitlab.com/wt0f/asdf-ripgrep.git"
|
||||
"rust:github.com/code-lever/asdf-rust.git"
|
||||
"shellcheck:github.com/luizm/asdf-shellcheck.git"
|
||||
"shfmt:github.com/luizm/asdf-shfmt.git"
|
||||
"terragrunt:github.com/ohmer/asdf-terragrunt.git"
|
||||
"tf-summarize:github.com/adamcrews/asdf-tf-summarize.git"
|
||||
"yamllint:github.com/ericcornelissen/asdf-yamllint.git"
|
||||
"yq:github.com/sudermanjr/asdf-yq.git"
|
||||
)
|
||||
|
||||
msg "Installing asdf plugins"
|
||||
for item in "${ASDF_INSTALLABLES[@]}"; do
|
||||
CMD=$(echo "${item}" | awk -F ":" '{print $1}')
|
||||
@@ -72,7 +84,7 @@ install_asdf_plugins()
|
||||
done
|
||||
|
||||
msg "Exporting asdf plugin versions"
|
||||
asdf-plugin-manager export > "${XDG_CONFIG_HOME}/asdf/plugin-versions"
|
||||
asdf-plugin-manager export > "${ASDF_PLUGIN_MANAGER_PLUGIN_VERSIONS_FILENAME}"
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -87,7 +99,7 @@ reshim()
|
||||
# create usage function
|
||||
usage()
|
||||
{
|
||||
echo "Usage: $0 [both|install|add_plugins]"
|
||||
echo "Usage: $0 [both|install|add_plugins|update]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -99,6 +111,10 @@ main()
|
||||
update_asdf
|
||||
reshim
|
||||
;;
|
||||
"update")
|
||||
update_asdf_commands
|
||||
reshim
|
||||
;;
|
||||
"install")
|
||||
update_asdf
|
||||
reshim
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# shellcheck source=shared.sh
|
||||
|
||||
echo "This file has been deprecated in favor of asdf. Please use asdf instead."
|
||||
echo "This file ($0) has been deprecated in favor of asdf. Please use asdf instead."
|
||||
exit 0
|
||||
|
||||
eval "$HOME/.dotfiles/config/shared.sh"
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
#
|
||||
# Install fzf
|
||||
#
|
||||
|
||||
echo "This file ($0) has been deprecated in favor of asdf. Please use asdf instead."
|
||||
exit 0
|
||||
|
||||
# shellcheck source=shared.sh
|
||||
eval "$DOTFILES/config/shared.sh"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# shellcheck source=shared.sh
|
||||
|
||||
echo "This file has been deprecated in favor of asdf. Please use asdf instead."
|
||||
echo "This file ($0) has been deprecated in favor of asdf. Please use asdf instead."
|
||||
exit 0
|
||||
|
||||
eval "$DOTFILES/config/shared.sh"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# shellcheck source=shared.sh
|
||||
|
||||
echo "This file has been deprecated in favor of asdf. Please use asdf instead."
|
||||
echo "This file ($0) has been deprecated in favor of asdf. Please use asdf instead."
|
||||
exit 0
|
||||
|
||||
eval "$DOTFILES/config/shared.sh"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# shellcheck source=shared.sh
|
||||
|
||||
echo "This file has been deprecated in favor of asdf. Please use asdf instead."
|
||||
echo "This file ($0) has been deprecated in favor of asdf. Please use asdf instead."
|
||||
exit 0
|
||||
|
||||
source "${DOTFILES}/config/shared.sh"
|
||||
|
||||
Reference in New Issue
Block a user