refactor and add new theme
This commit is contained in:
parent
94beeb1081
commit
499efa20f1
11 changed files with 172 additions and 67 deletions
|
|
@ -47,6 +47,27 @@ ln -s ~/nixos-private-dots/nvim ~/.config/nvim
|
||||||
|
|
||||||
Чтоб понять есть ли проблемы с конфигом, может какие-то пакеты отсутствуют, можно запустить `:healthcheck`.
|
Чтоб понять есть ли проблемы с конфигом, может какие-то пакеты отсутствуют, можно запустить `:healthcheck`.
|
||||||
|
|
||||||
|
## Изменить в будущем
|
||||||
|
|
||||||
|
Сейчас я сделал в стоке везде табуляцию в 4 символа на таб. Не пробелы. Если захочу это исправить и сделать per language настройки, то это можно сделать по разному. Сейчас у меня lsp/formatter сами заменяют табы на пробелы при сохранении файла.
|
||||||
|
|
||||||
|
Use `:h ftplugin` together with `:h :setlocal`
|
||||||
|
В каталоге nvim надо сделать каталог `ftplugin` и в него добавлять файлы `filetype.lua`. Например для python будет `python.lua`. И там можно писать настройки для каждого отдельного языка:
|
||||||
|
```lua
|
||||||
|
vim.bo.tabstop = 4 -- size of a hard tabstop (ts).
|
||||||
|
vim.bo.shiftwidth = 4 -- size of an indentation (sw).
|
||||||
|
vim.bo.expandtab = true -- always uses spaces instead of tab characters (et).
|
||||||
|
vim.bo.softtabstop = 4 -- number of spaces a <Tab> counts for. When 0, feature is off (sts)
|
||||||
|
```
|
||||||
|
|
||||||
|
Если не хочется возиться с тонной файлов, то можно добавить это в init.vim (надо переписать для init.lua):
|
||||||
|
```vim
|
||||||
|
autocmd BufEnter *.py :setlocal tabstop=4 shiftwidth=4 expandtab
|
||||||
|
autocmd BufEnter *.js :setlocal tabstop=2 shiftwidth=2 expandtab
|
||||||
|
```
|
||||||
|
|
||||||
|
Per project можно использовать `.editorconfig` файл в корне проекта. Нвим должен работать с его настройками.
|
||||||
|
|
||||||
## Бинды
|
## Бинды
|
||||||
|
|
||||||
Тут будет список биндов, которых нет в стандартном NeoVim
|
Тут будет список биндов, которых нет в стандартном NeoVim
|
||||||
|
|
@ -58,7 +79,7 @@ ln -s ~/nixos-private-dots/nvim ~/.config/nvim
|
||||||
Я не помню откуда эти бинды, может они есть в стоке, а может нет, но они полезные.
|
Я не помню откуда эти бинды, может они есть в стоке, а может нет, но они полезные.
|
||||||
|
|
||||||
| Bind | Description |
|
| Bind | Description |
|
||||||
|---------------------|-------------------------------------|
|
|---------------------|---------------------------------------------------------|
|
||||||
| `K` | Hover documentation |
|
| `K` | Hover documentation |
|
||||||
| `ctrl+o` | Go back |
|
| `ctrl+o` | Go back |
|
||||||
| `ctrl+i` | Go forward (if you went backwards) |
|
| `ctrl+i` | Go forward (if you went backwards) |
|
||||||
|
|
@ -73,6 +94,7 @@ ln -s ~/nixos-private-dots/nvim ~/.config/nvim
|
||||||
| `]d` | Go to next `D`iagnostic message |
|
| `]d` | Go to next `D`iagnostic message |
|
||||||
| `space e` | Show diagnostic `E`rror message |
|
| `space e` | Show diagnostic `E`rror message |
|
||||||
| `space q` | Open diagnostic `Q`uickfix |
|
| `space q` | Open diagnostic `Q`uickfix |
|
||||||
|
| `ctrl+l` | Перейти к следующему плейсхолдеру сниппета в insert mod |
|
||||||
|
|
||||||
|
|
||||||
Бинды в таблице ниже нажимаются без пробела перед ними. Просто бинд
|
Бинды в таблице ниже нажимаются без пробела перед ними. Просто бинд
|
||||||
|
|
@ -192,6 +214,7 @@ Normal mode. С пробелом
|
||||||
- `YAML LSP` имеет [опциональные настройки](https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.txt#yamlls)
|
- `YAML LSP` имеет [опциональные настройки](https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.txt#yamlls)
|
||||||
- `JSON LSP` имеет [опциональные настройки](https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.txt#jsonls)
|
- `JSON LSP` имеет [опциональные настройки](https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.txt#jsonls)
|
||||||
- `rust-analyzer` имеет много опциональных настроек
|
- `rust-analyzer` имеет много опциональных настроек
|
||||||
|
- Чтоб `sql` работал внутри `.go` файлов, sql запросы надо писать внутри \`` так `\`. Тоесть внутри \` с пробелом в начале и конце, а не просто строка.
|
||||||
- `sqlfluff` требует иметь `.sqlfluff` в директории проекта. Вот пример конфига:
|
- `sqlfluff` требует иметь `.sqlfluff` в директории проекта. Вот пример конфига:
|
||||||
```toml
|
```toml
|
||||||
[sqlfluff]
|
[sqlfluff]
|
||||||
|
|
|
||||||
4
nvim/ftplugin/nix.lua
Normal file
4
nvim/ftplugin/nix.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
vim.bo.expandtab = true
|
||||||
|
vim.bo.tabstop = 2
|
||||||
|
vim.bo.shiftwidth = 2
|
||||||
|
vim.bo.softtabstop = 2
|
||||||
|
|
@ -32,9 +32,6 @@ require('lazy').setup({
|
||||||
-- Установлены из коробки в kickstart.nvim --
|
-- Установлены из коробки в kickstart.nvim --
|
||||||
---------------------------------------------
|
---------------------------------------------
|
||||||
|
|
||||||
-- Detect expandtab and shiftwidth automatically
|
|
||||||
require 'kickstart.plugins.vim-sleuth',
|
|
||||||
|
|
||||||
-- Git integration for buffers
|
-- Git integration for buffers
|
||||||
require 'kickstart.plugins.gitsigns',
|
require 'kickstart.plugins.gitsigns',
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" },
|
"gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" },
|
||||||
"go.nvim": { "branch": "master", "commit": "c6d5ca26377d01c4de1f7bff1cd62c8b43baa6bc" },
|
"go.nvim": { "branch": "master", "commit": "c6d5ca26377d01c4de1f7bff1cd62c8b43baa6bc" },
|
||||||
"gruvbox-material": { "branch": "master", "commit": "e41451337d33997aff4c078a83165a9f66e2d38d" },
|
"gruvbox-material": { "branch": "master", "commit": "e41451337d33997aff4c078a83165a9f66e2d38d" },
|
||||||
|
"gruvbox.nvim": { "branch": "main", "commit": "68c3460a5d1d1a362318960035c9f3466d5011f5" },
|
||||||
"guihua.lua": { "branch": "master", "commit": "d783191eaa75215beae0c80319fcce5e6b3beeda" },
|
"guihua.lua": { "branch": "master", "commit": "d783191eaa75215beae0c80319fcce5e6b3beeda" },
|
||||||
"image.nvim": { "branch": "master", "commit": "f1163cc2f6fff5b0de7c23c7502eee0df23a3e0e" },
|
"image.nvim": { "branch": "master", "commit": "f1163cc2f6fff5b0de7c23c7502eee0df23a3e0e" },
|
||||||
"indent-blankline.nvim": { "branch": "master", "commit": "259357fa4097e232730341fa60988087d189193a" },
|
"indent-blankline.nvim": { "branch": "master", "commit": "259357fa4097e232730341fa60988087d189193a" },
|
||||||
|
|
@ -52,6 +53,5 @@
|
||||||
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||||
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
|
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
|
||||||
"tokyonight.nvim": { "branch": "main", "commit": "7bb270adaa7692c2c33befc35f5567fc596a2504" },
|
"tokyonight.nvim": { "branch": "main", "commit": "7bb270adaa7692c2c33befc35f5567fc596a2504" },
|
||||||
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
|
|
||||||
"which-key.nvim": { "branch": "main", "commit": "1f8d414f61e0b05958c342df9b6a4c89ce268766" }
|
"which-key.nvim": { "branch": "main", "commit": "1f8d414f61e0b05958c342df9b6a4c89ce268766" }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,9 @@ return {
|
||||||
end,
|
end,
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
lua = { 'stylua' },
|
lua = { 'stylua' },
|
||||||
|
go = { 'gofmt', 'injected' },
|
||||||
sql = { 'sqlfluff' },
|
sql = { 'sqlfluff' },
|
||||||
-- sql = { 'sql_formatter' },
|
-- ['*'] = { 'injected' }, -- enables injected-lang formatting for all filetypes
|
||||||
-- ["*"] = { "injected" }, -- enables injected-lang formatting for all filetypes
|
|
||||||
|
|
||||||
-- Conform can also run multiple formatters sequentially
|
-- Conform can also run multiple formatters sequentially
|
||||||
-- python = { "isort", "black" },
|
-- python = { "isort", "black" },
|
||||||
|
|
@ -67,8 +67,19 @@ return {
|
||||||
-- end,
|
-- end,
|
||||||
-- stdin = true,
|
-- stdin = true,
|
||||||
-- },
|
-- },
|
||||||
|
sqlfluff = {
|
||||||
|
command = 'sqlfluff',
|
||||||
|
args = {
|
||||||
|
'format',
|
||||||
|
-- 'fix',
|
||||||
|
-- '--dialect',
|
||||||
|
-- 'postgres',
|
||||||
|
-- '--disable-progress-bar',
|
||||||
|
'-',
|
||||||
|
},
|
||||||
|
stdin = true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ return {
|
||||||
-- Fuzzy find all the symbols in your current document.
|
-- Fuzzy find all the symbols in your current document.
|
||||||
-- Symbols are things like variables, functions, types, etc.
|
-- Symbols are things like variables, functions, types, etc.
|
||||||
-- Было <leader>ds [D]ocument [S]ymbols
|
-- Было <leader>ds [D]ocument [S]ymbols
|
||||||
map('<leader>S', require('telescope.builtin').lsp_document_symbols, 'Document [S]ymbols')
|
map('<leader>ss', require('telescope.builtin').lsp_document_symbols, 'Document [S]ymbols')
|
||||||
|
|
||||||
-- Fuzzy find all the symbols in your current workspace.
|
-- Fuzzy find all the symbols in your current workspace.
|
||||||
-- Similar to document symbols, except searches over your entire project.
|
-- Similar to document symbols, except searches over your entire project.
|
||||||
|
|
@ -190,8 +190,28 @@ return {
|
||||||
-- taplo
|
-- taplo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- local util = require 'lspconfig.util'
|
||||||
local lspconfig = require 'lspconfig'
|
local lspconfig = require 'lspconfig'
|
||||||
|
|
||||||
|
-- require('lspconfig.configs').postgres_lsp = {
|
||||||
|
-- default_config = {
|
||||||
|
-- name = 'postgres_lsp',
|
||||||
|
-- cmd = { 'postgres_lsp' },
|
||||||
|
-- filetypes = { 'sql' },
|
||||||
|
-- single_file_support = true,
|
||||||
|
-- root_dir = util.root_pattern 'root-file.txt',
|
||||||
|
-- },
|
||||||
|
-- }
|
||||||
|
|
||||||
|
-- SQL
|
||||||
|
-- lspconfig.postgres_lsp.setup { force_setup = true }
|
||||||
|
lspconfig.sqls.setup {
|
||||||
|
on_attach = function(client)
|
||||||
|
-- Выключить форматирование
|
||||||
|
client.server_capabilities.documentFormattingProvider = false
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
-- Nix
|
-- Nix
|
||||||
lspconfig.nixd.setup {}
|
lspconfig.nixd.setup {}
|
||||||
|
|
||||||
|
|
@ -199,15 +219,6 @@ return {
|
||||||
lspconfig.gopls.setup {}
|
lspconfig.gopls.setup {}
|
||||||
lspconfig.templ.setup {}
|
lspconfig.templ.setup {}
|
||||||
|
|
||||||
-- SQL
|
|
||||||
-- lspconfig.postgres_lsp.setup {}
|
|
||||||
lspconfig.sqls.setup {
|
|
||||||
on_attach = function(client, bufnr)
|
|
||||||
-- Выключить форматирование
|
|
||||||
client.server_capabilities.documentFormattingProvider = false
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Frontend
|
-- Frontend
|
||||||
lspconfig.tailwindcss.setup {}
|
lspconfig.tailwindcss.setup {}
|
||||||
lspconfig.ts_ls.setup {}
|
lspconfig.ts_ls.setup {}
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ return {
|
||||||
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
||||||
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
||||||
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||||
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
vim.keymap.set('n', '<leader>sS', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
||||||
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
||||||
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
||||||
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,60 @@ return {
|
||||||
-- Гандоны не дают выбрать тему нормально --
|
-- Гандоны не дают выбрать тему нормально --
|
||||||
-- Приходится конфиг переписывать ради выбора расцветок --
|
-- Приходится конфиг переписывать ради выбора расцветок --
|
||||||
----------------------------------------------------------
|
----------------------------------------------------------
|
||||||
|
{
|
||||||
|
'ellisonleao/gruvbox.nvim',
|
||||||
|
priority = 1000,
|
||||||
|
config = true,
|
||||||
|
-- opts = ...
|
||||||
|
init = function()
|
||||||
|
local colors = require('gruvbox').palette
|
||||||
|
colors.neutral_aqua = '#8bba7f'
|
||||||
|
colors.bright_red = '#f2594b'
|
||||||
|
colors.bright_green = '#a4ab43'
|
||||||
|
-- Default options:
|
||||||
|
require('gruvbox').setup {
|
||||||
|
terminal_colors = true, -- add neovim terminal colors
|
||||||
|
undercurl = true, -- underline errors
|
||||||
|
underline = true, -- underline links
|
||||||
|
bold = false, -- bold keywords
|
||||||
|
italic = {
|
||||||
|
strings = true,
|
||||||
|
emphasis = true, -- курсив выделения
|
||||||
|
comments = true,
|
||||||
|
operators = false,
|
||||||
|
folds = true, -- курсив для сворачиваемых блоков кода
|
||||||
|
},
|
||||||
|
strikethrough = true, -- зачёркиваниe удалённых или устаревших элементов
|
||||||
|
invert_selection = false,
|
||||||
|
invert_signs = false,
|
||||||
|
invert_tabline = false,
|
||||||
|
invert_intend_guides = false,
|
||||||
|
inverse = true, -- invert background for search, diffs, statuslines and errors
|
||||||
|
contrast = '', -- can be "hard", "soft" or empty string
|
||||||
|
palette_overrides = {},
|
||||||
|
overrides = {
|
||||||
|
LspReferenceText = { -- ссылки на элементы под курсором
|
||||||
|
bg = '#504945',
|
||||||
|
},
|
||||||
|
LspReferenceWrite = {
|
||||||
|
bg = '#504945',
|
||||||
|
},
|
||||||
|
LspReferenceRead = {
|
||||||
|
bg = '#504945',
|
||||||
|
},
|
||||||
|
String = {
|
||||||
|
fg = colors.neutral_aqua,
|
||||||
|
},
|
||||||
|
['@keyword.import.go'] = {
|
||||||
|
fg = colors.bright_red,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
dim_inactive = false,
|
||||||
|
transparent_mode = false,
|
||||||
|
}
|
||||||
|
vim.cmd.colorscheme 'gruvbox'
|
||||||
|
end,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'sainnhe/gruvbox-material',
|
'sainnhe/gruvbox-material',
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
|
|
@ -105,11 +159,15 @@ return {
|
||||||
vim.g.gruvbox_material_foreground = 'mix'
|
vim.g.gruvbox_material_foreground = 'mix'
|
||||||
-- 'grey', 'colored', 'highlighted'
|
-- 'grey', 'colored', 'highlighted'
|
||||||
vim.g.gruvbox_material_diagnostic_virtual_text = 'colored'
|
vim.g.gruvbox_material_diagnostic_virtual_text = 'colored'
|
||||||
vim.g.gruvbox_material_better_performance = 1
|
|
||||||
vim.g.gruvbox_material_diagnostic_line_highlight = 1
|
vim.g.gruvbox_material_diagnostic_line_highlight = 1
|
||||||
vim.g.gruvbox_material_diagnostic_text_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.g.gruvbox_material_enable_italic = true
|
||||||
vim.cmd.colorscheme 'gruvbox-material'
|
-- vim.cmd.colorscheme 'gruvbox-material'
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -147,4 +205,3 @@ return {
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,34 @@
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
'nvim-treesitter/nvim-treesitter-context',
|
||||||
|
config = function()
|
||||||
|
require('treesitter-context').setup {
|
||||||
|
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
||||||
|
multiwindow = false, -- Enable multiwindow support.
|
||||||
|
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
|
||||||
|
min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
|
||||||
|
line_numbers = true,
|
||||||
|
multiline_threshold = 3, -- Maximum number of lines to show for a single context
|
||||||
|
trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
|
||||||
|
mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline'
|
||||||
|
-- Separator between context and content. Should be a single character string, like '-'.
|
||||||
|
-- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
|
||||||
|
separator = nil,
|
||||||
|
zindex = 20, -- The Z-index of the context window
|
||||||
|
on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching
|
||||||
|
}
|
||||||
|
vim.keymap.set('n', 'gp', function()
|
||||||
|
require('treesitter-context').go_to_context(vim.v.count1)
|
||||||
|
end, { silent = true, desc = '[G]oto context ([P]arent)' })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
-- {
|
||||||
|
-- 'nvim-treesitter/nvim-treesitter-textobjects',
|
||||||
|
-- },
|
||||||
|
},
|
||||||
build = ':TSUpdate',
|
build = ':TSUpdate',
|
||||||
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
||||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
||||||
|
|
@ -34,6 +62,7 @@ return {
|
||||||
'toml',
|
'toml',
|
||||||
'yaml',
|
'yaml',
|
||||||
'cmake',
|
'cmake',
|
||||||
|
'printf',
|
||||||
},
|
},
|
||||||
-- Autoinstall languages that are not installed
|
-- Autoinstall languages that are not installed
|
||||||
auto_install = true,
|
auto_install = true,
|
||||||
|
|
@ -53,28 +82,4 @@ return {
|
||||||
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
|
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
|
||||||
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'nvim-treesitter/nvim-treesitter-context',
|
|
||||||
dependencies = { 'nvim-treesitter/nvim-treesitter' },
|
|
||||||
config = function()
|
|
||||||
require('treesitter-context').setup {
|
|
||||||
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
|
||||||
multiwindow = false, -- Enable multiwindow support.
|
|
||||||
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
|
|
||||||
min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
|
|
||||||
line_numbers = true,
|
|
||||||
multiline_threshold = 3, -- Maximum number of lines to show for a single context
|
|
||||||
trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
|
|
||||||
mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline'
|
|
||||||
-- Separator between context and content. Should be a single character string, like '-'.
|
|
||||||
-- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
|
|
||||||
separator = nil,
|
|
||||||
zindex = 20, -- The Z-index of the context window
|
|
||||||
on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching
|
|
||||||
}
|
|
||||||
vim.keymap.set('n', 'gp', function()
|
|
||||||
require('treesitter-context').go_to_context(vim.v.count1)
|
|
||||||
end, { silent = true, desc = '[G]oto context ([P]arent)' })
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
|
||||||
return {
|
|
||||||
'tpope/vim-sleuth', -- Detect expandtab and shiftwidth automatically
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -19,7 +19,9 @@ vim.opt.relativenumber = true
|
||||||
|
|
||||||
-- Табуляция в 4 символа
|
-- Табуляция в 4 символа
|
||||||
vim.opt.tabstop = 4
|
vim.opt.tabstop = 4
|
||||||
-- vim.opt.shiftwidth = 4
|
vim.opt.shiftwidth = 4
|
||||||
|
-- Юзать пробелы вместо табов
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
|
||||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||||
vim.opt.mouse = 'a'
|
vim.opt.mouse = 'a'
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue