use new nvim 0.7 functions

This commit is contained in:
saibotk 2022-04-18 03:40:59 +02:00
parent 651e05c30a
commit 42593f71e5
Signed by: saibotk
GPG key ID: 67585F0065E261D5
4 changed files with 26 additions and 52 deletions

View file

@ -1,41 +1,38 @@
local map = require("utils").map
-- search for visual selection -- search for visual selection
map {'v', '//', 'y/<C-R>"<CR>'} vim.keymap.set('v', '//', 'y/<C-R>"<CR>')
map {'n', 'H', '^'} vim.keymap.set('n', 'H', '^')
-- ex command -- ex command
map {'c', '<C-p>', '<Up>'} vim.keymap.set('c', '<C-p>', '<Up>')
map {'c', '<C-n>', '<Down>'} vim.keymap.set('c', '<C-n>', '<Down>')
-- auto expand brackets -- auto expand brackets
map {'i', '(;', '(<CR>)<C-c>O'} vim.keymap.set('i', '(;', '(<CR>)<C-c>O')
map {'i', '(,', '(<CR>),<C-c>O'} vim.keymap.set('i', '(,', '(<CR>),<C-c>O')
map {'i', '{;', '{<CR>}<C-c>O'} vim.keymap.set('i', '{;', '{<CR>}<C-c>O')
map {'i', '{,', '{<CR>},<C-c>O'} vim.keymap.set('i', '{,', '{<CR>},<C-c>O')
map {'i', '[;', '[<CR>]<C-c>O'} vim.keymap.set('i', '[;', '[<CR>]<C-c>O')
map {'i', '[,', '[<CR>],<C-c>O'} vim.keymap.set('i', '[,', '[<CR>],<C-c>O')
-- toggle hybrid mode -- toggle hybrid mode
map {'n', '<leader>h', ':set rnu!<CR>'} vim.keymap.set('n', '<leader>h', ':set rnu!<CR>')
-- nvim-tree.lua -- nvim-tree.lua
map {'n', '<leader>e', ':NvimTreeToggle<CR>'} vim.keymap.set('n', '<leader>e', ':NvimTreeToggle<CR>')
-- Telescope -- Telescope
map {'n', '<C-y>', '<cmd>Telescope buffers<CR>'} vim.keymap.set('n', '<C-y>', '<cmd>Telescope buffers<CR>')
map {'n', '<leader>f', '<cmd>Telescope find_files<CR>'} vim.keymap.set('n', '<leader>f', '<cmd>Telescope find_files<CR>')
map {'n', '<leader>l', '<cmd>Telescope live_grep<CR>'} vim.keymap.set('n', '<leader>l', '<cmd>Telescope live_grep<CR>')
map {'n', '<silent> gy', '<cmd>Telescope treesitter<CR>'} vim.keymap.set('n', '<silent> gy', '<cmd>Telescope treesitter<CR>')
map {'n', '<leader>wm', '<cmd>lua require("notes").list()<CR>'} vim.keymap.set('n', '<leader>wm', require("notes").list)
map {'n', '<leader>wt', '<cmd>lua require("notes").tags()<CR>'} vim.keymap.set('n', '<leader>wt', require("notes").tags)
-- neo formatter -- neo formatter
map {'n', '<leader>p', ':Neoformat<CR>'} vim.keymap.set('n', '<leader>p', ':Neoformat<CR>')
-- goyo mapping
map {'n', '<silent> <leader>w', ':Goyo<CR>'}
-- spelling -- spelling
map {'n', '<silent> <leader>se', ':set spell spelllang=en<CR>'} vim.keymap.set('n', '<silent> <leader>se', ':set spell spelllang=en<CR>')
map {'n', '<silent> <leader>sd', ':set spell spelllang=de<CR>'} vim.keymap.set('n', '<silent> <leader>sd', ':set spell spelllang=de<CR>')

View file

@ -2,15 +2,14 @@
-- syntax -- syntax
vim.cmd [[ vim.cmd [[
syntax on let mapleader = " "
let mapleader=" "
colorscheme sonokai
hi MatchParen guibg=NONE guifg=red gui=bold
set shortmess+=c set shortmess+=c
colorscheme sonokai
]] ]]
-- color settings -- color settings
vim.opt.termguicolors = true vim.opt.termguicolors=true
vim.g.do_filetype_lua = 1
-- random settings -- random settings
vim.opt.number = true vim.opt.number = true

View file

@ -1,6 +1,5 @@
-- PLUGIN OPTIONS -- PLUGIN OPTIONS
-- GITGUTTER SETUP -- GITGUTTER SETUP
-- ========================= -- =========================
vim.api.nvim_set_var('gitgutter_sign_added', '') vim.api.nvim_set_var('gitgutter_sign_added', '')

View file

@ -1,21 +0,0 @@
local M = {}
function M.map(key)
-- get the extra options
local opts = {noremap = true}
for i, v in pairs(key) do
if type(i) == 'string' then opts[i] = v end
end
-- basic support for buffer-scoped keybindings
local buffer = opts.buffer
opts.buffer = nil
if buffer then
vim.api.nvim_buf_set_keymap(0, key[1], key[2], key[3], opts)
else
vim.api.nvim_set_keymap(key[1], key[2], key[3], opts)
end
end
return M