Compare commits
3 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9fab3f125d | |||
| a2b01fa801 | |||
| 15ca9992d1 |
26 changed files with 339 additions and 728 deletions
35
.github/ISSUE_TEMPLATE/bug_report.md
vendored
35
.github/ISSUE_TEMPLATE/bug_report.md
vendored
|
|
@ -1,35 +0,0 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- Any bug report not following this template will be immediately closed. Thanks -->
|
||||
|
||||
## Before Reporting an Issue
|
||||
- I have read the kickstart.nvim README.md.
|
||||
- I have read the appropriate plugin's documentation.
|
||||
- I have searched that this issue has not been reported before.
|
||||
|
||||
- [ ] **By checking this, I confirm that the above steps are completed. I understand leaving this unchecked will result in this report being closed immediately.**
|
||||
|
||||
## Describe the bug
|
||||
<!-- A clear and concise description of what the bug is. -->
|
||||
|
||||
## To Reproduce
|
||||
<!-- Steps to reproduce the behavior. -->
|
||||
1. ...
|
||||
|
||||
## Desktop
|
||||
<!-- please complete the following information. -->
|
||||
- OS:
|
||||
- Terminal:
|
||||
|
||||
## Neovim Version
|
||||
<!-- Output of running `:version` from inside of neovim. -->
|
||||
|
||||
```
|
||||
```
|
||||
8
.github/pull_request_template.md
vendored
8
.github/pull_request_template.md
vendored
|
|
@ -1,8 +0,0 @@
|
|||
***************************************************************************
|
||||
**NOTE**
|
||||
Please verify that the `base repository` above has the intended destination!
|
||||
Github by default opens Pull Requests against the parent of a forked repository.
|
||||
If this is your personal fork and you didn't intend to open a PR for contribution
|
||||
to the original project then adjust the `base repository` accordingly.
|
||||
**************************************************************************
|
||||
|
||||
21
.github/workflows/stylua.yml
vendored
21
.github/workflows/stylua.yml
vendored
|
|
@ -1,21 +0,0 @@
|
|||
# Check Lua Formatting
|
||||
name: Check Lua Formatting
|
||||
on: pull_request_target
|
||||
|
||||
jobs:
|
||||
stylua-check:
|
||||
if: github.repository == 'nvim-lua/kickstart.nvim'
|
||||
name: Stylua Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Stylua Check
|
||||
uses: JohnnyMorganz/stylua-action@v3
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
version: latest
|
||||
args: --check .
|
||||
|
||||
273
README.md
273
README.md
|
|
@ -1,267 +1,26 @@
|
|||
Сделай бекап старого конфига, если он есть и если он нужен. Конфиг находится тут: `~/.config/nvim`
|
||||
|
||||
Это вариант конфига, который я ставлю на сервер.
|
||||
|
||||
Первый запуск конфига может быть долгим. Не прерывай этот процесс, пока не появится меню плагин манагера.
|
||||
|
||||
Надо скачать:
|
||||
- `neovim`
|
||||
- `git`
|
||||
- `ripgrep`
|
||||
- `fd`
|
||||
- `unzip`
|
||||
- `npm` (на некоторых дистрах он отдельно, на некоторых является частью `nodejs`, на всякий качаю оба пакета)
|
||||
- Что-то для буфера обмена. На X11 это `xclip`, на Wayland это `wl-clipboard`. На маке и винде не знаю что надо качать.
|
||||
- Любой nerd font. У меня это `JetBrainsMono Nerd Font Mono`
|
||||
```sh
|
||||
sudo pacman -Sy neovim git ripgrep fd unzip npm gcc ttf-jetbrains-mono-nerd noto-fonts-emoji go rustup ueberzugpp
|
||||
```
|
||||
К этим пакетам добавь `wl-clipboard` если ты на wayland или `xclip`, если на X11
|
||||
Если тебе не нужна поддержка языков программирования `go` и `rust`, то удали соответствующие пакеты из списка. Для поддержки `rust` надо дописать это в терминал, чтоб скачать ласт версию языка:
|
||||
```sh
|
||||
rustup default stable
|
||||
```
|
||||
|
||||
Установить этот конфиг на Linux или Mac можно так:
|
||||
```sh
|
||||
git clone https://github.com/buliway/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
|
||||
```
|
||||
Для винды через `cmd.exe` так:
|
||||
```sh
|
||||
git clone https://github.com/buliway/kickstart.nvim.git "%localappdata%\nvim"
|
||||
```
|
||||
Для винды через `powershell.exe` так:
|
||||
```sh
|
||||
git clone https://github.com/buliway/kickstart.nvim.git "${env:LOCALAPPDATA}\nvim"
|
||||
git clone --branch arch --single-branch --depth 1 https://github.com/Buliway/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
|
||||
```
|
||||
|
||||
# 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>
|
||||
Если надо больше информации по установке и настройке, то вот доп источники:
|
||||
- [kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim) - Оригинальный конфиг, который я взял за основу и немного дополнил. В их readme много дополнительной информации.
|
||||
- [The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o) - Гайд по `kickstart.nvim`. Название видео говорит как есть. Мне очень сильно помогло создать свой конфиг.
|
||||
- [0 to LSP : Neovim RC From Scratch](https://youtu.be/w7i4amO_zaE) - Старый гайд по настройке NeoVim с нуля. Некоторые настройки и плагины больше не актуальны, но мне понравилось видеть логику и рассуждения человека при составлении конфига с нуля.
|
||||
|
||||
В этом конфиге я выключил плагин для дебага. Этот конфиг я использую на запасных системах, где мне не нужен дебаг и я не хочу качать дополнительные пакеты для него. Если нужен дебаг, то можно раскомментировать нужные строки в `init.lua`. Не уверен надо ли докачивать какие-то пакеты для этого.
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
8
init.lua
8
init.lua
|
|
@ -64,7 +64,7 @@ require('lazy').setup({
|
|||
require 'kickstart.plugins.treesitter',
|
||||
|
||||
-- Debug your code via Debug Adapter Protocol
|
||||
require 'kickstart.plugins.debug',
|
||||
-- require 'kickstart.plugins.debug',
|
||||
|
||||
-- Add indentation guides even on blank lines
|
||||
require 'kickstart.plugins.indent_line',
|
||||
|
|
@ -94,6 +94,12 @@ require('lazy').setup({
|
|||
-- Plugins for color highlight
|
||||
require 'custom.plugins.colorizer',
|
||||
|
||||
-- Symbol usage plugin
|
||||
require 'custom.plugins.symbol_usage',
|
||||
|
||||
-- Adding history for nvim clipboard
|
||||
require 'custom.plugins.clip_history',
|
||||
|
||||
-- Autoformat markdown tables
|
||||
{
|
||||
'Kicamon/markdown-table-mode.nvim',
|
||||
|
|
|
|||
14
lua/custom/plugins/clip_history.lua
Normal file
14
lua/custom/plugins/clip_history.lua
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
-- Adding history for nvim clipboard
|
||||
|
||||
return {
|
||||
{
|
||||
'AckslD/nvim-neoclip.lua',
|
||||
dependencies = {
|
||||
{ 'nvim-telescope/telescope.nvim' },
|
||||
},
|
||||
config = function()
|
||||
require('neoclip').setup()
|
||||
vim.keymap.set('n', '<leader>sc', ':Telescope neoclip<CR>', { desc = '[S]earch [C]lip history' })
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
@ -9,7 +9,9 @@ return {
|
|||
'nvim-treesitter/nvim-treesitter',
|
||||
},
|
||||
config = function()
|
||||
require('go').setup()
|
||||
require('go').setup {
|
||||
tag_options = '', -- sets options sent to gomodifytags, i.e., json=omitempty
|
||||
}
|
||||
vim.keymap.set({ 'n' }, '<leader>gta', ':GoAddTag<CR>', { desc = '[G]o [T]ag [A]dd' })
|
||||
vim.keymap.set({ 'n' }, '<leader>gtr', ':GoRmTag<CR>', { desc = '[G]o [T]ag [R]emove' })
|
||||
vim.keymap.set({ 'n' }, '<leader>gs', ':GoFillStruct<CR>', { desc = '[G]o fill [S]truct' })
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
return {
|
||||
{
|
||||
'mrcjkb/rustaceanvim',
|
||||
version = '^5', -- Recommended
|
||||
version = '^6', -- Recommended
|
||||
lazy = false, -- This plugin is already lazy
|
||||
},
|
||||
}
|
||||
|
|
|
|||
80
lua/custom/plugins/symbol_usage.lua
Normal file
80
lua/custom/plugins/symbol_usage.lua
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
-- Symbol usage plugin
|
||||
|
||||
local SymbolKind = vim.lsp.protocol.SymbolKind
|
||||
|
||||
local function h(name)
|
||||
return vim.api.nvim_get_hl(0, { name = name })
|
||||
end
|
||||
|
||||
-- hl-groups can have any name
|
||||
vim.api.nvim_set_hl(0, 'SymbolUsageRounding', { fg = h('CursorLine').bg, italic = true })
|
||||
vim.api.nvim_set_hl(0, 'SymbolUsageContent', { bg = h('CursorLine').bg, fg = h('Comment').fg, italic = true })
|
||||
vim.api.nvim_set_hl(0, 'SymbolUsageRef', { fg = h('Function').fg, bg = h('CursorLine').bg, italic = true })
|
||||
vim.api.nvim_set_hl(0, 'SymbolUsageDef', { fg = h('Type').fg, bg = h('CursorLine').bg, italic = true })
|
||||
vim.api.nvim_set_hl(0, 'SymbolUsageImpl', { fg = h('@keyword').fg, bg = h('CursorLine').bg, italic = true })
|
||||
|
||||
local function text_format(symbol)
|
||||
local res = {}
|
||||
|
||||
local round_start = { '', 'SymbolUsageRounding' }
|
||||
local round_end = { '', 'SymbolUsageRounding' }
|
||||
|
||||
-- Indicator that shows if there are any other symbols in the same line
|
||||
local stacked_functions_content = symbol.stacked_count > 0 and ('+%s'):format(symbol.stacked_count) or ''
|
||||
|
||||
if symbol.references then
|
||||
local usage = symbol.references <= 1 and 'usage' or 'usages'
|
||||
local num = symbol.references == 0 and 'no' or symbol.references
|
||||
table.insert(res, round_start)
|
||||
table.insert(res, { ' ', 'SymbolUsageRef' })
|
||||
table.insert(res, { ('%s %s'):format(num, usage), 'SymbolUsageContent' })
|
||||
table.insert(res, round_end)
|
||||
end
|
||||
|
||||
if symbol.definition then
|
||||
if #res > 0 then
|
||||
table.insert(res, { ' ', 'NonText' })
|
||||
end
|
||||
table.insert(res, round_start)
|
||||
table.insert(res, { ' ', 'SymbolUsageDef' })
|
||||
table.insert(res, { symbol.definition .. ' defs', 'SymbolUsageContent' })
|
||||
table.insert(res, round_end)
|
||||
end
|
||||
|
||||
if symbol.implementation then
|
||||
if #res > 0 then
|
||||
table.insert(res, { ' ', 'NonText' })
|
||||
end
|
||||
table.insert(res, round_start)
|
||||
table.insert(res, { ' ', 'SymbolUsageImpl' })
|
||||
table.insert(res, { symbol.implementation .. ' impls', 'SymbolUsageContent' })
|
||||
table.insert(res, round_end)
|
||||
end
|
||||
|
||||
if stacked_functions_content ~= '' then
|
||||
if #res > 0 then
|
||||
table.insert(res, { ' ', 'NonText' })
|
||||
end
|
||||
table.insert(res, round_start)
|
||||
table.insert(res, { ' ', 'SymbolUsageImpl' })
|
||||
table.insert(res, { stacked_functions_content, 'SymbolUsageContent' })
|
||||
table.insert(res, round_end)
|
||||
end
|
||||
|
||||
return res
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
'Wansmer/symbol-usage.nvim',
|
||||
event = 'LspAttach', -- need run before LspAttach if you use nvim 0.9. On 0.10 use 'LspAttach'
|
||||
config = function()
|
||||
require('symbol-usage').setup {
|
||||
filetypes = {},
|
||||
log = { enabled = false, level = 'INFO', stdout = {}, log_file = {}, notify = {} },
|
||||
text_format = text_format,
|
||||
kinds = { SymbolKind.Function, SymbolKind.Method, SymbolKind.Class, SymbolKind.Struct, SymbolKind.Variable, SymbolKind.Constant },
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
@ -98,10 +98,6 @@ vim.api.nvim_create_autocmd('User', {
|
|||
nested = true,
|
||||
})
|
||||
|
||||
vim.keymap.set('n', '<Space><BS>', function()
|
||||
restore_session()
|
||||
end, { desc = 'Restore session' })
|
||||
|
||||
-- Session delete
|
||||
vim.keymap.set('n', '<Space>Sd', function()
|
||||
local name = session_name()
|
||||
|
|
|
|||
|
|
@ -4,41 +4,30 @@ local state = {
|
|||
win = -1,
|
||||
},
|
||||
}
|
||||
|
||||
local function create_floating_window(opts)
|
||||
opts = opts or {}
|
||||
local width = opts.width or math.floor(vim.o.columns * 0.8)
|
||||
local height = opts.height or math.floor(vim.o.lines * 0.8)
|
||||
|
||||
-- Calculate the position to center the window
|
||||
local col = math.floor((vim.o.columns - width) / 2)
|
||||
local row = math.floor((vim.o.lines - height) / 2)
|
||||
|
||||
-- Create a buffer
|
||||
local buf = nil
|
||||
if vim.api.nvim_buf_is_valid(opts.buf) then
|
||||
buf = opts.buf
|
||||
else
|
||||
buf = vim.api.nvim_create_buf(false, true) -- No file, scratch buffer
|
||||
buf = vim.api.nvim_create_buf(false, true)
|
||||
end
|
||||
|
||||
-- Define window configuration
|
||||
local win_config = {
|
||||
relative = 'editor',
|
||||
width = width,
|
||||
height = height,
|
||||
col = col,
|
||||
row = row,
|
||||
style = 'minimal', -- No borders or extra UI elements
|
||||
style = 'minimal',
|
||||
border = 'rounded',
|
||||
}
|
||||
|
||||
-- Create the floating window
|
||||
local win = vim.api.nvim_open_win(buf, true, win_config)
|
||||
|
||||
return { buf = buf, win = win }
|
||||
end
|
||||
|
||||
local toggle_terminal = function()
|
||||
if not vim.api.nvim_win_is_valid(state.floating.win) then
|
||||
state.floating = create_floating_window { buf = state.floating.buf }
|
||||
|
|
@ -49,8 +38,5 @@ local toggle_terminal = function()
|
|||
vim.api.nvim_win_hide(state.floating.win)
|
||||
end
|
||||
end
|
||||
|
||||
-- Example usage:
|
||||
-- Create a floating window with default dimensions
|
||||
vim.api.nvim_create_user_command('Floaterminal', toggle_terminal, {})
|
||||
vim.keymap.set({ 'n', 't' }, '<leader>tt', toggle_terminal, { desc = '[T]oggle [T]erminal' })
|
||||
|
|
|
|||
|
|
@ -1,10 +1,3 @@
|
|||
--[[
|
||||
--
|
||||
-- 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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
-- Autoformat
|
||||
-- Timeout для форматирования пришлось задать в 5 секунд, потому что sqlfluff очень долго форматирует
|
||||
|
||||
return {
|
||||
{
|
||||
'stevearc/conform.nvim',
|
||||
|
|
@ -27,21 +24,18 @@ return {
|
|||
-- have a well standardized coding style. You can add additional
|
||||
-- languages here or re-enable it for the disabled ones.
|
||||
local disable_filetypes = { c = true, cpp = true }
|
||||
local lsp_format_opt
|
||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||
lsp_format_opt = 'never'
|
||||
return nil
|
||||
else
|
||||
lsp_format_opt = 'fallback'
|
||||
return {
|
||||
timeout_ms = 5000,
|
||||
lsp_format = 'fallback',
|
||||
}
|
||||
end
|
||||
return {
|
||||
timeout_ms = 5000,
|
||||
lsp_format = lsp_format_opt,
|
||||
}
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
go = { 'gofmt', 'injected' },
|
||||
sql = { 'sqlfluff' },
|
||||
-- ['*'] = { 'injected' }, -- enables injected-lang formatting for all filetypes
|
||||
|
||||
-- Conform can also run multiple formatters sequentially
|
||||
|
|
@ -50,36 +44,7 @@ return {
|
|||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
||||
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||
},
|
||||
formatters = {
|
||||
-- sql_formatter = {
|
||||
-- -- prepend_args = { "-c", vim.fn.expand("~/.config/sql_formatter.json"),
|
||||
-- args = function()
|
||||
-- -- Создаём временный JSON-файл конфигурации
|
||||
-- local config_path = vim.fn.tempname() .. ".json"
|
||||
-- local config_content = vim.fn.json_encode({
|
||||
-- tabWidth = 4,
|
||||
-- })
|
||||
-- local file = io.open(config_path, "w")
|
||||
-- file:write(config_content)
|
||||
-- file:close()
|
||||
-- -- Возвращаем аргументы для форматтера с указанием конфигурационного файла
|
||||
-- return { "-c", config_path }
|
||||
-- end,
|
||||
-- stdin = true,
|
||||
-- },
|
||||
sqlfluff = {
|
||||
command = 'sqlfluff',
|
||||
args = {
|
||||
'format',
|
||||
-- 'fix',
|
||||
-- '--dialect',
|
||||
-- 'postgres',
|
||||
-- '--disable-progress-bar',
|
||||
'-',
|
||||
},
|
||||
stdin = true,
|
||||
},
|
||||
},
|
||||
formatters = {},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,5 @@
|
|||
-- 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,
|
||||
opts = {},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
-- Autocompletion
|
||||
|
||||
return {
|
||||
{
|
||||
'hrsh7th/nvim-cmp',
|
||||
event = 'InsertEnter',
|
||||
'saghen/blink.cmp',
|
||||
event = 'VimEnter',
|
||||
version = '1.*',
|
||||
dependencies = {
|
||||
-- Snippet Engine & its associated nvim-cmp source
|
||||
-- Snippet Engine
|
||||
{
|
||||
'L3MON4D3/LuaSnip',
|
||||
version = '2.*',
|
||||
build = (function()
|
||||
-- Build Step is needed for regex support in snippets.
|
||||
-- This step is not supported in many windows environments.
|
||||
|
|
@ -28,108 +28,96 @@ return {
|
|||
end,
|
||||
},
|
||||
},
|
||||
opts = {},
|
||||
},
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
|
||||
-- Adds other completion capabilities.
|
||||
-- nvim-cmp does not ship with all sources by default. They are split
|
||||
-- into multiple repos for maintenance purposes.
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-path',
|
||||
'hrsh7th/cmp-nvim-lsp-signature-help',
|
||||
'folke/lazydev.nvim',
|
||||
},
|
||||
config = function()
|
||||
-- See `:help cmp`
|
||||
local cmp = require 'cmp'
|
||||
local luasnip = require 'luasnip'
|
||||
luasnip.config.setup {}
|
||||
|
||||
cmp.setup {
|
||||
preselect = cmp.PreselectMode.None,
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
completion = { completeopt = 'menu,menuone,noinsert' },
|
||||
|
||||
-- For an understanding of why these mappings were
|
||||
-- chosen, you will need to read `:help ins-completion`
|
||||
--
|
||||
--- @module 'blink.cmp'
|
||||
--- @type blink.cmp.Config
|
||||
opts = {
|
||||
keymap = {
|
||||
-- No, but seriously. Please read `:help ins-completion`, it is really good!
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
-- (enabled by default in nvim-cmp)
|
||||
-- Select the [n]ext item
|
||||
-- ['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
-- Select the [p]revious item
|
||||
-- ['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
--
|
||||
-- All presets have the following mappings:
|
||||
-- <tab>/<s-tab>: move to right/left of your snippet expansion
|
||||
-- <c-space>: Open menu or open docs if already open
|
||||
-- <c-n>/<c-p> or <up>/<down>: Select next/previous item
|
||||
-- <c-e>: Hide menu
|
||||
-- <c-k>: Toggle signature help
|
||||
--
|
||||
-- See :h blink-cmp-config-keymap for defining your own keymap
|
||||
-- preset = 'default',
|
||||
|
||||
-- Accept ([y]es) the completion.
|
||||
-- This will auto-import if your LSP supports it.
|
||||
-- This will expand snippets if the LSP sent a snippet.
|
||||
-- ['<C-y>'] = cmp.mapping.confirm { select = true },
|
||||
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
||||
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
||||
|
||||
-- If you prefer more traditional completion keymaps,
|
||||
-- you can uncomment the following lines
|
||||
-- ['<CR>'] = cmp.mapping.confirm { select = true },
|
||||
['<Tab>'] = cmp.mapping.select_next_item(),
|
||||
['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||
-- Удалил все сток бинды и добавил сам что надо
|
||||
-- https://cmp.saghen.dev/configuration/keymap.html
|
||||
preset = 'none',
|
||||
|
||||
-- Allows Up arrow to fall back without interacting with cmp
|
||||
['<Up>'] = cmp.mapping(function(fallback)
|
||||
cmp.close()
|
||||
fallback()
|
||||
end, { 'i', 'c' }),
|
||||
-- Open menu or open docs if already open
|
||||
['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' },
|
||||
-- Hide menu
|
||||
['<C-e>'] = { 'hide' },
|
||||
-- Accept the completion
|
||||
['<C-y>'] = { 'select_and_accept' },
|
||||
['<C-Tab>'] = { 'select_and_accept' },
|
||||
|
||||
-- Allows Up arrow to fall back without interacting with cmp
|
||||
['<Down>'] = cmp.mapping(function(fallback)
|
||||
cmp.close()
|
||||
fallback()
|
||||
end, { 'i', 'c' }),
|
||||
-- Select next/previous item
|
||||
['<Tab>'] = { 'select_next', 'fallback' },
|
||||
['<S-Tab>'] = { 'select_prev', 'fallback' },
|
||||
|
||||
-- Scroll the documentation window [b]ack / [f]orward
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
-- Scroll the documentation window [b]ack / [f]orward
|
||||
['<C-b>'] = { 'scroll_documentation_up', 'fallback' },
|
||||
['<C-f>'] = { 'scroll_documentation_down', 'fallback' },
|
||||
|
||||
-- Manually trigger a completion from nvim-cmp.
|
||||
-- Generally you don't need this, because nvim-cmp will display
|
||||
-- completions whenever it has completion options available.
|
||||
['<C-Space>'] = cmp.mapping.complete {},
|
||||
-- Think of <c-l> as moving to the right of your snippet expansion.
|
||||
-- So if you have a snippet that's like:
|
||||
-- function $name($args)
|
||||
-- $body
|
||||
-- end
|
||||
--
|
||||
-- <c-l> will move you to the right of each of the expansion locations.
|
||||
-- <c-h> is similar, except moving you backwards.
|
||||
['<C-l>'] = { 'snippet_forward', 'fallback' },
|
||||
['<C-h>'] = { 'snippet_backward', 'fallback' },
|
||||
|
||||
-- Think of <c-l> as moving to the right of your snippet expansion.
|
||||
-- So if you have a snippet that's like:
|
||||
-- function $name($args)
|
||||
-- $body
|
||||
-- end
|
||||
--
|
||||
-- <c-l> will move you to the right of each of the expansion locations.
|
||||
-- <c-h> is similar, except moving you backwards.
|
||||
['<C-l>'] = cmp.mapping(function()
|
||||
if luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<C-h>'] = cmp.mapping(function()
|
||||
if luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
-- Toggle signature help
|
||||
['<C-k>'] = { 'show_signature', 'hide_signature', 'fallback' },
|
||||
},
|
||||
|
||||
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
||||
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
||||
appearance = {
|
||||
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||
-- Adjusts spacing to ensure icons are aligned
|
||||
nerd_font_variant = 'mono',
|
||||
},
|
||||
|
||||
completion = {
|
||||
-- By default, you may press `<c-space>` to show the documentation.
|
||||
-- Optionally, set `auto_show = true` to show the documentation after a delay.
|
||||
documentation = { auto_show = true, auto_show_delay_ms = 500 },
|
||||
},
|
||||
|
||||
sources = {
|
||||
default = { 'lsp', 'path', 'snippets', 'lazydev' },
|
||||
providers = {
|
||||
lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
|
||||
},
|
||||
sources = {
|
||||
{
|
||||
name = 'lazydev',
|
||||
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
|
||||
group_index = 0,
|
||||
},
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'path' },
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
snippets = { preset = 'luasnip' },
|
||||
|
||||
-- Blink.cmp includes an optional, recommended rust fuzzy matcher,
|
||||
-- which automatically downloads a prebuilt binary when enabled.
|
||||
--
|
||||
-- By default, we use the Lua implementation instead, but you may enable
|
||||
-- the rust implementation via `'prefer_rust_with_warning'`
|
||||
--
|
||||
-- See :h blink-cmp-config-fuzzy for more information
|
||||
fuzzy = { implementation = 'lua' },
|
||||
|
||||
-- Shows a signature help window while you type arguments for a function
|
||||
signature = { enabled = true },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,32 @@
|
|||
-- 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 = '*',
|
||||
branch = 'v3.x',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
||||
'MunifTanjim/nui.nvim',
|
||||
-- { -- Optional image support in preview window: See `# Preview Mode` for more information
|
||||
-- '3rd/image.nvim',
|
||||
-- build = false, -- so that it doesn't build the rock
|
||||
-- opts = {
|
||||
-- backend = 'ueberzug', -- or "kitty"
|
||||
-- processor = 'magick_cli', -- or "magick_rock"
|
||||
-- },
|
||||
-- },
|
||||
{ -- Optional image support in preview window: See `# Preview Mode` for more information
|
||||
'3rd/image.nvim',
|
||||
build = false, -- so that it doesn't build the rock
|
||||
opts = {
|
||||
backend = 'ueberzug', -- or "kitty"
|
||||
processor = 'magick_cli', -- or "magick_rock"
|
||||
},
|
||||
},
|
||||
},
|
||||
cmd = 'Neotree',
|
||||
lazy = false, -- neo-tree will lazily load itself
|
||||
keys = {
|
||||
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
|
||||
},
|
||||
---@module "neo-tree"
|
||||
---@type neotree.Config?
|
||||
opts = {
|
||||
close_if_last_window = true,
|
||||
filesystem = {
|
||||
window = {
|
||||
mappings = {
|
||||
|
|
|
|||
|
|
@ -1,18 +1,3 @@
|
|||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
|
||||
-- NOTE: Plugins can also be added by using a table,
|
||||
-- with the first argument being the link and the following
|
||||
-- keys can be used to configure plugin behavior/loading/etc.
|
||||
--
|
||||
-- Use `opts = {}` to force a plugin to be loaded.
|
||||
--
|
||||
|
||||
-- Here is a more advanced example where we pass configuration
|
||||
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
|
||||
-- require('gitsigns').setup({ ... })
|
||||
--
|
||||
-- See `:help gitsigns` to understand what the configuration keys do
|
||||
|
||||
return {
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
-- Add indentation guides even on blank lines
|
||||
|
||||
return {
|
||||
{
|
||||
'lukas-reineke/indent-blankline.nvim',
|
||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||
-- See `:help ibl`
|
||||
main = 'ibl',
|
||||
opts = {},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ return {
|
|||
local lint = require 'lint'
|
||||
lint.linters_by_ft = {
|
||||
-- markdown = { 'markdownlint' },
|
||||
sql = { 'sqlfluff' },
|
||||
-- go = { 'golangcilint' },
|
||||
-- proto = { 'buf_lint' }, -- Крашит
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,89 +27,69 @@ return {
|
|||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||
{ 'j-hui/fidget.nvim', opts = {} },
|
||||
|
||||
-- Allows extra capabilities provided by nvim-cmp
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
-- Allows extra capabilities provided by blink.cmp
|
||||
'saghen/blink.cmp',
|
||||
},
|
||||
config = function()
|
||||
-- Brief aside: **What is LSP?**
|
||||
--
|
||||
-- LSP is an initialism you've probably heard, but might not understand what it is.
|
||||
--
|
||||
-- LSP stands for Language Server Protocol. It's a protocol that helps editors
|
||||
-- and language tooling communicate in a standardized fashion.
|
||||
--
|
||||
-- In general, you have a "server" which is some tool built to understand a particular
|
||||
-- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers
|
||||
-- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone
|
||||
-- processes that communicate with some "client" - in this case, Neovim!
|
||||
--
|
||||
-- LSP provides Neovim with features like:
|
||||
-- - Go to definition
|
||||
-- - Find references
|
||||
-- - Autocompletion
|
||||
-- - Symbol Search
|
||||
-- - and more!
|
||||
--
|
||||
-- Thus, Language Servers are external tools that must be installed separately from
|
||||
-- Neovim. This is where `mason` and related plugins come into play.
|
||||
--
|
||||
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully
|
||||
-- and elegantly composed help section, `:help lsp-vs-treesitter`
|
||||
|
||||
-- This function gets run when an LSP attaches to a particular buffer.
|
||||
-- That is to say, every time a new file is opened that is associated with
|
||||
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
|
||||
-- function will be executed to configure the current buffer
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
|
||||
callback = function(event)
|
||||
-- NOTE: Remember that Lua is a real programming language, and as such it is possible
|
||||
-- to define small helper and utility functions so you don't have to repeat yourself.
|
||||
--
|
||||
-- In this case, we create a function that lets us more easily define mappings specific
|
||||
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
||||
local map = function(keys, func, desc, mode)
|
||||
mode = mode or 'n'
|
||||
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
||||
end
|
||||
|
||||
-- Jump to the definition of the word under your cursor.
|
||||
-- This is where a variable was first declared, or where a function is defined, etc.
|
||||
-- To jump back, press <C-t>.
|
||||
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
||||
-- Rename the variable under your cursor.
|
||||
-- Most Language Servers support renaming across files, etc.
|
||||
map('grn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
|
||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
||||
-- or a suggestion from your LSP for this to activate.
|
||||
map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' })
|
||||
|
||||
-- Find references for the word under your cursor.
|
||||
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
|
||||
-- Jump to the implementation of the word under your cursor.
|
||||
-- Useful when your language has ways of declaring types without an actual implementation.
|
||||
map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
||||
map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
||||
|
||||
-- Jump to the definition of the word under your cursor.
|
||||
-- This is where a variable was first declared, or where a function is defined, etc.
|
||||
-- To jump back, press <C-t>.
|
||||
map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
||||
|
||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||
-- For example, in C this would take you to the header.
|
||||
map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
|
||||
-- Fuzzy find all the symbols in your current document.
|
||||
-- Symbols are things like variables, functions, types, etc.
|
||||
map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols')
|
||||
-- Было <leader>ds [D]ocument [S]ymbols
|
||||
-- map('<leader>ss', require('telescope.builtin').lsp_document_symbols, 'Document [S]ymbols')
|
||||
|
||||
-- Fuzzy find all the symbols in your current workspace.
|
||||
-- Similar to document symbols, except searches over your entire project.
|
||||
map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols')
|
||||
|
||||
-- Jump to the type of the word under your cursor.
|
||||
-- Useful when you're not sure what type a variable is and you want to see
|
||||
-- the definition of its *type*, not where it was *defined*.
|
||||
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
|
||||
map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition')
|
||||
|
||||
-- Fuzzy find all the symbols in your current document.
|
||||
-- Symbols are things like variables, functions, types, etc.
|
||||
-- Было <leader>ds [D]ocument [S]ymbols
|
||||
map('<leader>ss', require('telescope.builtin').lsp_document_symbols, 'Document [S]ymbols')
|
||||
|
||||
-- Fuzzy find all the symbols in your current workspace.
|
||||
-- Similar to document symbols, except searches over your entire project.
|
||||
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
|
||||
-- Rename the variable under your cursor.
|
||||
-- Most Language Servers support renaming across files, etc.
|
||||
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
|
||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
||||
-- or a suggestion from your LSP for this to activate.
|
||||
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
|
||||
|
||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||
-- For example, in C this would take you to the header.
|
||||
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
|
||||
---@param client vim.lsp.Client
|
||||
---@param method vim.lsp.protocol.Method
|
||||
---@param bufnr? integer some lsp support methods only in specific files
|
||||
---@return boolean
|
||||
local function client_supports_method(client, method, bufnr)
|
||||
if vim.fn.has 'nvim-0.11' == 1 then
|
||||
return client:supports_method(method, bufnr)
|
||||
else
|
||||
return client.supports_method(method, { bufnr = bufnr })
|
||||
end
|
||||
end
|
||||
|
||||
-- The following two autocommands are used to highlight references of the
|
||||
-- word under your cursor when your cursor rests there for a little while.
|
||||
|
|
@ -117,7 +97,8 @@ return {
|
|||
--
|
||||
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
|
||||
-- if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
|
||||
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
|
||||
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
|
||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
buffer = event.buf,
|
||||
|
|
@ -144,7 +125,8 @@ return {
|
|||
-- code, if the language server you are using supports them
|
||||
--
|
||||
-- This may be unwanted, since they displace some of your code
|
||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
|
||||
-- if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
|
||||
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
|
||||
map('<leader>th', function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
||||
end, '[T]oggle Inlay [H]ints')
|
||||
|
|
@ -164,18 +146,9 @@ return {
|
|||
|
||||
-- LSP servers and clients are able to communicate to each other what features they support.
|
||||
-- By default, Neovim doesn't support everything that is in the LSP specification.
|
||||
-- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
|
||||
-- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
|
||||
|
||||
-- Настройки для некоторых lsp серверов. Приходится делать так.
|
||||
local cap_css = vim.lsp.protocol.make_client_capabilities()
|
||||
cap_css.textDocument.completion.completionItem.snippetSupport = true
|
||||
local cap_html = vim.lsp.protocol.make_client_capabilities()
|
||||
cap_html.textDocument.completion.completionItem.snippetSupport = true
|
||||
local cap_json = vim.lsp.protocol.make_client_capabilities()
|
||||
cap_json.textDocument.completion.completionItem.snippetSupport = true
|
||||
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
|
||||
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
|
||||
local capabilities = require('blink.cmp').get_lsp_capabilities()
|
||||
|
||||
-- Enable the following language servers
|
||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||
|
|
@ -187,30 +160,25 @@ return {
|
|||
-- - on_attach (func): Функция, которая вызывается, когда LSP подключается к буферу
|
||||
-- - settings (table): Override the default settings passed when initializing the server.
|
||||
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
||||
local cap_css = vim.lsp.protocol.make_client_capabilities()
|
||||
cap_css.textDocument.completion.completionItem.snippetSupport = true
|
||||
local cap_html = vim.lsp.protocol.make_client_capabilities()
|
||||
cap_html.textDocument.completion.completionItem.snippetSupport = true
|
||||
local cap_json = vim.lsp.protocol.make_client_capabilities()
|
||||
cap_json.textDocument.completion.completionItem.snippetSupport = true
|
||||
local servers = {
|
||||
-- See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||
--
|
||||
-- Some languages (like typescript) have entire language plugins that can be useful:
|
||||
-- https://github.com/pmizio/typescript-tools.nvim
|
||||
--
|
||||
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
||||
|
||||
-- SQL
|
||||
sqls = {
|
||||
on_attach = function(client)
|
||||
-- Выключить форматирование
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
end,
|
||||
},
|
||||
|
||||
-- Golang
|
||||
gopls = {},
|
||||
-- templ = {},
|
||||
gopls = {
|
||||
completion = {
|
||||
unimported = false,
|
||||
},
|
||||
},
|
||||
templ = {},
|
||||
|
||||
-- Frontend
|
||||
tailwindcss = {},
|
||||
ts_ls = {},
|
||||
-- tailwindcss = {},
|
||||
-- htmx = {},
|
||||
htmx = {},
|
||||
emmet_language_server = {
|
||||
filetypes = {
|
||||
'templ',
|
||||
|
|
@ -247,12 +215,9 @@ return {
|
|||
completion = {
|
||||
callSnippet = 'Replace',
|
||||
},
|
||||
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
||||
-- diagnostics = { disable = { 'missing-fields' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- C/C++
|
||||
clangd = {
|
||||
filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, -- Удалил "proto"
|
||||
|
|
@ -271,7 +236,14 @@ return {
|
|||
rust_analyzer = {},
|
||||
|
||||
-- Bash
|
||||
bashls = {},
|
||||
bashls = {
|
||||
on_attach = function(client, bufnr)
|
||||
local filename = vim.api.nvim_buf_get_name(bufnr)
|
||||
if filename:match '/%.env$' or filename:match '/%.env%..+$' then
|
||||
client.stop() -- отключить LSP только для .env
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
-- JSON
|
||||
jsonls = {
|
||||
|
|
@ -302,6 +274,8 @@ return {
|
|||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||
|
||||
require('mason-lspconfig').setup {
|
||||
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
|
||||
automatic_installation = false,
|
||||
handlers = {
|
||||
function(server_name)
|
||||
local server = servers[server_name] or {}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
-- Collection of various small independent plugins/modules
|
||||
|
||||
return {
|
||||
{
|
||||
'echasnovski/mini.nvim',
|
||||
|
|
|
|||
|
|
@ -1,17 +1,7 @@
|
|||
-- Fuzzy Finder (files, lsp, etc)
|
||||
|
||||
-- NOTE: Plugins can specify dependencies.
|
||||
--
|
||||
-- The dependencies are proper plugin specifications as well - anything
|
||||
-- you do for a plugin at the top level, you can do for a dependency.
|
||||
--
|
||||
-- Use the `dependencies` key to specify the dependencies of a particular plugin
|
||||
|
||||
return {
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
event = 'VimEnter',
|
||||
branch = '0.1.x',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
||||
|
|
@ -92,7 +82,7 @@ return {
|
|||
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set('n', '<leader><leader>', function()
|
||||
builtin.buffers { sort_mru = true, ignore_current_buffer = true }
|
||||
end, { desc = '[ ] Find etisting buffers' })
|
||||
end, { desc = '[ ] Find existing buffers' })
|
||||
vim.keymap.set('n', '<leader>st', ':Telescope colorscheme<CR>', { desc = '[S]earch [T]hemes' })
|
||||
|
||||
-- Slightly advanced example of overriding default behavior and theme
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
-- You can easily change to a different colorscheme.
|
||||
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
||||
|
||||
-- Cмена тем тут сделана уёбищно
|
||||
-- Чтоб сменить стандартную тему, надо раскомментировать vim.cmd.colorscheme пад именем темы
|
||||
-- Чтоб сменить стандартную тему, надо раскомментировать vim.cmd.colorscheme под именем темы
|
||||
-- и закомментировать это же у прошлой темы
|
||||
|
||||
-- В lazy.nvim параметр priority определяет порядок загрузки плагинов.
|
||||
|
|
@ -12,22 +11,6 @@
|
|||
|
||||
-- https://dotfyle.com/neovim/colorscheme/top
|
||||
|
||||
-- Убедитесь, что Sonokai установлен через lazy.nvim или другой менеджер
|
||||
local variants = { 'default', 'atlantis', 'andromeda', 'shusia', 'maia', 'espresso' }
|
||||
|
||||
-- Создаем псевдонимы для каждой темы
|
||||
for _, variant in ipairs(variants) do
|
||||
local alias = 'sonokai-' .. variant
|
||||
vim.api.nvim_create_user_command('Colorscheme' .. variant, function()
|
||||
vim.g.sonokai_style = variant
|
||||
vim.cmd 'colorscheme sonokai'
|
||||
end, {})
|
||||
|
||||
-- Регистрируем в Neovim как отдельный colorscheme
|
||||
vim.api.nvim_set_hl(0, alias, {})
|
||||
vim.cmd(string.format("autocmd ColorSchemePre %s let g:sonokai_style = '%s' | colorscheme sonokai", alias, variant))
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
'folke/tokyonight.nvim',
|
||||
|
|
@ -92,7 +75,7 @@ return {
|
|||
},
|
||||
|
||||
----------------------------------------------------------
|
||||
-- Гандоны не дают выбрать тему нормально --
|
||||
-- Не дают выбрать тему нормально --
|
||||
-- Приходится конфиг переписывать ради выбора расцветок --
|
||||
----------------------------------------------------------
|
||||
{
|
||||
|
|
@ -149,27 +132,6 @@ return {
|
|||
vim.cmd.colorscheme 'gruvbox'
|
||||
end,
|
||||
},
|
||||
{
|
||||
'sainnhe/gruvbox-material',
|
||||
priority = 1000,
|
||||
init = function()
|
||||
-- 'hard', 'medium', 'soft'
|
||||
vim.g.gruvbox_material_background = 'medium'
|
||||
-- 'material', 'mix', 'original'
|
||||
vim.g.gruvbox_material_foreground = 'mix'
|
||||
-- 'grey', 'colored', 'highlighted'
|
||||
vim.g.gruvbox_material_diagnostic_virtual_text = 'colored'
|
||||
vim.g.gruvbox_material_diagnostic_line_highlight = 1
|
||||
vim.g.gruvbox_material_diagnostic_text_highlight = 1
|
||||
|
||||
-- vim.g.gruvbox_material_inlay_hints_background = 'dimmed'
|
||||
-- vim.g.gruvbox_material_better_performance = 1
|
||||
-- vim.g.gruvbox_material_spell_foreground = 'colored'
|
||||
-- vim.g.gruvbox_material_enable_bold = 1
|
||||
-- vim.g.gruvbox_material_enable_italic = true
|
||||
-- vim.cmd.colorscheme 'gruvbox-material'
|
||||
end,
|
||||
},
|
||||
{
|
||||
'sainnhe/everforest',
|
||||
priority = 1000,
|
||||
|
|
|
|||
|
|
@ -1,20 +1,3 @@
|
|||
-- Useful plugin to show you pending keybinds.
|
||||
|
||||
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
|
||||
--
|
||||
-- This is often very useful to both group configuration, as well as handle
|
||||
-- lazy loading plugins that don't need to be loaded immediately at startup.
|
||||
--
|
||||
-- For example, in the following configuration, we use:
|
||||
-- event = 'VimEnter'
|
||||
--
|
||||
-- which loads which-key before all the UI elements are loaded. Events can be
|
||||
-- normal autocommands events (`:help autocmd-events`).
|
||||
--
|
||||
-- Then, because we use the `config` key, the configuration only runs
|
||||
-- after the plugin has been loaded:
|
||||
-- config = function() ... end
|
||||
|
||||
return {
|
||||
{
|
||||
'folke/which-key.nvim',
|
||||
|
|
@ -59,12 +42,12 @@ return {
|
|||
|
||||
-- Document existing key chains
|
||||
spec = {
|
||||
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
|
||||
-- { '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
|
||||
-- { '<leader>d', group = '[D]ocument' },
|
||||
{ '<leader>r', group = '[R]ename' },
|
||||
-- { '<leader>r', group = '[R]ename' },
|
||||
{ '<leader>s', group = '[S]earch' },
|
||||
{ '<leader>S', group = '[S]ession' },
|
||||
{ '<leader>w', group = '[W]orkspace' },
|
||||
-- { '<leader>w', group = '[W]orkspace' },
|
||||
{ '<leader>t', group = '[T]oggle' },
|
||||
{ '<leader>g', group = '[G]olang' },
|
||||
{ '<leader>gt', group = '[G]olang [T]ag' },
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ vim.opt.expandtab = true
|
|||
-- yaml lsp за меня решают сколько пробелов мне надо. Это фикс
|
||||
-- Их параметры конфига для переназначения не работают. Пришлось костыль сделать
|
||||
vim.cmd [[
|
||||
autocmd FileType yaml setlocal shiftwidth=4 tabstop=4 softtabstop=4 expandtab
|
||||
autocmd FileType yaml setlocal shiftwidth=2 tabstop=2 softtabstop=2 expandtab
|
||||
]]
|
||||
|
||||
-- Комментировать .proto код биндом
|
||||
|
|
@ -37,6 +37,25 @@ vim.api.nvim_create_autocmd('FileType', {
|
|||
vim.bo.commentstring = '// %s'
|
||||
end,
|
||||
})
|
||||
-- Комментировать .sql код биндом
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = 'sql',
|
||||
callback = function()
|
||||
vim.bo.commentstring = '-- %s'
|
||||
end,
|
||||
})
|
||||
|
||||
-- Fix .sqlfluff highlight
|
||||
vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
|
||||
pattern = '*.sqlfluff',
|
||||
command = 'set filetype=toml',
|
||||
})
|
||||
|
||||
-- Disable netrw for file tree
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
-- optionally enable 24-bit colour
|
||||
-- vim.opt.termguicolors = true
|
||||
|
||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||
vim.opt.mouse = 'a'
|
||||
|
|
@ -123,6 +142,11 @@ vim.opt.cursorline = true
|
|||
-- Minimal number of screen lines to keep above and below the cursor.
|
||||
vim.opt.scrolloff = 10
|
||||
|
||||
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
|
||||
-- instead raise a dialog asking if you wish to save the current file(s)
|
||||
-- See `:help 'confirm'`
|
||||
-- vim.opt.confirm = true
|
||||
|
||||
-- [[ Basic Keymaps ]]
|
||||
-- See `:help vim.keymap.set()`
|
||||
|
||||
|
|
@ -161,6 +185,12 @@ vim.keymap.set('n', '<C-Right>', '<C-w><C-l>', { desc = 'Move focus to the right
|
|||
vim.keymap.set('n', '<C-Down>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
||||
vim.keymap.set('n', '<C-Up>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||
|
||||
-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
|
||||
-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
|
||||
-- vim.keymap.set("n", "<C-S-l>", "<C-w>L", { desc = "Move window to the right" })
|
||||
-- vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" })
|
||||
-- vim.keymap.set("n", "<C-S-k>", "<C-w>K", { desc = "Move window to the upper" })
|
||||
|
||||
-- [[ Basic Autocommands ]]
|
||||
-- See `:help lua-guide-autocommands`
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue