Compare commits

...

5 Commits
master ... mini

Author SHA1 Message Date
Christoph J. Scherr 37c3c6da98
plugin mappings 2024-03-06 16:02:31 +01:00
Christoph J. Scherr 510ab5ec4e
important plugins 2024-03-06 15:52:27 +01:00
Christoph J. Scherr a07b964ee5
vscode 2024-03-06 11:43:46 +01:00
Christoph J. Scherr bddb567c11
add mappings 2024-03-06 11:36:04 +01:00
Christoph J. Scherr 70ec080c06
remove tons of stuff 2024-03-06 10:52:12 +01:00
39 changed files with 670 additions and 4240 deletions

View File

@ -1,161 +0,0 @@
# [CONTRIBUTING](https://nvchad.github.io/contribute)
## NvChad install for contributors
If you wish to contribute to NvChad, you should:
1. [create a fork on GitHub](https://docs.github.com/en/get-started/quickstart/fork-a-repo)
2. clone your fork to your machine
- For ssh:
```shell
$ git clone git@github.com:<YOUR GITHUB USERNAME>/NvChad.git ~/.config/nvim
```
- For https:
```shell
$ git clone https://github.com/<YOUR GITHUB USERNAME>/NvChad.git ~/.config/nvim
```
3. [add a new remote repo to track](https://www.atlassian.com/git/tutorials/git-forks-and-upstreams)
- this means you can push/pull as normal to your own repo, but also easily track & update from the NvChad repo
- for ssh:
```shell
$ git remote add upstream git@github.com:NvChad/NvChad.git
```
- for https:
```shell
$ git remote add upstream https://github.com/NvChad/NvChad.git
```
4. any time you create a branch to do some work, use
```shell
$ git fetch upstream && git checkout -b dev-myFEAT upstream/main
```
5. only use the **--rebase** flag to update your dev branch
- this means that there are no `Merge NvChad/main into devBranch` commits, which are to be avoided
```shell
$ git pull upstream --rebase
```
## Things to know before contributing
- When making a PR (pull request), please be very descriptive about what you've done!
- PR titles should be formatted with 'fix', 'chore' or 'feat'. ex: `feat: add new plugin`
- PRs should follow the pull request formats where applicable
- We are open to all PRs, but may decline some for a myriad of reasons. Though don't be discouraged! We'll still be open to discussions.
- PR's are always welcomed however NvChad aims to be less bloated. So PR's regarding existing plugin's enhancement and creating new features with existing plugins itself ( without adding a new plugin), bug fixes and corrections are more encouraged.
- NvChad won't keep adding more and more features (like adding new plugins most likely) as requested if they feel unneeded and aren't usable by the majority!! If you think the plugin you want to be added is very useful and many NvChaders would find it useful, then such feature's PR is welcomed!
- But adding specific features like adding config for [wakatime](https://github.com/wakatime/vim-wakatime) etc will be added in this [chad user configs](https://github.com/NvChad/NvChad/wiki/Chad-user-configs). This lets the user select the things only they want ( adding configs from extra configs ).
## How to remove or edit commits from your PR
> You may have been directed here to remove a commit such as a merge commit: `Merge NvChad/main into devBranch` from your PR
> As these commands edit your git history, you may need to **force push** with `git push origin --force`
1. Run the following:
```
$ git rebase -i HEAD~<NUMBER OF COMMITS TO GO BACK>
```
<details><summary>Example</summary>
<p>
```shell
$ git rebase -i HEAD~4
```
```shell
pick 28b2dcb statusline add lsp status
pick dad9a39 feat: Added lsp radial progress
pick 68f72f1 add clickable btn for exiting nvim
pick b281b53 avoid using q! for quitting vim
# Rebase 52b655b..b281b53 onto 52b655b (4 commands)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup <commit> = like "squash", but discard this commit's log message
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# . create a merge commit using the original merge commit's
# . message (or the oneline, if no original merge commit was
# . specified). Use -c <commit> to reword the commit message.
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
```
</p>
</details>
2. Change the `pick` commands to whatever you wish, you may wish to `d` `drop` or `e` `edit` a commit. Then save & quit this git file to run it.
<details><summary>Example</summary>
<p>
```shell {3,4}
pick 28b2dcb statusline add lsp status
pick dad9a39 feat: Added lsp radial progress
edit 68f72f1 add clickable btn for exiting nvim
d b281b53 avoid using q! for quitting vim
# Rebase 52b655b..b281b53 onto 52b655b (4 commands)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup <commit> = like "squash", but discard this commit's log message
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# . create a merge commit using the original merge commit's
# . message (or the oneline, if no original merge commit was
# . specified). Use -c <commit> to reword the commit message.
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
```
</p>
</details>
3. If you picked `drop` you are done, if you picked `edit` then edit your files, then run:
```shell
$ git add <files>
```
4. Once you have edited & added your files, run:
```shell
$ git rebase --continue
```
5. You will likely need to push using:
```shell
$ git push origin --force
```
## Help
For help with contributing and anything else nvChad related join the [discord](https://discord.gg/VyPxsGArXc)

3
.github/FUNDING.yml vendored
View File

@ -1,3 +0,0 @@
patreon: siduck
ko_fi: siduck
custom: ["https://www.buymeacoffee.com/siduck", "https://www.paypal.com/paypalme/siduck76"]

View File

@ -1,34 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
<!-- Before reporting: update nvchad to the latest version,read breaking changes page,search existing issues. -->
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- Operating System
- Terminal
- Version of Neovim
**Additional context**
Add any other context about the problem here.

View File

@ -1,8 +0,0 @@
blank_issues_enabled: false
contact_links:
- name: Wiki
url: https://github.com/siduck76/NvChad/wiki
about: "Walks you through how to use and Configure NvChad."
- name: Visit our gitter chat
url: https://gitter.im/neovim-dotfiles/community
about: "A place where we dicuss NvChad related stuff."

View File

@ -1,23 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem was.
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
**Screenshot**
Maybe a screenshot of the feature

View File

@ -1,14 +0,0 @@
Fixes Issue # (If it doesn't fix an issue then delete this line)
Features Added:
- Plugin Name (Add links if possible too)
Reasoning:
List why the feature is needed
Speed (If applicable):
Show the impact on the speed of nvChad
Other:
Anything else relevant goes here

View File

@ -1,16 +0,0 @@
(Make sure your title is either: 'fix', 'chore', or 'feat' then your title. ex: `fix: add new plugin`)
Fixes Issue # (If it doesn't fix an issue then delete this line)
Plugins Added:
- [Plugin Name](Plugin Link)
- [Plugin Name](Plugin Link)
Reasoning:
List why the plugin(s) should be added
Speed:
Show the impact on the speed of nvChad
Other:
Anything else relevant goes here

122
.github/README.md vendored
View File

@ -1,122 +0,0 @@
<h1 align="center">NvChad</h1>
<div align="center">
<a href="https://nvchad.com/">Home</a>
<span></span>
<a href="https://nvchad.com/docs/quickstart/install">Install</a>
<span></span>
<a href="https://nvchad.com/docs/contribute">Contribute</a>
<span></span>
<a href="https://github.com/NvChad/NvChad#gift_heart-support">Support</a>
<span></span>
<a href="https://nvchad.com/docs/features">Features</a>
<p></p>
</div>
<div align="center">
[![Neovim Minimum Version](https://img.shields.io/badge/Neovim-0.9.0-blueviolet.svg?style=flat-square&logo=Neovim&color=90E59A&logoColor=white)](https://github.com/neovim/neovim)
[![GitHub Issues](https://img.shields.io/github/issues/NvChad/NvChad.svg?style=flat-square&label=Issues&color=d77982)](https://github.com/NvChad/NvChad/issues)
[![Discord](https://img.shields.io/discord/869557815780470834?color=738adb&label=Discord&logo=discord&logoColor=white&style=flat-square)](https://discord.gg/gADmkJb9Fb)
[![Matrix](https://img.shields.io/badge/Matrix-40aa8b.svg?style=flat-square&logo=Matrix&logoColor=white)](https://matrix.to/#/#nvchad:matrix.org)
[![Telegram](https://img.shields.io/badge/Telegram-blue.svg?style=flat-square&logo=Telegram&logoColor=white)](https://t.me/DE_WM)
</div>
## Showcase
<img src="https://nvchad.com/features/nvdash.webp">
<img src="https://nvchad.com/banner.webp">
<img src="https://nvchad.com/screenshots/onedark.webp">
<img src="https://nvchad.com/screenshots/rxyhn1.webp">
## What is it?
- NvChad is a neovim config written in lua aiming to provide a base configuration with very beautiful UI and blazing fast startuptime (around 0.02 secs ~ 0.07 secs). We tweak UI plugins such as telescope, nvim-tree, bufferline etc well to provide an aesthetic UI experience.
- Lazy loading is done 93% of the time meaning that plugins will not be loaded by default, they will be loaded only when required also at specific commands, events etc. This lowers the startuptime and it was like 0.07~ secs tested on an old pentium machine 1.4ghz + 4gb ram & HDD.
- NvChad isn't a framework! It's supposed to be used as a "base" config, so users can tweak the defaults well, and also remove the things they don't like in the default config and build their config on top of it. Users can tweak the entire default config while staying in their custom config (lua/custom dir). This is the control center of the user's config and gitignored so the users can stay up-to-date with NvChad's latest config (main branch) while still controlling it with their chadrc (file that controls entire custom dir).
## Theme Showcase
<details><summary> <b>Images (Click to expand!)</b></summary>
![4 themes](https://nvchad.com/screenshots/four_Themes.webp)
![radium 1](https://nvchad.com/screenshots/radium1.webp)
![radium 2](https://nvchad.com/screenshots/radium2.webp)
![radium 3](https://nvchad.com/screenshots/radium3.webp)
(Note: these are just 4-5 themes, NvChad has around 56 themes)
</details>
## UI related plugins used
<details><summary> <b>Images (Click to expand!)</b></summary>
<h3> Nvim-tree.lua </h3>
Fast file tree:
<kbd><img src="https://nvchad.com/features/nvimtree.webp"></kbd>
<h3> Telescope-nvim </h3>
A fuzzy file finder, picker, sorter, previewer and much more:
<kbd><img src="https://nvchad.com/features/telescope.webp"></kbd>
<h3> Our own statusline written from scratch </h3>
[NvChad UI](https://github.com/NvChad/ui)
<kbd><img src="https://nvchad.com/features/statuslines.webp"></kbd>
<h3> Tabufline (our own pertab bufferline) </h3>
<kbd><img src="https://nvchad.com/features/tabufline.webp"></kbd>
- Here's a [video](https://www.youtube.com/watch?v=V_9iJ96U_k8&ab_channel=siduck) that showcases it.
<h3> NvCheatsheet ( our UI Plugin ) </h3>
<kbd> <img src="https://nvchad.com/features/nvcheatsheet.webp"/></kbd>
</details>
## Plugins list
- Many beautiful themes, theme toggler by our [base46 plugin](https://github.com/NvChad/base46)
- Inbuilt terminal toggling & management with [Nvterm](https://github.com/NvChad/nvterm)
- Lightweight & performant ui plugin with [NvChad UI](https://github.com/NvChad/ui) It provides statusline modules, tabufline ( tabs + buffer manager) , beautiful cheatsheets, NvChad updater, hide & unhide terminal buffers, theme switcher and much more!
- File navigation with [nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua)
- Beautiful and configurable icons with [nvim-web-devicons](https://github.com/kyazdani42/nvim-web-devicons)
- Git diffs and more with [gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim)
- NeoVim Lsp configuration with [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) and [mason.nvim](https://github.com/williamboman/mason.nvim)
- Autocompletion with [nvim-cmp](https://github.com/hrsh7th/nvim-cmp)
- File searching, previewing image and text files and more with [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim).
- Syntax highlighting with [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
- Autoclosing braces and html tags with [nvim-autopairs](https://github.com/windwp/nvim-autopairs)
- Indentlines with [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim)
- Useful snippets with [friendly snippets](https://github.com/rafamadriz/friendly-snippets) + [LuaSnip](https://github.com/L3MON4D3/LuaSnip).
- Popup mappings keysheet [whichkey.nvim](https://github.com/folke/which-key.nvim)
## History
- I (@siduck i.e creator of NvChad) in my initial days of learning to program wanted a lightweight IDE for writing code, I had a very low end system which was like 1.4ghz pentium + 4gb ram & HDD. I was into web dev stuff so many suggested me to use vscode but that thing was very heavy on my system, It took more ram than my browser! ( minimal ungoogled chromium ) so I never tried it again, sublime text was nice but the fear of using proprietary software XD for a linux user bugged me a lot. Then I tried doom-emacs which looked pretty but it was slow and I was lost within its docs, I tried lunarvim but too lazy to read the docs. Doom-emacs and lunarvim inspired me to make a config which is the prettiest + very fast and simple.
- I'm decent at ricing i.e customizing system and making it look pretty so I posted my neovim rice on [neovim subreddit](https://www.reddit.com/r/neovim/comments/m3xl4f/neovim_rice/), my neovim-dotfiles github repo blew up and then I had to come up with a name, I was amazed by the chad meme lol so I put NvChad as the name, the chad word in here doesnt literally mean the chad guy but in the sense such as chad linux vs windows i.e meaning superior, best etc. NvChad was made for my personal use but it gained some popularity which inspired me to make a public config i.e config usable by many and less hassle to update as everyone's going to use the same base config (NvChad) with their custom modifications (which are gitignored so that wont mess up), without the custom config stuff users would have to keep a track of every commit and copy paste git diffs to manually update nvchad.
## :gift_heart: Support
If you like NvChad and would like to support & appreciate it via donation then I'll gladly accept it.
[![kofi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/siduck)
[![paypal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://paypal.me/siduck13)
[![buymeacoffee](https://img.shields.io/badge/Buy_Me_A_Coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/siduck)
[![patreon](https://img.shields.io/badge/Patreon-F96854?style=for-the-badge&logo=patreon&logoColor=white)](https://www.patreon.com/siduck)
## Credits
- [Elianiva](https://github.com/elianiva) helped me with NeoVim Lua related issues many times, NvChad wouldn't exist without his help at all as he helped me in my initial neovim journey!
- @lorvethe for making the beautiful NvChad logo.

View File

@ -1,22 +0,0 @@
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '30 1 * * *'
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.'
exempt-all-issue-assignees: true # doesn't close an issue if someone was assigned to it.
close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity.'
exempt-all-pr-assignees: true # doesn't close a pr if someone was assigned to it.
days-before-issue-stale: 30
days-before-pr-stale: 45
days-before-issue-close: 5
days-before-pr-close: 10

7
.gitignore vendored
View File

@ -1,8 +1 @@
plugin
ftplugin
syntax
coc-settings.json
.luarc.json
lazy-lock.json
after
**/.DS_Store

View File

@ -1,6 +0,0 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferDouble"
call_parentheses = "None"

162
init.lua
View File

@ -1,21 +1,157 @@
require "core"
local opt = vim.opt
local g = vim.g
g.maplocalleader = ";"
g.python3_host_prog = "/usr/bin/python3"
local custom_init_path = vim.api.nvim_get_runtime_file("lua/custom/init.lua", false)[1]
-- disable netrw at the very start of your init.lua
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
if custom_init_path then
dofile(custom_init_path)
opt.mouse = "a" -- mouse does annoying things for me if it's not 'a'
opt.signcolumn = "yes"
opt.clipboard = "" -- don't just use the system clipboard
opt.wrap = false
opt.breakindent = false
opt.spell = false
opt.list = true
opt.conceallevel = 2
opt.undofile = true
opt.undolevels = 10000
opt.writebackup = false
opt.history = 5000
opt.shada = { "'1000", "<50", "s10", "h" }
-- Tabs and Indents
-- ===
opt.textwidth = 80 -- Text width maximum chars before wrapping
opt.tabstop = 4 -- The number of spaces a tab is
opt.shiftwidth = 4 -- Number of spaces to use in auto(indent)
opt.smarttab = true -- Tab insert blanks according to 'shiftwidth'
opt.autoindent = true -- Use same indenting on new lines
opt.smartindent = true -- Smart autoindenting on new lines
opt.shiftround = true -- Round indent to multiple of 'shiftwidth'
-- Timing
-- ===
opt.ttimeout = true
opt.timeoutlen = 500 -- Time out on mappings
opt.ttimeoutlen = 10 -- Time out on key codes
opt.updatetime = 500 -- Idle time to write swap and trigger CursorHold
-- Searching
-- ===
opt.ignorecase = true -- Search ignoring case
opt.smartcase = true -- Keep case when searching with *
opt.infercase = true -- Adjust case in insert completion mode
opt.incsearch = true -- Incremental search
-- Formatting
-- ===
opt.wrap = false -- No wrap by default
opt.linebreak = true -- Break long lines at 'breakat'
opt.breakat = "\\ \\ ;:,!?" -- Long lines break chars
opt.startofline = false -- Cursor in same column for few commands
opt.splitbelow = true -- Splits open bottom right
opt.splitright = true
opt.breakindentopt = { shift = 2, min = 20 }
opt.formatoptions = "" -- see :h fo-table & :h formatoptions
-- Diff
-- ===
opt.diffopt:append({ "iwhite", "indent-heuristic", "algorithm:patience" })
opt.wildmode = "longest:full,full" -- Command-line completion mode
-- Folds
-- ===
opt.foldlevel = 10 -- start with all folds open
-- Editor UI
-- ===
vim.o.guifont = "FiraCode Nerd Font:h15"
opt.termguicolors = true
opt.shortmess = "xsTOInfFitloCaAs"
opt.showmode = true -- Show mode in cmd window
opt.scrolloff = 2 -- Keep at least n lines above/below
opt.sidescrolloff = 0 -- Keep at least n lines left/right
opt.numberwidth = 2 -- Minimum number of columns to use for the line number
opt.number = true -- Show line numbers
opt.relativenumber = true -- Show relative line numbers
opt.ruler = true -- Default status ruler
opt.list = true -- Show hidden characters
opt.showtabline = 1 -- Don't change this, goes back to a vanilla vim default
opt.laststatus = 3 -- Always show laststatus
if vim.g.started_by_firenvim == true then
opt.showtabline = 1 -- Don't show tabline in firenvim, unless multitab
opt.laststatus = 1 -- Don't show laststatus in firenvim
opt.wrap = true
end
require("core.utils").load_mappings()
if vim.g.neovide == true then
-- fulscreen with F11
vim.api.nvim_set_keymap("n", "<F11>", ":let g:neovide_fullscreen = !g:neovide_fullscreen<CR>", {})
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
vim.g.neovide_underline_automatic_scaling = true
-- bootstrap lazy.nvim!
if not vim.loop.fs_stat(lazypath) then
require("core.bootstrap").gen_chadrc_template()
require("core.bootstrap").lazy(lazypath)
-- vim.g.neovide_floating_blur_amount_x = 2.0
-- vim.g.neovide_floating_blur_amount_y = 2.0
vim.g.neovide_scroll_animation_length = 0.1
-- vim.g.neovide_cursor_animation_length = 0
-- vim.g.neovide_cursor_trail_size = 0
vim.g.neovide_hide_mouse_when_typing = true
vim.g.neovide_fullscreen = true
end
dofile(vim.g.base46_cache .. "defaults")
vim.opt.rtp:prepend(lazypath)
require "plugins"
opt.helpheight = 0 -- Disable help window resizing
opt.winwidth = 30 -- Minimum width for active window
opt.winminwidth = 1 -- Minimum width for inactive windows
opt.winheight = 1 -- Minimum height for active window
opt.winminheight = 1 -- Minimum height for inactive window
opt.showcmd = false -- show command in status line
opt.cmdheight = 0
opt.cmdwinheight = 5 -- Command-line lines
opt.equalalways = true -- Resize windows on split or close
opt.colorcolumn = "+0" -- Column highlight at textwidth's max character-limit
opt.cursorline = true
opt.cursorlineopt = { "number", "screenline" }
opt.pumheight = 10 -- Maximum number of items to show in the popup menu
opt.pumwidth = 10 -- Minimum width for the popup menu
opt.pumblend = 10 -- Popup blend
-- Spelling correction
-- ===
opt.spell = false -- manually enable spell with `set spell` or `<leader>ts`
opt.spelllang = "en,de_de,"
opt.spellsuggest = "double,50,timeout:5000"
-- autocommands
-- ===
local function augroup(name)
return vim.api.nvim_create_augroup("plex_" .. name, {})
end
-- guis
if vim.g.vscode then
require("vscode")
end
-- mappings
local utils = require("core.utils")
utils.load_mappings("clipboard")
utils.load_mappings("movements")
utils.load_mappings("edit")
utils.load_mappings("tabs")
utils.load_mappings("ui")
require("plugins")

View File

@ -1,62 +0,0 @@
local M = {}
local fn = vim.fn
M.echo = function(str)
vim.cmd "redraw"
vim.api.nvim_echo({ { str, "Bold" } }, true, {})
end
local function shell_call(args)
local output = fn.system(args)
assert(vim.v.shell_error == 0, "External call failed with error code: " .. vim.v.shell_error .. "\n" .. output)
end
M.lazy = function(install_path)
------------- base46 ---------------
local lazy_path = fn.stdpath "data" .. "/lazy/base46"
M.echo " Compiling base46 theme to bytecode ..."
local base46_repo = "https://github.com/NvChad/base46"
shell_call { "git", "clone", "--depth", "1", "-b", "v2.0", base46_repo, lazy_path }
vim.opt.rtp:prepend(lazy_path)
require("base46").compile()
--------- lazy.nvim ---------------
M.echo " Installing lazy.nvim & plugins ..."
local repo = "https://github.com/folke/lazy.nvim.git"
shell_call { "git", "clone", "--filter=blob:none", "--branch=stable", repo, install_path }
vim.opt.rtp:prepend(install_path)
-- install plugins
require "plugins"
-- mason packages & show post_bootstrap screen
require "nvchad.post_install"()
end
M.gen_chadrc_template = function()
local path = fn.stdpath "config" .. "/lua/custom"
if fn.isdirectory(path) ~= 1 then
local input = vim.env.NVCHAD_EXAMPLE_CONFIG or fn.input "Do you want to install example custom config? (y/N): "
if input:lower() == "y" then
M.echo "Cloning example custom config repo..."
shell_call { "git", "clone", "--depth", "1", "https://github.com/NvChad/example_config", path }
fn.delete(path .. "/.git", "rf")
else
-- use very minimal chadrc
fn.mkdir(path, "p")
local file = io.open(path .. "/chadrc.lua", "w")
if file then
file:write "---@type ChadrcConfig\nlocal M = {}\n\nM.ui = { theme = 'onedark' }\n\nreturn M"
file:close()
end
end
end
end
return M

View File

@ -1,92 +0,0 @@
local M = {}
M.options = {
nvchad_branch = "v2.0",
}
M.ui = {
------------------------------- base46 -------------------------------------
-- hl = highlights
hl_add = {},
hl_override = {},
changed_themes = {},
theme_toggle = { "onedark", "one_light" },
theme = "onedark", -- default theme
transparency = false,
lsp_semantic_tokens = false, -- needs nvim v0.9, just adds highlight groups for lsp semantic tokens
-- https://github.com/NvChad/base46/tree/v2.0/lua/base46/extended_integrations
extended_integrations = {}, -- these aren't compiled by default, ex: "alpha", "notify"
-- cmp themeing
cmp = {
icons = true,
lspkind_text = true,
style = "default", -- default/flat_light/flat_dark/atom/atom_colored
border_color = "grey_fg", -- only applicable for "default" style, use color names from base30 variables
selected_item_bg = "colored", -- colored / simple
},
telescope = { style = "borderless" }, -- borderless / bordered
------------------------------- nvchad_ui modules -----------------------------
statusline = {
theme = "default", -- default/vscode/vscode_colored/minimal
-- default/round/block/arrow separators work only for default statusline theme
-- round and block will work for minimal theme only
separator_style = "default",
overriden_modules = nil,
},
-- lazyload it when there are 1+ buffers
tabufline = {
show_numbers = false,
enabled = true,
lazyload = true,
overriden_modules = nil,
},
-- nvdash (dashboard)
nvdash = {
load_on_startup = false,
header = {
" ▄ ▄ ",
" ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ ",
" █ ▄ █▄█ ▄▄▄ █ █▄█ █ █ ",
" ▄▄ █▄█▄▄▄█ █▄█▄█▄▄█▄▄█ █ ",
" ▄ █▄▄█ ▄ ▄▄ ▄█ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ",
" █▄▄▄▄ ▄▄▄ █ ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ █ ▄",
"▄ █ █▄█ █▄█ █ █ █▄█ █ █▄█ ▄▄▄ █ █",
"█▄█ ▄ █▄▄█▄▄█ █ ▄▄█ █ ▄ █ █▄█▄█ █",
" █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█ █▄█▄▄▄█ ",
},
buttons = {
{ " Find File", "Spc f f", "Telescope find_files" },
{ "󰈚 Recent Files", "Spc f o", "Telescope oldfiles" },
{ "󰈭 Find Word", "Spc f w", "Telescope live_grep" },
{ " Bookmarks", "Spc m a", "Telescope marks" },
{ " Themes", "Spc t h", "Telescope themes" },
{ " Mappings", "Spc c h", "NvCheatsheet" },
},
},
cheatsheet = { theme = "grid" }, -- simple/grid
lsp = {
-- show function signatures i.e args as you type
signature = {
disabled = false,
silent = true, -- silences 'no signature help available' message from appearing
},
},
}
M.plugins = "" -- path i.e "custom.plugins", so make custom/plugins.lua file
M.lazy_nvim = require "plugins.configs.lazy_nvim" -- config for lazy.nvim startup options
M.mappings = require "core.mappings"
return M

View File

@ -1,115 +0,0 @@
local opt = vim.opt
local g = vim.g
local config = require("core.utils").load_config()
-------------------------------------- globals -----------------------------------------
g.nvchad_theme = config.ui.theme
g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/"
g.toggle_theme_icon = ""
g.transparency = config.ui.transparency
-------------------------------------- options ------------------------------------------
opt.laststatus = 3 -- global statusline
opt.showmode = false
opt.clipboard = "unnamedplus"
opt.cursorline = true
-- Indenting
opt.expandtab = true
opt.shiftwidth = 2
opt.smartindent = true
opt.tabstop = 2
opt.softtabstop = 2
opt.fillchars = { eob = " " }
opt.ignorecase = true
opt.smartcase = true
opt.mouse = "a"
-- Numbers
opt.number = true
opt.numberwidth = 2
opt.ruler = false
-- disable nvim intro
opt.shortmess:append "sI"
opt.signcolumn = "yes"
opt.splitbelow = true
opt.splitright = true
opt.termguicolors = true
opt.timeoutlen = 400
opt.undofile = true
-- interval for writing swap file to disk, also used by gitsigns
opt.updatetime = 250
-- go to previous/next line with h,l,left arrow and right arrow
-- when cursor reaches end/beginning of line
opt.whichwrap:append "<>[]hl"
g.mapleader = " "
-- disable some default providers
for _, provider in ipairs { "node", "perl", "python3", "ruby" } do
vim.g["loaded_" .. provider .. "_provider"] = 0
end
-- add binaries installed by mason.nvim to path
local is_windows = vim.loop.os_uname().sysname == "Windows_NT"
vim.env.PATH = vim.fn.stdpath "data" .. "/mason/bin" .. (is_windows and ";" or ":") .. vim.env.PATH
-------------------------------------- autocmds ------------------------------------------
local autocmd = vim.api.nvim_create_autocmd
-- dont list quickfix buffers
autocmd("FileType", {
pattern = "qf",
callback = function()
vim.opt_local.buflisted = false
end,
})
-- reload some chadrc options on-save
autocmd("BufWritePost", {
pattern = vim.tbl_map(function(path)
return vim.fs.normalize(vim.loop.fs_realpath(path))
end, vim.fn.glob(vim.fn.stdpath "config" .. "/lua/custom/**/*.lua", true, true, true)),
group = vim.api.nvim_create_augroup("ReloadNvChad", {}),
callback = function(opts)
local fp = vim.fn.fnamemodify(vim.fs.normalize(vim.api.nvim_buf_get_name(opts.buf)), ":r") --[[@as string]]
local app_name = vim.env.NVIM_APPNAME and vim.env.NVIM_APPNAME or "nvim"
local module = string.gsub(fp, "^.*/" .. app_name .. "/lua/", ""):gsub("/", ".")
require("plenary.reload").reload_module "base46"
require("plenary.reload").reload_module(module)
require("plenary.reload").reload_module "custom.chadrc"
config = require("core.utils").load_config()
vim.g.nvchad_theme = config.ui.theme
vim.g.transparency = config.ui.transparency
-- statusline
require("plenary.reload").reload_module("nvchad.statusline." .. config.ui.statusline.theme)
vim.opt.statusline = "%!v:lua.require('nvchad.statusline." .. config.ui.statusline.theme .. "').run()"
-- tabufline
if config.ui.tabufline.enabled then
require("plenary.reload").reload_module "nvchad.tabufline.modules"
vim.opt.tabline = "%!v:lua.require('nvchad.tabufline.modules').run()"
end
require("base46").load_all_highlights()
-- vim.cmd("redraw!")
end,
})
-------------------------------------- commands ------------------------------------------
local new_cmd = vim.api.nvim_create_user_command
new_cmd("NvChadUpdate", function()
require "nvchad.updater"()
end, {})

View File

@ -1,468 +0,0 @@
-- n, v, i, t = mode names
local M = {}
M.general = {
i = {
-- go to beginning and end
["<C-b>"] = { "<ESC>^i", "Beginning of line" },
["<C-e>"] = { "<End>", "End of line" },
-- navigate within insert mode
["<C-h>"] = { "<Left>", "Move left" },
["<C-l>"] = { "<Right>", "Move right" },
["<C-j>"] = { "<Down>", "Move down" },
["<C-k>"] = { "<Up>", "Move up" },
},
n = {
["<Esc>"] = { "<cmd> noh <CR>", "Clear highlights" },
-- switch between windows
["<C-h>"] = { "<C-w>h", "Window left" },
["<C-l>"] = { "<C-w>l", "Window right" },
["<C-j>"] = { "<C-w>j", "Window down" },
["<C-k>"] = { "<C-w>k", "Window up" },
-- save
["<C-s>"] = { "<cmd> w <CR>", "Save file" },
-- Copy all
["<C-c>"] = { "<cmd> %y+ <CR>", "Copy whole file" },
-- line numbers
["<leader>n"] = { "<cmd> set nu! <CR>", "Toggle line number" },
["<leader>rn"] = { "<cmd> set rnu! <CR>", "Toggle relative number" },
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
-- empty mode is same as using <cmd> :map
-- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour
["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
-- new buffer
["<leader>b"] = { "<cmd> enew <CR>", "New buffer" },
["<leader>ch"] = { "<cmd> NvCheatsheet <CR>", "Mapping cheatsheet" },
["<leader>fm"] = {
function()
vim.lsp.buf.format { async = true }
end,
"LSP formatting",
},
},
t = {
["<C-x>"] = { vim.api.nvim_replace_termcodes("<C-\\><C-N>", true, true, true), "Escape terminal mode" },
},
v = {
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
["<"] = { "<gv", "Indent line" },
[">"] = { ">gv", "Indent line" },
},
x = {
["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
-- Don't copy the replaced text after pasting in visual mode
-- https://vim.fandom.com/wiki/Replace_a_word_with_yanked_text#Alternative_mapping_for_paste
["p"] = { 'p:let @+=@0<CR>:let @"=@0<CR>', "Dont copy replaced text", opts = { silent = true } },
},
}
M.tabufline = {
plugin = true,
n = {
-- cycle through buffers
["<tab>"] = {
function()
require("nvchad.tabufline").tabuflineNext()
end,
"Goto next buffer",
},
["<S-tab>"] = {
function()
require("nvchad.tabufline").tabuflinePrev()
end,
"Goto prev buffer",
},
-- close buffer + hide terminal buffer
["<leader>x"] = {
function()
require("nvchad.tabufline").close_buffer()
end,
"Close buffer",
},
},
}
M.comment = {
plugin = true,
-- toggle comment in both modes
n = {
["<leader>/"] = {
function()
require("Comment.api").toggle.linewise.current()
end,
"Toggle comment",
},
},
v = {
["<leader>/"] = {
"<ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>",
"Toggle comment",
},
},
}
M.lspconfig = {
plugin = true,
-- See `<cmd> :help vim.lsp.*` for documentation on any of the below functions
n = {
["gD"] = {
function()
vim.lsp.buf.declaration()
end,
"LSP declaration",
},
["gd"] = {
function()
vim.lsp.buf.definition()
end,
"LSP definition",
},
["K"] = {
function()
vim.lsp.buf.hover()
end,
"LSP hover",
},
["gi"] = {
function()
vim.lsp.buf.implementation()
end,
"LSP implementation",
},
["<leader>ls"] = {
function()
vim.lsp.buf.signature_help()
end,
"LSP signature help",
},
["<leader>D"] = {
function()
vim.lsp.buf.type_definition()
end,
"LSP definition type",
},
["<leader>ra"] = {
function()
require("nvchad.renamer").open()
end,
"LSP rename",
},
["<leader>ca"] = {
function()
vim.lsp.buf.code_action()
end,
"LSP code action",
},
["gr"] = {
function()
vim.lsp.buf.references()
end,
"LSP references",
},
["<leader>lf"] = {
function()
vim.diagnostic.open_float { border = "rounded" }
end,
"Floating diagnostic",
},
["[d"] = {
function()
vim.diagnostic.goto_prev { float = { border = "rounded" } }
end,
"Goto prev",
},
["]d"] = {
function()
vim.diagnostic.goto_next { float = { border = "rounded" } }
end,
"Goto next",
},
["<leader>q"] = {
function()
vim.diagnostic.setloclist()
end,
"Diagnostic setloclist",
},
["<leader>wa"] = {
function()
vim.lsp.buf.add_workspace_folder()
end,
"Add workspace folder",
},
["<leader>wr"] = {
function()
vim.lsp.buf.remove_workspace_folder()
end,
"Remove workspace folder",
},
["<leader>wl"] = {
function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end,
"List workspace folders",
},
},
v = {
["<leader>ca"] = {
function()
vim.lsp.buf.code_action()
end,
"LSP code action",
},
},
}
M.nvimtree = {
plugin = true,
n = {
-- toggle
["<C-n>"] = { "<cmd> NvimTreeToggle <CR>", "Toggle nvimtree" },
-- focus
["<leader>e"] = { "<cmd> NvimTreeFocus <CR>", "Focus nvimtree" },
},
}
M.telescope = {
plugin = true,
n = {
-- find
["<leader>ff"] = { "<cmd> Telescope find_files <CR>", "Find files" },
["<leader>fa"] = { "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR>", "Find all" },
["<leader>fw"] = { "<cmd> Telescope live_grep <CR>", "Live grep" },
["<leader>fb"] = { "<cmd> Telescope buffers <CR>", "Find buffers" },
["<leader>fh"] = { "<cmd> Telescope help_tags <CR>", "Help page" },
["<leader>fo"] = { "<cmd> Telescope oldfiles <CR>", "Find oldfiles" },
["<leader>fz"] = { "<cmd> Telescope current_buffer_fuzzy_find <CR>", "Find in current buffer" },
-- git
["<leader>cm"] = { "<cmd> Telescope git_commits <CR>", "Git commits" },
["<leader>gt"] = { "<cmd> Telescope git_status <CR>", "Git status" },
-- pick a hidden term
["<leader>pt"] = { "<cmd> Telescope terms <CR>", "Pick hidden term" },
-- theme switcher
["<leader>th"] = { "<cmd> Telescope themes <CR>", "Nvchad themes" },
["<leader>ma"] = { "<cmd> Telescope marks <CR>", "telescope bookmarks" },
},
}
M.nvterm = {
plugin = true,
t = {
-- toggle in terminal mode
["<A-i>"] = {
function()
require("nvterm.terminal").toggle "float"
end,
"Toggle floating term",
},
["<A-h>"] = {
function()
require("nvterm.terminal").toggle "horizontal"
end,
"Toggle horizontal term",
},
["<A-v>"] = {
function()
require("nvterm.terminal").toggle "vertical"
end,
"Toggle vertical term",
},
},
n = {
-- toggle in normal mode
["<A-i>"] = {
function()
require("nvterm.terminal").toggle "float"
end,
"Toggle floating term",
},
["<A-h>"] = {
function()
require("nvterm.terminal").toggle "horizontal"
end,
"Toggle horizontal term",
},
["<A-v>"] = {
function()
require("nvterm.terminal").toggle "vertical"
end,
"Toggle vertical term",
},
-- new
["<leader>h"] = {
function()
require("nvterm.terminal").new "horizontal"
end,
"New horizontal term",
},
["<leader>v"] = {
function()
require("nvterm.terminal").new "vertical"
end,
"New vertical term",
},
},
}
M.whichkey = {
plugin = true,
n = {
["<leader>wK"] = {
function()
vim.cmd "WhichKey"
end,
"Which-key all keymaps",
},
["<leader>wk"] = {
function()
local input = vim.fn.input "WhichKey: "
vim.cmd("WhichKey " .. input)
end,
"Which-key query lookup",
},
},
}
M.blankline = {
plugin = true,
n = {
["<leader>cc"] = {
function()
local ok, start = require("indent_blankline.utils").get_current_context(
vim.g.indent_blankline_context_patterns,
vim.g.indent_blankline_use_treesitter_scope
)
if ok then
vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 })
vim.cmd [[normal! _]]
end
end,
"Jump to current context",
},
},
}
M.gitsigns = {
plugin = true,
n = {
-- Navigation through hunks
["]c"] = {
function()
if vim.wo.diff then
return "]c"
end
vim.schedule(function()
require("gitsigns").next_hunk()
end)
return "<Ignore>"
end,
"Jump to next hunk",
opts = { expr = true },
},
["[c"] = {
function()
if vim.wo.diff then
return "[c"
end
vim.schedule(function()
require("gitsigns").prev_hunk()
end)
return "<Ignore>"
end,
"Jump to prev hunk",
opts = { expr = true },
},
-- Actions
["<leader>rh"] = {
function()
require("gitsigns").reset_hunk()
end,
"Reset hunk",
},
["<leader>ph"] = {
function()
require("gitsigns").preview_hunk()
end,
"Preview hunk",
},
["<leader>gb"] = {
function()
package.loaded.gitsigns.blame_line()
end,
"Blame line",
},
["<leader>td"] = {
function()
require("gitsigns").toggle_deleted()
end,
"Toggle deleted",
},
},
}
return M

View File

@ -1,118 +1,38 @@
local M = {}
local merge_tb = vim.tbl_deep_extend
M.load_config = function()
local config = require "core.default_config"
local chadrc_path = vim.api.nvim_get_runtime_file("lua/custom/chadrc.lua", false)[1]
if chadrc_path then
local chadrc = dofile(chadrc_path)
config.mappings = M.remove_disabled_keys(chadrc.mappings, config.mappings)
config = merge_tb("force", config, chadrc)
config.mappings.disabled = nil
end
return config
end
M.remove_disabled_keys = function(chadrc_mappings, default_mappings)
if not chadrc_mappings then
return default_mappings
end
-- store keys in a array with true value to compare
local keys_to_disable = {}
for _, mappings in pairs(chadrc_mappings) do
for mode, section_keys in pairs(mappings) do
if not keys_to_disable[mode] then
keys_to_disable[mode] = {}
end
section_keys = (type(section_keys) == "table" and section_keys) or {}
for k, _ in pairs(section_keys) do
keys_to_disable[mode][k] = true
end
end
end
-- make a copy as we need to modify default_mappings
for section_name, section_mappings in pairs(default_mappings) do
for mode, mode_mappings in pairs(section_mappings) do
mode_mappings = (type(mode_mappings) == "table" and mode_mappings) or {}
for k, _ in pairs(mode_mappings) do
-- if key if found then remove from default_mappings
if keys_to_disable[mode] and keys_to_disable[mode][k] then
default_mappings[section_name][mode][k] = nil
end
end
end
end
return default_mappings
end
M.load_mappings = function(section, mapping_opt)
vim.schedule(function()
local function set_section_map(section_values)
if section_values.plugin then
return
end
vim.schedule(function()
local function set_section_map(section_values)
if section_values.plugin then
return
end
section_values.plugin = nil
section_values.plugin = nil
for mode, mode_values in pairs(section_values) do
local default_opts = merge_tb("force", { mode = mode }, mapping_opt or {})
for keybind, mapping_info in pairs(mode_values) do
-- merge default + user opts
local opts = merge_tb("force", default_opts, mapping_info.opts or {})
local merge_tb = vim.tbl_deep_extend
for mode, mode_values in pairs(section_values) do
local default_opts = merge_tb("force", { mode = mode }, mapping_opt or {})
for keybind, mapping_info in pairs(mode_values) do
-- merge default + user opts
local opts = merge_tb("force", default_opts, mapping_info.opts or {})
mapping_info.opts, opts.mode = nil, nil
opts.desc = mapping_info[2]
mapping_info.opts, opts.mode = nil, nil
opts.desc = mapping_info[2]
vim.keymap.set(mode, keybind, mapping_info[1], opts)
end
end
end
vim.keymap.set(mode, keybind, mapping_info[1], opts)
end
end
end
local mappings = require("core.utils").load_config().mappings
local mappings = require("mappings")
if type(section) == "string" then
mappings[section]["plugin"] = nil
mappings = { mappings[section] }
end
if type(section) == "string" then
mappings[section]["plugin"] = nil
mappings = { mappings[section] }
end
for _, sect in pairs(mappings) do
set_section_map(sect)
end
end)
for _, sect in pairs(mappings) do
set_section_map(sect)
end
end)
end
M.lazy_load = function(plugin)
vim.api.nvim_create_autocmd({ "BufRead", "BufWinEnter", "BufNewFile" }, {
group = vim.api.nvim_create_augroup("BeLazyOnFileOpen" .. plugin, {}),
callback = function()
local file = vim.fn.expand "%"
local condition = file ~= "NvimTree_1" and file ~= "[lazy]" and file ~= ""
if condition then
vim.api.nvim_del_augroup_by_name("BeLazyOnFileOpen" .. plugin)
-- dont defer for treesitter as it will show slow highlighting
-- This deferring only happens only when we do "nvim filename"
if plugin ~= "nvim-treesitter" then
vim.schedule(function()
require("lazy").load { plugins = plugin }
if plugin == "nvim-lspconfig" then
vim.cmd "silent! do FileType"
end
end, 0)
else
require("lazy").load { plugins = plugin }
end
end
end,
})
end
return M

View File

@ -1,74 +0,0 @@
---@type ChadrcConfig
local M = {}
-- Path to overriding theme and highlights files
local highlights = require "custom.highlights"
M.ui = {
theme = "oceanic-next",
theme_toggle = { "oceanic-next", "oceanic-light" },
hl_override = highlights.override,
hl_add = highlights.add,
lsp_semantic_tokens = true,
statusline = {
theme = "default", -- default/vscode/vscode_colored/minimal
-- default/round/block/arrow separators work only for default statusline theme
-- round and block will work for minimal theme only
separator_style = "default",
overriden_modules = nil,
},
-- lazyload it when there are 1+ buffers
tabufline = {
show_numbers = true,
enabled = true,
lazyload = true,
overriden_modules = nil,
},
-- nvdash (dashboard)
nvdash = {
load_on_startup = true,
header = {
" ",
" █ ████████ █████ ███████ ████ ",
" ███ ██████ █████ █████████ ██████ ",
" █████ ██████████████████████ ████ ███████████████ ",
" ██ ██ █████ █████████████ ████ ████████████████ ",
" ████ ███████████████ █████████ ████ █████ ██████ ████ ",
" ██████ ██████ ███ █████████ ████ █████ █████ ████ ",
" ████████ ███████████████████ ████ ████ █████ ████ ████ ",
" ",
" 🛠️ Sharp tools make good work 🖥️ ",
},
},
}
M.plugins = "custom.plugins"
-- check core.mappings for table structure
M.mappings = require "custom.mappings"
local get_info = function()
local buf = {
{ " Find File", ";ff", "Telescope find_files" },
{ "󰈚 Recent Files", ";fo", "Telescope oldfiles" },
{ "󰈭 Find Word", ";fw", "Telescope live_grep" },
{ " Bookmarks", ";fm", "Telescope marks" },
{ " Theme: " .. M.ui.theme, ";th", "Telescope themes" },
{
" Toggle Theme",
"<space>th",
function()
require("base46").toggle_theme()
end,
},
{ " Mappings", "<space>ch", "NvCheatsheet" },
{ " Git", "<space>gg", "LazyGit" },
{ " Files", "<F5>", "NvimTreeToggle" },
{ " Change Directory", ";cd", "Telescope zoxide list" },
{ " Terminal", "<A-i>", "ToggleTerm direction=float" },
}
return buf
end
M.ui.nvdash.buttons = get_info()
return M

View File

@ -1,26 +0,0 @@
local options = {
lsp_fallback = true,
formatters_by_ft = {
lua = { "stylua" },
javascript = { "prettier" },
css = { "prettier" },
html = { "prettier" },
sh = { "shfmt" },
toml = { "taplo" },
rust = { "rustfmt" },
},
-- adding same formatter for multiple filetypes can look too much work for some
-- instead of the above code you could just use a loop! the config is just a table after all!
-- format_on_save = {
-- -- These options will be passed to conform.format()
-- timeout_ms = 500,
-- lsp_fallback = true,
-- },
}
require("conform").setup(options)

View File

@ -1,48 +0,0 @@
local on_attach = require("plugins.configs.lspconfig").on_attach
local capabilities = require("plugins.configs.lspconfig").capabilities
local lspconfig = require "lspconfig"
-- if you just want default config for the servers then put them in a table
local servers = {
"html",
"cssls",
"tsserver",
"clangd",
"pyright",
-- "rust_analyzer", -- rustaceanvim wants to do that, but the builtin thing has better integration!
"bashls",
"cmake",
}
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = on_attach,
capabilities = capabilities,
}
end
lspconfig.rust_analyzer.setup {
on_attach = on_attach,
settings = {
["rust-analyzer"] = {
check = {
command = "clippy",
},
imports = {
granularity = {
group = "module",
},
prefix = "self",
},
cargo = {
buildScripts = {
enable = true,
},
},
procMacro = {
enable = true,
},
},
},
}

View File

@ -1,84 +0,0 @@
local M = {}
M.treesitter = {
ensure_installed = {
"vim",
"lua",
"html",
"css",
"javascript",
"typescript",
"tsx",
"c",
"markdown",
"markdown_inline",
"rust",
"cpp",
"python",
"yaml",
"json",
"toml",
"bash",
},
indent = {
enable = true,
-- disable = {
-- "python"
-- },
},
}
M.mason = {
ensure_installed = {
-- general purpose
"purpose",
-- lua stuff
"lua-language-server",
"stylua",
-- web dev stuff
"css-lsp",
"html-lsp",
"typescript-language-server",
"deno",
"prettier",
-- c/cpp stuff
"clangd",
"clang-format",
"cmake-language-server",
-- rust
"rust-analyzer",
"taplo",
-- python
"pyright",
-- english??
-- "write-good",
-- shell
"shellcheck",
"bash-language-server",
},
}
-- git support in nvimtree
M.nvimtree = {
git = {
enable = true,
},
renderer = {
highlight_git = true,
icons = {
show = {
git = true,
},
},
},
}
return M

View File

@ -1,30 +0,0 @@
-- To find any highlight groups: "<cmd> Telescope highlights"
-- Each highlight group can take a table with variables fg, bg, bold, italic, etc
-- base30 variable names can also be used as colors
local M = {}
---@type Base46HLGroupsList
M.override = {
Comment = {
italic = false,
},
-- NvDashAscii = {
-- fg = "#b33366",
-- bg = "#1a1a1a",
-- },
-- NvDashButtons = {
-- fg = "White",
-- bg = "#241e1e",
-- },
TodoFgNOTE = {
fg = "#cccccc"
}
}
---@type HLTable
M.add = {
NvimTreeOpenedFolderName = { fg = "green", bold = true },
}
return M

View File

@ -1,186 +0,0 @@
local opt = vim.opt
local g = vim.g
g.maplocalleader = ";"
g.python3_host_prog = '/usr/bin/python3'
opt.mouse = "a" -- mouse does annoying things for me if it's not 'a'
opt.signcolumn = "yes"
opt.clipboard = "" -- don't just use the system clipboard
opt.wrap = false
opt.breakindent = false
opt.spell = false
opt.list = true
opt.conceallevel = 2
opt.undofile = true
opt.undolevels = 10000
opt.writebackup = false
opt.history = 5000
opt.shada = { "'1000", "<50", "s10", "h" }
-- Tabs and Indents
-- ===
opt.textwidth = 80 -- Text width maximum chars before wrapping
opt.tabstop = 4 -- The number of spaces a tab is
opt.shiftwidth = 4 -- Number of spaces to use in auto(indent)
opt.smarttab = true -- Tab insert blanks according to 'shiftwidth'
opt.autoindent = true -- Use same indenting on new lines
opt.smartindent = true -- Smart autoindenting on new lines
opt.shiftround = true -- Round indent to multiple of 'shiftwidth'
-- Timing
-- ===
opt.ttimeout = true
opt.timeoutlen = 500 -- Time out on mappings
opt.ttimeoutlen = 10 -- Time out on key codes
opt.updatetime = 500 -- Idle time to write swap and trigger CursorHold
-- Searching
-- ===
opt.ignorecase = true -- Search ignoring case
opt.smartcase = true -- Keep case when searching with *
opt.infercase = true -- Adjust case in insert completion mode
opt.incsearch = true -- Incremental search
-- Formatting
-- ===
opt.wrap = false -- No wrap by default
opt.linebreak = true -- Break long lines at 'breakat'
opt.breakat = "\\ \\ ;:,!?" -- Long lines break chars
opt.startofline = false -- Cursor in same column for few commands
opt.splitbelow = true -- Splits open bottom right
opt.splitright = true
opt.breakindentopt = { shift = 2, min = 20 }
opt.formatoptions = "qnlmBjp" -- see :h fo-table & :h formatoptions
-- Diff
-- ===
opt.diffopt:append { "iwhite", "indent-heuristic", "algorithm:patience" }
opt.wildmode = "longest:full,full" -- Command-line completion mode
-- Folds
-- ===
opt.foldlevel = 10 -- start with all folds open
-- Editor UI
-- ===
vim.o.guifont = "FiraCode Nerd Font:h15"
opt.termguicolors = true
opt.shortmess = "xsTOInfFitloCaAs"
opt.showmode = true -- Show mode in cmd window
opt.scrolloff = 2 -- Keep at least n lines above/below
opt.sidescrolloff = 0 -- Keep at least n lines left/right
opt.numberwidth = 2 -- Minimum number of columns to use for the line number
opt.number = true -- Show line numbers
opt.relativenumber = true -- Show relative line numbers
opt.ruler = true -- Default status ruler
opt.list = true -- Show hidden characters
opt.showtabline = 1 -- Don't change this, goes back to a vanilla vim default
opt.laststatus = 3 -- Always show laststatus
if vim.g.started_by_firenvim == true then
opt.showtabline = 1 -- Don't show tabline in firenvim, unless multitab
opt.laststatus = 1 -- Don't show laststatus in firenvim
opt.wrap = true
end
if vim.g.neovide == true then
-- fulscreen with F11
vim.api.nvim_set_keymap("n", "<F11>", ":let g:neovide_fullscreen = !g:neovide_fullscreen<CR>", {})
vim.g.neovide_underline_automatic_scaling = true
-- vim.g.neovide_floating_blur_amount_x = 2.0
-- vim.g.neovide_floating_blur_amount_y = 2.0
vim.g.neovide_scroll_animation_length = 0.1
-- vim.g.neovide_cursor_animation_length = 0
-- vim.g.neovide_cursor_trail_size = 0
vim.g.neovide_hide_mouse_when_typing = true
vim.g.neovide_fullscreen = true
end
opt.helpheight = 0 -- Disable help window resizing
opt.winwidth = 30 -- Minimum width for active window
opt.winminwidth = 1 -- Minimum width for inactive windows
opt.winheight = 1 -- Minimum height for active window
opt.winminheight = 1 -- Minimum height for inactive window
opt.showcmd = false -- show command in status line
opt.cmdheight = 0
opt.cmdwinheight = 5 -- Command-line lines
opt.equalalways = true -- Resize windows on split or close
opt.colorcolumn = "+0" -- Column highlight at textwidth's max character-limit
opt.cursorline = true
opt.cursorlineopt = { "number", "screenline" }
opt.pumheight = 10 -- Maximum number of items to show in the popup menu
opt.pumwidth = 10 -- Minimum width for the popup menu
opt.pumblend = 10 -- Popup blend
-- Spelling correction
-- ===
opt.spell = false -- manually enable spell with `set spell` or `<leader>ts`
opt.spelllang = "en,de_de,"
opt.spellsuggest = "double,50,timeout:5000"
-- autocommands
-- ===
local function augroup(name)
return vim.api.nvim_create_augroup("plex_" .. name, {})
end
-- highlight on yank
vim.api.nvim_create_autocmd("TextYankPost", {
group = augroup "highlight_yank",
callback = function()
vim.highlight.on_yank()
end,
})
-- Disable conceallevel for specific file-types.
vim.api.nvim_create_autocmd("FileType", {
group = augroup "fix_conceallevel",
pattern = { "latex", "tex" },
callback = function()
vim.opt_local.conceallevel = 0
end,
})
-- Resize splits if window got resized
vim.api.nvim_create_autocmd("VimResized", {
group = augroup "resize_splits",
callback = function()
vim.cmd "wincmd ="
end,
})
-- Wrap and enable spell-checker in text filetypes
vim.api.nvim_create_autocmd("FileType", {
group = augroup "spell_conceal",
pattern = { "gitcommit", "markdown", "tex", "latex", "norg" },
callback = function()
vim.opt_local.spell = true
vim.opt_local.conceallevel = 0
end,
})
-- map resizing for firenvim
if vim.g.started_by_firenvim == true then
vim.keymap.set("n", "<leader><C-DOWN>", function()
vim.o.lines = vim.o.lines + 1
end, { expr = true, desc = "Make Display bigger" })
vim.keymap.set("n", "<leader><C-UP>", function()
vim.o.lines = vim.o.lines - 1
end, { expr = true, desc = "Make Display smaller" })
end
-- alias filetypes
vim.filetype.add { extension = { tera = "html" } }

View File

@ -1,661 +0,0 @@
---@type MappingsTable
local M = {}
-- NOTE: The mappings here are case sensitive!!! Removing a specific default
-- mapping requires the same case here!
M.disabled = {
n = {
["<C-a>"] = "",
["<C-s>"] = "",
["<C-c>"] = "",
["<leader>n"] = "",
["<leader>rn"] = "",
["<Up>"] = "",
["<Down>"] = "",
["<leader>x"] = "",
["<leader>/"] = "",
["<leader>ra"] = "",
["[d"] = "",
["]d"] = "",
["[c"] = "",
["]c"] = "",
["<leader>h"] = "",
["<leader>ff"] = "",
["<leader>fm"] = "",
["<leader>fa"] = "",
["<leader>fw"] = "",
["<leader>fb"] = "",
["<leader>th"] = "",
["<leader>fh"] = "",
["<leader>fo"] = "",
["<leader>fz"] = "",
["<leader>cm"] = "",
["<leader>gt"] = "",
["<leader>pt"] = "",
["<leader>ma"] = "",
["<leader>v"] = "",
["<leader>rh"] = "",
["<leader>ph"] = "",
["<leader>gb"] = "",
["<leader>td"] = "",
["<leader>wk"] = "",
["#"] = "",
["J"] = "",
},
t = {
["<C-t>"] = "",
},
v = {
["#"] = "",
["?"] = "",
["<leader>/"] = "",
["J"] = "",
},
}
M.tabufline = {
plugin = true,
n = {
-- cycle through buffers
["<Tab>"] = {
function()
require("nvchad.tabufline").tabuflineNext()
end,
"Goto next buffer",
},
["<S-tab>"] = {
function()
require("nvchad.tabufline").tabuflinePrev()
end,
"Goto prev buffer",
},
-- close buffer + hide terminal buffer
["<A-c>"] = {
function()
require("nvchad.tabufline").close_buffer()
end,
"Close buffer",
},
},
}
M.comment = {
plugin = true,
-- toggle comment in both modes
n = {
["<leader>v"] = {
function()
require("Comment.api").toggle.linewise.current()
end,
"Toggle comment",
},
},
v = {
["<leader>v"] = {
"<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>",
"Toggle comment",
},
},
}
M.leap = {
plugin = true,
n = {
["s"] = {
"<plug>(leap-forward)",
"leap forward",
},
["S"] = {
"<plug>(leap-backward)",
"leap backward",
},
["gs"] = {
"<plug>(leap-from-window)",
"leap from window",
},
},
x = {
["s"] = {
"<plug>(leap-forward)",
"leap forward",
},
["S"] = {
"<plug>(leap-backward)",
"leap forward",
},
["gs"] = {
"<plug>(leap-from-window)",
"leap from window",
},
},
o = {
["s"] = {
"<plug>(leap-forward)",
"leap forward",
},
["S"] = {
"<plug>(leap-backward)",
"leap forward",
},
["gs"] = {
"<plug>(leap-from-window)",
"leap from window",
},
},
}
M.lazygit = {
plugin = true,
n = {
["<leader>gg"] = { "<cmd> LazyGit <cr>", "Open LazyGit" },
},
}
M.lspconfig = {
plugin = true,
n = {
["[d"] = {
function()
vim.diagnostic.goto_prev { float = { border = "rounded" } }
end,
"Goto prev",
},
["]d"] = {
function()
vim.diagnostic.goto_next { float = { border = "rounded" } }
end,
"Goto next",
},
["<leader>cr"] = {
function()
require("nvchad.renamer").open()
end,
"LSP rename",
},
},
}
M.clipboard = {
plugin = false,
n = {
["<leader>y"] = { '"+y', "yank to system" },
["<leader>Y"] = { '"+Y', "yank to system" },
["<leader>yy"] = { '"+y', "yank to system" },
},
v = {
["<leader>y"] = { '"+y', "yank to system" },
["<leader>Y"] = { '"+Y', "yank to system" },
["<leader>yy"] = { '"+y', "yank to system" },
},
}
M.telescope = {
plugin = true,
n = {
-- find
["<localleader>ff"] = { "<cmd> Telescope find_files <cr>", "Find files" },
["<localleader>fa"] = { "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <cr>", "Find all" },
["<localleader>fw"] = { "<cmd> Telescope live_grep <cr>", "Live grep" },
["<localleader>fb"] = { "<cmd> Telescope buffers <cr>", "Find buffers" },
["<localleader>fh"] = { "<cmd> Telescope help_tags <cr>", "Help page" },
["<localleader>fo"] = { "<cmd> Telescope oldfiles <cr>", "Find oldfiles" },
["<localleader>fz"] = { "<cmd> Telescope current_buffer_fuzzy_find <cr>", "Find in current buffer" },
-- directory
["<localleader>cd"] = { "<cmd> Telescope zoxide list<cr>", "telescope zoxide cd" },
-- git
["<localleader>cm"] = { "<cmd> Telescope git_commits <cr>", "Git commits" },
["<localleader>gt"] = { "<cmd> Telescope git_status <cr>", "Git status" },
-- pick a hidden term
["<localleader>pt"] = { "<cmd> Telescope terms <cr>", "Pick hidden term" },
-- theme switcher
["<localleader>th"] = { "<cmd> Telescope themes <cr>", "Nvchad themes" },
["<localleader>ma"] = { "<cmd> Telescope marks <cr>", "telescope bookmarks" },
-- lsp stuff
["<localleader>cw"] = { "<cmd> Telescope lsp_dynamic_workspace_symbols <cr>", "telescope dynamic workspace symbols" },
["<localleader>cf"] = { "<cmd> Telescope lsp_document_symbols <cr>", "telescope document symbols" },
["<localleader>ci"] = { "<cmd> Telescope diagnostics <cr>", "telescope diagnostics" },
},
}
M.toggleterm = {
plugin = true,
n = {
["<F12>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-i>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-t>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=tab"<cr>',
"toggle terminal",
},
["<A-h>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=horizontal"<cr>',
"toggle terminal",
},
["<A-v>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=vertical"<cr>',
"toggle terminal",
},
},
i = {
["<F12>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-i>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-t>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=tab"<cr>',
"toggle terminal",
},
["<A-h>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=horizontal"<cr>',
"toggle terminal",
},
["<A-v>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=vertical"<cr>',
"toggle terminal",
},
},
t = {
["<F12>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-i>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-t>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=tab"<cr>',
"toggle terminal",
},
["<A-h>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=horizontal"<cr>',
"toggle terminal",
},
["<A-v>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=vertical"<cr>',
"toggle terminal",
},
},
x = {
["<F12>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-i>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-t>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=tab"<cr>',
"toggle terminal",
},
["<A-h>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=horizontal"<cr>',
"toggle terminal",
},
["<A-v>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=vertical"<cr>',
"toggle terminal",
},
},
}
M.nvimtree = {
plugin = true,
n = {
-- toggle
["<C-n>"] = { "<cmd> NvimTreeToggle <cr>", "Toggle nvimtree" },
["<F5>"] = { "<cmd> NvimTreeToggle <cr>", "Toggle nvimtree" },
["<leader>tf"] = { "<cmd> NvimTreeToggle <cr>", "Toggle nvimtree" },
-- focus
["<localleader>e"] = { "<cmd> NvimTreeFocus <cr>", "Focus nvimtree" },
},
}
M.movements = {
plugin = false,
i = {
--big move
["<A-k>"] = { "<C-u>", "big step down" },
["<A-j>"] = { "<C-d>", "big step down" },
-- go to beginning and end
["<C-b>"] = { "<home>", "Beginning of line" },
["<C-e>"] = { "<end>", "End of line" },
-- navigate within insert mode
["<C-h>"] = { "<left>", "Move left" },
["<C-l>"] = { "<right>", "Move right" },
["<C-j>"] = { "<down>", "Move down" },
["<C-k>"] = { "<up>", "Move up" },
},
n = {
--big move
["<A-k>"] = { "<C-u>", "big step down" },
["<A-j>"] = { "<C-d>", "big step down" },
-- go to beginning and end
["H"] = { "<home>", "Beginning of line" },
["L"] = { "<end>", "End of line" },
-- go to mark with "#"
["#"] = { "'", "go to mark" },
-- spell
["]s"] = { "]s", "go to next spelling mark" },
["[s"] = { "[s", "go to last spelling mark" },
-- just scroll a line
["zk"] = { "<C-y>", "scroll up a line" },
["zj"] = { "<C-e>", "scroll down a line" },
},
v = {
--big move
["<A-k>"] = { "<C-u>", "big step down" },
["<A-j>"] = { "<C-d>", "big step down" },
-- go to beginning and end
["H"] = { "<home>", "Beginning of line" },
["L"] = { "<end>", "End of line" },
},
t = {
["<C-w>"] = {
vim.api.nvim_replace_termcodes("<C-\\><C-N>", true, true, true),
"Escape terminal mode",
},
},
}
M.edit = {
plugin = false,
n = {
-- easy newline
["OO"] = { "O<esc>", "insert a line above" },
["oo"] = { "o<esc>", "insert a line below" },
-- substitute (change hovered/selection with insert mode)
-- normally, this is s, but that is leaps binding now
["<leader>s"] = { "s", "replace with insert mode" },
-- split and join lines
["J"] = { "j" },
["<C-s-j>"] = { "<cmd>join<cr>", "join lines" },
["<C-s-s>"] = { "i<cr><esc>l", "split line" },
-- do something useful with the arrows
["<Up>"] = { "<cmd> move-2<cr>", "Move line up" },
["<Down>"] = { "<cmd> move+<cr>", "Move line down" },
["<Left>"] = { "<<", "Less indentation" },
["<Right>"] = { ">>", "More indentation" },
-- format with conform
["<leader>ff"] = {
function()
-- vim.lsp.buf.format()
require("conform").format()
end,
"format buffer",
},
-- remove trailing whitespace
["<leader>fw"] = {
function()
require("mini.trailspace").trim()
end,
"remove whitespace",
},
-- spell
["z<space>"] = { "<cmd>Telescope spell_suggest<CR>", "Spell suggest" },
["z="] = { "<cmd>Telescope spell_suggest<CR>", "Spell suggest" },
},
v = {
-- NOTE: I would love to know why these commands work, they seem really
-- crazy.
["<Up>"] = { ":move'<-2<CR>gv=gv", "Move lines up", opts = { silent = true } },
["<Down>"] = { ":move'>+<CR>gv=gv", "Move lines down", opts = { silent = true } },
["<Left>"] = { "<gv", "Less indentation" },
["<Right>"] = { ">gv", "More indentation" },
},
x = {},
t = {
--big move
["<A-k>"] = { "<C-u>", "big step down" },
["<A-j>"] = { "<C-d>", "big step down" },
},
}
M.ui = {
plugin = false,
n = {
-- toggle wrap
["<leader>tw"] = {
function()
vim.opt_local.wrap = not vim.wo.wrap
vim.opt_local.breakindent = not vim.wo.breakindent
if vim.wo.colorcolumn == "" then
vim.opt_local.colorcolumn = tostring(vim.bo.textwidth)
else
vim.opt_local.colorcolumn = ""
end
end,
"toggle wrap",
},
-- toggle some features
["<leader>tn"] = { "<cmd>setlocal nonumber!<cr>", "toggle line numbers" },
["<leader>trn"] = { "<cmd>setlocal nornu!<cr>", "toggle relative line numbers" },
["<leader>ts"] = { "<cmd>setlocal spell!<cr>", "toggle spell check" },
["<leader>ti"] = {
function()
require("lsp-inlayhints").toggle()
end,
"toggle inlay hints",
},
["<leader>th"] = {
function()
require("base46").toggle_theme()
end,
"toggle theme",
},
["<leader>te"] = {
function()
require("base46").toggle_transparency()
end,
"toggle transparency",
},
-- open windows
['<leader>"'] = { "<cmd>vsplit<cr>", "open a new window to the side" },
["<leader>%"] = { "<cmd>split<cr>", "open a new window on the totop" },
-- resize windows
["<C-Up>"] = { "<cmd>resize +1<cr>", "resize window" },
["<C-Down>"] = { "<cmd>resize -1<cr>", "resize window" },
["<C-Left>"] = { "<cmd>vertical resize +1<cr>", "resize window" },
["<C-Right>"] = { "<cmd>vertical resize -1<cr>", "resize window" },
-- tabs
["<leader>wn"] = { "<cmd>tabnew<cr>", "open a new tab" },
["<leader>wc"] = { "<cmd>tabclose<cr>", "close current tab" },
["<leader>wk"] = { "<cmd>tabnext<cr>", "go to next tab" },
["<leader>wj"] = { "<cmd>tabprevious<cr>", "go to prev tab" },
-- folds
["<S-Return>"] = { "zMzv", "focus on this fold" },
},
}
M.goto_preview = {
plugin = true,
n = {
["gpd"] = {
function()
require("goto-preview").goto_preview_definition()
end,
"go to definition preview",
noremap = true,
},
["gpD"] = {
function()
require("goto-preview").goto_preview_declaration()
end,
"go to declaration preview",
noremap = true,
},
["gpi"] = {
function()
require("goto-preview").goto_preview_implementation()
end,
"go to implementation preview",
noremap = true,
},
["gpt"] = {
function()
require("goto-preview").goto_preview_type_definition()
end,
"go to type preview",
noremap = true,
},
["gpr"] = {
function()
require("goto-preview").goto_preview_type_references()
end,
"go to references preview",
noremap = true,
},
["gpc"] = {
function()
require("goto-preview").close_all_win()
end,
"close previews",
noremap = true,
},
},
}
M.debug = {
plugin = true,
n = {
["<leader>db"] = {
function()
require("dap").toggle_breakpoint()
end,
"toggle breakpoint",
noremap = true,
},
["<leader>dc"] = {
function()
require("dap").continue()
end,
"debug continue",
noremap = true,
},
["<leader>ds"] = {
function()
require("dap").step_over()
end,
"debug step over",
noremap = true,
},
["<leader>di"] = {
function()
require("dap").step_into()
end,
"debug step into",
noremap = true,
},
["<leader>dr"] = {
function()
require("dap").repl.open()
end,
"debug open repl",
noremap = true,
},
["<leader>dws"] = {
function()
local widgets = require "dap.ui.widgets"
local my_sidebar = widgets.sidebar(widgets.scopes)
my_sidebar.open()
end,
"debug window scopes",
noremap = true,
},
["<leader>dwt"] = {
function()
local widgets = require "dap.ui.widgets"
local my_sidebar = widgets.sidebar(widgets.threads)
my_sidebar.open()
end,
"debug window threads",
noremap = true,
},
["<leader>dwe"] = {
function()
local widgets = require "dap.ui.widgets"
local my_sidebar = widgets.sidebar(widgets.expression)
my_sidebar.open()
end,
"debug window expressions",
noremap = true,
},
["<leader>dwi"] = {
function()
local widgets = require "dap.ui.widgets"
local my_sidebar = widgets.sidebar(widgets.sessions)
my_sidebar.open()
end,
"debug window sessions",
noremap = true,
},
["<leader>dwf"] = {
function()
local widgets = require "dap.ui.widgets"
local my_sidebar = widgets.sidebar(widgets.frames)
my_sidebar.open()
end,
"debug window frames",
noremap = true,
},
["<leader>dK"] = {
function()
require("dap.ui.widgets").hover()
end,
"debug hover",
noremap = true,
},
["<leader>du"] = {
function()
require("dapui").toggle()
end,
"debug ui toggle",
noremap = true,
},
},
}
return M

View File

@ -1,904 +0,0 @@
local overrides = require "custom.configs.overrides"
---@type NvPluginSpec[]
local plugins = {
-- Override plugin definition options
{
"neovim/nvim-lspconfig",
config = function()
require "plugins.configs.lspconfig"
require "custom.configs.lspconfig"
end, -- Override to setup mason-lspconfig
},
-- override plugin configs
{
"williamboman/mason.nvim",
opts = overrides.mason,
},
{
"nvim-treesitter/nvim-treesitter",
opts = overrides.treesitter,
},
{
"nvim-tree/nvim-tree.lua",
opts = overrides.nvimtree,
},
-- Install a plugin
{
-- exit insert mode with 'jk'
"max397574/better-escape.nvim",
enabled = true,
event = "InsertEnter",
config = function()
require("better_escape").setup()
end,
},
{
"stevearc/conform.nvim",
-- for users those who want auto-save conform + lazyloading!
-- event = "BufWritePre"
config = function()
require "custom.configs.conform"
end,
},
{
"ggandor/leap.nvim",
lazy = false,
config = function()
require("core.utils").load_mappings "leap"
end,
},
{
"ggandor/flit.nvim",
lazy = false,
config = function()
require("flit").setup {
keys = { f = "f", F = "F", t = "t", T = "T" },
-- A string like "nv", "nvo", "o", etc.
labeled_modes = "v",
multiline = true,
-- Like `leap`s similar argument (call-specific overrides).
-- E.g.: opts = { equivalence_classes = {} }
opts = {},
}
end,
},
{
"kdheepak/lazygit.nvim",
lazy = false,
keys = { "<leader>gg" },
cmd = "LazyGit",
-- optional for floating window border decoration
dependencies = {
"nvim-lua/plenary.nvim",
},
init = function()
require("core.utils").load_mappings "lazygit"
end,
},
{
"folke/which-key.nvim",
keys = { "<leader>", "<localleader>", "<c-r>", "<c-w>", '"', "'", "`", "c", "v", "g" },
defaults = {
mode = { "n", "v" },
[";"] = { name = "+telescope" },
[";f"] = { name = "+find" },
[";d"] = { name = "+lsp/todo" },
["g"] = { name = "+goto" },
["]"] = { name = "+next" },
["["] = { name = "+prev" },
["<leader>x"] = { name = "+diagnostics/quickfix" },
["<leader>d"] = { name = "+debug" },
["<leader>c"] = { name = "+code" },
["<leader>g"] = { name = "+git" },
["<leader>t"] = { name = "+toggle/tools" },
["<leader>w"] = { name = "+window/which" },
["<leader>f"] = { name = "+formatting" },
},
},
{
"echasnovski/mini.trailspace",
lazy = false,
event = { "BufReadPost", "BufNewFile" },
opts = {},
},
{
"itchyny/vim-cursorword",
event = "FileType",
init = function()
vim.g.cursorword = 0
end,
config = function()
local augroup = vim.api.nvim_create_augroup("plex_cursorword", {})
vim.api.nvim_create_autocmd("FileType", {
group = augroup,
pattern = {
"conf",
"dosini",
"json",
"markdown",
"nginx",
"text",
"yaml",
},
callback = function()
if vim.wo.diff or vim.wo.previewwindow then
vim.b.cursorword = 0
else
vim.b.cursorword = 1
end
end,
})
vim.api.nvim_create_autocmd("InsertEnter", {
group = augroup,
callback = function()
if vim.b["cursorword"] == 1 then
vim.b["cursorword"] = 0
end
end,
})
vim.api.nvim_create_autocmd("InsertLeave", {
group = augroup,
callback = function()
if vim.b["cursorword"] == 0 then
vim.b["cursorword"] = 1
end
end,
})
end,
},
{
"RRethy/vim-illuminate",
lazy = false,
event = { "BufReadPost", "BufNewFile" },
opts = {
delay = 200,
under_cursor = false,
modes_allowlist = { "n", "no", "nt" },
filetypes_denylist = {
"DiffviewFileHistory",
"DiffviewFiles",
"SidebarNvim",
"fugitive",
"git",
"minifiles",
"neo-tree",
},
},
keys = {
{ "]]", desc = "Next Reference" },
{ "[[", desc = "Prev Reference" },
},
config = function(_, opts)
require("illuminate").configure(opts)
local function map(key, dir, buffer)
vim.keymap.set("n", key, function()
require("illuminate")["goto_" .. dir .. "_reference"](false)
end, {
desc = dir:sub(1, 1):upper() .. dir:sub(2) .. " Reference",
buffer = buffer,
})
end
map("]]", "next")
map("[[", "prev")
-- also set it after loading ftplugins, since a lot overwrite [[ and ]]
vim.api.nvim_create_autocmd("FileType", {
group = vim.api.nvim_create_augroup("plex_illuminate", {}),
callback = function()
local buffer = vim.api.nvim_get_current_buf()
map("]]", "next", buffer)
map("[[", "prev", buffer)
end,
})
end,
},
{
"folke/todo-comments.nvim",
lazy = false,
dependencies = "nvim-telescope/telescope.nvim",
-- stylua: ignore
keys = {
{ ']t', function() require('todo-comments').jump_next() end, desc = 'Next todo comment' },
{ '[t', function() require('todo-comments').jump_prev() end, desc = 'Previous todo comment' },
{ '<LocalLeader>dt', '<cmd>TodoTelescope<CR>', desc = 'todo' },
{ '<leader>xt', '<cmd>TodoTrouble<CR>', desc = 'Todo (Trouble)' },
{ '<leader>xT', '<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>', desc = 'Todo/Fix/Fixme (Trouble)' },
},
opts = {
signs = true,
keywords = {
FIX = {
icon = "", -- icon used for the sign, and in search results
color = "error", -- can be a hex color, or a named color (see below)
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
},
TODO = { icon = "", color = "todo" },
HACK = { icon = "", color = "hack" },
SECURITY = { icon = "󰒃 ", color = "security" },
WARN = { icon = "", color = "warning", alt = { "WARNING", "XXX" } },
PERF = { icon = "", color = "perf", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
NOTE = { icon = "", color = "hint", alt = { "INFO" } },
TEST = { icon = "", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
},
colors = {
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
todo = { "DiagnosticTodo", "#80e64d" },
hint = { "DiagnosticHint", "#10B981" },
hack = { "DiagnosticHack", "#FF33FF" },
security = { "DiagnosticSecurity", "#FF6600" },
default = { "Identifier", "#7C3AED" },
test = { "DiagnosticTest", "#E6E600" },
perf = { "DiagnosticPerf", "#9999ff" },
},
},
},
{
"folke/trouble.nvim",
cmd = { "Trouble", "TroubleToggle" },
opts = { use_diagnostic_signs = true },
-- stylua: ignore
keys = {
{
'<leader>e',
'<cmd>TroubleToggle document_diagnostics<CR>',
noremap = true,
desc =
'Document Diagnostics'
},
{
'<leader>r',
'<cmd>TroubleToggle workspace_diagnostics<CR>',
noremap = true,
desc =
'Workspace Diagnostics'
},
{ '<leader>xx', '<cmd>TroubleToggle document_diagnostics<cr>', desc = 'Document Diagnostics (Trouble)' },
{ '<leader>xX', '<cmd>TroubleToggle workspace_diagnostics<cr>', desc = 'Workspace Diagnostics (Trouble)' },
{ '<leader>xQ', '<cmd>TroubleToggle quickfix<cr>', desc = 'Quickfix List (Trouble)' },
{ '<leader>xL', '<cmd>TroubleToggle loclist<cr>', desc = 'Location List (Trouble)' },
{
'[q',
function()
if require('trouble').is_open() then
require('trouble').previous({ skip_groups = true, jump = true })
else
vim.cmd.cprev()
end
end,
desc = 'Previous trouble/quickfix item',
},
{
']q',
function()
if require('trouble').is_open() then
require('trouble').next({ skip_groups = true, jump = true })
else
vim.cmd.cnext()
end
end,
desc = 'Next trouble/quickfix item',
},
},
},
{
"NvChad/nvterm",
enabled = false,
},
{
"akinsho/toggleterm.nvim",
init = function()
require("core.utils").load_mappings "toggleterm"
end,
cmd = "ToggleTerm",
opts = {
size = function(term)
if term.direction == "horizontal" then
return vim.o.lines * 0.35
elseif term.direction == "vertical" then
return vim.o.columns * 0.35
else
return 20
end
end,
open_mapping = false,
float_opts = {
border = "curved",
},
},
},
-- lazy.nvim
{
"folke/noice.nvim",
enabled = not vim.g.started_by_firenvim,
event = "VeryLazy",
-- config.lsp.signature.enabled = false
dependencies = {
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
"MunifTanjim/nui.nvim",
-- OPTIONAL:
-- `nvim-notify` is only needed, if you want to use the notification view.
-- If not available, we use `mini` as the fallback
"rcarriga/nvim-notify",
},
config = function()
require("noice").setup {
lsp = {
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
-- IDK how to disable the nvchad builtins for this, which would
-- produce a conflict
signature = { enabled = false },
hover = { enabled = false },
},
-- 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 = true, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = true, -- add a border to hover docs and signature help
},
messages = {
enabled = true,
-- NOTE: we keep it with notify,
-- change this to something else if you want
view_error = "notify",
},
popupmenu = {
enabled = true,
},
notify = {
enabled = true,
},
}
end,
},
{
"goolord/alpha-nvim",
enabled = false,
lazy = false,
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
local dash = require "alpha.themes.dashboard"
require("alpha").setup(dash.config)
end,
},
{
"stevearc/dressing.nvim",
init = function()
---@diagnostic disable-next-line: duplicate-set-field
vim.ui.select = function(...)
require("lazy").load { plugins = { "dressing.nvim" } }
return vim.ui.select(...)
end
---@diagnostic disable-next-line: duplicate-set-field
vim.ui.input = function(...)
require("lazy").load { plugins = { "dressing.nvim" } }
return vim.ui.input(...)
end
end,
},
{
"chentoast/marks.nvim",
lazy = false,
dependencies = "lewis6991/gitsigns.nvim",
event = "FileType",
opts = {
sign_priority = { lower = 10, upper = 15, builtin = 8, bookmark = 20 },
bookmark_1 = { sign = "󰉀" }, -- ⚐ ⚑ 󰈻 󰈼 󰈽 󰈾 󰈿 󰉀
},
},
{
"kevinhwang91/nvim-bqf",
ft = "qf",
cmd = "BqfAutoToggle",
event = "QuickFixCmdPost",
opts = {
auto_resize_height = false,
func_map = {
tab = "st",
split = "sv",
vsplit = "sg",
stoggleup = "K",
stoggledown = "J",
stogglevm = "<Space>",
ptoggleitem = "p",
ptoggleauto = "P",
ptogglemode = "zp",
pscrollup = "<C-b>",
pscrolldown = "<C-f>",
prevfile = "gk",
nextfile = "gj",
prevhist = "<S-Tab>",
nexthist = "<Tab>",
},
preview = {
auto_preview = true,
should_preview_cb = function(bufnr)
-- file size greater than 100kb can't be previewed automatically
local filename = vim.api.nvim_buf_get_name(bufnr)
local fsize = vim.fn.getfsize(filename)
if fsize > 100 * 1024 then
return false
end
return true
end,
},
},
},
{
"uga-rosa/ccc.nvim",
lazy = false,
event = "FileType",
keys = {
{ "<Leader>cp", "<cmd>CccPick<CR>", desc = "Color-picker" },
},
opts = {
highlighter = {
auto_enable = true,
lsp = true,
excludes = { "lazy", "mason", "help", "neo-tree" },
},
},
},
{
"Bekaboo/deadcolumn.nvim",
event = { "BufReadPre", "BufNewFile" },
},
{
"rmagatti/goto-preview",
event = "FileType",
config = function()
require("core.utils").load_mappings "goto_preview"
require("goto-preview").setup {}
end,
dependencies = "nvim-telescope/telescope.nvim",
opts = {
width = 78,
height = 15,
default_mappings = false,
opacity = 10,
},
},
{
"glacambre/firenvim",
enabled = vim.g.started_by_firenvim,
lazy = false,
build = function()
vim.fn["firenvim#install"](0)
end,
config = function()
vim.g.firenvim_config = {
localSettings = {
[".*"] = {
filename = "/tmp/{hostname}_{pathname%10}.{extension%5}",
cmdline = "firenvim",
takeover = "never", -- can't open it with never at all?
},
},
}
end,
},
{
"sidebar-nvim/sidebar.nvim",
cmd = { "SidebarNvimToggle", "SidebarNvimOpen" },
config = function()
require("sidebar-nvim").setup {
bindings = {
["q"] = function()
require("sidebar-nvim").close()
end,
},
}
end,
},
{
"dhruvasagar/vim-table-mode",
lazy = false,
-- <Leader>tm is automatically set for toggle
-- see <Leader>t menu
},
{
"kevinhwang91/nvim-ufo",
event = { "BufReadPost", "BufNewFile" },
-- stylua: ignore
keys = {
{ 'zR', function() require('ufo').openAllFolds() end },
{ 'zM', function() require('ufo').closeAllFolds() end },
},
dependencies = {
"kevinhwang91/promise-async",
"nvim-treesitter/nvim-treesitter",
"neovim/nvim-lspconfig",
},
opts = function()
-- fancy display function for folds (stolen from nvim-ufo readme)
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
require("ufo").setup {
-- use treesitter to get the folds
provider_selector = function(bufnr, filetype, buftype)
return { "treesitter", "indent" }
end,
-- apply out fancy fold display
fold_virt_text_handler = handler,
}
end,
},
{
-- enables UNIX specific stuff in vim,
-- specifically:
-- :SudoWrite
-- :SudoRead
-- :Chmod
-- and also some more, but those are easy done with shell
"tpope/vim-eunuch",
lazy = false,
},
{
"nvimtools/none-ls.nvim",
event = { "BufReadPre", "BufNewFile" },
opts = function(_, opts)
opts.sources = {}
local nls = require "null-ls"
local builtins = nls.builtins
local sources = {
builtins.formatting.djlint.with {
filetypes = { "django", "jinja.html", "htmldjango", "tera", "html" },
},
builtins.diagnostics.djlint.with {
filetypes = { "django", "jinja.html", "htmldjango", "tera", "html" },
},
builtins.formatting.shfmt,
-- builtins.diagnostics.write_good.with {
-- diagnostics_postprocess = function(diagnostic)
-- diagnostic.severity = vim.diagnostic.severity.HINT
-- end,
-- },
}
for _, source in ipairs(sources) do
table.insert(opts.sources, source)
end
end,
},
{
"lvimuser/lsp-inlayhints.nvim",
event = "LspAttach",
opts = {
inlay_hints = {
parameter_hints = { show = true },
type_hints = { show = true },
only_current_line = false,
-- highlight group
highlight = "LspInlayHint",
-- virt_text priority
priority = 0,
},
},
config = function(_, opts)
require("lsp-inlayhints").setup(opts)
vim.api.nvim_create_augroup("LspAttach_inlayhints", {})
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("LspAttach_inlayhints", {}),
callback = function(args)
if not (args.data and args.data.client_id) then
return
end
local client = vim.lsp.get_client_by_id(args.data.client_id)
require("lsp-inlayhints").on_attach(client, args.buf)
end,
})
-- change how the highlighting looks
vim.cmd "hi LspInlayHint guibg=(bg*0.8) guifg=#6699b3"
end,
},
{ "kosayoda/nvim-lightbulb", event = { "BufReadPre", "BufNewFile" } },
{
"Wansmer/treesj",
cmd = { "TSJJoin", "TSJSplit", "TSJSplit" },
keys = {
{ "<C-s-j>", "<cmd>TSJJoin<CR>" },
{ "<C-s-s>", "<cmd>TSJSplit<CR>" },
},
opts = {
use_default_keymaps = false,
},
},
{
"b0o/incline.nvim",
event = "FileType",
config = function()
local function get_diagnostic_label(props)
local icons = { error = "", warn = "", info = "", hint = "" }
local label = {}
for severity, icon in pairs(icons) do
local n = #vim.diagnostic.get(props.buf, { severity = vim.diagnostic.severity[string.upper(severity)] })
if n > 0 then
table.insert(label, { icon .. " " .. n .. " ", group = "DiagnosticSign" .. severity })
end
end
if #label > 0 then
table.insert(label, { "| " })
end
return label
end
local function get_git_diff(props)
local icons = { removed = "", changed = "", added = "" }
local labels = {}
-- local signs = vim.api.nvim_buf_get_var(props.buf, "gitsigns_status_dict")
-- local signs = vim.b.gitsigns_status_dict
-- for name, icon in pairs(icons) do
-- if tonumber(signs[name]) and signs[name] > 0 then
-- table.insert(labels, { icon .. " " .. signs[name] .. " ", group = "Diff" .. name })
-- end
-- end
if #labels > 0 then
table.insert(labels, { "| " })
end
return labels
end
require("incline").setup {
render = function(props)
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
local ft_icon, ft_color = require("nvim-web-devicons").get_icon_color(filename)
local modified = vim.api.nvim_buf_get_option(props.buf, "modified") and "bold,italic" or "bold"
local buffer = {
{ get_diagnostic_label(props) },
{ get_git_diff(props) },
{ ft_icon, guifg = ft_color },
{ " " },
{ filename, gui = modified },
}
return buffer
end,
}
end,
},
{
"mikesmithgh/kitty-scrollback.nvim",
enabled = true,
lazy = true,
cmd = { "KittyScrollbackGenerateKittens", "KittyScrollbackCheckHealth" },
event = { "User KittyScrollbackLaunch" },
-- version = '*', -- latest stable version, may have breaking changes if major version changed
-- version = '^3.0.0', -- pin major version, include fixes and features that do not have breaking changes
config = function()
require("kitty-scrollback").setup {
myconfig = function()
return { keymaps_enabled = false }
end,
}
end,
},
{
"hrsh7th/nvim-cmp",
enabled = not vim.g.started_by_firenvim,
},
{
"ziontee113/icon-picker.nvim",
keys = {
{ "<C-I>", "<cmd>IconPickerNormal<CR>", desc = "pick icon" },
{ "y<C-I>", "<cmd>IconPickerYank<CR>", desc = "yank icon" },
},
cmd = { "IconPickerInsert", "IconPickerYank", "IconPickerNormal" },
config = function()
require("icon-picker").setup { disable_legacy_commands = true }
end,
},
{
"mfussenegger/nvim-dap",
lazy = false,
init = function()
require("core.utils").load_mappings "debug"
end,
config = function()
local dap = require "dap"
local mason_registry = require "mason-registry"
local codelldb_root = mason_registry.get_package("codelldb"):get_install_path() .. "/extension/"
local codelldb_path = codelldb_root .. "adapter/codelldb"
local liblldb_path = codelldb_root .. "lldb/lib/liblldb.so"
dap.defaults.fallback.external_terminal = {
command = "/home/plex/.local/bin/kitty",
args = {},
}
dap.adapters.gdb = {
type = "executable",
command = "gdb",
args = { "-i", "dap" },
}
dap.adapters.codelldb = {
type = "server",
port = "30333",
executable = {
command = codelldb_path,
args = { "--port", "30333" },
detached = false,
},
}
dap.configurations.cpp = {
{
name = "Launch file",
type = "codelldb",
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
args = function()
return require("custom.utils").tokenize_args(vim.fn.input "args: ")
end,
cwd = "${workspaceFolder}",
-- FIXME: perhaps we can put the stdio somewhere more practical
stopOnEntry = false,
},
}
dap.configurations.c = dap.configurations.cpp
dap.configurations.rust = dap.configurations.cpp
end,
},
{
"rcarriga/nvim-dap-ui",
init = function()
require("core.utils").load_mappings "debug"
end,
dependencies = {
"mfussenegger/nvim-dap",
},
config = function(_, opts)
local dap = require "dap"
local dapui = require "dapui"
dapui.setup(opts)
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open {}
end
dap.listeners.before.event_terminated["dapui_config"] = function()
-- dapui.close {}
end
dap.listeners.before.event_exited["dapui_config"] = function()
-- dapui.close {}
end
end,
},
{ "folke/neodev.nvim", opts = {} },
{
"mrcjkb/rustaceanvim",
enabled = true,
version = "^4", -- Recommended
ft = { "rust" },
config = function()
local dap = require "dap"
vim.g.rustaceanvim = {
enable_clippy = true,
-- Plugin configuration
tools = {
enable_clippy = true,
},
-- LSP configuration
server = {
on_attach = function(client, bufnr)
-- you can also put keymaps in here
end,
settings = {
-- rust-analyzer language server configuration
["rust-analyzer"] = {
cargo = {
features = "all",
},
},
},
},
-- DAP configuration
dap = {
-- FIXME: the rustaceanvim debug config does not map the stdout/stderr to the
-- opened terminal, effectively rendering debugging with it useless. Luckily,
-- we can use the regular nvim-dap and nvim-dap-ui.
adapter = dap.adapters.codelldb,
},
}
end,
},
{
"theHamsta/nvim-dap-virtual-text",
lazy = false, -- PERF: this can be done more elegant
config = function()
require("nvim-dap-virtual-text").setup()
end,
},
{
"jvgrootveld/telescope-zoxide",
dependencies = "nvim-telescope/telescope.nvim",
config = function()
-- Useful for easily creating commands
local z_utils = require "telescope._extensions.zoxide.utils"
require("telescope").setup {
-- (other Telescope configuration...)
extensions = {
zoxide = {
prompt_title = "[ Walking on the shoulders of TJ ]",
mappings = {
default = {
after_action = function(selection)
print("Update to (" .. selection.z_score .. ") " .. selection.path)
end,
},
["<C-s>"] = {
before_action = function(selection)
print "before C-s"
end,
action = function(selection)
vim.cmd.edit(selection.path)
end,
},
-- Opens the selected entry in a new split
["<C-q>"] = { action = z_utils.create_basic_command "split" },
},
},
},
}
require("telescope").load_extension "zoxide"
end,
},
{ "nanotee/zoxide.vim", lazy = false, enabled = false },
{
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
ft = { "markdown" },
build = function()
vim.fn["mkdp#util#install"]()
end,
config = function()
-- Ugly fix for wsl not finding my browser
-- I HATE windows
vim.g.mkdp_echo_preview_url = 1
end,
},
}
return plugins

View File

@ -1,67 +0,0 @@
local M = {}
-- this function will split a string into a table of tokens, like it would
-- be passed into the `argv` of a program that was executed from the commandline
--
-- @param string raw string of cli args that should be split
-- @return table tokens args as a table
M.tokenize_args = function(raw)
-- NOTE: string.gmatch is does not use regex, but a smaller pattern matcher!
-- A complete regex parser would be larger than lua itself. See
-- [Programming in Lua 20.2](https://www.lua.org/pil/20.2.html).
--
-- Notable differences:
-- '-' is ungreedy wildcard
-- '*?' does not work
-- '|' is not or
--
-- This means we're better of implementing the lexer with an algorithm.
local t = {}
local current = ""
local in_str = false
local str_seek
for c in string.gmatch(raw, ".") do -- iterate through all chars
if c == ' ' and not in_str then
if string.len(current) > 0 then
table.insert(t, current)
current = ""
end
elseif c == '"' and not in_str then
in_str = true
str_seek = '"'
elseif c == "'" and not in_str then
in_str = true
str_seek = "'"
elseif c == str_seek and in_str then
in_str = false
table.insert(t, current)
current = ""
else
current = current .. c
end
end
if string.len(current) > 0 then
table.insert(t, current)
end
return t
end
--- dumps a variable into a string, so it can be printed. This is meant for
--- debug prints
--- @param any t any variable
--- @return string t_dumped t dumped to string
M.dump = function(t)
if type(t) == 'table' then
local s = '{ '
for k, v in pairs(t) do
if type(k) ~= 'number' then k = '"' .. k .. '"' end
if k ~= 1 then
s = s .. ', '
end
s = s .. '[' .. k .. '] = \'' .. M.dump(v) .. '\''
end
return s .. ' }'
else
return tostring(t)
end
end
return M

415
lua/mappings.lua Normal file
View File

@ -0,0 +1,415 @@
---@type MappingsTable
local M = {}
M.tabs = {
plugin = false,
n = {
-- cycle through buffers
["<Tab>"] = {
"gt",
"Goto next tab",
},
["<S-tab>"] = {
"gT",
"Goto prev tab",
},
-- close buffer + hide terminal buffer
["<A-c>"] = {
"q",
"Close buffer",
},
},
}
M.comment = {
plugin = true,
-- toggle comment in both modes
n = {
["<leader>v"] = {
function()
require("Comment.api").toggle.linewise.current()
end,
"Toggle comment",
},
},
v = {
["<leader>v"] = {
"<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>",
"Toggle comment",
},
},
}
M.leap = {
plugin = true,
n = {
["s"] = {
"<plug>(leap-forward)",
"leap forward",
},
["S"] = {
"<plug>(leap-backward)",
"leap backward",
},
["gs"] = {
"<plug>(leap-from-window)",
"leap from window",
},
},
x = {
["s"] = {
"<plug>(leap-forward)",
"leap forward",
},
["S"] = {
"<plug>(leap-backward)",
"leap forward",
},
["gs"] = {
"<plug>(leap-from-window)",
"leap from window",
},
},
o = {
["s"] = {
"<plug>(leap-forward)",
"leap forward",
},
["S"] = {
"<plug>(leap-backward)",
"leap forward",
},
["gs"] = {
"<plug>(leap-from-window)",
"leap from window",
},
},
}
M.clipboard = {
plugin = false,
n = {
["<leader>y"] = { '"+y', "yank to system" },
["<leader>Y"] = { '"+Y', "yank to system" },
["<leader>yy"] = { '"+y', "yank to system" },
},
v = {
["<leader>y"] = { '"+y', "yank to system" },
["<leader>Y"] = { '"+Y', "yank to system" },
["<leader>yy"] = { '"+y', "yank to system" },
},
}
M.telescope = {
plugin = true,
n = {
-- find
["<localleader>ff"] = { "<cmd> Telescope find_files <cr>", "Find files" },
["<localleader>fa"] = { "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <cr>", "Find all" },
["<localleader>fw"] = { "<cmd> Telescope live_grep <cr>", "Live grep" },
["<localleader>fb"] = { "<cmd> Telescope buffers <cr>", "Find buffers" },
["<localleader>fh"] = { "<cmd> Telescope help_tags <cr>", "Help page" },
["<localleader>fo"] = { "<cmd> Telescope oldfiles <cr>", "Find oldfiles" },
["<localleader>fz"] = { "<cmd> Telescope current_buffer_fuzzy_find <cr>", "Find in current buffer" },
-- directory
["<localleader>cd"] = { "<cmd> Telescope zoxide list<cr>", "telescope zoxide cd" },
-- git
["<localleader>cm"] = { "<cmd> Telescope git_commits <cr>", "Git commits" },
["<localleader>gt"] = { "<cmd> Telescope git_status <cr>", "Git status" },
-- pick a hidden term
["<localleader>pt"] = { "<cmd> Telescope terms <cr>", "Pick hidden term" },
-- theme switcher
["<localleader>th"] = { "<cmd> Telescope themes <cr>", "Nvchad themes" },
["<localleader>ma"] = { "<cmd> Telescope marks <cr>", "telescope bookmarks" },
-- lsp stuff
["<localleader>cw"] = {
"<cmd> Telescope lsp_dynamic_workspace_symbols <cr>",
"telescope dynamic workspace symbols",
},
["<localleader>cf"] = { "<cmd> Telescope lsp_document_symbols <cr>", "telescope document symbols" },
["<localleader>ci"] = { "<cmd> Telescope diagnostics <cr>", "telescope diagnostics" },
-- spell
["z<space>"] = { "<cmd>Telescope spell_suggest<CR>", "Spell suggest" },
["z="] = { "<cmd>Telescope spell_suggest<CR>", "Spell suggest" },
},
}
M.toggleterm = {
plugin = true,
n = {
["<F12>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-i>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-t>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=tab"<cr>',
"toggle terminal",
},
["<A-h>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=horizontal"<cr>',
"toggle terminal",
},
["<A-v>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=vertical"<cr>',
"toggle terminal",
},
},
i = {
["<F12>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-i>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-t>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=tab"<cr>',
"toggle terminal",
},
["<A-h>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=horizontal"<cr>',
"toggle terminal",
},
["<A-v>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=vertical"<cr>',
"toggle terminal",
},
},
t = {
["<F12>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-i>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-t>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=tab"<cr>',
"toggle terminal",
},
["<A-h>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=horizontal"<cr>',
"toggle terminal",
},
["<A-v>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=vertical"<cr>',
"toggle terminal",
},
},
x = {
["<F12>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-i>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=float"<cr>',
"toggle terminal",
},
["<A-t>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=tab"<cr>',
"toggle terminal",
},
["<A-h>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=horizontal"<cr>',
"toggle terminal",
},
["<A-v>"] = {
'<cmd>exe v:count1 "ToggleTerm direction=vertical"<cr>',
"toggle terminal",
},
},
}
M.nvimtree = {
plugin = true,
n = {
-- toggle
["<C-n>"] = { "<cmd> NvimTreeToggle <cr>", "Toggle nvimtree" },
["<F5>"] = { "<cmd> NvimTreeToggle <cr>", "Toggle nvimtree" },
["<leader>tf"] = { "<cmd> NvimTreeToggle <cr>", "Toggle nvimtree" },
-- focus
["<localleader>e"] = { "<cmd> NvimTreeFocus <cr>", "Focus nvimtree" },
},
}
M.movements = {
plugin = false,
i = {
--big move
["<A-k>"] = { "<C-u>", "big step down" },
["<A-j>"] = { "<C-d>", "big step down" },
-- go to beginning and end
["<C-b>"] = { "<home>", "Beginning of line" },
["<C-e>"] = { "<end>", "End of line" },
-- navigate within insert mode
["<C-h>"] = { "<left>", "Move left" },
["<C-l>"] = { "<right>", "Move right" },
["<C-j>"] = { "<down>", "Move down" },
["<C-k>"] = { "<up>", "Move up" },
},
n = {
--big move
["<A-k>"] = { "<C-u>", "big step down" },
["<A-j>"] = { "<C-d>", "big step down" },
-- go to beginning and end
["H"] = { "<home>", "Beginning of line" },
["L"] = { "<end>", "End of line" },
-- go to mark with "#"
["#"] = { "'", "go to mark" },
-- spell
["]s"] = { "]s", "go to next spelling mark" },
["[s"] = { "[s", "go to last spelling mark" },
-- just scroll a line
["zk"] = { "<C-y>", "scroll up a line" },
["zj"] = { "<C-e>", "scroll down a line" },
},
v = {
--big move
["<A-k>"] = { "<C-u>", "big step down" },
["<A-j>"] = { "<C-d>", "big step down" },
-- go to beginning and end
["H"] = { "<home>", "Beginning of line" },
["L"] = { "<end>", "End of line" },
},
t = {
["<C-w>"] = {
vim.api.nvim_replace_termcodes("<C-\\><C-N>", true, true, true),
"Escape terminal mode",
},
},
}
M.edit = {
plugin = false,
n = {
-- easy newline
["OO"] = { "O<esc>", "insert a line above" },
["oo"] = { "o<esc>", "insert a line below" },
-- substitute (change hovered/selection with insert mode)
-- normally, this is s, but that is leaps binding now
["<leader>s"] = { "s", "replace with insert mode" },
-- split and join lines
["J"] = { "j" },
["<C-s-j>"] = { "<cmd>join<cr>", "join lines" },
["<C-s-s>"] = { "i<cr><esc>l", "split line" },
-- do something useful with the arrows
["<Up>"] = { "<cmd> move-2<cr>", "Move line up" },
["<Down>"] = { "<cmd> move+<cr>", "Move line down" },
["<Left>"] = { "<<", "Less indentation" },
["<Right>"] = { ">>", "More indentation" },
-- format
["<leader>ff"] = {
"gg=G",
"format buffer",
},
},
v = {
-- NOTE: I would love to know why these commands work, they seem really
-- crazy.
["<Up>"] = { ":move'<-2<CR>gv=gv", "Move lines up", opts = { silent = true } },
["<Down>"] = { ":move'>+<CR>gv=gv", "Move lines down", opts = { silent = true } },
["<Left>"] = { "<gv", "Less indentation" },
["<Right>"] = { ">gv", "More indentation" },
},
x = {},
t = {
--big move
["<A-k>"] = { "<C-u>", "big step down" },
["<A-j>"] = { "<C-d>", "big step down" },
},
}
M.ui = {
plugin = false,
n = {
-- toggle wrap
["<leader>tw"] = {
function()
vim.opt_local.wrap = not vim.wo.wrap
vim.opt_local.breakindent = not vim.wo.breakindent
if vim.wo.colorcolumn == "" then
vim.opt_local.colorcolumn = tostring(vim.bo.textwidth)
else
vim.opt_local.colorcolumn = ""
end
end,
"toggle wrap",
},
-- toggle some features
["<leader>tn"] = { "<cmd>setlocal nonumber!<cr>", "toggle line numbers" },
["<leader>trn"] = { "<cmd>setlocal nornu!<cr>", "toggle relative line numbers" },
["<leader>ts"] = { "<cmd>setlocal spell!<cr>", "toggle spell check" },
["<leader>ti"] = {
function()
require("lsp-inlayhints").toggle()
end,
"toggle inlay hints",
},
-- open windows
['<leader>"'] = { "<cmd>vsplit<cr>", "open a new window to the side" },
["<leader>%"] = { "<cmd>split<cr>", "open a new window on the totop" },
-- resize windows
["<C-Up>"] = { "<cmd>resize +1<cr>", "resize window" },
["<C-Down>"] = { "<cmd>resize -1<cr>", "resize window" },
["<C-Left>"] = { "<cmd>vertical resize +1<cr>", "resize window" },
["<C-Right>"] = { "<cmd>vertical resize -1<cr>", "resize window" },
-- tabs
["<leader>wn"] = { "<cmd>tabnew<cr>", "open a new tab" },
["<leader>wc"] = { "<cmd>tabclose<cr>", "close current tab" },
["<leader>wk"] = { "<cmd>tabnext<cr>", "go to next tab" },
["<leader>wj"] = { "<cmd>tabprevious<cr>", "go to prev tab" },
-- folds
["<S-Return>"] = { "zMzv", "focus on this fold" },
},
}
M.trailspace = {
plugin = true,
n = {
-- remove trailing whitespace
["<leader>fw"] = {
function()
require("mini.trailspace").trim()
end,
"remove whitespace",
},
},
}
return M

79
lua/plugins.lua Normal file
View File

@ -0,0 +1,79 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- Example using a list of specs with the default options
vim.g.mapleader = " " -- Make sure to set `mapleader` before lazy so your mappings are correct
require("lazy").setup({
{
"mhartington/oceanic-next",
config = function()
vim.cmd("syntax enable")
vim.cmd("colorscheme OceanicNext")
end,
},
{
"ggandor/leap.nvim",
lazy = false,
config = function()
require("core.utils").load_mappings "leap"
end,
},
{
"ggandor/flit.nvim",
lazy = false,
config = function()
require("flit").setup({
keys = { f = "f", F = "F", t = "t", T = "T" },
-- A string like "nv", "nvo", "o", etc.
labeled_modes = "v",
multiline = true,
-- Like `leap`s similar argument (call-specific overrides).
-- E.g.: opts = { equivalence_classes = {} }
opts = {},
})
end,
},
{
"echasnovski/mini.trailspace",
lazy = false,
event = { "BufReadPost", "BufNewFile" },
opts = {},
config = function()
require("core.utils").load_mappings "trailspace"
end,
},
{
-- exit insert mode with 'jk'
"max397574/better-escape.nvim",
enabled = true,
event = "InsertEnter",
config = function()
require("better_escape").setup()
end,
},
{
"dhruvasagar/vim-table-mode",
lazy = false,
-- <Leader>tm is automatically set for toggle
-- see <Leader>t menu
},
"nvim-tree/nvim-web-devicons",
{
"nvim-tree/nvim-tree.lua",
lazy = false,
config = function()
require("nvim-tree").setup()
end,
},
})

View File

@ -1,120 +0,0 @@
local cmp = require "cmp"
dofile(vim.g.base46_cache .. "cmp")
local cmp_ui = require("core.utils").load_config().ui.cmp
local cmp_style = cmp_ui.style
local field_arrangement = {
atom = { "kind", "abbr", "menu" },
atom_colored = { "kind", "abbr", "menu" },
}
local formatting_style = {
-- default fields order i.e completion word + item.kind + item.kind icons
fields = field_arrangement[cmp_style] or { "abbr", "kind", "menu" },
format = function(_, item)
local icons = require "nvchad.icons.lspkind"
local icon = (cmp_ui.icons and icons[item.kind]) or ""
if cmp_style == "atom" or cmp_style == "atom_colored" then
icon = " " .. icon .. " "
item.menu = cmp_ui.lspkind_text and " (" .. item.kind .. ")" or ""
item.kind = icon
else
icon = cmp_ui.lspkind_text and (" " .. icon .. " ") or icon
item.kind = string.format("%s %s", icon, cmp_ui.lspkind_text and item.kind or "")
end
return item
end,
}
local function border(hl_name)
return {
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
}
end
local options = {
completion = {
completeopt = "menu,menuone",
},
window = {
completion = {
side_padding = (cmp_style ~= "atom" and cmp_style ~= "atom_colored") and 1 or 0,
winhighlight = "Normal:CmpPmenu,CursorLine:CmpSel,Search:None",
scrollbar = false,
},
documentation = {
border = border "CmpDocBorder",
winhighlight = "Normal:CmpDoc",
},
},
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
formatting = formatting_style,
mapping = {
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Insert,
select = true,
},
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
else
fallback()
end
end, {
"i",
"s",
}),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
else
fallback()
end
end, {
"i",
"s",
}),
},
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "nvim_lua" },
{ name = "path" },
},
}
if cmp_style ~= "atom" and cmp_style ~= "atom_colored" then
options.window.completion.border = border "CmpBorder"
end
return options

View File

@ -1,46 +0,0 @@
return {
defaults = { lazy = true },
install = { colorscheme = { "nvchad" } },
ui = {
icons = {
ft = "",
lazy = "󰂠 ",
loaded = "",
not_loaded = "",
},
},
performance = {
rtp = {
disabled_plugins = {
"2html_plugin",
"tohtml",
"getscript",
"getscriptPlugin",
"gzip",
"logipat",
"netrw",
"netrwPlugin",
"netrwSettings",
"netrwFileHandlers",
"matchit",
"tar",
"tarPlugin",
"rrhelper",
"spellfile_plugin",
"vimball",
"vimballPlugin",
"zip",
"zipPlugin",
"rplugin",
"syntax",
"synmenu",
"optwin",
"compiler",
"bugreport",
"ftplugin",
},
},
},
}

View File

@ -1,64 +0,0 @@
dofile(vim.g.base46_cache .. "lsp")
require "nvchad.lsp"
local M = {}
local utils = require "core.utils"
-- export on_attach & capabilities for custom lspconfigs
M.on_attach = function(client, bufnr)
utils.load_mappings("lspconfig", { buffer = bufnr })
if client.server_capabilities.signatureHelpProvider then
require("nvchad.signature").setup(client)
end
if not utils.load_config().ui.lsp_semantic_tokens and client.supports_method "textDocument/semanticTokens" then
client.server_capabilities.semanticTokensProvider = nil
end
end
M.capabilities = vim.lsp.protocol.make_client_capabilities()
M.capabilities.textDocument.completion.completionItem = {
documentationFormat = { "markdown", "plaintext" },
snippetSupport = true,
preselectSupport = true,
insertReplaceSupport = true,
labelDetailsSupport = true,
deprecatedSupport = true,
commitCharactersSupport = true,
tagSupport = { valueSet = { 1 } },
resolveSupport = {
properties = {
"documentation",
"detail",
"additionalTextEdits",
},
},
}
require("lspconfig").lua_ls.setup {
on_attach = M.on_attach,
capabilities = M.capabilities,
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
workspace = {
library = {
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
[vim.fn.stdpath "data" .. "/lazy/ui/nvchad_types"] = true,
[vim.fn.stdpath "data" .. "/lazy/lazy.nvim/lua/lazy"] = true,
},
maxPreload = 100000,
preloadFileSize = 10000,
},
},
},
}
return M

View File

@ -1,28 +0,0 @@
local options = {
ensure_installed = { "lua-language-server" }, -- not an option from mason.nvim
PATH = "skip",
ui = {
icons = {
package_pending = "",
package_installed = "󰄳 ",
package_uninstalled = " 󰚌",
},
keymaps = {
toggle_server_expand = "<CR>",
install_server = "i",
update_server = "u",
check_server_version = "c",
update_all_servers = "U",
check_outdated_servers = "C",
uninstall_server = "X",
cancel_installation = "<C-c>",
},
},
max_concurrent_installers = 10,
}
return options

View File

@ -1,77 +0,0 @@
local options = {
filters = {
dotfiles = false,
exclude = { vim.fn.stdpath "config" .. "/lua/custom" },
},
disable_netrw = true,
hijack_netrw = true,
hijack_cursor = true,
hijack_unnamed_buffer_when_opening = false,
sync_root_with_cwd = true,
update_focused_file = {
enable = true,
update_root = false,
},
view = {
adaptive_size = false,
side = "left",
width = 30,
preserve_window_proportions = true,
},
git = {
enable = false,
ignore = true,
},
filesystem_watchers = {
enable = true,
},
actions = {
open_file = {
resize_window = true,
},
},
renderer = {
root_folder_label = false,
highlight_git = false,
highlight_opened_files = "none",
indent_markers = {
enable = false,
},
icons = {
show = {
file = true,
folder = true,
folder_arrow = true,
git = false,
},
glyphs = {
default = "󰈚",
symlink = "",
folder = {
default = "",
empty = "",
empty_open = "",
open = "",
symlink = "",
symlink_open = "",
arrow_open = "",
arrow_closed = "",
},
git = {
unstaged = "",
staged = "",
unmerged = "",
renamed = "",
untracked = "",
deleted = "",
ignored = "",
},
},
},
},
}
return options

View File

@ -1,66 +0,0 @@
local M = {}
local utils = require "core.utils"
M.blankline = {
indentLine_enabled = 1,
filetype_exclude = {
"help",
"terminal",
"lazy",
"lspinfo",
"TelescopePrompt",
"TelescopeResults",
"mason",
"nvdash",
"nvcheatsheet",
"",
},
buftype_exclude = { "terminal" },
show_trailing_blankline_indent = false,
show_first_indent_level = false,
show_current_context = true,
show_current_context_start = true,
}
M.luasnip = function(opts)
require("luasnip").config.set_config(opts)
-- vscode format
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.vscode_snippets_path or "" }
-- snipmate format
require("luasnip.loaders.from_snipmate").load()
require("luasnip.loaders.from_snipmate").lazy_load { paths = vim.g.snipmate_snippets_path or "" }
-- lua format
require("luasnip.loaders.from_lua").load()
require("luasnip.loaders.from_lua").lazy_load { paths = vim.g.lua_snippets_path or "" }
vim.api.nvim_create_autocmd("InsertLeave", {
callback = function()
if
require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
and not require("luasnip").session.jump_active
then
require("luasnip").unlink_current()
end
end,
})
end
M.gitsigns = {
signs = {
add = { text = "" },
change = { text = "" },
delete = { text = "󰍵" },
topdelete = { text = "" },
changedelete = { text = "~" },
untracked = { text = "" },
},
on_attach = function(bufnr)
utils.load_mappings("gitsigns", { buffer = bufnr })
end,
}
return M

View File

@ -1,55 +0,0 @@
local options = {
defaults = {
vimgrep_arguments = {
"rg",
"-L",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8,
},
vertical = {
mirror = false,
},
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
file_sorter = require("telescope.sorters").get_fuzzy_file,
file_ignore_patterns = { "node_modules" },
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = { "truncate" },
winblend = 0,
border = {},
borderchars = { "", "", "", "", "", "", "", "" },
color_devicons = true,
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
-- Developer configurations: Not meant for general override
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
mappings = {
n = { ["q"] = require("telescope.actions").close },
},
},
extensions_list = { "themes", "terms" },
}
return options

View File

@ -1,12 +0,0 @@
local options = {
ensure_installed = { "lua" },
highlight = {
enable = true,
use_languagetree = true,
},
indent = { enable = true },
}
return options

View File

@ -1,281 +0,0 @@
-- All plugins have lazy=true by default,to load a plugin on startup just lazy=false
-- List of all default plugins & their definitions
local default_plugins = {
"nvim-lua/plenary.nvim",
{
"NvChad/base46",
branch = "v2.0",
build = function()
require("base46").load_all_highlights()
end,
},
{
"NvChad/ui",
branch = "v2.0",
lazy = false,
},
{
"NvChad/nvterm",
init = function()
require("core.utils").load_mappings "nvterm"
end,
config = function(_, opts)
require "base46.term"
require("nvterm").setup(opts)
end,
},
{
"NvChad/nvim-colorizer.lua",
init = function()
require("core.utils").lazy_load "nvim-colorizer.lua"
end,
config = function(_, opts)
require("colorizer").setup(opts)
-- execute colorizer as soon as possible
vim.defer_fn(function()
require("colorizer").attach_to_buffer(0)
end, 0)
end,
},
{
"nvim-tree/nvim-web-devicons",
opts = function()
return { override = require "nvchad.icons.devicons" }
end,
config = function(_, opts)
dofile(vim.g.base46_cache .. "devicons")
require("nvim-web-devicons").setup(opts)
end,
},
{
"lukas-reineke/indent-blankline.nvim",
version = "2.20.7",
init = function()
require("core.utils").lazy_load "indent-blankline.nvim"
end,
opts = function()
return require("plugins.configs.others").blankline
end,
config = function(_, opts)
require("core.utils").load_mappings "blankline"
dofile(vim.g.base46_cache .. "blankline")
require("indent_blankline").setup(opts)
end,
},
{
"nvim-treesitter/nvim-treesitter",
tag = "v0.9.2",
init = function()
require("core.utils").lazy_load "nvim-treesitter"
end,
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
build = ":TSUpdate",
opts = function()
return require "plugins.configs.treesitter"
end,
config = function(_, opts)
dofile(vim.g.base46_cache .. "syntax")
require("nvim-treesitter.configs").setup(opts)
end,
},
-- git stuff
{
"lewis6991/gitsigns.nvim",
ft = { "gitcommit", "diff" },
init = function()
-- load gitsigns only when a git file is opened
vim.api.nvim_create_autocmd({ "BufRead" }, {
group = vim.api.nvim_create_augroup("GitSignsLazyLoad", { clear = true }),
callback = function()
vim.fn.jobstart({"git", "-C", vim.loop.cwd(), "rev-parse"},
{
on_exit = function(_, return_code)
if return_code == 0 then
vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad"
vim.schedule(function()
require("lazy").load { plugins = { "gitsigns.nvim" } }
end)
end
end
}
)
end,
})
end,
opts = function()
return require("plugins.configs.others").gitsigns
end,
config = function(_, opts)
dofile(vim.g.base46_cache .. "git")
require("gitsigns").setup(opts)
end,
},
-- lsp stuff
{
"williamboman/mason.nvim",
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUpdate" },
opts = function()
return require "plugins.configs.mason"
end,
config = function(_, opts)
dofile(vim.g.base46_cache .. "mason")
require("mason").setup(opts)
-- custom nvchad cmd to install all mason binaries listed
vim.api.nvim_create_user_command("MasonInstallAll", function()
if opts.ensure_installed and #opts.ensure_installed > 0 then
vim.cmd("MasonInstall " .. table.concat(opts.ensure_installed, " "))
end
end, {})
vim.g.mason_binaries_list = opts.ensure_installed
end,
},
{
"neovim/nvim-lspconfig",
init = function()
require("core.utils").lazy_load "nvim-lspconfig"
end,
config = function()
require "plugins.configs.lspconfig"
end,
},
-- load luasnips + cmp related in insert mode only
{
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
{
-- snippet plugin
"L3MON4D3/LuaSnip",
dependencies = "rafamadriz/friendly-snippets",
opts = { history = true, updateevents = "TextChanged,TextChangedI" },
config = function(_, opts)
require("plugins.configs.others").luasnip(opts)
end,
},
-- autopairing of (){}[] etc
{
"windwp/nvim-autopairs",
opts = {
fast_wrap = {},
disable_filetype = { "TelescopePrompt", "vim" },
},
config = function(_, opts)
require("nvim-autopairs").setup(opts)
-- setup cmp for autopairs
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done())
end,
},
-- cmp sources plugins
{
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
},
},
opts = function()
return require "plugins.configs.cmp"
end,
config = function(_, opts)
require("cmp").setup(opts)
end,
},
{
"numToStr/Comment.nvim",
keys = {
{ "gcc", mode = "n", desc = "Comment toggle current line" },
{ "gc", mode = { "n", "o" }, desc = "Comment toggle linewise" },
{ "gc", mode = "x", desc = "Comment toggle linewise (visual)" },
{ "gbc", mode = "n", desc = "Comment toggle current block" },
{ "gb", mode = { "n", "o" }, desc = "Comment toggle blockwise" },
{ "gb", mode = "x", desc = "Comment toggle blockwise (visual)" },
},
init = function()
require("core.utils").load_mappings "comment"
end,
config = function(_, opts)
require("Comment").setup(opts)
end,
},
-- file managing , picker etc
{
"nvim-tree/nvim-tree.lua",
cmd = { "NvimTreeToggle", "NvimTreeFocus" },
init = function()
require("core.utils").load_mappings "nvimtree"
end,
opts = function()
return require "plugins.configs.nvimtree"
end,
config = function(_, opts)
dofile(vim.g.base46_cache .. "nvimtree")
require("nvim-tree").setup(opts)
end,
},
{
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter" },
cmd = "Telescope",
init = function()
require("core.utils").load_mappings "telescope"
end,
opts = function()
return require "plugins.configs.telescope"
end,
config = function(_, opts)
dofile(vim.g.base46_cache .. "telescope")
local telescope = require "telescope"
telescope.setup(opts)
-- load extensions
for _, ext in ipairs(opts.extensions_list) do
telescope.load_extension(ext)
end
end,
},
-- Only load whichkey after all the gui
{
"folke/which-key.nvim",
keys = { "<leader>", "<c-r>", "<c-w>", '"', "'", "`", "c", "v", "g" },
init = function()
require("core.utils").load_mappings "whichkey"
end,
cmd = "WhichKey",
config = function(_, opts)
dofile(vim.g.base46_cache .. "whichkey")
require("which-key").setup(opts)
end,
},
}
local config = require("core.utils").load_config()
if #config.plugins > 0 then
table.insert(default_plugins, { import = config.plugins })
end
require("lazy").setup(default_plugins, config.lazy_nvim)

0
lua/vscode.lua Normal file
View File

138
mini.lua
View File

@ -1,138 +0,0 @@
local opt = vim.opt
local g = vim.g
g.maplocalleader = ";"
g.python3_host_prog = '/usr/bin/python3'
opt.mouse = "a" -- mouse does annoying things for me if it's not 'a'
opt.signcolumn = "yes"
opt.clipboard = "" -- don't just use the system clipboard
opt.wrap = false
opt.breakindent = false
opt.spell = false
opt.list = true
opt.conceallevel = 2
opt.undofile = true
opt.undolevels = 10000
opt.writebackup = false
opt.history = 5000
opt.shada = { "'1000", "<50", "s10", "h" }
-- Tabs and Indents
-- ===
opt.textwidth = 80 -- Text width maximum chars before wrapping
opt.tabstop = 4 -- The number of spaces a tab is
opt.shiftwidth = 4 -- Number of spaces to use in auto(indent)
opt.smarttab = true -- Tab insert blanks according to 'shiftwidth'
opt.autoindent = true -- Use same indenting on new lines
opt.smartindent = true -- Smart autoindenting on new lines
opt.shiftround = true -- Round indent to multiple of 'shiftwidth'
-- Timing
-- ===
opt.ttimeout = true
opt.timeoutlen = 500 -- Time out on mappings
opt.ttimeoutlen = 10 -- Time out on key codes
opt.updatetime = 500 -- Idle time to write swap and trigger CursorHold
-- Searching
-- ===
opt.ignorecase = true -- Search ignoring case
opt.smartcase = true -- Keep case when searching with *
opt.infercase = true -- Adjust case in insert completion mode
opt.incsearch = true -- Incremental search
-- Formatting
-- ===
opt.wrap = false -- No wrap by default
opt.linebreak = true -- Break long lines at 'breakat'
opt.breakat = "\\ \\ ;:,!?" -- Long lines break chars
opt.startofline = false -- Cursor in same column for few commands
opt.splitbelow = true -- Splits open bottom right
opt.splitright = true
opt.breakindentopt = { shift = 2, min = 20 }
opt.formatoptions = "" -- see :h fo-table & :h formatoptions
-- Diff
-- ===
opt.diffopt:append { "iwhite", "indent-heuristic", "algorithm:patience" }
opt.wildmode = "longest:full,full" -- Command-line completion mode
-- Folds
-- ===
opt.foldlevel = 10 -- start with all folds open
-- Editor UI
-- ===
vim.o.guifont = "FiraCode Nerd Font:h15"
opt.termguicolors = true
opt.shortmess = "xsTOInfFitloCaAs"
opt.showmode = true -- Show mode in cmd window
opt.scrolloff = 2 -- Keep at least n lines above/below
opt.sidescrolloff = 0 -- Keep at least n lines left/right
opt.numberwidth = 2 -- Minimum number of columns to use for the line number
opt.number = true -- Show line numbers
opt.relativenumber = true -- Show relative line numbers
opt.ruler = true -- Default status ruler
opt.list = true -- Show hidden characters
opt.showtabline = 1 -- Don't change this, goes back to a vanilla vim default
opt.laststatus = 3 -- Always show laststatus
if vim.g.started_by_firenvim == true then
opt.showtabline = 1 -- Don't show tabline in firenvim, unless multitab
opt.laststatus = 1 -- Don't show laststatus in firenvim
opt.wrap = true
end
if vim.g.neovide == true then
-- fulscreen with F11
vim.api.nvim_set_keymap("n", "<F11>", ":let g:neovide_fullscreen = !g:neovide_fullscreen<CR>", {})
vim.g.neovide_underline_automatic_scaling = true
-- vim.g.neovide_floating_blur_amount_x = 2.0
-- vim.g.neovide_floating_blur_amount_y = 2.0
vim.g.neovide_scroll_animation_length = 0.1
-- vim.g.neovide_cursor_animation_length = 0
-- vim.g.neovide_cursor_trail_size = 0
vim.g.neovide_hide_mouse_when_typing = true
vim.g.neovide_fullscreen = true
end
opt.helpheight = 0 -- Disable help window resizing
opt.winwidth = 30 -- Minimum width for active window
opt.winminwidth = 1 -- Minimum width for inactive windows
opt.winheight = 1 -- Minimum height for active window
opt.winminheight = 1 -- Minimum height for inactive window
opt.showcmd = false -- show command in status line
opt.cmdheight = 0
opt.cmdwinheight = 5 -- Command-line lines
opt.equalalways = true -- Resize windows on split or close
opt.colorcolumn = "+0" -- Column highlight at textwidth's max character-limit
opt.cursorline = true
opt.cursorlineopt = { "number", "screenline" }
opt.pumheight = 10 -- Maximum number of items to show in the popup menu
opt.pumwidth = 10 -- Minimum width for the popup menu
opt.pumblend = 10 -- Popup blend
-- Spelling correction
-- ===
opt.spell = false -- manually enable spell with `set spell` or `<leader>ts`
opt.spelllang = "en,de_de,"
opt.spellsuggest = "double,50,timeout:5000"
-- autocommands
-- ===
local function augroup(name)
return vim.api.nvim_create_augroup("plex_" .. name, {})
end