mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-15 06:32:40 +00:00
Added nvim/which-key
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
require('plugins')
|
require('plugins')
|
||||||
|
|
||||||
-- Key maps
|
-- Key maps
|
||||||
require('keymaps')
|
require('mappings')
|
||||||
|
|
||||||
-- Common settings
|
-- Common settings
|
||||||
require('settings')
|
require('settings')
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
-- disable v
|
--isable v
|
||||||
-- local presets = require("which-key.plugins.presets")
|
-- local presets = require("which-key.plugins.presets")
|
||||||
-- presets.operators["v"] = nil
|
-- presets.operators["v"] = nil
|
||||||
require("which-key").setup {
|
require("which-key").setup {
|
||||||
@@ -63,8 +63,8 @@ require("which-key").setup {
|
|||||||
i = {"j", "k"},
|
i = {"j", "k"},
|
||||||
v = {"j", "k"}
|
v = {"j", "k"}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
local wk = require("which-key")
|
local wk = require("which-key")
|
||||||
default_options = {noremap = true, silent = true}
|
default_options = {noremap = true, silent = true}
|
||||||
|
|
||||||
@@ -72,8 +72,17 @@ default_options = {noremap = true, silent = true}
|
|||||||
--wk.register({ga = {"<Plug>(EasyAlign)", "Align", mode = "x"}})
|
--wk.register({ga = {"<Plug>(EasyAlign)", "Align", mode = "x"}})
|
||||||
|
|
||||||
-- Register all leader based mappings
|
-- Register all leader based mappings
|
||||||
|
local wk = require("which-key")
|
||||||
|
-- As an example, we will create the following mappings:
|
||||||
|
-- * <leader>ff find files
|
||||||
|
-- * <leader>fr show recent files
|
||||||
|
-- * <leader>fb Foobar
|
||||||
|
-- we'll document:
|
||||||
|
-- * <leader>fn new file
|
||||||
|
-- * <leader>fe edit file
|
||||||
|
-- and hide <leader>1
|
||||||
wk.register({
|
wk.register({
|
||||||
["<Tab>"] = {"<cmd>e#<cr>", "Switch to previously opened buffer"},
|
["<leader>"] = {
|
||||||
b = {
|
b = {
|
||||||
name = "Buffers",
|
name = "Buffers",
|
||||||
b = {
|
b = {
|
||||||
@@ -82,40 +91,15 @@ wk.register({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
f = {
|
f = {
|
||||||
name = "Files",
|
name = "File",
|
||||||
s = {"<cmd>w<cr>", "Save Buffer"},
|
f = { "<cmd>Telescope find_files<cr>", "Find File" },
|
||||||
f = {
|
r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
|
||||||
"<cmd>lua require'telescope.builtin'.find_files({ find_command = {'fd', '--hidden', '--type', 'file', '--follow'}})<cr>",
|
n = { "<cmd>enew<cr>", "New File" },
|
||||||
"Find File"
|
|
||||||
},
|
|
||||||
l = {"<cmd>Lf<cr>", "Open LF"},
|
|
||||||
p = {"<cmd>NvimTreeToggle<cr>", "Toogle Tree"},
|
|
||||||
r = {"<cmd>Telescope oldfiles<cr>", "Open Recent File"},
|
|
||||||
T = {"<cmd>NvimTreeFindFile<CR>", "Find in Tree"}
|
|
||||||
},
|
},
|
||||||
s = {
|
},
|
||||||
name = "Search",
|
s = {
|
||||||
c = {"<cmd>Telescope colorscheme<cr>", "Colorscheme"},
|
name = "Search",
|
||||||
h = {"<cmd>Telescope help_tags<cr>", "Find Help"},
|
c = {"<cmd>Telescope colorscheme<cr>", "Colorscheme" }
|
||||||
M = {"<cmd>Telescope man_pages<cr>", "Man Pages"},
|
}
|
||||||
R = {"<cmd>Telescope registers<cr>", "Registers"},
|
|
||||||
t = {"<cmd>Telescope live_grep<cr>", "Text"},
|
})
|
||||||
s = {"<cmd>Telescope grep_string<cr>", "Text under cursor"},
|
|
||||||
k = {"<cmd>Telescope keymaps<cr>", "Keymaps"},
|
|
||||||
C = {"<cmd>Telescope commands<cr>", "Commands"},
|
|
||||||
p = {"<cmd>Telescope projects<cr>", "Projects"},
|
|
||||||
P = {
|
|
||||||
"<cmd>lua require('telescope.builtin.internal').colorscheme({enable_preview = true})<cr>",
|
|
||||||
"Colorscheme with Preview"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
w = {
|
|
||||||
name = "Window",
|
|
||||||
q = {"<cmd>:q<cr>", "Close"},
|
|
||||||
s = {"<cmd>:split<cr>", "Horizontal Split"},
|
|
||||||
t = {"<c-w>t", "Move to new tab"},
|
|
||||||
["="] = {"<c-w>=", "Equally size"},
|
|
||||||
v = {"<cmd>:vsplit<cr>", "Verstical Split"},
|
|
||||||
w = {"<c-w>x", "Swap"}
|
|
||||||
},
|
|
||||||
}, {prefix = "<leader>", mode = "n", default_options})
|
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
local keymap = vim.api.nvim_set_keymap
|
|
||||||
default_options = {noremap = true, silent = true}
|
|
||||||
expr_options = {noremap = true, expr = true, silent = true}
|
|
||||||
|
|
||||||
-- map the leader key
|
|
||||||
--keymap('n', '<Space>', '<NOP>', default_options)
|
|
||||||
vim.g.mapleader = ","
|
|
||||||
|
|
||||||
-- easier escape key mapping
|
|
||||||
keymap('i', 'jk', '<ESC>', default_options)
|
|
||||||
|
|
||||||
keymap('n', '<c-s>', ':w<CR>', default_options)
|
|
||||||
keymap('i', '<c-s>', '<ESC>:w<CR>a', default_options)
|
|
||||||
|
|
||||||
-- buffer focus
|
|
||||||
local opts = { noremap = true }
|
|
||||||
keymap('n', '<c-j>', '<c-w>j', default_options)
|
|
||||||
keymap('n', '<c-h>', '<c-w>h', default_options)
|
|
||||||
keymap('n', '<c-k>', '<c-w>k', default_options)
|
|
||||||
keymap('n', '<c-l>', '<c-w>l', default_options)
|
|
||||||
|
|
||||||
-- refresh config
|
|
||||||
--keymap('n', '<Leader>so', ':so $MYVIMRC<CR>', default_opts)
|
|
||||||
|
|
||||||
--keymap('n', '<C-n>', ':NvimTreeToggle<CR>', default_opts)
|
|
||||||
-- find files
|
|
||||||
--keymap('n', '<Leader>f', ':Telescope find_files<cr>', default_opts)
|
|
||||||
|
|
||||||
33
nvim/.config/nvim/lua/mappings.lua
Normal file
33
nvim/.config/nvim/lua/mappings.lua
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
local keymap = vim.api.nvim_set_keymap
|
||||||
|
default_options = {noremap = true, silent = true}
|
||||||
|
expr_options = {noremap = true, expr = true, silent = true}
|
||||||
|
|
||||||
|
-- map the leader key
|
||||||
|
keymap('n', '<Space>', '<NOP>', default_options)
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
|
||||||
|
-- easier escape key mapping
|
||||||
|
keymap('i', 'jk', '<ESC>', default_options)
|
||||||
|
|
||||||
|
keymap('n', '<c-s>', ':w<CR>', default_options)
|
||||||
|
keymap('i', '<c-s>', '<ESC>:w<CR>a', default_options)
|
||||||
|
|
||||||
|
-- paste over currently selected text without yanking it
|
||||||
|
keymap("v", "p", "\"_dP", default_options)
|
||||||
|
|
||||||
|
-- buffer focus
|
||||||
|
local opts = { noremap = true }
|
||||||
|
keymap('n', '<c-j>', '<c-w>j', default_options)
|
||||||
|
keymap('n', '<c-h>', '<c-w>h', default_options)
|
||||||
|
keymap('n', '<c-k>', '<c-w>k', default_options)
|
||||||
|
keymap('n', '<c-l>', '<c-w>l', default_options)
|
||||||
|
|
||||||
|
-- Resizing panes
|
||||||
|
keymap("n", "<Left>", ":vertical resize +1<CR>", default_options)
|
||||||
|
keymap("n", "<Right>", ":vertical resize -1<CR>", default_options)
|
||||||
|
keymap("n", "<Up>", ":resize -1<CR>", default_options)
|
||||||
|
keymap("n", "<Down>", ":resize +1<CR>", default_options)
|
||||||
|
|
||||||
|
-- Move selected line / block of text in visual mode
|
||||||
|
keymap("x", "K", ":move '<-2<CR>gv-gv", default_options)
|
||||||
|
keymap("x", "J", ":move '>+1<CR>gv-gv", default_options)
|
||||||
@@ -1,24 +1,3 @@
|
|||||||
-- Nightfox
|
-- Nightfox
|
||||||
require('nightfox').load('nordfox')
|
require('nightfox').load('nordfox')
|
||||||
|
|
||||||
-- Tokyo Night
|
|
||||||
-- Example config in Lua
|
|
||||||
--vim.g.tokyonight_style = "storm"
|
|
||||||
--vim.g.tokyonight_italic_functions = true
|
|
||||||
--vim.g.tokyonight_sidebars = { "qf", "vista_kind", "terminal", "packer" }
|
|
||||||
|
|
||||||
-- Change the "hint" color to the "orange" color, and make the "error" color bright red
|
|
||||||
--vim.g.tokyonight_colors = { hint = "orange", error = "#ff0000" }
|
|
||||||
|
|
||||||
-- Load the colorscheme
|
|
||||||
--vim.cmd[[colorscheme tokyonight]]
|
|
||||||
|
|
||||||
-- Nord
|
|
||||||
-- Example config in lua
|
|
||||||
--vim.g.nord_contrast = true
|
|
||||||
--vim.g.nord_borders = false
|
|
||||||
--vim.g.nord_disable_background = false
|
|
||||||
--vim.g.nord_italic = false
|
|
||||||
|
|
||||||
-- Load the colorscheme
|
|
||||||
--require('nord').set()
|
|
||||||
|
|||||||
@@ -87,6 +87,17 @@ _G.packer_plugins = {
|
|||||||
path = "/Users/michael/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
|
path = "/Users/michael/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
|
||||||
url = "https://github.com/kyazdani42/nvim-tree.lua"
|
url = "https://github.com/kyazdani42/nvim-tree.lua"
|
||||||
},
|
},
|
||||||
|
["nvim-treesitter"] = {
|
||||||
|
config = { 'require("config/treesitter")' },
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/michael/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
||||||
|
url = "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||||
|
},
|
||||||
|
["nvim-treesitter-textobjects"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/michael/.local/share/nvim/site/pack/packer/start/nvim-treesitter-textobjects",
|
||||||
|
url = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects"
|
||||||
|
},
|
||||||
["nvim-web-devicons"] = {
|
["nvim-web-devicons"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/Users/michael/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
|
path = "/Users/michael/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
|
||||||
@@ -107,14 +118,22 @@ _G.packer_plugins = {
|
|||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/Users/michael/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
path = "/Users/michael/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||||
url = "https://github.com/nvim-telescope/telescope.nvim"
|
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||||
|
},
|
||||||
|
["which-key.nvim"] = {
|
||||||
|
config = { 'require("config/which")' },
|
||||||
|
loaded = false,
|
||||||
|
needs_bufread = false,
|
||||||
|
only_cond = false,
|
||||||
|
path = "/Users/michael/.local/share/nvim/site/pack/packer/opt/which-key.nvim",
|
||||||
|
url = "https://github.com/folke/which-key.nvim"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
time([[Defining packer_plugins]], false)
|
time([[Defining packer_plugins]], false)
|
||||||
-- Config for: nvim-tree.lua
|
-- Config for: lualine.nvim
|
||||||
time([[Config for nvim-tree.lua]], true)
|
time([[Config for lualine.nvim]], true)
|
||||||
require("config/nvim-tree")
|
require("config/lualine")
|
||||||
time([[Config for nvim-tree.lua]], false)
|
time([[Config for lualine.nvim]], false)
|
||||||
-- Config for: nightfox.nvim
|
-- Config for: nightfox.nvim
|
||||||
time([[Config for nightfox.nvim]], true)
|
time([[Config for nightfox.nvim]], true)
|
||||||
require("config/nightfox")
|
require("config/nightfox")
|
||||||
@@ -123,10 +142,21 @@ time([[Config for nightfox.nvim]], false)
|
|||||||
time([[Config for telescope.nvim]], true)
|
time([[Config for telescope.nvim]], true)
|
||||||
require("config/telescope")
|
require("config/telescope")
|
||||||
time([[Config for telescope.nvim]], false)
|
time([[Config for telescope.nvim]], false)
|
||||||
-- Config for: lualine.nvim
|
-- Config for: nvim-treesitter
|
||||||
time([[Config for lualine.nvim]], true)
|
time([[Config for nvim-treesitter]], true)
|
||||||
require("config/lualine")
|
require("config/treesitter")
|
||||||
time([[Config for lualine.nvim]], false)
|
time([[Config for nvim-treesitter]], false)
|
||||||
|
-- Config for: nvim-tree.lua
|
||||||
|
time([[Config for nvim-tree.lua]], true)
|
||||||
|
require("config/nvim-tree")
|
||||||
|
time([[Config for nvim-tree.lua]], false)
|
||||||
|
vim.cmd [[augroup packer_load_aucmds]]
|
||||||
|
vim.cmd [[au!]]
|
||||||
|
-- Event lazy-loads
|
||||||
|
time([[Defining lazy-load event autocommands]], true)
|
||||||
|
vim.cmd [[au VimEnter * ++once lua require("packer.load")({'which-key.nvim'}, { event = "VimEnter *" }, _G.packer_plugins)]]
|
||||||
|
time([[Defining lazy-load event autocommands]], false)
|
||||||
|
vim.cmd("augroup END")
|
||||||
if should_profile then save_profiles() end
|
if should_profile then save_profiles() end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user