145 lines
3.8 KiB
Lua
145 lines
3.8 KiB
Lua
-- TODO: Rewrite it accordingly to new configuration.
|
|
-- TODO: Also, make it actually minimal. 😉
|
|
|
|
-- Set <space> as the leader key
|
|
-- See `:help mapleader`
|
|
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
|
vim.g.mapleader = ' '
|
|
vim.g.maplocalleader = ' '
|
|
|
|
-- Install package manager
|
|
-- https://github.com/folke/lazy.nvim
|
|
-- `:help lazy.nvim.txt` for more info
|
|
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
|
if not vim.loop.fs_stat(lazypath) then
|
|
vim.fn.system {
|
|
'git',
|
|
'clone',
|
|
'--filter=blob:none',
|
|
'https://github.com/folke/lazy.nvim.git',
|
|
'--branch=stable', -- latest stable release
|
|
lazypath,
|
|
}
|
|
end
|
|
vim.opt.rtp:prepend(lazypath)
|
|
|
|
require('lazy').setup({
|
|
|
|
{
|
|
"Mofiqul/adwaita.nvim",
|
|
lazy = false,
|
|
priority = 1000,
|
|
config = function()
|
|
vim.cmd('colorscheme adwaita')
|
|
end
|
|
},
|
|
|
|
{
|
|
-- Set lualine as statusline
|
|
'nvim-lualine/lualine.nvim',
|
|
-- See `:help lualine.txt`
|
|
opts = {
|
|
options = {
|
|
icons_enabled = true,
|
|
theme = 'adwaita',
|
|
component_separators = '|',
|
|
section_separators = '',
|
|
},
|
|
},
|
|
},
|
|
|
|
{
|
|
-- Highlight, edit, and navigate code
|
|
'nvim-treesitter/nvim-treesitter',
|
|
dependencies = {
|
|
'nvim-treesitter/nvim-treesitter-textobjects',
|
|
},
|
|
build = ':TSUpdate',
|
|
}
|
|
})
|
|
|
|
vim.wo.number = true
|
|
|
|
-- [[ Configure Treesitter ]]
|
|
-- See `:help nvim-treesitter`
|
|
require('nvim-treesitter.configs').setup {
|
|
-- Add languages to be installed here that you want installed for treesitter
|
|
ensure_installed = { },
|
|
|
|
-- Do not install parses synchronously
|
|
sync_install = false,
|
|
|
|
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
|
auto_install = false,
|
|
|
|
-- List of parsers to ignore installing
|
|
-- ignore_install = { "markdown" },
|
|
|
|
-- Required property, but empty
|
|
modules = {},
|
|
|
|
highlight = {
|
|
enable = true,
|
|
},
|
|
indent = { enable = true, disable = { 'python' } },
|
|
incremental_selection = {
|
|
enable = true,
|
|
keymaps = {
|
|
init_selection = '<c-space>',
|
|
node_incremental = '<c-space>',
|
|
scope_incremental = '<c-s>',
|
|
node_decremental = '<M-space>',
|
|
},
|
|
},
|
|
textobjects = {
|
|
select = {
|
|
enable = true,
|
|
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
|
keymaps = {
|
|
-- You can use the capture groups defined in textobjects.scm
|
|
['aa'] = '@parameter.outer',
|
|
['ia'] = '@parameter.inner',
|
|
['af'] = '@function.outer',
|
|
['if'] = '@function.inner',
|
|
['ac'] = '@class.outer',
|
|
['ic'] = '@class.inner',
|
|
},
|
|
},
|
|
move = {
|
|
enable = true,
|
|
set_jumps = true, -- whether to set jumps in the jumplist
|
|
goto_next_start = {
|
|
[']m'] = '@function.outer',
|
|
[']]'] = '@class.outer',
|
|
},
|
|
goto_next_end = {
|
|
[']M'] = '@function.outer',
|
|
[']['] = '@class.outer',
|
|
},
|
|
goto_previous_start = {
|
|
['[m'] = '@function.outer',
|
|
['[['] = '@class.outer',
|
|
},
|
|
goto_previous_end = {
|
|
['[M'] = '@function.outer',
|
|
['[]'] = '@class.outer',
|
|
},
|
|
},
|
|
swap = {
|
|
enable = true,
|
|
swap_next = {
|
|
['<leader>a'] = '@parameter.inner',
|
|
},
|
|
swap_previous = {
|
|
['<leader>A'] = '@parameter.inner',
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
-- Diagnostic keymaps
|
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
|
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
|
|
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
|
|
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
|