commit
8512b8294c
17 changed files with 373 additions and 2034 deletions
19
LICENSE.md
19
LICENSE.md
|
|
@ -1,19 +0,0 @@
|
||||||
MIT License
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
240
README.md
240
README.md
|
|
@ -1,240 +0,0 @@
|
||||||
# kickstart.nvim
|
|
||||||
|
|
||||||
## Introduction
|
|
||||||
|
|
||||||
A starting point for Neovim that is:
|
|
||||||
|
|
||||||
* Small
|
|
||||||
* Single-file
|
|
||||||
* Completely Documented
|
|
||||||
|
|
||||||
**NOT** a Neovim distribution, but instead a starting point for your configuration.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
### Install Neovim
|
|
||||||
|
|
||||||
Kickstart.nvim targets *only* the latest
|
|
||||||
['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest
|
|
||||||
['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim.
|
|
||||||
If you are experiencing issues, please make sure you have the latest versions.
|
|
||||||
|
|
||||||
### Install External Dependencies
|
|
||||||
|
|
||||||
External Requirements:
|
|
||||||
- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`)
|
|
||||||
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation)
|
|
||||||
- Clipboard tool (xclip/xsel/win32yank or other depending on the platform)
|
|
||||||
- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons
|
|
||||||
- if you have it set `vim.g.have_nerd_font` in `init.lua` to true
|
|
||||||
- Emoji fonts (Ubuntu only, and only if you want emoji!) `sudo apt install fonts-noto-color-emoji`
|
|
||||||
- Language Setup:
|
|
||||||
- If you want to write Typescript, you need `npm`
|
|
||||||
- If you want to write Golang, you will need `go`
|
|
||||||
- etc.
|
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes
|
|
||||||
> and quick install snippets
|
|
||||||
|
|
||||||
### Install Kickstart
|
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> [Backup](#FAQ) your previous configuration (if any exists)
|
|
||||||
|
|
||||||
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\` |
|
|
||||||
|
|
||||||
#### Recommended Step
|
|
||||||
|
|
||||||
[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>/kickstart.nvim.git`
|
|
||||||
|
|
||||||
You likely want to remove `lazy-lock.json` from your fork's `.gitignore` file
|
|
||||||
too - it's ignored in the kickstart repo to make maintenance easier, but it's
|
|
||||||
[recommended to track it in version control](https://lazy.folke.io/usage/lockfile).
|
|
||||||
|
|
||||||
#### Clone kickstart.nvim
|
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> If following the recommended step above (i.e., forking the repo), replace
|
|
||||||
> `nvim-lua` with `<your_github_username>` in the commands below
|
|
||||||
|
|
||||||
<details><summary> Linux and Mac </summary>
|
|
||||||
|
|
||||||
```sh
|
|
||||||
git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details><summary> Windows </summary>
|
|
||||||
|
|
||||||
If you're using `cmd.exe`:
|
|
||||||
|
|
||||||
```
|
|
||||||
git clone https://github.com/nvim-lua/kickstart.nvim.git "%localappdata%\nvim"
|
|
||||||
```
|
|
||||||
|
|
||||||
If you're using `powershell.exe`
|
|
||||||
|
|
||||||
```
|
|
||||||
git clone https://github.com/nvim-lua/kickstart.nvim.git "${env:LOCALAPPDATA}\nvim"
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### Post Installation
|
|
||||||
|
|
||||||
Start Neovim
|
|
||||||
|
|
||||||
```sh
|
|
||||||
nvim
|
|
||||||
```
|
|
||||||
|
|
||||||
That's it! Lazy will install all the plugins you have. Use `:Lazy` to view
|
|
||||||
the current plugin status. Hit `q` to close the window.
|
|
||||||
|
|
||||||
#### Read The Friendly Documentation
|
|
||||||
|
|
||||||
Read through the `init.lua` file in your configuration folder for more
|
|
||||||
information about extending and exploring Neovim. That also includes
|
|
||||||
examples of adding popularly requested plugins.
|
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> For more information about a particular plugin check its repository's documentation.
|
|
||||||
|
|
||||||
|
|
||||||
### Getting Started
|
|
||||||
|
|
||||||
[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o)
|
|
||||||
|
|
||||||
### FAQ
|
|
||||||
|
|
||||||
* What should I do if I already have a pre-existing Neovim configuration?
|
|
||||||
* You should back it up and then delete all associated files.
|
|
||||||
* This includes your existing init.lua and the Neovim files in `~/.local`
|
|
||||||
which can be deleted with `rm -rf ~/.local/share/nvim/`
|
|
||||||
* Can I keep my existing configuration in parallel to kickstart?
|
|
||||||
* Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME`
|
|
||||||
to maintain multiple configurations. For example, you can install the kickstart
|
|
||||||
configuration in `~/.config/nvim-kickstart` and create an alias:
|
|
||||||
```
|
|
||||||
alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim'
|
|
||||||
```
|
|
||||||
When you run Neovim using `nvim-kickstart` alias it will use the alternative
|
|
||||||
config directory and the matching local directory
|
|
||||||
`~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim
|
|
||||||
distribution that you would like to try out.
|
|
||||||
* What if I want to "uninstall" this configuration:
|
|
||||||
* See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information
|
|
||||||
* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files?
|
|
||||||
* The main purpose of kickstart is to serve as a teaching tool and a reference
|
|
||||||
configuration that someone can easily use to `git clone` as a basis for their own.
|
|
||||||
As you progress in learning Neovim and Lua, you might consider splitting `init.lua`
|
|
||||||
into smaller parts. A fork of kickstart that does this while maintaining the
|
|
||||||
same functionality is available here:
|
|
||||||
* [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim)
|
|
||||||
* Discussions on this topic can be found here:
|
|
||||||
* [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218)
|
|
||||||
* [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473)
|
|
||||||
|
|
||||||
### Install Recipes
|
|
||||||
|
|
||||||
Below you can find OS specific install instructions for Neovim and dependencies.
|
|
||||||
|
|
||||||
After installing all the dependencies continue with the [Install Kickstart](#Install-Kickstart) step.
|
|
||||||
|
|
||||||
#### Windows Installation
|
|
||||||
|
|
||||||
<details><summary>Windows with Microsoft C++ Build Tools and CMake</summary>
|
|
||||||
Installation may require installing build tools and updating the run command for `telescope-fzf-native`
|
|
||||||
|
|
||||||
See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation)
|
|
||||||
|
|
||||||
This requires:
|
|
||||||
|
|
||||||
- Install CMake and the Microsoft C++ Build Tools on Windows
|
|
||||||
|
|
||||||
```lua
|
|
||||||
{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
<details><summary>Windows with gcc/make using chocolatey</summary>
|
|
||||||
Alternatively, one can install gcc and make which don't require changing the config,
|
|
||||||
the easiest way is to use choco:
|
|
||||||
|
|
||||||
1. install [chocolatey](https://chocolatey.org/install)
|
|
||||||
either follow the instructions on the page or use winget,
|
|
||||||
run in cmd as **admin**:
|
|
||||||
```
|
|
||||||
winget install --accept-source-agreements chocolatey.chocolatey
|
|
||||||
```
|
|
||||||
|
|
||||||
2. install all requirements using choco, exit the previous cmd and
|
|
||||||
open a new one so that choco path is set, and run in cmd as **admin**:
|
|
||||||
```
|
|
||||||
choco install -y neovim git ripgrep wget fd unzip gzip mingw make
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
<details><summary>WSL (Windows Subsystem for Linux)</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
wsl --install
|
|
||||||
wsl
|
|
||||||
sudo add-apt-repository ppa:neovim-ppa/unstable -y
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install make gcc ripgrep unzip git xclip neovim
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
|
|
||||||
#### Linux Install
|
|
||||||
<details><summary>Ubuntu Install Steps</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo add-apt-repository ppa:neovim-ppa/unstable -y
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install make gcc ripgrep unzip git xclip neovim
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
<details><summary>Debian Install Steps</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install make gcc ripgrep unzip git xclip curl
|
|
||||||
|
|
||||||
# Now we install nvim
|
|
||||||
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz
|
|
||||||
sudo rm -rf /opt/nvim-linux-x86_64
|
|
||||||
sudo mkdir -p /opt/nvim-linux-x86_64
|
|
||||||
sudo chmod a+rX /opt/nvim-linux-x86_64
|
|
||||||
sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz
|
|
||||||
|
|
||||||
# make it available in /usr/local/bin, distro installs to /usr/bin
|
|
||||||
sudo ln -sf /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
<details><summary>Fedora Install Steps</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo dnf install -y gcc make git ripgrep fd-find unzip neovim
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details><summary>Arch Install Steps</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
================================================================================
|
|
||||||
INTRODUCTION *kickstart.nvim*
|
|
||||||
|
|
||||||
Kickstart.nvim is a project to help you get started on your neovim journey.
|
|
||||||
|
|
||||||
*kickstart-is-not*
|
|
||||||
It is not:
|
|
||||||
- Complete framework for every plugin under the sun
|
|
||||||
- Place to add every plugin that could ever be useful
|
|
||||||
|
|
||||||
*kickstart-is*
|
|
||||||
It is:
|
|
||||||
- Somewhere that has a good start for the most common "IDE" type features:
|
|
||||||
- autocompletion
|
|
||||||
- goto-definition
|
|
||||||
- find references
|
|
||||||
- fuzzy finding
|
|
||||||
- and hinting at what more can be done :)
|
|
||||||
- A place to _kickstart_ your journey.
|
|
||||||
- You should fork this project and use/modify it so that it matches your
|
|
||||||
style and preferences. If you don't want to do that, there are probably
|
|
||||||
other projects that would fit much better for you (and that's great!)!
|
|
||||||
|
|
||||||
vim:tw=78:ts=8:ft=help:norl:
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
{
|
|
||||||
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
|
|
||||||
"auto-save.nvim": { "branch": "main", "commit": "5fbcaac0a2698c87a9a1bd2083cb6949505cca12" },
|
|
||||||
"barbar.nvim": { "branch": "master", "commit": "53b5a2f34b68875898f0531032fbf090e3952ad7" },
|
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
|
|
||||||
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
|
|
||||||
"cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" },
|
|
||||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
|
||||||
"conform.nvim": { "branch": "master", "commit": "372fc521f8421b7830ea6db4d6ea3bae1c77548c" },
|
|
||||||
"dashboard-nvim": { "branch": "master", "commit": "591b5b29e2f17b97496ec3179f6ecd08bb8502cc" },
|
|
||||||
"everforest-nvim": { "branch": "main", "commit": "135cc21a45756e688dd1a3cbeb1c80a04b569b46" },
|
|
||||||
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
|
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "fd50977fce4d5240b910d2b816e71fb726cbbaf7" },
|
|
||||||
"image.nvim": { "branch": "master", "commit": "4c51d6202628b3b51e368152c053c3fb5c5f76f2" },
|
|
||||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
|
||||||
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
|
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
|
|
||||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "1255518cb067e038a4755f5cb3e980f79b6ab89c" },
|
|
||||||
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
|
|
||||||
"mini.nvim": { "branch": "main", "commit": "088d67751584e4168f35bca89bad70ada7ea4636" },
|
|
||||||
"nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" },
|
|
||||||
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
|
||||||
"nvim-dap": { "branch": "master", "commit": "8df427aeba0a06c6577dc3ab82de3076964e3b8d" },
|
|
||||||
"nvim-dap-python": { "branch": "master", "commit": "34282820bb713b9a5fdb120ae8dd85c2b3f49b51" },
|
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "37cc31c64d657feff6f752a1bf15f584d4734eca" },
|
|
||||||
"nvim-tree.lua": { "branch": "master", "commit": "be5b788f2dc1522c73fb7afad9092331c8aebe80" },
|
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "3b308861a8d7d7bfbe9be51d52e54dcfd9fe3d38" },
|
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "50b5b06bff13a9b4eab946de7c7033649a6618a1" },
|
|
||||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
|
||||||
"render-markdown.nvim": { "branch": "main", "commit": "7f81e9dcc15504c044f20df39d28a590cd5c6ca5" },
|
|
||||||
"roslyn.nvim": { "branch": "main", "commit": "7f8c18c6aac3667e0c0ec1aa30ecc77d3d36807f" },
|
|
||||||
"rzls.nvim": { "branch": "main", "commit": "ebb652a4876c3c6af344333a6fc6bacffd85a27a" },
|
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
|
||||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
|
||||||
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
|
||||||
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
|
|
||||||
"transparent.nvim": { "branch": "main", "commit": "8a2749a2fa74f97fe6557f61b89ac7fd873f3c21" },
|
|
||||||
"venv-selector.nvim": { "branch": "regexp", "commit": "c677caa1030808a9f90092e522de7cc20c1390dd" },
|
|
||||||
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
|
|
||||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
-- You can add your own plugins here or in other files in this directory!
|
|
||||||
-- I promise not to create any merge conflicts in this directory :)
|
|
||||||
--
|
|
||||||
-- See the kickstart.nvim README for more information
|
|
||||||
return {}
|
|
||||||
40
lua/custom/plugins/tabs.lua
Normal file
40
lua/custom/plugins/tabs.lua
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
-- Tab display settings
|
||||||
|
vim.opt.showtabline = 1 -- Always show tabline (0=never, 1=when multiple tabs, 2=always)
|
||||||
|
vim.opt.tabline = '' -- Use default tabline (empty string uses built-in)
|
||||||
|
|
||||||
|
-- Transparent tabline appearance
|
||||||
|
vim.cmd([[
|
||||||
|
hi TabLineFill guibg=NONE ctermfg=242 ctermbg=NONE
|
||||||
|
]])
|
||||||
|
|
||||||
|
-- Alternative navigation (more intuitive)
|
||||||
|
vim.keymap.set('n', '<leader>tn', ':tabnew<CR>', { desc = 'New tab' })
|
||||||
|
|
||||||
|
-- Tab moving
|
||||||
|
vim.keymap.set('n', '<leader>tm', ':tabmove<CR>', { desc = 'Move tab' })
|
||||||
|
vim.keymap.set('n', '<leader>t>', ':tabmove +1<CR>', { desc = 'Move tab right' })
|
||||||
|
vim.keymap.set('n', '<leader>t<', ':tabmove -1<CR>', { desc = 'Move tab left' })
|
||||||
|
|
||||||
|
-- Function to open file in new tab
|
||||||
|
local function open_file_in_tab()
|
||||||
|
vim.ui.input({ prompt = 'File to open in new tab: ', completion = 'file' }, function(input)
|
||||||
|
if input and input ~= '' then
|
||||||
|
vim.cmd('tabnew ' .. input)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Enhanced keybindings
|
||||||
|
vim.keymap.set('n', '<leader>tO', open_file_in_tab, { desc = 'Open file in new tab' })
|
||||||
|
|
||||||
|
-- Function to close buffer but keep tab if it's the only buffer in tab
|
||||||
|
local function smart_close_buffer()
|
||||||
|
local buffers_in_tab = #vim.fn.tabpagebuflist()
|
||||||
|
if buffers_in_tab > 1 then
|
||||||
|
vim.cmd('bdelete')
|
||||||
|
else
|
||||||
|
-- If it's the only buffer in tab, close the tab
|
||||||
|
vim.cmd('tabclose')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.keymap.set('n', '<leader>x', smart_close_buffer, { desc = 'Smart close buffer/tab' })
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
--[[
|
|
||||||
--
|
|
||||||
-- This file is not required for your own configuration,
|
|
||||||
-- but helps people determine if their system is setup correctly.
|
|
||||||
--
|
|
||||||
--]]
|
|
||||||
|
|
||||||
local check_version = function()
|
|
||||||
local verstr = tostring(vim.version())
|
|
||||||
if not vim.version.ge then
|
|
||||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if vim.version.ge(vim.version(), '0.10-dev') then
|
|
||||||
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
|
|
||||||
else
|
|
||||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local check_external_reqs = function()
|
|
||||||
-- Basic utils: `git`, `make`, `unzip`
|
|
||||||
for _, exe in ipairs { 'git', 'make', 'unzip', 'rg' } do
|
|
||||||
local is_executable = vim.fn.executable(exe) == 1
|
|
||||||
if is_executable then
|
|
||||||
vim.health.ok(string.format("Found executable: '%s'", exe))
|
|
||||||
else
|
|
||||||
vim.health.warn(string.format("Could not find executable: '%s'", exe))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
check = function()
|
|
||||||
vim.health.start 'kickstart.nvim'
|
|
||||||
|
|
||||||
vim.health.info [[NOTE: Not every warning is a 'must-fix' in `:checkhealth`
|
|
||||||
|
|
||||||
Fix only warnings for plugins and languages you intend to use.
|
|
||||||
Mason will give warnings for languages that are not installed.
|
|
||||||
You do not need to install, unless you want to use those languages!]]
|
|
||||||
|
|
||||||
local uv = vim.uv or vim.loop
|
|
||||||
vim.health.info('System Information: ' .. vim.inspect(uv.os_uname()))
|
|
||||||
|
|
||||||
check_version()
|
|
||||||
check_external_reqs()
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
-- autopairs
|
|
||||||
-- https://github.com/windwp/nvim-autopairs
|
|
||||||
|
|
||||||
return {
|
|
||||||
'windwp/nvim-autopairs',
|
|
||||||
event = 'InsertEnter',
|
|
||||||
-- Optional dependency
|
|
||||||
dependencies = { 'hrsh7th/nvim-cmp' },
|
|
||||||
config = function()
|
|
||||||
require('nvim-autopairs').setup {}
|
|
||||||
-- If you want to automatically add `(` after selecting a function or method
|
|
||||||
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
|
|
||||||
local cmp = require 'cmp'
|
|
||||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
@ -1,148 +0,0 @@
|
||||||
-- debug.lua
|
|
||||||
--
|
|
||||||
-- Shows how to use the DAP plugin to debug your code.
|
|
||||||
--
|
|
||||||
-- Primarily focused on configuring the debugger for Go, but can
|
|
||||||
-- be extended to other languages as well. That's why it's called
|
|
||||||
-- kickstart.nvim and not kitchen-sink.nvim ;)
|
|
||||||
|
|
||||||
return {
|
|
||||||
-- NOTE: Yes, you can install new plugins here!
|
|
||||||
'mfussenegger/nvim-dap',
|
|
||||||
-- NOTE: And you can specify dependencies as well
|
|
||||||
dependencies = {
|
|
||||||
-- Creates a beautiful debugger UI
|
|
||||||
'rcarriga/nvim-dap-ui',
|
|
||||||
|
|
||||||
-- Required dependency for nvim-dap-ui
|
|
||||||
'nvim-neotest/nvim-nio',
|
|
||||||
|
|
||||||
-- Installs the debug adapters for you
|
|
||||||
'williamboman/mason.nvim',
|
|
||||||
'jay-babu/mason-nvim-dap.nvim',
|
|
||||||
|
|
||||||
-- Add your own debuggers here
|
|
||||||
'leoluz/nvim-dap-go',
|
|
||||||
},
|
|
||||||
keys = {
|
|
||||||
-- Basic debugging keymaps, feel free to change to your liking!
|
|
||||||
{
|
|
||||||
'<F5>',
|
|
||||||
function()
|
|
||||||
require('dap').continue()
|
|
||||||
end,
|
|
||||||
desc = 'Debug: Start/Continue',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<F1>',
|
|
||||||
function()
|
|
||||||
require('dap').step_into()
|
|
||||||
end,
|
|
||||||
desc = 'Debug: Step Into',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<F2>',
|
|
||||||
function()
|
|
||||||
require('dap').step_over()
|
|
||||||
end,
|
|
||||||
desc = 'Debug: Step Over',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<F3>',
|
|
||||||
function()
|
|
||||||
require('dap').step_out()
|
|
||||||
end,
|
|
||||||
desc = 'Debug: Step Out',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>b',
|
|
||||||
function()
|
|
||||||
require('dap').toggle_breakpoint()
|
|
||||||
end,
|
|
||||||
desc = 'Debug: Toggle Breakpoint',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>B',
|
|
||||||
function()
|
|
||||||
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
|
||||||
end,
|
|
||||||
desc = 'Debug: Set Breakpoint',
|
|
||||||
},
|
|
||||||
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
|
||||||
{
|
|
||||||
'<F7>',
|
|
||||||
function()
|
|
||||||
require('dapui').toggle()
|
|
||||||
end,
|
|
||||||
desc = 'Debug: See last session result.',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
local dap = require 'dap'
|
|
||||||
local dapui = require 'dapui'
|
|
||||||
|
|
||||||
require('mason-nvim-dap').setup {
|
|
||||||
-- Makes a best effort to setup the various debuggers with
|
|
||||||
-- reasonable debug configurations
|
|
||||||
automatic_installation = true,
|
|
||||||
|
|
||||||
-- You can provide additional configuration to the handlers,
|
|
||||||
-- see mason-nvim-dap README for more information
|
|
||||||
handlers = {},
|
|
||||||
|
|
||||||
-- You'll need to check that you have the required things installed
|
|
||||||
-- online, please don't ask me how to install them :)
|
|
||||||
ensure_installed = {
|
|
||||||
-- Update this to ensure that you have the debuggers for the langs you want
|
|
||||||
'delve',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Dap UI setup
|
|
||||||
-- For more information, see |:help nvim-dap-ui|
|
|
||||||
dapui.setup {
|
|
||||||
-- Set icons to characters that are more likely to work in every terminal.
|
|
||||||
-- Feel free to remove or use ones that you like more! :)
|
|
||||||
-- Don't feel like these are good choices.
|
|
||||||
icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
|
|
||||||
controls = {
|
|
||||||
icons = {
|
|
||||||
pause = '⏸',
|
|
||||||
play = '▶',
|
|
||||||
step_into = '⏎',
|
|
||||||
step_over = '⏭',
|
|
||||||
step_out = '⏮',
|
|
||||||
step_back = 'b',
|
|
||||||
run_last = '▶▶',
|
|
||||||
terminate = '⏹',
|
|
||||||
disconnect = '⏏',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Change breakpoint icons
|
|
||||||
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
|
|
||||||
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
|
|
||||||
-- local breakpoint_icons = vim.g.have_nerd_font
|
|
||||||
-- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
|
|
||||||
-- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
|
|
||||||
-- for type, icon in pairs(breakpoint_icons) do
|
|
||||||
-- local tp = 'Dap' .. type
|
|
||||||
-- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
|
|
||||||
-- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
|
|
||||||
-- end
|
|
||||||
|
|
||||||
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
|
||||||
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
|
||||||
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
|
||||||
|
|
||||||
-- Install golang specific config
|
|
||||||
require('dap-go').setup {
|
|
||||||
delve = {
|
|
||||||
-- On Windows delve must be run attached or it crashes.
|
|
||||||
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
|
|
||||||
detached = vim.fn.has 'win32' == 0,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
|
||||||
-- NOTE: gitsigns is already included in init.lua but contains only the base
|
|
||||||
-- config. This will add also the recommended keymaps.
|
|
||||||
|
|
||||||
return {
|
|
||||||
{
|
|
||||||
'lewis6991/gitsigns.nvim',
|
|
||||||
opts = {
|
|
||||||
on_attach = function(bufnr)
|
|
||||||
local gitsigns = require 'gitsigns'
|
|
||||||
|
|
||||||
local function map(mode, l, r, opts)
|
|
||||||
opts = opts or {}
|
|
||||||
opts.buffer = bufnr
|
|
||||||
vim.keymap.set(mode, l, r, opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Navigation
|
|
||||||
map('n', ']c', function()
|
|
||||||
if vim.wo.diff then
|
|
||||||
vim.cmd.normal { ']c', bang = true }
|
|
||||||
else
|
|
||||||
gitsigns.nav_hunk 'next'
|
|
||||||
end
|
|
||||||
end, { desc = 'Jump to next git [c]hange' })
|
|
||||||
|
|
||||||
map('n', '[c', function()
|
|
||||||
if vim.wo.diff then
|
|
||||||
vim.cmd.normal { '[c', bang = true }
|
|
||||||
else
|
|
||||||
gitsigns.nav_hunk 'prev'
|
|
||||||
end
|
|
||||||
end, { desc = 'Jump to previous git [c]hange' })
|
|
||||||
|
|
||||||
-- Actions
|
|
||||||
-- visual mode
|
|
||||||
map('v', '<leader>hs', function()
|
|
||||||
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
|
||||||
end, { desc = 'git [s]tage hunk' })
|
|
||||||
map('v', '<leader>hr', function()
|
|
||||||
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
|
||||||
end, { desc = 'git [r]eset hunk' })
|
|
||||||
-- normal mode
|
|
||||||
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
|
|
||||||
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
|
|
||||||
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
|
|
||||||
map('n', '<leader>hu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' })
|
|
||||||
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
|
|
||||||
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
|
|
||||||
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
|
|
||||||
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
|
|
||||||
map('n', '<leader>hD', function()
|
|
||||||
gitsigns.diffthis '@'
|
|
||||||
end, { desc = 'git [D]iff against last commit' })
|
|
||||||
-- Toggles
|
|
||||||
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
|
|
||||||
map('n', '<leader>tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' })
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
return {
|
|
||||||
{ -- Add indentation guides even on blank lines
|
|
||||||
'lukas-reineke/indent-blankline.nvim',
|
|
||||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
|
||||||
-- See `:help ibl`
|
|
||||||
main = 'ibl',
|
|
||||||
opts = {},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
||||||
return {
|
|
||||||
|
|
||||||
{ -- Linting
|
|
||||||
'mfussenegger/nvim-lint',
|
|
||||||
event = { 'BufReadPre', 'BufNewFile' },
|
|
||||||
config = function()
|
|
||||||
local lint = require 'lint'
|
|
||||||
lint.linters_by_ft = {
|
|
||||||
markdown = { 'markdownlint' },
|
|
||||||
}
|
|
||||||
|
|
||||||
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
|
||||||
-- instead set linters_by_ft like this:
|
|
||||||
-- lint.linters_by_ft = lint.linters_by_ft or {}
|
|
||||||
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
|
|
||||||
--
|
|
||||||
-- However, note that this will enable a set of default linters,
|
|
||||||
-- which will cause errors unless these tools are available:
|
|
||||||
-- {
|
|
||||||
-- clojure = { "clj-kondo" },
|
|
||||||
-- dockerfile = { "hadolint" },
|
|
||||||
-- inko = { "inko" },
|
|
||||||
-- janet = { "janet" },
|
|
||||||
-- json = { "jsonlint" },
|
|
||||||
-- markdown = { "vale" },
|
|
||||||
-- rst = { "vale" },
|
|
||||||
-- ruby = { "ruby" },
|
|
||||||
-- terraform = { "tflint" },
|
|
||||||
-- text = { "vale" }
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- You can disable the default linters by setting their filetypes to nil:
|
|
||||||
-- lint.linters_by_ft['clojure'] = nil
|
|
||||||
-- lint.linters_by_ft['dockerfile'] = nil
|
|
||||||
-- lint.linters_by_ft['inko'] = nil
|
|
||||||
-- lint.linters_by_ft['janet'] = nil
|
|
||||||
-- lint.linters_by_ft['json'] = nil
|
|
||||||
-- lint.linters_by_ft['markdown'] = nil
|
|
||||||
-- lint.linters_by_ft['rst'] = nil
|
|
||||||
-- lint.linters_by_ft['ruby'] = nil
|
|
||||||
-- lint.linters_by_ft['terraform'] = nil
|
|
||||||
-- lint.linters_by_ft['text'] = nil
|
|
||||||
|
|
||||||
-- Create autocommand which carries out the actual linting
|
|
||||||
-- on the specified events.
|
|
||||||
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
|
||||||
group = lint_augroup,
|
|
||||||
callback = function()
|
|
||||||
-- Only run the linter in buffers that you can modify in order to
|
|
||||||
-- avoid superfluous noise, notably within the handy LSP pop-ups that
|
|
||||||
-- describe the hovered symbol using Markdown.
|
|
||||||
if vim.opt_local.modifiable:get() then
|
|
||||||
lint.try_lint()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
-- Neo-tree is a Neovim plugin to browse the file system
|
|
||||||
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
|
||||||
|
|
||||||
return {
|
|
||||||
'nvim-neo-tree/neo-tree.nvim',
|
|
||||||
version = '*',
|
|
||||||
dependencies = {
|
|
||||||
'nvim-lua/plenary.nvim',
|
|
||||||
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
|
||||||
'MunifTanjim/nui.nvim',
|
|
||||||
},
|
|
||||||
cmd = 'Neotree',
|
|
||||||
keys = {
|
|
||||||
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
|
|
||||||
},
|
|
||||||
opts = {
|
|
||||||
filesystem = {
|
|
||||||
window = {
|
|
||||||
mappings = {
|
|
||||||
['\\'] = 'close_window',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
88
nvim-pack-lock.json
Normal file
88
nvim-pack-lock.json
Normal file
|
|
@ -0,0 +1,88 @@
|
||||||
|
{
|
||||||
|
"plugins": {
|
||||||
|
"asyncomplete-lsp.vim": {
|
||||||
|
"rev": "d5d91e1ad70edb00368c11d3e81008835ac14dd1",
|
||||||
|
"src": "https://github.com/prabirshrestha/asyncomplete-lsp.vim"
|
||||||
|
},
|
||||||
|
"asyncomplete.vim": {
|
||||||
|
"rev": "17b654a87a834d4e835fb7467e562b4421ad9310",
|
||||||
|
"src": "https://github.com/prabirshrestha/asyncomplete.vim"
|
||||||
|
},
|
||||||
|
"auto-save.nvim": {
|
||||||
|
"rev": "979b6c82f60cfa80f4cf437d77446d0ded0addf0",
|
||||||
|
"src": "https://github.com/Pocco81/auto-save.nvim"
|
||||||
|
},
|
||||||
|
"barbar.nvim": {
|
||||||
|
"rev": "fb4369940a07dda35fa4d7f54cf4a36aa00440e6",
|
||||||
|
"src": "https://github.com/romgrk/barbar.nvim"
|
||||||
|
},
|
||||||
|
"basedpyright": {
|
||||||
|
"rev": "513aa518c60e4fe8e9b3cb87c115dc75427013f4",
|
||||||
|
"src": "https://github.com/DetachHead/basedpyright"
|
||||||
|
},
|
||||||
|
"blink.cmp": {
|
||||||
|
"rev": "b19413d214068f316c78978b08264ed1c41830ec",
|
||||||
|
"src": "https://github.com/saghen/blink.cmp"
|
||||||
|
},
|
||||||
|
"everforest-nvim": {
|
||||||
|
"rev": "557bce922401e247a596583679bc181d4d688554",
|
||||||
|
"src": "https://github.com/neanias/everforest-nvim.git"
|
||||||
|
},
|
||||||
|
"lualine.nvim": {
|
||||||
|
"rev": "3946f0122255bc377d14a59b27b609fb3ab25768",
|
||||||
|
"src": "https://github.com/nvim-lualine/lualine.nvim"
|
||||||
|
},
|
||||||
|
"mason-lspconfig.nvim": {
|
||||||
|
"rev": "b1d9a914b02ba5660f1e272a03314b31d4576fe2",
|
||||||
|
"src": "https://github.com/mason-org/mason-lspconfig.nvim"
|
||||||
|
},
|
||||||
|
"mason-tool-installer.nvim": {
|
||||||
|
"rev": "517ef5994ef9d6b738322664d5fdd948f0fdeb46",
|
||||||
|
"src": "https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim"
|
||||||
|
},
|
||||||
|
"mason.nvim": {
|
||||||
|
"rev": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800",
|
||||||
|
"src": "https://github.com/mason-org/mason.nvim"
|
||||||
|
},
|
||||||
|
"mini.nvim": {
|
||||||
|
"rev": "6e885e4c27743ae6bf5957ea78ce86c032835f09",
|
||||||
|
"src": "https://github.com/echasnovski/mini.nvim"
|
||||||
|
},
|
||||||
|
"nvim-lspconfig": {
|
||||||
|
"rev": "abf6d190f2c06818489c0bd4b926e7e3a06c5e51",
|
||||||
|
"src": "https://github.com/neovim/nvim-lspconfig"
|
||||||
|
},
|
||||||
|
"nvim-surround": {
|
||||||
|
"rev": "fcfa7e02323d57bfacc3a141f8a74498e1522064",
|
||||||
|
"src": "https://github.com/kylechui/nvim-surround"
|
||||||
|
},
|
||||||
|
"nvim-tree.lua": {
|
||||||
|
"rev": "1eda2569394f866360e61f590f1796877388cb8a",
|
||||||
|
"src": "https://github.com/nvim-tree/nvim-tree.lua"
|
||||||
|
},
|
||||||
|
"nvim-treesitter": {
|
||||||
|
"rev": "42fc28ba918343ebfd5565147a42a26580579482",
|
||||||
|
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||||
|
},
|
||||||
|
"nvim-treesitter-textobjects": {
|
||||||
|
"rev": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef",
|
||||||
|
"src": "https://github.com/nvim-treesitter/nvim-treesitter-textobjects"
|
||||||
|
},
|
||||||
|
"nvim-web-devicons": {
|
||||||
|
"rev": "8dcb311b0c92d460fac00eac706abd43d94d68af",
|
||||||
|
"src": "https://github.com/nvim-tree/nvim-web-devicons"
|
||||||
|
},
|
||||||
|
"plenary.nvim": {
|
||||||
|
"rev": "b9fd5226c2f76c951fc8ed5923d85e4de065e509",
|
||||||
|
"src": "https://github.com/nvim-lua/plenary.nvim"
|
||||||
|
},
|
||||||
|
"telescope.nvim": {
|
||||||
|
"rev": "83a3a713d6b2d2a408491a1b959e55a7fa8678e8",
|
||||||
|
"src": "https://github.com/nvim-telescope/telescope.nvim"
|
||||||
|
},
|
||||||
|
"vim-lsp-settings": {
|
||||||
|
"rev": "139d4adf61f0699cc97744d4e6dfb8a6317397f5",
|
||||||
|
"src": "https://github.com/mattn/vim-lsp-settings"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,55 +1,55 @@
|
||||||
vim.keymap.set("t", "<esc><esc>", "<c-\\><c-n>")
|
vim.keymap.set("t", "<esc><esc>", "<c-\\><c-n>")
|
||||||
|
|
||||||
local state = {
|
local state = {
|
||||||
floating = {
|
floating = {
|
||||||
buf = -1,
|
buf = -1,
|
||||||
win = -1,
|
win = -1,
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
local function create_floating_window(opts)
|
local function create_floating_window(opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
local width = opts.width or math.floor(vim.o.columns * 0.8)
|
local width = opts.width or math.floor(vim.o.columns * 0.8)
|
||||||
local height = opts.height or math.floor(vim.o.lines * 0.8)
|
local height = opts.height or math.floor(vim.o.lines * 0.8)
|
||||||
|
|
||||||
-- Calculate the position to center the window
|
-- Calculate the position to center the window
|
||||||
local col = math.floor((vim.o.columns - width) / 2)
|
local col = math.floor((vim.o.columns - width) / 2)
|
||||||
local row = math.floor((vim.o.lines - height) / 2)
|
local row = math.floor((vim.o.lines - height) / 2)
|
||||||
|
|
||||||
-- Create a buffer
|
-- Create a buffer
|
||||||
local buf = nil
|
local buf = nil
|
||||||
if vim.api.nvim_buf_is_valid(opts.buf) then
|
if vim.api.nvim_buf_is_valid(opts.buf) then
|
||||||
buf = opts.buf
|
buf = opts.buf
|
||||||
else
|
else
|
||||||
buf = vim.api.nvim_create_buf(false, true) -- No file, scratch buffer
|
buf = vim.api.nvim_create_buf(false, true) -- No file, scratch buffer
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Define window configuration
|
-- Define window configuration
|
||||||
local win_config = {
|
local win_config = {
|
||||||
relative = "editor",
|
relative = "editor",
|
||||||
width = width,
|
width = width,
|
||||||
height = height,
|
height = height,
|
||||||
col = col,
|
col = col,
|
||||||
row = row,
|
row = row,
|
||||||
style = "minimal", -- No borders or extra UI elements
|
style = "minimal", -- No borders or extra UI elements
|
||||||
border = "rounded",
|
border = "rounded",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Create the floating window
|
-- Create the floating window
|
||||||
local win = vim.api.nvim_open_win(buf, true, win_config)
|
local win = vim.api.nvim_open_win(buf, true, win_config)
|
||||||
|
|
||||||
return { buf = buf, win = win }
|
return { buf = buf, win = win }
|
||||||
end
|
end
|
||||||
|
|
||||||
local toggle_terminal = function()
|
local toggle_terminal = function()
|
||||||
if not vim.api.nvim_win_is_valid(state.floating.win) then
|
if not vim.api.nvim_win_is_valid(state.floating.win) then
|
||||||
state.floating = create_floating_window({ buf = state.floating.buf })
|
state.floating = create_floating_window { buf = state.floating.buf }
|
||||||
if vim.bo[state.floating.buf].buftype ~= "terminal" then
|
if vim.bo[state.floating.buf].buftype ~= "terminal" then
|
||||||
vim.cmd.terminal()
|
vim.cmd.terminal()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
vim.api.nvim_win_hide(state.floating.win)
|
vim.api.nvim_win_hide(state.floating.win)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Example usage:
|
-- Example usage:
|
||||||
|
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
local ls = require("luasnip")
|
|
||||||
local rep = require("luasnip.extras").rep
|
|
||||||
local ai = require("luasnip.nodes.absolute_indexer")
|
|
||||||
local fmt = require("luasnip.extras.fmt").fmt
|
|
||||||
|
|
||||||
ls.config.set_config({
|
|
||||||
history = true,
|
|
||||||
updateevents = "TextChanged,TextChangedI",
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader><leader>s", "<cmd>source ~/.config/nvim/plugin/luasnip.lua<CR>")
|
|
||||||
|
|
||||||
vim.keymap.set({ "i", "s" }, "<A-k>", function()
|
|
||||||
if ls.expand_or_jumpable() then
|
|
||||||
ls.expand_or_jump()
|
|
||||||
end
|
|
||||||
end, { silent = true })
|
|
||||||
|
|
||||||
vim.keymap.set({ "i", "s" }, "<A-j>", function()
|
|
||||||
if ls.jumpable(-1) then
|
|
||||||
ls.jump(-1)
|
|
||||||
end
|
|
||||||
end, { silent = true })
|
|
||||||
|
|
||||||
ls.add_snippets("python", {
|
|
||||||
ls.snippet("main", {
|
|
||||||
ls.text_node({ 'if __name__ == "__main__":', "\t" }),
|
|
||||||
ls.insert_node(1),
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
|
|
||||||
ls.add_snippets("python", {
|
|
||||||
ls.snippet(
|
|
||||||
"class",
|
|
||||||
fmt(
|
|
||||||
[[
|
|
||||||
class {}:
|
|
||||||
def __init__(self, {}):
|
|
||||||
self.{} = {}
|
|
||||||
]],
|
|
||||||
{ ls.insert_node(1), ls.insert_node(2), rep(2), rep(2) }
|
|
||||||
)
|
|
||||||
),
|
|
||||||
})
|
|
||||||
Loading…
Reference in a new issue