1
0
Fork 0
mirror of https://codeberg.org/Mo8it/dotfiles.git synced 2025-01-01 15:39:20 +00:00

Upgrade to nvim 0.7

This commit is contained in:
Mo 2022-05-01 14:36:25 +02:00
parent dd4d5b842c
commit 7da654e964
3 changed files with 41 additions and 31 deletions

View file

@ -1,10 +1,8 @@
local map = vim.api.nvim_set_keymap local set = vim.keymap.set
local opts = { local opts = {
noremap = true,
silent = true, silent = true,
} }
local e_opts = { local e_opts = {
noremap = true,
silent = true, silent = true,
expr = true, expr = true,
} }
@ -16,46 +14,51 @@ end
-- --
map("", "<Space>", "<Nop>", opts) set("", "<Space>", "<Nop>", opts)
vim.g.mapleader = " " vim.g.mapleader = " "
vim.g.maplocalleader = " " vim.g.maplocalleader = " "
-- For navigation with soft wrap -- For navigation with soft wrap
map("n", "j", "v:count == 0 ? 'gj' : 'j'", e_opts) set("n", "j", "v:count == 0 ? 'gj' : 'j'", e_opts)
map("n", "k", "v:count == 0 ? 'gk' : 'k'", e_opts) set("n", "k", "v:count == 0 ? 'gk' : 'k'", e_opts)
-- --
map("n", "<C-k>", cmd("BufferLineCycleNext"), opts) set("n", "<C-k>", cmd("BufferLineCycleNext"), opts)
map("n", "<C-j>", cmd("BufferLineCyclePrev"), opts) set("n", "<C-j>", cmd("BufferLineCyclePrev"), opts)
map("n", "<C-b>", cmd("Neotree"), opts) set("n", "<C-b>", cmd("Neotree"), opts)
-- Telescope -- Telescope
map("n", "<C-p>", cmd("lua require('plugins.telescope').custom_find_files()"), opts) local custom_telescope = require("plugins.telescope")
map("n", "<C-h>", cmd("lua require('plugins.telescope').custom_find_hidden_files()"), opts) local builtin_telescope = require("telescope.builtin")
map("n", "<C-f>", cmd("lua require('telescope.builtin').current_buffer_fuzzy_find()"), opts) set("n", "<C-p>", custom_telescope.custom_find_files, opts)
set("n", "<C-h>", custom_telescope.custom_find_hidden_files, opts)
set("n", "<C-f>", builtin_telescope.current_buffer_fuzzy_find, opts)
-- --
map("n", "<space>f", cmd("lua require('telescope.builtin').live_grep()"), opts) set("n", "<space>f", builtin_telescope.live_grep, opts)
map("n", "<space>s", cmd("lua require('telescope.builtin').lsp_document_symbols()"), opts) set("n", "<space>s", builtin_telescope.lsp_document_symbols, opts)
map("n", "<space>d", cmd("lua require('telescope.builtin').lsp_definitions()"), opts) set("n", "<space>d", builtin_telescope.lsp_definitions, opts)
map("n", "<space>r", cmd("lua require('telescope.builtin').lsp_references()"), opts) set("n", "<space>r", builtin_telescope.lsp_references, opts)
-- LSP -- LSP
map("n", "<space>h", cmd("lua vim.lsp.buf.hover()"), opts) set("n", "<space>h", vim.lsp.buf.hover, opts)
-- Focus -- Focus
vim.api.nvim_set_keymap("n", "<C-l>", cmd("lua require('focus').split_cycle()"), opts) local focus = require("focus")
set("n", "L", focus.split_cycle, opts)
-- hlslens -- hlslens
map("n", "n", [[<Cmd>execute('normal! ' . v:count1 . 'n')<CR><Cmd>lua require('hlslens').start()<CR>]], opts) local map = vim.api.nvim_set_keymap
map("n", "N", [[<Cmd>execute('normal! ' . v:count1 . 'N')<CR><Cmd>lua require('hlslens').start()<CR>]], opts) local map_opts = {
map("n", "*", [[*<Cmd>lua require('hlslens').start()<CR>]], opts) noremap = true,
map("n", "#", [[#<Cmd>lua require('hlslens').start()<CR>]], opts) silent = true,
map("n", "g*", [[g*<Cmd>lua require('hlslens').start()<CR>]], opts) }
map("n", "g#", [[g#<Cmd>lua require('hlslens').start()<CR>]], opts)
-- --
map("x", "*", [[*<Cmd>lua require('hlslens').start()<CR>]], opts) map("n", "n", [[<Cmd>execute('normal! ' . v:count1 . 'n')<CR><Cmd>lua require('hlslens').start()<CR>]], map_opts)
map("x", "#", [[#<Cmd>lua require('hlslens').start()<CR>]], opts) map("n", "N", [[<Cmd>execute('normal! ' . v:count1 . 'N')<CR><Cmd>lua require('hlslens').start()<CR>]], map_opts)
map("x", "g*", [[g*<Cmd>lua require('hlslens').start()<CR>]], opts) map("n", "*", [[*<Cmd>lua require('hlslens').start()<CR>]], map_opts)
map("x", "g#", [[g#<Cmd>lua require('hlslens').start()<CR>]], opts) map("n", "#", [[#<Cmd>lua require('hlslens').start()<CR>]], map_opts)
--
map("x", "*", [[*<Cmd>lua require('hlslens').start()<CR>]], map_opts)
map("x", "#", [[#<Cmd>lua require('hlslens').start()<CR>]], map_opts)

View file

@ -39,8 +39,17 @@ opt.confirm = true
opt.linebreak = true opt.linebreak = true
opt.laststatus = 3
-- Highlight on yank -- Highlight on yank
vim.cmd([[au TextYankPost * silent! lua vim.highlight.on_yank {timeout=1200}]]) local function custom_highlight_on_yank()
return vim.highlight.on_yank({ timeout = 1200 })
end
vim.api.nvim_create_autocmd("TextYankPost", {
pattern = "*",
callback = custom_highlight_on_yank,
})
-- Disable diagnostics -- Disable diagnostics
vim.diagnostic.disable() vim.diagnostic.disable()

View file

@ -26,7 +26,6 @@ return require("packer").startup(function()
requires = { requires = {
"nvim-lua/plenary.nvim", "nvim-lua/plenary.nvim",
}, },
tag = "nvim-0.6",
}) })
-- --
use({ use({
@ -66,7 +65,6 @@ return require("packer").startup(function()
-- Comment -- Comment
use({ use({
"numToStr/Comment.nvim", "numToStr/Comment.nvim",
tag = "v0.6",
}) })
-- Todo-comment -- Todo-comment