Add which-key safeguard
This commit is contained in:
parent
da04b67bd4
commit
4e68e46d31
1 changed files with 21 additions and 52 deletions
73
init.lua
73
init.lua
|
@ -31,7 +31,6 @@ end
|
||||||
opt.guicursor:append('a:blinkon1000') -- Blink cursor once a second for all modes
|
opt.guicursor:append('a:blinkon1000') -- Blink cursor once a second for all modes
|
||||||
o.mouse = 'a' -- Enable mouse input
|
o.mouse = 'a' -- Enable mouse input
|
||||||
o.termguicolors = true -- Enable 24bit terminal colors
|
o.termguicolors = true -- Enable 24bit terminal colors
|
||||||
g.neovide_confirm_quit = 1 -- Confirm closing neovide window when changes are unsaved
|
|
||||||
|
|
||||||
-- Other interface settings
|
-- Other interface settings
|
||||||
o.clipboard = 'unnamedplus' -- Use system clipboard by default
|
o.clipboard = 'unnamedplus' -- Use system clipboard by default
|
||||||
|
@ -75,14 +74,20 @@ if fn.executable('rg') then
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Convenience keybindings
|
-- Convenience keybindings
|
||||||
require'which-key'.register{['<C-w>!'] = {'<Cmd>copen<CR>', 'Quickfix window'}}
|
do
|
||||||
require'which-key'.register{['<F2>'] = {'<Cmd>set number! relativenumber!<CR>', 'Toggle relative numbers'}}
|
-- which-key might not be available yet
|
||||||
require'which-key'.register{['<F3>'] = {'<Cmd>set number!<CR>', 'Toggle line numbers'}}
|
local ok, which_key = pcall(require, 'which-key')
|
||||||
|
if ok then
|
||||||
|
which_key.register{['<C-w>!'] = {'<Cmd>copen<CR>', 'Quickfix window'}}
|
||||||
|
which_key.register{['<F2>'] = {'<Cmd>set number! relativenumber!<CR>', 'Toggle relative numbers'}}
|
||||||
|
which_key.register{['<F3>'] = {'<Cmd>set number!<CR>', 'Toggle line numbers'}}
|
||||||
|
|
||||||
require'which-key'.register{['<A-h>'] = {'<C-w>h', 'Go to the left window'}}
|
which_key.register{['<A-h>'] = {'<C-w>h', 'Go to the left window'}}
|
||||||
require'which-key'.register{['<A-l>'] = {'<C-w>l', 'Go to the right window'}}
|
which_key.register{['<A-l>'] = {'<C-w>l', 'Go to the right window'}}
|
||||||
require'which-key'.register{['<A-n>'] = {'<C-w>n', 'Go to the up window'}}
|
which_key.register{['<A-n>'] = {'<C-w>n', 'Go to the up window'}}
|
||||||
require'which-key'.register{['<A-e>'] = {'<C-w>e', 'Go to the down window'}}
|
which_key.register{['<A-e>'] = {'<C-w>e', 'Go to the down window'}}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Do workman remappings
|
-- Do workman remappings
|
||||||
noremap('', 'n', 'gj')
|
noremap('', 'n', 'gj')
|
||||||
|
@ -94,6 +99,9 @@ noremap('', 'k', 'e')
|
||||||
vim.cmd [[
|
vim.cmd [[
|
||||||
command! Light colorscheme base16-atelier-sulphurpool-light
|
command! Light colorscheme base16-atelier-sulphurpool-light
|
||||||
command! Dark colorscheme nord
|
command! Dark colorscheme nord
|
||||||
|
|
||||||
|
" Perform file as the root user
|
||||||
|
"cmap w!! w !sudo tee > /dev/null %
|
||||||
]]
|
]]
|
||||||
|
|
||||||
-- Autocommands
|
-- Autocommands
|
||||||
|
@ -110,32 +118,13 @@ au BufReadPost *
|
||||||
" Highlight yanked text
|
" Highlight yanked text
|
||||||
au TextYankPost * silent! lua vim.highlight.on_yank()
|
au TextYankPost * silent! lua vim.highlight.on_yank()
|
||||||
|
|
||||||
au User StartifyReady noremap <buffer> n gj| noremap <buffer> e gk
|
au User Startified noremap <buffer> n j | noremap <buffer> e k
|
||||||
|
|
||||||
" Recompile plugin config cache when vimrc is updated
|
" Recompile plugin config cache when vimrc is updated
|
||||||
au BufWritePost */.config/nvim/init.lua source <afile> | PackerCompile
|
au BufWritePost */.config/nvim/init.lua source <afile> | PackerCompile
|
||||||
|
|
||||||
augroup END
|
augroup END
|
||||||
]]
|
]]
|
||||||
--local au = vim.api.nvim_create_augroup
|
|
||||||
--local augroup = vim.api.nvim_create_augroup('luarc', {clear = true})
|
|
||||||
--au('User', { pattern = 'StartifyReady', group = augroup, callback = function(cmd)
|
|
||||||
-- vim.keymap.set('', 'n', 'gj', {silent = true, buffer = true})
|
|
||||||
-- vim.keymap.set('', 'e', 'gk', {silent = true, buffer = true})
|
|
||||||
--end})
|
|
||||||
--au('BufWritePost', {
|
|
||||||
-- pattern = '*/.config/nvim/init.lua',
|
|
||||||
-- group = augroup,
|
|
||||||
-- command = 'source <afile> | PackerCompile'
|
|
||||||
--})
|
|
||||||
--au('TextYankPost', { pattern = '*', group = augroup, callback = vim.highlight.on_yank })
|
|
||||||
--au('BufWritePost', { pattern = '*/.config/nvim/init.lua', command = 'source <afile> | PackerCompile' })
|
|
||||||
--au('BufReadPost', { pattern = '*', group = augroup, command = function()
|
|
||||||
-- local line = vim.fn.line
|
|
||||||
-- if line[['\"]] > 1 && line[['\"]] <= line'$' && o.ft ~= 'commit' then
|
|
||||||
-- vim.cmd'normal g`"'
|
|
||||||
-- end
|
|
||||||
--end })
|
|
||||||
|
|
||||||
-- Diagnostics
|
-- Diagnostics
|
||||||
vim.diagnostic.config {
|
vim.diagnostic.config {
|
||||||
|
@ -237,21 +226,7 @@ require'packer'.startup(function(use)
|
||||||
use 'vim-airline/vim-airline'
|
use 'vim-airline/vim-airline'
|
||||||
use 'vim-airline/vim-airline-themes'
|
use 'vim-airline/vim-airline-themes'
|
||||||
use 'romgrk/barbar.nvim'
|
use 'romgrk/barbar.nvim'
|
||||||
use {'MattesGroeger/vim-bookmarks', config = function()
|
use 'MattesGroeger/vim-bookmarks'
|
||||||
vim.g.bookmark_save_per_working_dir = 1
|
|
||||||
end}
|
|
||||||
use {'stevearc/dressing.nvim', config = function()
|
|
||||||
vim.cmd'highlight link FloatTitle TelescopeBorder'
|
|
||||||
require'dressing'.setup {
|
|
||||||
input = {
|
|
||||||
winhighlight = 'NormalFloat:TelescopeNormal,FloatBorder:TelescopeBorder'
|
|
||||||
},
|
|
||||||
select = {
|
|
||||||
enabled = false,
|
|
||||||
telescope = require'telescope.themes'.get_cursor()
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end}
|
|
||||||
use 'j-hui/fidget.nvim'
|
use 'j-hui/fidget.nvim'
|
||||||
use 'tpope/vim-fugitive'
|
use 'tpope/vim-fugitive'
|
||||||
use 'tpope/vim-rhubarb'
|
use 'tpope/vim-rhubarb'
|
||||||
|
@ -274,7 +249,7 @@ require'packer'.startup(function(use)
|
||||||
require'stabilize'.setup()
|
require'stabilize'.setup()
|
||||||
end}
|
end}
|
||||||
use 'mhinz/vim-startify'
|
use 'mhinz/vim-startify'
|
||||||
use {'nvim-telescope/telescope.nvim', after = 'which-key.nvim', config = function()
|
use {'nvim-telescope/telescope.nvim', config = function()
|
||||||
require'telescope'.setup {
|
require'telescope'.setup {
|
||||||
defaults = {
|
defaults = {
|
||||||
sorting_strategy = 'ascending',
|
sorting_strategy = 'ascending',
|
||||||
|
@ -302,7 +277,7 @@ require'packer'.startup(function(use)
|
||||||
full_path = true,
|
full_path = true,
|
||||||
},
|
},
|
||||||
['ui-select'] = {
|
['ui-select'] = {
|
||||||
require'telescope.themes'.get_cursor()
|
require'telescope.themes'.get_dropdown({layout_strategy = 'cursor'})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -310,7 +285,7 @@ require'packer'.startup(function(use)
|
||||||
["<Leader>f"] = {
|
["<Leader>f"] = {
|
||||||
name = 'Telescope',
|
name = 'Telescope',
|
||||||
["<Space>"] = {'<Cmd>Telescope<CR>', 'List pickers'},
|
["<Space>"] = {'<Cmd>Telescope<CR>', 'List pickers'},
|
||||||
f = {'<Cmd>Telescope find_files<CR>', 'Files'},
|
f = {'<Cmd>Telescope find_files hidden=true<CR>', 'Files'},
|
||||||
d = {'<Cmd>Telescope find_files find_command=fd,--type,d,-I<CR>', 'Directories'},
|
d = {'<Cmd>Telescope find_files find_command=fd,--type,d,-I<CR>', 'Directories'},
|
||||||
r = {'<Cmd>Telescope oldfiles<CR>', 'Recent files'},
|
r = {'<Cmd>Telescope oldfiles<CR>', 'Recent files'},
|
||||||
g = {'<Cmd>Telescope live_grep<CR>', 'Grep'},
|
g = {'<Cmd>Telescope live_grep<CR>', 'Grep'},
|
||||||
|
@ -350,7 +325,6 @@ require'packer'.startup(function(use)
|
||||||
-- Finish bootstrap if we just cloned
|
-- Finish bootstrap if we just cloned
|
||||||
if packer_bootstrap then
|
if packer_bootstrap then
|
||||||
require('packer').sync()
|
require('packer').sync()
|
||||||
vim.notify('Bootstrapped plugin manager, you may need to restart neovim')
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -726,11 +700,6 @@ require('nvim-tree').setup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vim.cmd'highlight NvimTreeOpenedFile guifg=NONE gui=italic'
|
vim.cmd'highlight NvimTreeOpenedFile guifg=NONE gui=italic'
|
||||||
vim.api.nvim_create_autocmd('ColorScheme', {
|
|
||||||
group = 'vimrc',
|
|
||||||
desc = 'Change NvimTreeOpenedFile highlight',
|
|
||||||
command = 'highlight NvimTreeOpenedFile guifg=NONE gui=italic'
|
|
||||||
})
|
|
||||||
|
|
||||||
require'which-key'.register{['<Leader>t'] = {'<Cmd>NvimTreeToggle<CR>', 'Nvim Tree'}}
|
require'which-key'.register{['<Leader>t'] = {'<Cmd>NvimTreeToggle<CR>', 'Nvim Tree'}}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue