neovim config update

This commit is contained in:
Ivan Kovmir 2023-10-18 06:52:41 +02:00
parent 5bfbf36c43
commit ed32b78f7b
Signed by: kovmir
GPG Key ID: ECF867166654C9EA
7 changed files with 123 additions and 84 deletions

View File

@ -7,7 +7,7 @@ charset = utf-8
[*.lua]
indent_style = space
indent_size = 4
indent_size = 3
[Makefile]
indent_style = tab

View File

@ -7,18 +7,19 @@
"go.nvim": { "branch": "master", "commit": "d73ea5bc00f0d7b726b0ddfc29cea17a544459ba" },
"gruvbox.nvim": { "branch": "main", "commit": "477c62493c82684ed510c4f70eaf83802e398898" },
"guihua.lua": { "branch": "master", "commit": "5ad8dba19ce9b9fd8965598984dfdc9c119f97e4" },
"lazy.nvim": { "branch": "main", "commit": "c373663b491e2e3426a55bb199ebfccff96fbaca" },
"lazy.nvim": { "branch": "main", "commit": "4c75c8eeb957a99aa44ce8e526c04340ab358c5e" },
"leap.nvim": { "branch": "main", "commit": "5efe985cf68fac3b6a6dfe7a75fbfaca8db2af9c" },
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
"lualine.nvim": { "branch": "master", "commit": "1a3f6bba410aff5a51bf8c84287aaa3a8ba30d0d" },
"nvim-autopairs": { "branch": "master", "commit": "f6c71641f6f183427a651c0ce4ba3fb89404fa9e" },
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
"nvim-lspconfig": { "branch": "master", "commit": "e49b1e90c1781ce372013de3fa93a91ea29fc34a" },
"nvim-snippy": { "branch": "master", "commit": "5787f088c99c04309a8aa6363fd3ac9a5a26b780" },
"nvim-treesitter": { "branch": "master", "commit": "49e71322db582147ce8f4df1853d9dab08da0826" },
"nvim-treesitter": { "branch": "master", "commit": "9c4fc86b67c1d68141cef57846d24cbee9b74fb0" },
"nvim-treesitter-context": { "branch": "master", "commit": "82c695951612911421e8e21068ba5fc2c2e2c212" },
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
"telescope.nvim": { "branch": "master", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" },
"vim-fugitive": { "branch": "master", "commit": "cbe9dfa162c178946afa689dd3f42d4ea8bf89c1" },
"vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" },
"vim-snippets": { "branch": "master", "commit": "8d03b00eff93df4aa3bdada67ed09fd437221b20" },
"vimtex": { "branch": "master", "commit": "cbb20643b7bfe721902dac5760bf0d4889fb5f7e" },

View File

@ -1,20 +1,33 @@
local keymap = vim.keymap
local silent = { noremap = true, silent = true }
local kmap = vim.keymap
local opts = { noremap = true, silent = true }
-- Diagnostics
keymap.set('n', '<leader>[', vim.diagnostic.goto_prev, silent)
keymap.set('n', '<leader>]', vim.diagnostic.goto_next, silent)
keymap.set('n', '<leader>e', vim.diagnostic.setloclist, silent)
kmap.set('n', '<leader>[', vim.diagnostic.goto_prev, opts)
kmap.set('n', '<leader>]', vim.diagnostic.goto_next, opts)
kmap.set('n', '<leader>e', vim.diagnostic.setloclist, opts)
-- Copy and paste normally
keymap.set('v', '<C-c>', '"+y', silent)
keymap.set('i', '<C-v>', '<ESC>"+p', silent)
kmap.set('v', '<C-c>', '"+y', opts)
kmap.set('i', '<C-v>', '<ESC>"+p', opts)
-- Save and quit with leader
keymap.set('n', '<leader>q', ':qa<CR>', silent)
keymap.set('n', '<leader>w', ':wa<CR>', silent)
-- Window movement
keymap.set('n', '<c-h>', '<c-w>h', silent)
keymap.set('n', '<c-j>', '<c-w>j', silent)
keymap.set('n', '<c-k>', '<c-w>k', silent)
keymap.set('n', '<c-l>', '<c-w>l', silent)
keymap.set('n', '<leader>c', '<c-w>c', silent)
keymap.set('n', '<leader>o', '<c-w>o', silent)
kmap.set('n', '<leader>q', ':qa<CR>', opts)
kmap.set('n', '<leader>w', ':wa<CR>', opts)
-- Sane window movement
kmap.set('n', '<c-h>', '<c-w>h', opts)
kmap.set('n', '<c-j>', '<c-w>j', opts)
kmap.set('n', '<c-k>', '<c-w>k', opts)
kmap.set('n', '<c-l>', '<c-w>l', opts)
kmap.set('n', '<leader>c', '<c-w>c', opts)
kmap.set('n', '<leader>o', '<c-w>o', opts)
-- Misc
kmap.set('i', '<c-o>', '<ESC>A;<CR>', opts)
kmap.set('n', '<leader>fm', vim.cmd.Ex, opts)
kmap.set('v', 'J', ":m '>+1<CR>gv=gv")
kmap.set('v', 'K', ":m '<-2<CR>gv=gv")
kmap.set('n', '<c-d>', '<c-d>zz')
kmap.set('n', '<c-u>', '<c-u>zz')
kmap.set('n', 'n', 'nzzzv')
kmap.set('n', 'N', 'Nzzzv')
kmap.set('n', 'N', 'Nzzzv')
kmap.set('x', '<leader>p', '"_dP')

View File

@ -10,16 +10,20 @@ opt.list = true -- Show spaces at the end of the lines and tabs
opt.listchars = 'tab:| ,trail:-,nbsp:+'
opt.mouse = 'a' -- Enable mouse support for all modes
opt.number = true -- Display line numbers
opt.scrolloff = 3 -- Scroll one line ahead
opt.scrolloff = 5 -- Scroll one line ahead
opt.showmode = false -- Do not show current mode in the command prompt
opt.smartcase = true -- Case insensitive search unless a capital in search
opt.splitbelow = true -- Open splits below
opt.splitright = true -- Open splits to the right
opt.textwidth = 79 -- 80 (79) column rule
opt.colorcolumn = 80
opt.wrap = false
opt.timeout = false -- Never timeout on mappings
opt.ttimeout = true -- Timeout on keycodes
opt.ttimeoutlen = 200 -- Keycode timeout delay
opt.undofile = true -- Save undo files
opt.hlsearch = false
opt.foldmethod = 'expr' -- Create folds based on expression
opt.foldexpr = 'nvim_treesitter#foldexpr()' -- Expression to create folds
opt.foldlevel = 3 -- Fold everything deeper than this

View File

@ -0,0 +1,7 @@
return {
'tpope/vim-fugitive',
config = function()
vim.keymap.set('n', '<leader>gs', vim.cmd.Git)
end
}

View File

@ -1,49 +1,49 @@
return {
'nvim-telescope/telescope.nvim',
version = '*',
dependencies = {
'nvim-lua/plenary.nvim',
{
'nvim-telescope/telescope-fzf-native.nvim',
build = 'make'
}
},
config = function()
local telescope = require'telescope'
local builtin = require'telescope.builtin'
local kmap = vim.keymap
'nvim-telescope/telescope.nvim',
version = '*',
dependencies = {
'nvim-lua/plenary.nvim',
{
'nvim-telescope/telescope-fzf-native.nvim',
build = 'make'
}
},
config = function()
local telescope = require'telescope'
local builtin = require'telescope.builtin'
local kmap = vim.keymap
telescope.setup {
extensions = {
fzf = {
fuzzy = true,
override_generic_sorter = true,
override_file_sorter = true,
case_mode = "smart_case",
}
}
}
telescope.load_extension('fzf')
telescope.setup {
extensions = {
fzf = {
fuzzy = true,
override_generic_sorter = true,
override_file_sorter = true,
case_mode = "smart_case",
}
}
}
telescope.load_extension('fzf')
-- Pickers
-- nvim
kmap.set('n', '<leader>ff', builtin.find_files, {})
kmap.set('n', '<leader><leader>', builtin.buffers, {})
-- LSP
kmap.set('n', '<leader>ld', builtin.lsp_definitions, {})
kmap.set('n', '<leader>li', builtin.lsp_implementations, {})
kmap.set('n', '<leader>lc', builtin.lsp_incoming_calls, {})
kmap.set('n', '<leader>lo', builtin.lsp_outgoing_calls, {})
kmap.set('n', '<leader>lr', builtin.lsp_references, {})
kmap.set('n', '<leader>ls', builtin.lsp_document_symbols, {})
kmap.set('n', '<leader>lS', builtin.lsp_workspace_symbols, {})
kmap.set('n', '<leader>le', builtin.diagnostics, {})
kmap.set('n', '<leader>lt', builtin.lsp_type_definitions, {})
-- Treesitter
kmap.set('n', '<leader>t', builtin.treesitter, {})
-- Git
kmap.set('n', '<leader>gc', builtin.git_commits, {})
kmap.set('n', '<leader>gb', builtin.git_branches, {})
kmap.set('n', '<leader>gs', builtin.git_status, {})
end,
-- Pickers
-- nvim
kmap.set('n', '<leader>ff', builtin.find_files, {})
kmap.set('n', '<leader><leader>', builtin.buffers, {})
-- LSP
kmap.set('n', '<leader>ld', builtin.lsp_definitions, {})
kmap.set('n', '<leader>li', builtin.lsp_implementations, {})
kmap.set('n', '<leader>lc', builtin.lsp_incoming_calls, {})
kmap.set('n', '<leader>lo', builtin.lsp_outgoing_calls, {})
kmap.set('n', '<leader>lr', builtin.lsp_references, {})
kmap.set('n', '<leader>ls', builtin.lsp_document_symbols, {})
kmap.set('n', '<leader>lS', builtin.lsp_workspace_symbols, {})
kmap.set('n', '<leader>le', builtin.diagnostics, {})
kmap.set('n', '<leader>lt', builtin.lsp_type_definitions, {})
-- Treesitter
kmap.set('n', '<leader>t', builtin.treesitter, {})
-- Git
--kmap.set('n', '<leader>gc', builtin.git_commits, {})
--kmap.set('n', '<leader>gb', builtin.git_branches, {})
--kmap.set('n', '<leader>gs', builtin.git_status, {})
end,
}

View File

@ -1,20 +1,34 @@
return {
'nvim-treesitter/nvim-treesitter',
dependencies = {
{
'nvim-treesitter/nvim-treesitter-context',
config = function()
require'treesitter-context'.setup{
enable = true,
}
end,
},
},
config = function()
require'nvim-treesitter.configs'.setup {
ensure_installed = 'all',
highlight = { enable = true },
}
end,
build = ':TSUpdate all',
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdateSync',
config = function()
require'nvim-treesitter.configs'.setup {
ensure_installed = 'all',
highlight = { enable = true },
}
require'nvim-treesitter.configs'.setup {
incremental_selection = {
enable = true,
keymaps = {
-- Set to 'false' to disable.
init_selection = "gnn",
node_incremental = "grn",
scope_incremental = "grc",
node_decremental = "grm",
},
},
}
end,
dependencies = {
{
'nvim-treesitter/nvim-treesitter-context',
config = function()
require'treesitter-context'.setup{
enable = true,
}
end,
},
},
}