This commit is contained in:
Manuel
2025-08-25 17:42:37 +02:00
commit aed2435b50
31 changed files with 2269 additions and 0 deletions

8
CHANGELOG.md Normal file
View File

@@ -0,0 +1,8 @@
# CHANGELOG
- [v0.1.0](https://github.com/ntk148v/neovim-config/tree/v0.1.0): written in VimL, a single file only.
- [v0.1.1](https://github.com/ntk148v/neovim-config/tree/v0.1.1): written in VimL, consist of multiple files.
- [v0.2.0](https://github.com/ntk148v/neovim-config/tree/v0.2.0): started from this version, switch from VimL to Lua. For the reason, you may to check [neovim's official wiki](https://github.com/neovim/neovim/wiki/FAQ#why-embed-lua-instead-of-x). Follow [KISS principle](https://en.wikipedia.org/wiki/KISS_principle), this version uses the least plugins as possible. It's more like a skeleton, users can add more plugins and LSP.
- [v0.2.1](https://github.com/ntk148v/neovim-config/tree/v0.2.1): this version contains some minor changes.
- [v0.3.0](https://github.com/ntk148v/neovim-config/tree/v0.3.0): I decide to switch to [lazy.nvim](https://github.com/folke/lazy.nvim) as my plugin manager, instead of [packer](https://github.com/wbthomason/packer.nvim). The main reason is [lazy.nvim's support for plugin structure](https://github.com/folke/lazy.nvim#-structuring-your-plugins).
- [v0.4.0](https://github.com/ntk148v/neovim-config/tree/v0.4.0): Restructure the source code and change the customize configuration logic.

201
LICENSE Normal file
View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

276
README.md Normal file
View File

@@ -0,0 +1,276 @@
<div align="center">
<h1>Neovim configuration</h1>
<h4>A minimal Neovim configuration written in lua</h4>
<p>
<a href="https://github.com/ntk148v/neovim-config/blob/master/LICENSE">
<img
alt="License"
src="https://img.shields.io/github/license/ntk148v/neovim-config?style=for-the-badge"
/>
</a>
<a href="https://github.com/ntk148v/neovim-config/stargazers">
<img
alt="Stars"
src="https://img.shields.io/github/stars/ntk148v/neovim-config?style=for-the-badge"
/>
</a>
<img
alt="Neovim version"
src="https://img.shields.io/badge/Neovim-0.8+-57A143?style=for-the-badge&logo=neovim"
/>
<a href="https://github.com/ntk148v/neovim-config/releases/latest">
<img
alt="Latest release"
src="https://img.shields.io/github/v/release/ntk148v/neovim-config?style=for-the-badge" />
</a>
</p>
<br />
</div>
**Table of contents**
- [1. Introduction](#1-introduction)
- [2. Screenshots](#2-screenshots)
- [3. Installation](#3-installation)
- [4. File structure](#4-file-structure)
- [5. Plugins \& LSP](#5-plugins--lsp)
- [5.1. Plugins](#51-plugins)
- [5.2. LSP](#52-lsp)
- [6. Keymaps](#6-keymaps)
- [7. Customization](#7-customization)
- [8. Contribution](#8-contribution)
- [9. Guide and resources](#9-guide-and-resources)
## 1. Introduction
[Neovim](https://neovim.io/) is a pretty cool successor to Vim, focusing on compatibility while adding asynchronous plugin functionality and trying to clean up the code base. Having been fed up at various times with both Sublime Text (2 and 3) and Atom, and after realizing how much development I do over SSH, it seemed reasonable to check out using vim (or nvim, in this case) as my IDE. The advantages essentially boil down to:
- Consistent IDE over SSH or locally,
- No need to ever use the mouse while coding (takes longer to learn, but is faster; this is aided by vim-easymotion and Ctrl-Space),
- Its been around forever, and frankly, probably always will be.
Therefore, I decided to create this repository.
> [!IMPORTANT]
> There are several versions, checkout [CHANGELOG](./CHANGELOG.md).
>
> This configuration is meant as a starting point, and it fits my needs only. If you want to customize it, jump to [6. Customization](#6-customization).
## 2. Screenshots
| | |
| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| <img src="screenshots/nvim1.png" alt="dark" style="border-radius:1%"/> | <img src="screenshots/nvim2.png" alt="dark" style="border-radius:1%"/> |
| <img src="screenshots/nvim3.png" alt="dark" style="border-radius:1%"/> | <img src="screenshots/nvim4.png" alt="dark" style="border-radius:1%"/> |
| <img src="screenshots/nvim5.png" alt="dark" style="border-radius:1%"/> | <img src="screenshots/nvim6.png" alt="dark" style="border-radius:1%"/> |
| <img src="screenshots/nvim7.png" alt="dark" style="border-radius:1%"/> | <img src="screenshots/nvim8.png" alt="dark" style="border-radius:1%"/> |
## 3. Installation
- Requirements:
- Install [neovim >= 0.8.0](https://github.com/neovim/neovim/wiki/Installing-Neovim#install-from-package), or you can [build it](https://github.com/neovim/neovim/wiki/Building-Neovim#) yourself.
- git >= 2.19.0 (for partial clones support)
- [fd](https://github.com/sharkdp/fd) and [ripgrep](https://github.com/BurntSushi/ripgrep).
- I recommend using a [nerdfonts](https://www.nerdfonts.com/font-downloads) (optional)
- Backup your current neovim config, if necessary:
```shell
mv ~/.config/nvim ~/.config/nvim.bak
```
- Neovim's configurations are located under the following paths, depending on your OS:
| OS | PATH |
| :------------------- | :---------------------------------------- |
| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
| Windows (cmd) | `%localappdata%\nvim\` |
| Windows (powershell) | `$env:LOCALAPPDATA\nvim\` |
- [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo so that you have your own copy that you can modify, then install by cloning the fork to your machine using one of the commands below, depending on your OS.
> [!NOTE]
> Your fork's url will be something like this:
> `https://github.com/<your_github_username>/neovim-config.git`
- Get your configuration:
> [!NOTE]
> If following the recommended step above (i.e., forking the repo), replace
> `ntk148v` with `<your_github_username>` in the commands below
<details><summary> Linux and Mac </summary>
```shell
git clone https://github.com/ntk148v/neovim-config.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
```
</details>
<details><summary> Windows </summary>
If you're using `cmd.exe`:
```shell
git clone https://github.com/ntk148v/neovim-config.git "%localappdata%\nvim"
```
If you're using `powershell.exe`
```shell
git clone https://github.com/ntk148v/neovim-config.git "${env:LOCALAPPDATA}\nvim"
```
</details>
- Start Neovim, Lazy should be installed automatically, then it will install plugins.
```shell
nvim
```
- Restart Neovim and enjoy it.
- Keep updated: You should keep updated using `git pull`.
## 4. File structure
The files under config will be automatically loaded at the appropriate time, so you don't need to require those files manually.
```shell
tree ~/.config/nvim
├── init.lua
├── lazy-lock.json
└── lua
├── autocmds.lua
├── custom.lua
├── mappings.lua
├── options.lua
├── plugins
│   ├── configs
│   │   ├── cmp.lua
│   │   ├── gitsigns.lua
│   │   ├── lspconfig.lua
│   │   ├── lualine.lua
│   │   ├── luasnip.lua
│   │   ├── mason.lua
│   │   ├── null-ls.lua
│   │   ├── telescope.lua
│   │   ├── tree.lua
│   │   └── treesitter.lua
│   └── init.lua
└── sample_custom.lua
```
## 5. Plugins & LSP
### 5.1. Plugins
| Plugin | Description |
| --------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| [lazy.nvim](https://github.com/folke/lazy.nvim) | A modern plugin manager for Neovim |
| [mason.nvim](https://github.com/williamboman/mason.nvim) | Portable package manager for Neovim that runs everywhere Neovim runs. Easily install and manage LSP servers, DAP servers, linters, and formatters. |
| [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) | A collection of common configurations for Neovim's built-in language server client |
| [gitsigns](https://github.com/lewis6991/gitsigns.nvim) | Super fast git decorations implemented purely in lua/teal |
| [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) | Nvim Treesitter configurations and abstraction layer |
| [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) | Auto completion plugin |
| [LuaSnip](https://github.com/L3MON4D3/LuaSnip) | Snippet Engine for Neovim written in Lua |
| [nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua) - | A File Explorer written In Lua |
| [nvim-autopairs](https://github.com/windwp/nvim-autopairs) | A super powerful autopairs for Neovim |
| [nvim-web-devicons](https://github.com/nvim-tree/nvim-web-devicons) | Lua `fork` of vim-web-devicons for neovim |
| [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) | A blazing fast and easy to configure neovim statusline plugin written in pure lua. |
| [norcalli/nvim-colorizer.lua](https://github.com/norcalli/nvim-colorizer.lua) | The fastest Neovim colorizer. |
| [nvim-telescope/telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) | Find, Filter, Preview, Pick. All lua, all the time. |
| [rosé-pine](https://github.com/rose-pine/neovim) | Soho vibes for Neovim |
| [nvimtools/none-ls.nvim](https://github.com/nvimtools/none-ls.nvim) | null-ls.nvim reloaded / Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua. |
| [folke/which-key.nvim](https://github.com/folke/which-key.nvim) | Create key bindings that stick. WhichKey helps you remember your Neovim keymaps, by showing available keybindings in a popup as you type. |
### 5.2. LSP
By default, the follow LSP servers are installed and configured:
- python - [ruff_lsp](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#ruff_lsp)
- golang - [gopls](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#gopls)
- docker - [dockerls](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#dockerls)
- bash - [bashls](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#bashls)
- vim - [vimls](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#vimls)
- yaml - [yamlls](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#yamlls)
- json - [jsonls](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#jsonls)
Furthermore, it integrates with [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) to provide rich syntax highlighting and other language parsing magic.
If your language is not supported, please follow this:
- Check if LSP support is available in the [lspconfig repo](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md). To install a supported language server with [mason](https://github.com/williamboman/mason.nvim):
```vim
:LspInstall `<your_language_server>`
```
- Check if your syntax is supported in the [treesitter repo](https://github.com/nvim-treesitter/nvim-treesitter). To install a language syntax highlight, run:
```vim
:TSInstall `<language_to_install>`
```
You can add more LSP servers and language syntax highlighting by editing the custom file.
## 6. Keymaps
These are the default keymaps, in the following shortcuts, the `<leader>`+` key is set up to `` (space) character, check: [keymaps.lua](./nvim/lua/core/keymaps.lua).
| Shortcut | Mode | Description |
| ------------------------------ | ------ | --------------------------------------------- |
| <kbd>kk</kbd> | Insert | Esc with `kk` |
| <kbd>rr</kbd> | Normal | Reload configuration file |
| <kbd>tt</kbd> | Normal | Create terminal | |
| `<leader>`+<kbd>s</kbd> | Normal | Save file |
| `<leader>`+<kbd>q</kbd> | Normal | Save (close all windows) and exit from Neovim |
| `<leader>`+<kbd>n</kbd> | Normal | Open NvimTree |
| `<leader>`+<kbd>nr</kbd> | Normal | Refresh NvimTree |
| `<leader>`+<kbd>nf</kbd> | Normal | Find file in NvimTree |
| `<leader>`+<kbd>ff</kbd> | Normal | Open Telescope to find files |
| `<leader>`+<kbd>fg</kbd> | Normal | Open Telescope to do live grep |
| `<leader>`+<kbd>fb</kbd> | Normal | Open Telescope to list buffers |
| `<leader>`+<kbd>fh</kbd> | Normal | Open Telescope to show help |
| `<leader>`+<kbd>fo</kbd> | Normal | Open Telescope to show recent opened files |
| `<leader>`+<kbd>cm</kbd> | Normal | Open Telescope to list git commits |
| `<leader>`+<kbd>wh/j/k/l</kbd> | Normal | Move around splits |
| <kbd>mm</kbd> | Normal | Comment/Uncomment line |
There are many default keymaps, you can check it using `:map` command. There are also other variants:
- `:nmap` for normal mode mappings
- `:vmap` for visual mode mappings
- `:imap` for insert mode mappings
The above list is not complete. Typing `:help map` in Vim will give you more info.
## 7. Customization
You can customize this configuration by creating the `custom` module. You can choose either two ways:
- Create `${XDG_CONFIG_HOME:-$HOME/.config}/nvim/lua/custom.lua` file.
- Create module `${XDG_CONFIG_HOME:-$HOME/.config}/nvim/lua/custom/` if your custom configuration is too long, and you want to separate it into multiple files.
Checkout the [sample custom](./nvim/lua/sample_custom.lua) file for the starting point. The logic is taken from [CyberNvim](https://github.com/pgosar/CyberNvim/wiki/Configuration#predefined-sections). There are a number of defined sections in the config:
- `M.setup_sources` is used to add extra sources to connect to Null-ls - you can find a list of sources [here](https://github.com/nvimtools/none-ls.nvim/blob/main/doc/BUILTINS.md). The parameter b is just short for null_ls.builtins.
- `M.ensure_installed` is used to add extra [Treesitter](https://github.com/nvim-treesitter/nvim-treesitter) highlighter.
- `M.plugins` is where you will add your own plugin definitions.
- `M.configs` is the most important section of your own configuration. This is where you can define any autocommands, require any files, or otherwise completely port your current configuration.
- `M.formatting_servers` is used to setup auto formatting rules. You need to select the language server that will provide autoformatting capabilities
## 8. Contribution
Feel free to file an issue or open a pull request. You're welcome!
## 9. Guide and resources
- [nanotee/nvim-lua-guide](https://github.com/nanotee/nvim-lua-guide)
- [brainfucksec/neovim-lua](https://github.com/brainfucksec/neovim-lua)
- [LunarVim/Neovim-from-scratch](https://github.com/LunarVim/Neovim-from-scratch)
- [LunarVim/nvim-basic-ide](https://github.com/LunarVim/nvim-basic-ide)
&nbsp;
<p align="center">Copyright &copy; 2022-present <a href="https://github.com/ntk148v" target="_blank">Kien Nguyen Tuan</a>
<p align="center"><a href="https://github.com/ntk148v/neovim-config/blob/main/LICENSE"><img src="https://img.shields.io/static/v1.svg?style=for-the-badge&label=License&message=Apache2.0"/></a></p>

79
init.lua Normal file
View File

@@ -0,0 +1,79 @@
if vim.fn.has "nvim-0.8" == 0 then error "Need Neovim 0.8+ in order to use this config" end
for _, cmd in ipairs { "git", "rg", { "fd", "fdfind" } } do
local name = type(cmd) == "string" and cmd or vim.inspect(cmd)
local commands = type(cmd) == "string" and { cmd } or cmd
---@cast commands string[]
local found = false
for _, c in ipairs(commands) do
if vim.fn.executable(c) == 1 then
name = c
found = true
end
end
if not found then error(("`%s` is not installed"):format(name)) end
end
-- require('nvim-treesitter.configs').setup {
-- ensure_installed = { 'latex', 'bibtex', 'comment' },
-- highlight = { enable = true },
-- }
vim.g.vimtex_view_method = 'zathura' -- change to 'skim' (mac) or 'sumatrapdf' (win)
vim.g.vimtex_compiler_method = 'latexmk'
vim.g.vimtex_compiler_latexmk = {
build_dir = '',
options = { '-pdf', '-interaction=nonstopmode', '-synctex=1', '-file-line-error' },
}
-- forward/back search mappings
vim.g.vimtex_view_forward_search_on_start = 1
-- keymaps to compile/view (vimtex provides defaults: \ll, \lv, \li)
vim.api.nvim_set_keymap('n', '<leader>ll', '<cmd>VimtexCompile<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>lv', '<cmd>VimtexView<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>lk', '<cmd>VimtexStop<CR>', { noremap = true, silent = true })
-- LSP: texlab (you need texlab installed OR fall back to vimtex)
-- local nvim_lsp = require('lspconfig')
-- Basic nvim-cmp setup (LSP completion)
vim.g.python3_host_prog = '/home/manuel/.conda/envs/sci/bin/python3'
vim.g.tidal_target = "terminal"
vim.opt.termguicolors = true -- enable 24-bit RGB colors
-- Disable annoying deprecated message
vim.deprecate = function() end
-- bootstrap lazy and all plugins
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)
-- Load default configurations and plugins
for _, source in ipairs {
"plugins",
"options",
"mappings",
"autocmds",
} do
local ok, fault = pcall(require, source)
if not ok then vim.api.nvim_err_writeln("Failed to load " .. source .. "\n\n" .. fault) end
end
-- Load custom configurations
local exist, custom = pcall(require, "custom")
if exist and type(custom) == "table" and custom.configs then custom.configs() end

37
lazy-lock.json Normal file
View File

@@ -0,0 +1,37 @@
{
"LuaSnip": { "branch": "master", "commit": "de10d8414235b0a8cabfeba60d07c24304e71f5c" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"conform.nvim": { "branch": "master", "commit": "3543d000dafbc41cc7761d860cfdb24e82154f75" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" },
"image.nvim": { "branch": "master", "commit": "5cbb891eb8dde53f350dde69e23106d4e85d898b" },
"jupytext.nvim": { "branch": "master", "commit": "2e86acfa4345f611c86f57116db0c06ffecb721d" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "1ec4da522fa49dcecee8d190efda273464dd2192" },
"mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" },
"molten-nvim": { "branch": "main", "commit": "4e1c9997cb53b9d3236c5d6462d80119250ed5b7" },
"none-ls-extras.nvim": { "branch": "main", "commit": "924fe88a9983c7d90dbb31fc4e3129a583ea0a90" },
"none-ls.nvim": { "branch": "main", "commit": "5fcb73913a9290f78097e34420fe0e6130c5c33c" },
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-conda": { "branch": "main", "commit": "7e63124d98f48a3bb255eaa71d1602db610b9047" },
"nvim-lspconfig": { "branch": "master", "commit": "1c505a2a37c7732fb2a7e290c0f822abfb2ba1c5" },
"nvim-tree.lua": { "branch": "master", "commit": "b70a741f5a29a1d2baa3bbe7e5c0a4a5d6423849" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-web-devicons": { "branch": "master", "commit": "c2599a81ecabaae07c49ff9b45dcd032a8d90f1a" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"rose-pine": { "branch": "main", "commit": "72befaffeac38db7bdd49e0549eaa2c4806dd878" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
"transparent.nvim": { "branch": "main", "commit": "8ac59883de84e9cd1850ea25cf087031c5ba7d54" },
"vim-tidal": { "branch": "master", "commit": "e440fe5bdfe07f805e21e6872099685d38e8b761" },
"vimtex": { "branch": "master", "commit": "c74d9927d9ac2fd24f965634ab56fc5d3c0a60a7" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
}

64
lua/autocmds.lua Normal file
View File

@@ -0,0 +1,64 @@
--
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
--
-- File: autocmds.lua
-- Description: Autocommand functions
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
-- Define autocommands with Lua APIs
-- See: h:api-autocmd, h:augroup
local autocmd = vim.api.nvim_create_autocmd -- Create autocommand
-- General settings
-- Highlight on yank
autocmd("TextYankPost", {
callback = function()
vim.highlight.on_yank {
higroup = "IncSearch",
timeout = "1000",
}
end,
})
-- Remove whitespace on save
autocmd("BufWritePre", {
pattern = "",
command = ":%s/\\s\\+$//e",
})
-- Auto format on save using the attached (optionally filtered) language servere clients
-- https://neovim.io/doc/user/lsp.html#vim.lsp.buf.format()
autocmd("BufWritePre", {
pattern = "",
command = ":silent lua vim.lsp.buf.format()",
})
-- Don"t auto commenting new lines
autocmd("BufEnter", {
pattern = "",
command = "set fo-=c fo-=r fo-=o",
})
autocmd("Filetype", {
pattern = { "xml", "html", "xhtml", "css", "scss", "javascript", "typescript", "yaml", "lua" },
command = "setlocal shiftwidth=2 tabstop=2",
})
-- Set colorcolumn
autocmd("Filetype", {
pattern = { "python", "rst", "c", "cpp" },
command = "set colorcolumn=80",
})
autocmd("Filetype", {
pattern = { "gitcommit", "markdown", "text" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
})

85
lua/mappings.lua Normal file
View File

@@ -0,0 +1,85 @@
--
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
--
-- File: mappings.lua
-- Description: Key mapping configs
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
-- <leader> is a space now
local map = vim.keymap.set
local cmd = vim.cmd
vim.keymap.set("n", "<leader>b", ":Telescope buffers<CR>", { noremap = true, silent = true })
map("n", "<S-Tab>", ":bprevious<CR>", { noremap = true, silent = true })
map("n", "<Tab>", ":bnext<CR>", { noremap = true, silent = true })
map("n", "<leader>q", ":qa!<CR>", {})
-- Fast saving with <leader> and s
map("n", "<leader>s", ":w<CR>", {})
-- Move around splits
map("n", "<leader>wh", "<C-w>h", { desc = "switch window left" })
map("n", "<leader>wj", "<C-w>j", { desc = "switch window right" })
map("n", "<leader>wk", "<C-w>k", { desc = "switch window up" })
map("n", "<leader>wl", "<C-w>l", { desc = "switch window down" })
-- Reload configuration without restart nvim
-- Or you don't want to use plenary.nvim, you can use this code
-- function _G.reload_config()
-- for name, _ in pairs(package.loaded) do
-- if name:match("^me") then
-- package.loaded[name] = nil
-- end
-- end
-- dofile(vim.env.MYVIMRC)
-- vim.notify("Nvim configuration reloaded!", vim.log.levels.INFO)
-- end
function _G.reload_config()
local reload = require("plenary.reload").reload_module
reload("me", false)
dofile(vim.env.MYVIMRC)
vim.notify("Nvim configuration reloaded!", vim.log.levels.INFO)
end
map("n", "rr", _G.reload_config, { desc = "Reload configuration without restart nvim" })
-- Telescope
local builtin = require "telescope.builtin"
map("n", "<leader>ff", builtin.find_files, { desc = "Open Telescope to find files" })
map("n", "<leader>fg", builtin.live_grep, { desc = "Open Telescope to do live grep" })
map("n", "<leader>fb", builtin.buffers, { desc = "Open Telescope to list buffers" })
map("n", "<leader>fh", builtin.help_tags, { desc = "Open Telescope to show help" })
map("n", "<leader>fo", builtin.oldfiles, { desc = "Open Telescope to list recent files" })
map("n", "<leader>cm", builtin.git_commits, { desc = "Open Telescope to list git commits" })
-- NvimTree
map("n", "<leader>n", ":NvimTreeToggle<CR>", { desc = "Toggle NvimTree sidebar" }) -- open/close
map("n", "<leader>nr", ":NvimTreeRefresh<CR>", { desc = "Refresh NvimTree" }) -- refresh
map("n", "<leader>nf", ":NvimTreeFindFile<CR>", { desc = "Search file in NvimTree" }) -- search file
-- LSP
map(
"n",
"<leader>gm",
function() require("conform").format { lsp_fallback = true } end,
{ desc = "General Format file" }
)
-- global lsp mappings
map("n", "<leader>ds", vim.diagnostic.setloclist, { desc = "LSP Diagnostic loclist" })
-- Comment
map("n", "mm", "gcc", { desc = "Toggle comment", remap = true })
map("v", "mm", "gc", { desc = "Toggle comment", remap = true })
-- Terminal
map("n", "tt", function()
local height = math.floor(vim.o.lines / 2)
cmd("belowright split | resize " .. height .. " | terminal")
end, { noremap = true, silent = true })

163
lua/options.lua Normal file
View File

@@ -0,0 +1,163 @@
--
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
--
-- File: options.lua
-- Description: General Neovim settings and configuration
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
local cmd = vim.cmd
-- Set options (global/buffer/windows-scoped)
local opt = vim.opt
-- Global variables
local g = vim.g
local indent = 4
g.mapleader = " "
cmd [[
filetype plugin indent on
]]
opt.backspace = { "eol", "start", "indent" } -- allow backspacing over everything in insert mode
opt.clipboard = "unnamedplus" -- allow neovim to access the system clipboard
opt.fileencoding = "utf-8" -- the encoding written to a file
opt.encoding = "utf-8" -- the encoding
opt.matchpairs = { "(:)", "{:}", "[:]", "<:>" }
opt.syntax = "enable"
-- indention
opt.autoindent = true -- auto indentation
opt.expandtab = true -- convert tabs to spaces
opt.shiftwidth = indent -- the number of spaces inserted for each indentation
opt.smartindent = true -- make indenting smarter
opt.softtabstop = indent -- when hitting <BS>, pretend like a tab is removed, even if spaces
opt.tabstop = indent -- insert 2 spaces for a tab
opt.shiftround = true -- use multiple of shiftwidth when indenting with "<" and ">"
-- tabline
opt.showtabline = 2 -- always show tabs
opt.sessionoptions = "curdir,folds,globals,help,tabpages,terminal,winsize"
-- search
opt.hlsearch = true -- highlight all matches on previous search pattern
opt.ignorecase = true -- ignore case in search patterns
opt.smartcase = true -- smart case
opt.wildignore = opt.wildignore + { "*/node_modules/*", "*/.git/*", "*/vendor/*" }
opt.wildmenu = true -- make tab completion for files/buffers act like bash
-- ui
opt.cursorline = true -- highlight the current line
opt.laststatus = 2 -- only the last window will always have a status line
opt.lazyredraw = true -- don"t update the display while executing macros
opt.list = true
-- You can also add "space" or "eol", but I feel it"s quite annoying
opt.listchars = {
tab = "",
trail = "·",
extends = "»",
precedes = "«",
nbsp = "×",
}
-- Hide cmd line
opt.cmdheight = 0 -- more space in the neovim command line for displaying messages
opt.mouse = "a" -- allow the mouse to be used in neovim
opt.number = true -- set numbered lines
opt.scrolloff = 0 -- minimal number of screen lines to keep above and below the cursor
opt.sidescrolloff = 3 -- minimal number of screen columns to keep to the left and right (horizontal) of the cursor if wrap is `false`
opt.signcolumn = "yes" -- always show the sign column, otherwise it would shift the text each time
opt.splitbelow = true -- open new split below
opt.splitright = true -- open new split to the right
opt.wrap = true -- display a wrapped line
-- backups
opt.backup = false -- create a backup file
opt.swapfile = false -- creates a swapfile
opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
-- autocomplete
opt.completeopt = { "menu", "menuone", "noselect" } -- mostly just for cmp
opt.shortmess = opt.shortmess + {
c = true,
} -- hide all the completion messages, e.g. "-- XXX completion (YYY)", "match 1 of 2", "The only match", "Pattern not found"
-- By the way, -- INSERT -- is unnecessary anymore because the mode information is displayed in the statusline.
opt.showmode = false
-- perfomance
-- remember N lines in history
opt.history = 100 -- keep 100 lines of history
opt.redrawtime = 1500
opt.timeoutlen = 250 -- time to wait for a mapped sequence to complete (in milliseconds)
opt.ttimeoutlen = 10
opt.updatetime = 100 -- signify default updatetime 4000ms is not good for async update
-- theme
opt.termguicolors = true -- enable 24-bit RGB colors
-- persistent undo
-- Don"t forget to create folder $HOME/.local/share/nvim/undo
local undodir = vim.fn.stdpath "data" .. "/undo"
opt.undofile = true -- enable persistent undo
opt.undodir = undodir
opt.undolevels = 1000
opt.undoreload = 10000
-- fold
opt.foldmethod = "marker"
opt.foldlevel = 99
-- Disable builtin plugins
local disabled_built_ins = {
"2html_plugin",
"getscript",
"getscriptPlugin",
"gzip",
"logipat",
"netrw",
"netrwPlugin",
"netrwSettings",
"netrwFileHandlers",
"matchit",
"tar",
"tarPlugin",
"rrhelper",
"spellfile_plugin",
"vimball",
"vimballPlugin",
"zip",
"zipPlugin",
"tutor",
"rplugin",
"synmenu",
"optwin",
"compiler",
"bugreport",
"ftplugin",
}
for _, plugin in pairs(disabled_built_ins) do
g["loaded_" .. plugin] = 1
end
-- Colorscheme
-- By default, use rose-pine
cmd.colorscheme "rose-pine"
-- Enable virtual_lines feature if the current nvim version is 0.11+
if vim.fn.has "nvim-0.11" > 0 then
vim.diagnostic.config {
-- Use the default configuration
virtual_lines = true,
-- Alternatively, customize specific options
-- virtual_lines = {
-- -- Only show virtual line diagnostics for the current cursor line
-- current_line = true,
-- },
}
end

129
lua/plugins/configs/cmp.lua Normal file
View File

@@ -0,0 +1,129 @@
--
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
--
-- File: plugins/configs/cmp.lua
-- Description: cmp configuration
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
local cmp = require "cmp"
require("nvim-autopairs").setup {
check_ts = true,
ts_config = {
lua = { "string" }, -- it will not add a pair on that treesitter node
javascript = { "template_string" },
java = false, -- Don't check treesitter on java
},
-- Don't add pairs if it already has a close pair in the same line
enable_check_bracket_line = false,
-- Don't add pairs if the next char is alphanumeric
ignored_next_char = "[%w%.]", -- will ignore alphanumeric and `.` symbol
fast_wrap = {},
disable_filetype = { "TelescopePrompt", "vim" },
}
-- setup cmp for autopairs
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done())
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 = {
winhighlight = "Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel",
scrollbar = false,
},
documentation = {
border = border "CmpDocBorder",
winhighlight = "Normal:CmpDoc",
},
},
snippet = {
expand = function(args) require("luasnip").lsp_expand(args.body) end,
},
formatting = {
fields = { "abbr", "kind", "menu" },
format = require("lspkind").cmp_format {
maxwidth = 50,
ellipsis_char = "...",
mode = "symbol_text",
symbol_map = {},
},
},
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",
option = {
-- Avoid accidentally running on big files
get_bufnrs = function()
local buf = vim.api.nvim_get_current_buf()
local byte_size = vim.api.nvim_buf_get_offset(buf, vim.api.nvim_buf_line_count(buf))
if byte_size > 1024 * 1024 then -- 1 Megabyte max
return {}
end
return { buf }
end,
},
},
{ name = "nvim_lua" },
{ name = "path" },
},
}
cmp.setup(options)

View File

@@ -0,0 +1,57 @@
--
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
--
-- File: plugins/configs/gitsigns.lua
-- Description: Gitsigns configuration
return {
signs = {
add = {
text = "",
},
change = {
text = "",
},
delete = {
text = "",
},
topdelete = {
text = "󱅁 ",
},
changedelete = {
text = "󰍷 ",
},
},
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = {
interval = 1000,
follow_files = true,
},
attach_to_untracked = true,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = "eol", -- "eol" | "overlay" | "right_align"
delay = 1000,
ignore_whitespace = false,
},
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
max_file_length = 40000,
preview_config = {
-- Options passed to nvim_open_win
border = "single",
style = "minimal",
relative = "cursor",
row = 0,
col = 1,
},
}

View File

@@ -0,0 +1,43 @@
return
{
require("image").setup({
backend = "kitty",
processor = "magick_cli", -- or "magick_rock"
integrations = {
markdown = {
enabled = true,
clear_in_insert_mode = false,
download_remote_images = true,
only_render_image_at_cursor = false,
only_render_image_at_cursor_mode = "inline",
floating_windows = false, -- if true, images will be rendered in floating markdown windows
filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here
},
neorg = {
enabled = true,
filetypes = { "norg" },
},
typst = {
enabled = true,
filetypes = { "typst" },
},
html = {
enabled = false,
},
css = {
enabled = false,
},
},
max_width = 300,
max_height = 12,
max_width_window_percentage = math.huge,
max_height_window_percentage = math.huge,
window_overlap_clear_enabled = false, -- toggles images when windows are overlapped
window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "snacks_notif", "scrollview", "scrollview_sign" },
editor_only_render_when_focused = false, -- auto show/hide images when the editor gains/looses focus
tmux_show_only_in_active_window = false, -- auto show/hide images in the correct Tmux window (needs visual-activity off)
hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp", "*.avif" }, -- render image files as images when opened
})
}

View File

@@ -0,0 +1,106 @@
--
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
--
-- File: plugins/configs/lspconfig.lua
-- Description: LSP setup and config
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
local merge_tables = require("utils").merge_tables
local exist, custom = pcall(require, "custom")
local custom_formatting_servers = exist and type(custom) == "table" and custom.formatting_servers or {}
local formatting_servers = {
jsonls = {},
dockerls = {},
bashls = {},
gopls = {},
ruff_lsp = {},
vimls = {},
yamlls = {},
lua_ls = {
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false,
},
telemetry = {
enable = false,
},
},
},
},
}
-- Merge
merge_tables(formatting_servers, custom_formatting_servers)
local opts = {
-- Automatically format on save
autoformat = true,
-- options for vim.lsp.buf.format
-- `bufnr` and `filter` is handled by the LazyVim formatter,
-- but can be also overridden when specified
format = {
formatting_options = nil,
timeout_ms = nil,
},
-- LSP Server Settings
servers = formatting_servers,
-- you can do any additional lsp server setup here
-- return true if you don"t want this server to be setup with lspconfig
setup = {
-- example to setup with typescript.nvim
-- tsserver = function(_, opts)
-- require("typescript").setup({ server = opts })
-- return true
-- end,
-- Specify * to use this function as a fallback for any server
-- ["*"] = function(server, opts) end,
},
}
local servers = opts.servers
local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
local function setup(server)
local server_opts = vim.tbl_deep_extend("force", {
capabilities = vim.deepcopy(capabilities),
}, servers[server] or {})
if opts.setup[server] then
if opts.setup[server](server, server_opts) then return end
elseif opts.setup["*"] then
if opts.setup["*"](server, server_opts) then return end
end
require("lspconfig")[server].setup(server_opts)
end
local mlsp = require "mason-lspconfig"
local available = mlsp.get_available_servers()
local ensure_installed = {} ---@type string[]
for server, server_opts in pairs(servers) do
if server_opts then
server_opts = server_opts == true and {} or server_opts
-- run manual setup if mason=false or if this is a server that cannot be installed with mason-lspconfig
if server_opts.mason == false or not vim.tbl_contains(available, server) then
setup(server)
else
ensure_installed[#ensure_installed + 1] = server
end
end
end
require("mason").setup()
require("mason-lspconfig").setup {
ensure_installed = ensure_installed,
automatic_installation = true,
}

View File

@@ -0,0 +1,328 @@
--
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
--
-- File: plugins/configs/lualine.lua
-- Description: Pacman config for lualine
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
-- Credit: shadmansaleh & his evil theme: https://github.com/nvim-lualine/lualine.nvim/blob/master/examples/evil_lualine.lua
local lualine = require "lualine"
local lualine_require = require "lualine_require"
local utils = require "utils"
local function loadcolors()
-- Rose-pine palette
local rosepine = require "rose-pine.palette"
local colors = {
bg = rosepine.base,
fg = rosepine.text,
yellow = rosepine.gold,
cyan = rosepine.foam,
black = rosepine.subtled,
green = rosepine.pine,
white = rosepine.text,
magenta = rosepine.iris,
blue = rosepine.rose,
red = rosepine.love,
}
-- Try to load pywal colors
local modules = lualine_require.lazy_require {
utils_notices = "lualine.utils.notices",
}
local sep = package.config:sub(1, 1)
local wal_colors_path = table.concat({ os.getenv "HOME", ".cache", "wal", "colors.sh" }, sep)
local wal_colors_file = io.open(wal_colors_path, "r")
if wal_colors_file == nil then
modules.utils_notices.add_notice("lualine.nvim: " .. wal_colors_path .. " not found")
return colors
end
local ok, wal_colors_text = pcall(wal_colors_file.read, wal_colors_file, "*a")
wal_colors_file:close()
if not ok then
modules.utils_notices.add_notice(
"lualine.nvim: " .. wal_colors_path .. " could not be read: " .. wal_colors_text
)
return colors
end
local wal = {}
for line in vim.gsplit(wal_colors_text, "\n") do
if line:match "^[a-z0-9]+='#[a-fA-F0-9]+'$" ~= nil then
local i = line:find "="
local key = line:sub(0, i - 1)
local value = line:sub(i + 2, #line - 1)
wal[key] = value
end
end
-- Color table for highlights
colors = {
bg = wal.background,
fg = wal.foreground,
yellow = wal.color3,
cyan = wal.color4,
black = wal.color0,
green = wal.color2,
white = wal.color7,
magenta = wal.color5,
blue = wal.color6,
red = wal.color1,
}
return colors
end
local colors = loadcolors()
local conditions = {
buffer_not_empty = function() return vim.fn.empty(vim.fn.expand "%:t") ~= 1 end,
hide_in_width = function() return vim.fn.winwidth(0) > 80 end,
check_git_workspace = function()
local filepath = vim.fn.expand "%:p:h"
local gitdir = vim.fn.finddir(".git", filepath .. ";")
return gitdir and #gitdir > 0 and #gitdir < #filepath
end,
}
-- Config
local config = {
options = {
-- Disable sections and component separators
component_separators = "",
section_separators = "",
disabled_filetypes = { "Lazy", "NvimTree" },
theme = {
-- We are going to use lualine_c an lualine_x as left and
-- right section. Both are highlighted by c theme . So we
-- are just setting default looks o statusline
normal = {
c = {
fg = colors.fg,
bg = colors.bg,
},
},
inactive = {
c = {
fg = colors.fg,
bg = colors.bg,
},
},
},
},
sections = {
-- these are to remove the defaults
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
-- These will be filled later
lualine_c = {},
lualine_x = {},
},
inactive_sections = {
-- these are to remove the defaults
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
lualine_c = {},
lualine_x = {},
},
tabline = {
lualine_a = {
{
"buffers",
max_length = vim.o.columns * 2 / 3,
show_filename_only = false,
mode = 0, -- 0: Shows buffer name
-- 1: Shows buffer index
-- 2: Shows buffer name + buffer index
-- 3: Shows buffer number
-- 4: Shows buffer name + buffer number
right_padding = 5,
left_padding = 5,
-- Automatically updates active buffer color to match color of other components (will be overidden if buffers_color is set)
use_mode_colors = true,
buffers_color = {
-- Same values as the general color option can be used here.
active = {
fg = colors.fg,
bg = colors.bg,
gui = "bold",
}, -- Color for active buffer.
inactive = {
fg = utils.darken(colors.fg, 0.3),
bg = utils.darken(colors.bg, 0.3),
}, -- Color for inactive buffer.
},
symbols = {
modified = "", -- Text to show when the buffer is modified
alternate_file = "", -- Text to show to identify the alternate file
directory = "", -- Text to show when the buffer is a directory
},
},
},
},
extensions = {
"nvim-tree",
"mason",
"fzf",
},
}
-- Inserts a component in lualine_c at left section
local function ins_left(component) table.insert(config.sections.lualine_c, component) end
-- Inserts a component in lualine_x ot right section
local function ins_right(component) table.insert(config.sections.lualine_x, component) end
ins_left {
-- mode component
function() return "" end,
color = function()
-- auto change color according to neovims mode
local mode_color = {
n = colors.fg,
i = colors.green,
v = colors.blue,
[""] = colors.blue,
V = colors.blue,
c = colors.magenta,
no = colors.red,
s = colors.yellow,
S = colors.yellow,
[""] = colors.yellow,
ic = colors.yellow,
R = colors.white,
Rv = colors.white,
cv = colors.red,
ce = colors.red,
r = colors.cyan,
rm = colors.cyan,
["r?"] = colors.cyan,
["!"] = colors.red,
t = colors.red,
}
return {
fg = mode_color[vim.fn.mode()],
}
end,
}
ins_left {
"branch",
icon = "",
color = {
fg = colors.magenta,
gui = "bold",
},
}
ins_left {
"diff",
-- Is it me or the symbol for modified us really weird
symbols = { added = "", modified = "󰝤 ", removed = "" },
diff_color = {
added = {
fg = colors.green,
},
modified = {
fg = colors.yellow,
},
removed = {
fg = colors.red,
},
},
cond = conditions.hide_in_width,
}
-- Insert mid section. You can make any number of sections in neovim :)
-- for lualine it"s any number greater then 2
ins_left { function() return "%=" end }
ins_right {
-- Lsp server name .
function()
local msg = "null"
local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
local clients = vim.lsp.get_active_clients()
if next(clients) == nil then return msg end
for _, client in ipairs(clients) do
local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then return client.name end
end
return msg
end,
icon = " LSP:",
color = {
fg = colors.cyan,
gui = "bold",
},
}
ins_right {
"diagnostics",
sources = { "nvim_diagnostic" },
symbols = {
error = "",
warn = "",
info = "",
hints = "󰛩 ",
},
diagnostics_color = {
color_error = {
fg = colors.red,
},
color_warn = {
fg = colors.yellow,
},
color_info = {
fg = colors.cyan,
},
color_hints = {
fg = colors.magenta,
},
},
always_visible = false,
}
ins_right {
"fileformat",
fmt = string.upper,
icons_enabled = true,
color = {
fg = colors.green,
gui = "bold",
},
}
ins_right {
"location",
color = {
fg = colors.fg,
gui = "bold",
},
}
ins_right {
"progress",
color = {
fg = colors.fg,
gui = "bold",
},
}
-- Now don"t forget to initialize lualine
lualine.setup(config)

View File

@@ -0,0 +1,33 @@
--
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
--
-- File: plugins/configs/luasnsip.lua
-- Description: luasnip configuration
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
-- vscode format
require("luasnip.loaders.from_vscode").lazy_load { exclude = vim.g.vscode_snippets_exclude or {} }
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,
})

View File

@@ -0,0 +1,40 @@
--
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
--
-- File: plugins/configs/mason.lua
-- Description: mason
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
return {
{ "mason-org/mason.nvim", version = "*" },
{ "mason-org/mason-lspconfig.nvim", version = "*" },
"neovim/nvim-lspconfig",
require("mason").setup {
PATH = "prepend",
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,
},
}

View File

@@ -0,0 +1,22 @@
--
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
--
-- File: plugins/configs/null-ls.lua
-- Description: null-ls configuration
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
local null_ls = require "null-ls"
-- Load custom configurations
local exist, custom = pcall(require, "custom")
local sources = exist and type(custom) == "table" and custom.setup_sources and custom.setup_sources(null_ls.builtins)
or {}
null_ls.setup {
debug = false,
sources = sources,
}

View File

@@ -0,0 +1,33 @@
--
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
--
-- File: plugins/configs/telescope.lua
-- Description: nvim-telescope config
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
return {
defaults = {
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
sorting_strategy = "ascending",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
},
width = 0.87,
height = 0.80,
},
mappings = {
n = { ["q"] = require("telescope.actions").close },
},
},
extensions_list = { "themes", "terms" },
extensions = {},
}

View File

@@ -0,0 +1,85 @@
--
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
--
-- File: plugins/configs/tree.lua
-- Description: nvim-tree config
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
return {
filters = {
dotfiles = false,
},
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 = "",
},
},
},
},
}

View File

@@ -0,0 +1,56 @@
--
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
--
-- File: plugins/configs/treesitter.lua
-- Description: nvim-treesitter configuration
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
-- Load custom configurations
local exist, custom = pcall(require, "custom")
local ensure_installed = exist and type(custom) == "table" and custom.ensure_installed or {}
return {
-- A list of parser names, or "all"
ensure_installed = {
"go",
"python",
"dockerfile",
"json",
"yaml",
"markdown",
"html",
"scss",
"css",
"vim",
"lua",
ensure_installed,
},
highlight = {
enable = true,
use_languagetree = true,
},
indent = {
enable = true,
},
autotag = {
enable = true,
},
context_commentstring = {
enable = true,
enable_autocmd = false,
},
refactor = {
highlight_definitions = {
enable = true,
},
highlight_current_scope = {
enable = false,
},
},
}

316
lua/plugins/init.lua Normal file
View File

@@ -0,0 +1,316 @@
--
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
--
-- File: plugins/init.lua
-- Description: init plugins config
-- Built-in plugins
local builtin_plugins = {
{ "nvim-lua/plenary.nvim" },
-- File explore
-- nvim-tree.lua - A file explorer tree for neovim written in lua
{
"nvim-tree/nvim-tree.lua",
dependencies = {
"nvim-tree/nvim-web-devicons",
opt = true,
},
opts = function() require "plugins.configs.tree" end,
},
-- Formatter
-- Lightweight yet powerful formatter plugin for Neovim
{
"stevearc/conform.nvim",
opts = {
formatters_by_ft = { lua = { "stylua" } },
},
},
{
'kmontocam/nvim-conda',
dependencies = { 'nvim-lua/plenary.nvim' }
},
-- Git integration for buffers
{
"lewis6991/gitsigns.nvim",
event = { "BufReadPost", "BufNewFile", "BufWritePost" },
opts = function() require "plugins.configs.gitsigns" end,
},
-- in your `plugins.lua` (lazy.nvim)
{
"goerz/jupytext.nvim",
version = "0.2.0",
opts = {
format = "markdown", -- or "hydrogen" style etc.
autosync = true,
sync_patterns = { "*.md", "*.py" },
}
},
{
-- see the image.nvim readme for more information about configuring this plugin
"3rd/image.nvim",
build = false,
opts = {
processor = "magick_cli",
integrations = {
markdown = {
enabled = true,
}
}
},
opts = function() require "plugins.configs.image" end,
},
{
"benlubas/molten-nvim",
version = "^2.0.0", -- use version <2.0.0 to avoid breaking changes
dependencies = { "3rd/image.nvim" },
build = ":UpdateRemotePlugins",
init = function()
-- these are examples, not defaults. Please see the readme
vim.g.molten_image_provider = "image.nvim"
vim.g.molten_output_win_max_height = 20
end,
},
-- Treesitter interface
{
"nvim-treesitter/nvim-treesitter",
version = false, -- last release is way too old and doesn't work on Windows
evevent = { "BufReadPost", "BufNewFile", "BufWritePost" },
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
build = ":TSUpdate",
opts = function() require "plugins.configs.treesitter" end,
},
-- Telescope
-- Find, Filter, Preview, Pick. All lua, all the time.
{
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
},
},
cmd = "Telescope",
config = function(_)
require("telescope").setup()
-- To get fzf loaded and working with telescope, you need to call
-- load_extension, somewhere after setup function:
require("telescope").load_extension "fzf"
require "plugins.configs.telescope"
end,
},
-- Statusline
-- A blazing fast and easy to configure neovim statusline plugin written in pure lua.
{
"nvim-lualine/lualine.nvim",
opts = function() require "plugins.configs.lualine" end,
},
-- colorscheme
{
-- Rose-pine - Soho vibes for Neovim
"rose-pine/neovim",
name = "rose-pine",
opts = {
dark_variant = "main",
},
},
-- LSP stuffs
-- Portable package manager for Neovim that runs everywhere Neovim runs.
-- Easily install and manage LSP servers, DAP servers, linters, and formatters.
{
"williamboman/mason.nvim",
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUninstall", "MasonUninstallAll", "MasonLog" },
config = function() require "plugins.configs.mason" end,
},
{
"williamboman/mason-lspconfig.nvim",
},
{
"nvimtools/none-ls.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = { "nvimtools/none-ls-extras.nvim" },
lazy = true,
config = function() require "plugins.configs.null-ls" end,
},
{
"neovim/nvim-lspconfig",
event = "VimEnter",
lazy = false,
config = function() require "plugins.configs.lspconfig" end,
},
{
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
{
-- snippet plugin
"L3MON4D3/LuaSnip",
dependencies = "rafamadriz/friendly-snippets",
opts = { history = true, updateevents = "TextChanged,TextChangedI" },
config = function(_, opts)
require("luasnip").config.set_config(opts)
require "plugins.configs.luasnip"
end,
},
-- autopairing of (){}[] etc
{ "windwp/nvim-autopairs" },
{
"xiyaowong/transparent.nvim",
lazy = false, -- ensure it runs at startup
opts = {}, -- you can pass `groups` / `extra_groups` / `excludes` here
},
{
'tidalcycles/vim-tidal',
lazy = false
},
{ 'lervag/vimtex' },
{ 'neovim/nvim-lspconfig' },
{ 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' },
{ 'nvim-telescope/telescope.nvim', dependencies = { 'nvim-lua/plenary.nvim' } },
{ 'neovim/nvim-lspconfig' },
-- cmp sources plugins
{
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"onsails/lspkind.nvim",
},
},
opts = function() require "plugins.configs.cmp" end,
},
-- Colorizer
{
"norcalli/nvim-colorizer.lua",
config = function(_)
require("colorizer").setup()
-- execute colorizer as soon as possible
vim.defer_fn(function() require("colorizer").attach_to_buffer(0) end, 0)
end,
},
-- Keymappings
{
"folke/which-key.nvim",
event = "VeryLazy",
config = function() require("which-key").setup() end,
},
}
local exist, custom = pcall(require, "custom")
local custom_plugins = exist and type(custom) == "table" and custom.plugins or {}
-- Check if there is any custom plugins
-- local ok, custom_plugins = pcall(require, "plugins.custom")
require("lazy").setup {
spec = { builtin_plugins, custom_plugins },
lockfile = vim.fn.stdpath "config" .. "/lazy-lock.json", -- lockfile generated after running update.
defaults = {
lazy = false, -- should plugins be lazy-loaded?
version = nil,
-- version = "*", -- enable this to try installing the latest stable versions of plugins
},
ui = {
icons = {
ft = "",
lazy = "󰂠",
loaded = "",
not_loaded = "",
},
},
install = {
-- install missing plugins on startup
missing = true,
-- try to load one of these colorschemes when starting an installation during startup
colorscheme = { "rose-pine", "habamax" },
},
checker = {
-- automatically check for plugin updates
enabled = true,
-- get a notification when new updates are found
-- disable it as it's too annoying
notify = false,
-- check for updates every day
frequency = 86400,
},
change_detection = {
-- automatically check for config file changes and reload the ui
enabled = true,
-- get a notification when changes are found
-- disable it as it's too annoying
notify = false,
},
performance = {
cache = {
enabled = true,
},
},
state = vim.fn.stdpath "state" .. "/lazy/state.json", -- state info for checker and other things
}
require('nvim-treesitter.configs').setup {
ensure_installed = { 'latex', 'bibtex', 'comment' },
highlight = { enable = true },
}
local nvim_lsp = require('lspconfig')
nvim_lsp.texlab.setup {
settings = {
texlab = {
auxDirectory = "", -- optionally set build dir
build = {
executable = "latexmk",
args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" },
onSave = true, -- build on save
},
forwardSearch = {
executable = "zathura",
args = { "--synctex-forward", "%l:1:%f", "%p" },
},
chktex = { onOpen = false, onEdit = false }, -- optional lint settings
}
}
}
-- Basic nvim-cmp setup (LSP completion)
local cmp = require('cmp')
cmp.setup({
snippet = {
expand = function(args) require('luasnip').lsp_expand(args.body) end,
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
mapping = require('cmp').mapping.preset.insert({
['<C-Space>'] = require('cmp').mapping.complete(),
['<CR>'] = require('cmp').mapping.confirm({ select = true }),
})
})

56
lua/sample_custom.lua Normal file
View File

@@ -0,0 +1,56 @@
local M = {}
-- add extra plugins here
M.plugins = {
{ "Shatur/neovim-ayu" },
{ 'tidalcycles/vim-tidal' },
{ 'lervag/vimtex' },
{ 'neovim/nvim-lspconfig' },
{ 'nvim-telescope/telescope.nvim', dependencies = { 'nvim-lua/plenary.nvim' } },
{ 'jremmen/vim-ripgrep' }, -- or use ripgrep CLI
{ 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' },
{
"xiyaowong/transparent.nvim",
lazy = false, -- ensure it runs at startup
opts = {}, -- you can pass `groups` / `extra_groups` / `excludes` here
},
{
"dccsillag/magma-nvim",
build = ":UpdateRemotePlugins",
ft = { "python", "julia" },
config = function()
require("magma").setup {}
end
}
}
-- add extra configuration options here, like extra autocmds etc.
-- feel free to create your own separate files and require them in here
M.configs = function() require("ayu").colorscheme() end
-- add servers to be used for auto formatting here
M.formatting_servers = {
rust_analyzer = {},
lua_ls = {},
}
-- add Tree-sitter to auto-install
M.ensure_installed = { "toml" }
-- add any null-ls sources you want here
M.setup_sources = function(b)
return {
b.formatting.autopep8,
b.formatting.prettier.with {
extra_filetypes = { "toml" },
extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" },
},
b.formatting.black.with {
extra_args = { "--fast" },
},
b.formatting.stylua,
}
end
return M

46
lua/utils.lua Normal file
View File

@@ -0,0 +1,46 @@
local M = {}
M.merge_tables = function(t1, t2)
if type(t1) ~= "table" or type(t2) ~= "table" then return end
for k, v in pairs(t2) do
t1[k] = v
end
end
M.lighten = function(hex, factor)
-- Remove # if present
hex = hex:gsub("#", "")
-- Convert hex to RGB
local r = tonumber(hex:sub(1, 2), 16)
local g = tonumber(hex:sub(3, 4), 16)
local b = tonumber(hex:sub(5, 6), 16)
-- Apply lighten factor
r = math.min(255, math.floor(r + (255 - r) * factor))
g = math.min(255, math.floor(g + (255 - g) * factor))
b = math.min(255, math.floor(b + (255 - b) * factor))
-- Convert back to hex
return string.format("#%02X%02X%02X", r, g, b)
end
M.darken = function(hex, factor)
-- Remove # if present
hex = hex:gsub("#", "")
-- Convert hex to RGB
local r = tonumber(hex:sub(1, 2), 16)
local g = tonumber(hex:sub(3, 4), 16)
local b = tonumber(hex:sub(5, 6), 16)
-- Apply darken factor
r = math.max(0, math.floor(r * (1 - factor)))
g = math.max(0, math.floor(g * (1 - factor)))
b = math.max(0, math.floor(b * (1 - factor)))
-- Convert back to hex
return string.format("#%02X%02X%02X", r, g, b)
end
return M

6
neovim.yml Normal file
View File

@@ -0,0 +1,6 @@
---
base: lua51
globals:
vim:
any: true

BIN
screenshots/nvim1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

BIN
screenshots/nvim2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 KiB

BIN
screenshots/nvim3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

BIN
screenshots/nvim4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

BIN
screenshots/nvim5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 KiB

BIN
screenshots/nvim6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

BIN
screenshots/nvim7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 KiB

BIN
screenshots/nvim8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB