new: Clear search highlight by Esc in normal mode
This commit is contained in:
parent
b687443541
commit
2cc1fc0fb5
6 changed files with 68 additions and 49 deletions
|
@ -1,5 +1,6 @@
|
||||||
-- This file defines all the global config
|
-- This file defines all the global config
|
||||||
local set = vim.opt
|
local set = vim.opt
|
||||||
|
local g = vim.g
|
||||||
|
|
||||||
-- Turn on numbers
|
-- Turn on numbers
|
||||||
set.number = true
|
set.number = true
|
||||||
|
@ -23,9 +24,8 @@ set.spell = true
|
||||||
set.mouse = 'n'
|
set.mouse = 'n'
|
||||||
-- Enable programming dictionary
|
-- Enable programming dictionary
|
||||||
set.spelllang = { "en", "programming" }
|
set.spelllang = { "en", "programming" }
|
||||||
-- Use ctrl-[hjkl] to select the active split
|
|
||||||
|
|
||||||
-- Disable unused plugins
|
-- Disable unused plugins
|
||||||
vim.g.loaded_perl_provider = 0
|
g.loaded_perl_provider = 0
|
||||||
vim.g.loaded_node_provider = 0
|
g.loaded_node_provider = 0
|
||||||
vim.g.loaded_ruby_provider = 0
|
g.loaded_ruby_provider = 0
|
||||||
|
|
|
@ -1,34 +1,41 @@
|
||||||
-- This file lists all the global keymaps
|
-- This file lists all the global keymaps
|
||||||
|
local map = vim.keymap.set
|
||||||
|
local g = vim.g
|
||||||
|
local api = vim.api
|
||||||
|
local opt = vim.opt
|
||||||
|
|
||||||
-- Change the leader and localleader
|
-- Change the leader and localleader
|
||||||
vim.g.mapleader = ','
|
g.mapleader = ','
|
||||||
vim.g.maplocalleader = ';'
|
g.maplocalleader = ';'
|
||||||
|
|
||||||
-- Set K to hover
|
-- Set K to hover
|
||||||
vim.api.nvim_buf_create_user_command(0, "LspHover", "lua vim.lsp.buf.hover()", { nargs = '+' })
|
api.nvim_buf_create_user_command(0, "LspHover", "lua vim.lsp.buf.hover()", { nargs = '+' })
|
||||||
vim.opt.keywordprg = ":LspHover"
|
opt.keywordprg = ":LspHover"
|
||||||
|
|
||||||
-- Use ctrl-[hjkl] to select the active split!
|
-- Use ctrl-[hjkl] to select the active split!
|
||||||
vim.keymap.set('n', '<c-k>', ":wincmd k<cr>", { silent = true })
|
map('n', '<c-k>', ":wincmd k<cr>", { silent = true })
|
||||||
vim.keymap.set('n', '<c-j>', ":wincmd j<cr>", { silent = true })
|
map('n', '<c-j>', ":wincmd j<cr>", { silent = true })
|
||||||
vim.keymap.set('n', '<c-h>', ":wincmd h<cr>", { silent = true })
|
map('n', '<c-h>', ":wincmd h<cr>", { silent = true })
|
||||||
vim.keymap.set('n', '<c-l>', ":wincmd l<cr>", { silent = true })
|
map('n', '<c-l>', ":wincmd l<cr>", { silent = true })
|
||||||
|
|
||||||
-- Use ,dd for deleting without putting into buffer
|
-- Use ,dd for deleting without putting into buffer
|
||||||
vim.keymap.set({ 'v', 'n' }, '<leader>d', '"_d', { remap = false })
|
map({ 'v', 'n' }, '<leader>d', '"_d', { remap = false })
|
||||||
vim.keymap.set('n', '<leader>D', '"_D', { remap = false })
|
map('n', '<leader>D', '"_D', { remap = false })
|
||||||
vim.keymap.set('n', '<leader>x', '"_x', { remap = false })
|
map('n', '<leader>x', '"_x', { remap = false })
|
||||||
|
|
||||||
-- Insert a newline in normal mode by ,o
|
-- Insert a newline in normal mode by ,o
|
||||||
vim.keymap.set('n', '<leader>o', "o<Esc>k", { remap = false })
|
map('n', '<leader>o', "o<Esc>k", { remap = false })
|
||||||
vim.keymap.set('n', '<leader>O', "O<Esc>j", { remap = false })
|
map('n', '<leader>O', "O<Esc>j", { remap = false })
|
||||||
|
|
||||||
-- Use ,u for redo
|
-- Use ,u for redo
|
||||||
vim.keymap.set('n', '<leader>u', "<c-r>", { remap = false })
|
map('n', '<leader>u', "<c-r>", { remap = false })
|
||||||
|
|
||||||
-- Find files using fzf by ,f
|
-- Find files using fzf by ,f
|
||||||
vim.keymap.set('n', '<leader>f', ":Files<cr>", { remap = false })
|
map('n', '<leader>f', ":Files<cr>", { remap = false })
|
||||||
|
|
||||||
-- Move around buffers using ,j and ,k
|
-- Move around buffers using ,j and ,k
|
||||||
vim.keymap.set('n', '<leader>k', ":bnext<cr>", { remap = false })
|
map('n', '<leader>k', ":bnext<cr>", { remap = false })
|
||||||
vim.keymap.set('n', '<leader>j', ":bprevious<cr>", { remap = false })
|
map('n', '<leader>j', ":bprevious<cr>", { remap = false })
|
||||||
|
|
||||||
|
-- Clear search highlight by Esc in normal mode
|
||||||
|
map('n', '<Esc>', ':noh<cr>', { remap = false })
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
-- This file defines all the global configs
|
-- This file defines all the global configs
|
||||||
local set = vim.opt
|
local set = vim.opt
|
||||||
|
local g = vim.g
|
||||||
|
|
||||||
-- Turn on numbers
|
-- Turn on numbers
|
||||||
set.number = true
|
set.number = true
|
||||||
|
@ -23,7 +24,7 @@ set.mouse = 'n'
|
||||||
set.spelllang = { "en", "programming" }
|
set.spelllang = { "en", "programming" }
|
||||||
|
|
||||||
-- Disable unused plugins
|
-- Disable unused plugins
|
||||||
vim.g.loaded_perl_provider = 0
|
g.loaded_perl_provider = 0
|
||||||
vim.g.loaded_node_provider = 0
|
g.loaded_node_provider = 0
|
||||||
vim.g.loaded_ruby_provider = 0
|
g.loaded_ruby_provider = 0
|
||||||
|
|
||||||
|
|
|
@ -1,27 +1,32 @@
|
||||||
-- This file lists all the global keymaps
|
-- This file lists all the global keymaps
|
||||||
|
local map = vim.keymap.set
|
||||||
|
local g = vim.g
|
||||||
|
|
||||||
-- Change the leader and localleader
|
-- Change the leader and localleader
|
||||||
vim.g.mapleader = ','
|
g.mapleader = ','
|
||||||
vim.g.maplocalleader = ';'
|
g.maplocalleader = ';'
|
||||||
|
|
||||||
|
|
||||||
-- Use ,dd for deleting without putting into buffer
|
-- Use ,dd for deleting without putting into buffer
|
||||||
vim.keymap.set({ 'v', 'n' }, '<leader>d', '"_d', { remap = false })
|
map({ 'v', 'n' }, '<leader>d', '"_d', { remap = false })
|
||||||
vim.keymap.set('n', '<leader>D', '"_D', { remap = false })
|
map('n', '<leader>D', '"_D', { remap = false })
|
||||||
vim.keymap.set('n', '<leader>x', '"_x', { remap = false })
|
map('n', '<leader>x', '"_x', { remap = false })
|
||||||
|
|
||||||
-- Insert a newline in normal mode by ,o
|
-- Insert a newline in normal mode by ,o
|
||||||
vim.keymap.set('n', '<leader>o', "o<Esc>k", { remap = false })
|
map('n', '<leader>o', "o<Esc>k", { remap = false })
|
||||||
vim.keymap.set('n', '<leader>O', "O<Esc>j", { remap = false })
|
map('n', '<leader>O', "O<Esc>j", { remap = false })
|
||||||
|
|
||||||
-- Use ,u for redo
|
-- Use ,u for redo
|
||||||
vim.keymap.set('n', '<leader>u', "<c-r>", { remap = false })
|
map('n', '<leader>u', "<c-r>", { remap = false })
|
||||||
|
|
||||||
|
|
||||||
-- Find files using fzf by ,f
|
-- Find files using fzf by ,f
|
||||||
vim.keymap.set('n', '<leader>f', ":Files<cr>", { remap = false })
|
map('n', '<leader>f', ":Files<cr>", { remap = false })
|
||||||
|
|
||||||
-- Move around buffers using ,j and ,k
|
-- Move around buffers using ,j and ,k
|
||||||
vim.keymap.set('n', '<leader>k', ":bnext<cr>", { remap = false })
|
map('n', '<leader>k', ":bnext<cr>", { remap = false })
|
||||||
vim.keymap.set('n', '<leader>j', ":bprevious<cr>", { remap = false })
|
map('n', '<leader>j', ":bprevious<cr>", { remap = false })
|
||||||
|
|
||||||
|
-- Clear search highlight by Esc in normal mode
|
||||||
|
map('n', '<Esc>', ':noh<cr>', { remap = false })
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
-- This file defines all the global configs
|
-- This file defines all the global configs
|
||||||
local set = vim.opt
|
local set = vim.opt
|
||||||
|
local g = vim.g
|
||||||
|
|
||||||
-- Turn on numbers
|
-- Turn on numbers
|
||||||
set.number = true
|
set.number = true
|
||||||
|
@ -23,7 +24,7 @@ set.mouse = 'n'
|
||||||
set.spelllang = { "en", "programming" }
|
set.spelllang = { "en", "programming" }
|
||||||
|
|
||||||
-- Disable unused plugins
|
-- Disable unused plugins
|
||||||
vim.g.loaded_perl_provider = 0
|
g.loaded_perl_provider = 0
|
||||||
vim.g.loaded_node_provider = 0
|
g.loaded_node_provider = 0
|
||||||
vim.g.loaded_ruby_provider = 0
|
g.loaded_ruby_provider = 0
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,30 @@
|
||||||
-- This file lists all the global keymaps
|
-- This file lists all the global keymaps
|
||||||
|
local map = vim.keymap.set
|
||||||
|
local g = vim.g
|
||||||
|
|
||||||
-- Change the leader and localleader
|
-- Change the leader and localleader
|
||||||
vim.g.mapleader = ','
|
g.mapleader = ','
|
||||||
vim.g.maplocalleader = ';'
|
g.maplocalleader = ';'
|
||||||
|
|
||||||
-- Use ,dd for deleting without putting into buffer
|
-- Use ,dd for deleting without putting into buffer
|
||||||
vim.keymap.set({ 'v', 'n' }, '<leader>d', '"_d', { remap = false })
|
map({ 'v', 'n' }, '<leader>d', '"_d', { remap = false })
|
||||||
vim.keymap.set('n', '<leader>D', '"_D', { remap = false })
|
map('n', '<leader>D', '"_D', { remap = false })
|
||||||
vim.keymap.set('n', '<leader>x', '"_x', { remap = false })
|
map('n', '<leader>x', '"_x', { remap = false })
|
||||||
|
|
||||||
-- Insert a newline in normal mode by ,o
|
-- Insert a newline in normal mode by ,o
|
||||||
vim.keymap.set('n', '<leader>o', "o<Esc>k", { remap = false })
|
map('n', '<leader>o', "o<Esc>k", { remap = false })
|
||||||
vim.keymap.set('n', '<leader>O', "O<Esc>j", { remap = false })
|
map('n', '<leader>O', "O<Esc>j", { remap = false })
|
||||||
|
|
||||||
-- Use ,u for redo
|
-- Use ,u for redo
|
||||||
vim.keymap.set('n', '<leader>u', "<c-r>", { remap = false })
|
map('n', '<leader>u', "<c-r>", { remap = false })
|
||||||
|
|
||||||
-- Find files using fzf by ,f
|
-- Find files using fzf by ,f
|
||||||
vim.keymap.set('n', '<leader>f', ":Files<cr>", { remap = false })
|
map('n', '<leader>f', ":Files<cr>", { remap = false })
|
||||||
|
|
||||||
-- Move around buffers using ,j and ,k
|
-- Move around buffers using ,j and ,k
|
||||||
vim.keymap.set('n', '<leader>k', ":bnext<cr>", { remap = false })
|
map('n', '<leader>k', ":bnext<cr>", { remap = false })
|
||||||
vim.keymap.set('n', '<leader>j', ":bprevious<cr>", { remap = false })
|
map('n', '<leader>j', ":bprevious<cr>", { remap = false })
|
||||||
|
|
||||||
|
-- Clear search highlight by Esc in normal mode
|
||||||
|
map('n', '<Esc>', ':noh<cr>', { remap = false })
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue