added toggleterm and whitch-key.nvim.

due to adding whitch-key.nvim, also added descs to all keybinds.
This commit is contained in:
Gabe Venberg 2023-09-07 11:10:29 -05:00
parent 855108ffc2
commit 5f5dc76261
5 changed files with 126 additions and 62 deletions

View file

@ -1,5 +1,7 @@
--- ---
#this syncronizes with settings used by neovims treesitters so that the lsp formatting and treesitter formatting do not fight eatch other. #this syncronizes with settings used by neovims treesitters so that the lsp formatting and treesitter formatting do not fight eatch other.
PointerAlignment: Left
ColumnLimit: 120
IndentWidth: 4 IndentWidth: 4
TabWidth: 4 TabWidth: 4
UseCRLF: false UseCRLF: false

View file

@ -2,13 +2,14 @@
local cmd = vim.cmd local cmd = vim.cmd
local opt = vim.opt local opt = vim.opt
local fn = vim.fn local fn = vim.fn
local map = vim.api.nvim_set_keymap local map = vim.keymap.set
local wk = require("which-key")
--leader key is set through a variable, for some reason. --leader key is set through a variable, for some reason.
vim.g.mapleader = ';' vim.g.mapleader = ';'
--this plugin makes startup time a bit faster. To bootsrap configuration, you need to comment this one out, ignore any errors you get, do packersync, then uncomment it. --this plugin makes startup time a bit faster. To bootsrap configuration, you need to comment this one out, ignore any errors you get, do packersync, then uncomment it.
--require('impatient') require('impatient')
--do package management --do package management
require('packages') require('packages')
@ -33,7 +34,7 @@ opt.linebreak = true
opt.breakindent = true opt.breakindent = true
--add ruler to side of screen. --add ruler to side of screen.
opt.number = true opt.number = true
opt.numberwidth=2 opt.numberwidth=3
--displays cordinates of your cursor in statusbar --displays cordinates of your cursor in statusbar
opt.ruler = true opt.ruler = true
--always leave 5 cells between cursor and side of window. --always leave 5 cells between cursor and side of window.
@ -67,7 +68,7 @@ cmd([[source ~/.config/nvim/foldtext.vimrc]])
opt.foldmethod = 'indent' opt.foldmethod = 'indent'
opt.foldtext = 'minimal_foldtext()' opt.foldtext = 'minimal_foldtext()'
opt.fillchars = 'stl:=,stlnc: ,vert:|,fold:-' opt.fillchars = 'stl:=,stlnc: ,vert:|,fold:-'
opt.foldcolumn = '4' opt.foldcolumn = 'auto:4'
opt.foldenable = true opt.foldenable = true
opt.foldignore = '' opt.foldignore = ''
@ -96,52 +97,68 @@ function _G.Toggle_venn()
end end
--keyboard mappings --keyboard mappings
local opts = { noremap = true, silent = true } local function optsWithDesc(desc)
return {silent=true, desc=desc}
end
--toggle spell check --toggle spell check
map('n', '<leader>sp', ':setlocal spell!<CR>', opts) map('n', '<leader>sp', ':setlocal spell!<CR>', optsWithDesc("toggle spell check"))
--use ctrl+direction to move between splits. --use ctrl+direction to move between splits.
map('n', '<C-h>', '<C-w>h', opts) map('n', '<C-h>', '<C-w>h', optsWithDesc("move to split to the right"))
map('n', '<C-j>', '<C-w>j', opts) map('n', '<C-j>', '<C-w>j', optsWithDesc("move to split below"))
map('n', '<C-k>', '<C-w>k', opts) map('n', '<C-k>', '<C-w>k', optsWithDesc("move to split above"))
map('n', '<C-l>', '<C-w>l', opts) map('n', '<C-l>', '<C-w>l', optsWithDesc("move to split to the left"))
--toggle folds with space. --toggle folds with space.
map('', '<Space>', 'za', opts) map('n', '<Space>', 'za', optsWithDesc("toggle fold"))
--clear highlighting with leader+h --clear highlighting with leader+h
map('', '<leader>h', ':nohls<CR>', opts) map('', '<leader>h', ':nohls<CR>', optsWithDesc("clear highlighting"))
--open nvim-tree with leader+t --open file browser with leader+t
map('n', '<leader>t', ':NvimTreeToggle<CR>', opts) map('n', '<leader>t', ':NvimTreeToggle<CR>', optsWithDesc("toggle file browser"))
--open terminal with ctrl-\
--open symbols-outline with leader+o --open symbols-outline with leader+o
map('n', '<leader>o', ':SymbolsOutline<CR>', opts) map('n', '<leader>o', ':SymbolsOutline<CR>', optsWithDesc("toggle LSP symbol outline"))
--telescope stuff --telescope stuff
map('n', '<leader>ff', ':Telescope find_files<CR>', opts) --setup leader-f prefix in whitch-key
map('n', '<leader>fg', ':Telescope live_grep<CR>', opts) wk.register {
map('n', '<leader>fb', ':Telescope buffers<CR>', opts) ["<leader>f"]={
map('n', '<leader>fm', ':Telescope marks<CR>', opts) name="+telescope"
map('n', '<leader>fp', ':Telescope registers<CR>', opts) }
map('n', '<leader>fs', ':Telescope spell_suggest<CR>', opts) }
map('n', '<leader>fh', ':Telescope keymaps<CR>', opts) map('n', '<leader>ff', ':Telescope find_files<CR>', optsWithDesc("find files"))
map('n', '<leader>fz', ':Telescope current_buffer_fuzzy_find<CR>', opts) map('n', '<leader>fg', ':Telescope live_grep<CR>', optsWithDesc("grep"))
map('n', '<leader>fgc', ':Telescope git_commits<CR>', opts) map('n', '<leader>fb', ':Telescope buffers<CR>', optsWithDesc("find buffers"))
map('n', '<leader>fgb', ':Telescope git_branches<CR>', opts) map('n', '<leader>fm', ':Telescope marks<CR>', optsWithDesc("find marks"))
map('n', '<leader>fgs', ':Telescope git_stash<CR>', opts) map('n', '<leader>fp', ':Telescope registers<CR>', optsWithDesc("search registers"))
map('n', '<leader>fto', ':TodoTelescope', opts) map('n', '<leader>fs', ':Telescope spell_suggest<CR>', optsWithDesc("search spelling suggestions"))
map('n', '<leader>ft', ':Telescope treesitter<CR>', opts) map('n', '<leader>fh', ':Telescope keymaps<CR>', optsWithDesc("search keymaps"))
map('n', '<leader>fz', ':Telescope current_buffer_fuzzy_find<CR>', optsWithDesc("fuzzy find"))
map('n', '<leader>fgc', ':Telescope git_commits<CR>', optsWithDesc("search git commits"))
map('n', '<leader>fgb', ':Telescope git_branches<CR>', optsWithDesc("search git branches"))
map('n', '<leader>fgs', ':Telescope git_stash<CR>', optsWithDesc("search git stash"))
map('n', '<leader>fto', ':TodoTelescope', optsWithDesc("search todos"))
map('n', '<leader>ft', ':Telescope treesitter<CR>', optsWithDesc("search treesitter"))
--Treesitter context --Treesitter context
map('n', '<leader>c', ':TSContextToggle<CR>', opts) map('n', '<leader>c', ':TSContextToggle<CR>', optsWithDesc("toggle ts context"))
--tabline stuff (gt and gT are prev/next tab in stock vim) --tabline stuff (gt and gT are prev/next tab in stock vim)
map('n', 'gf', ':TablineBufferNext<CR>', opts) map('n', 'gf', ':TablineBufferNext<CR>', optsWithDesc("next buffer"))
map('n', 'gF', ':TablineBufferPrevious<CR>', opts) map('n', 'gF', ':TablineBufferPrevious<CR>', optsWithDesc("prev buffer"))
--gitsigns --gitsigns
map('n', '<leader>bl', ':Gitsigns toggle_current_line_blame<CR>', opts) map('n', '<leader>bl', ':Gitsigns toggle_current_line_blame<CR>', optsWithDesc("toggle inline git blame"))
--trouble plugin. --trouble plugin.
vim.keymap.set("n", "<leader>xx", "<cmd>TroubleToggle<cr>", opts) wk.register {
vim.keymap.set("n", "<leader>xw", "<cmd>TroubleToggle workspace_diagnostics<cr>", opts) ["<leader>x"]={
vim.keymap.set("n", "<leader>xd", "<cmd>TroubleToggle document_diagnostics<cr>", opts) name="+trouble"
vim.keymap.set("n", "<leader>xl", "<cmd>TroubleToggle loclist<cr>", opts) }
vim.keymap.set("n", "<leader>xq", "<cmd>TroubleToggle quickfix<cr>", opts) }
vim.keymap.set("n", "<leader>lR", "<cmd>TroubleToggle lsp_references<cr>", opts) map("n", "<leader>xx", "<cmd>TroubleToggle<cr>", optsWithDesc("toggle trouble"))
vim.keymap.set("n", "<leader>lD", "<cmd>TroubleToggle lsp_definitions<cr>", opts) map("n", "<leader>xw", "<cmd>TroubleToggle workspace_diagnostics<cr>", optsWithDesc("workspace diagnostics"))
map("n", "<leader>xd", "<cmd>TroubleToggle document_diagnostics<cr>", optsWithDesc("document diagnostics"))
map("n", "<leader>xl", "<cmd>TroubleToggle loclist<cr>", optsWithDesc("location list"))
map("n", "<leader>xq", "<cmd>TroubleToggle quickfix<cr>", optsWithDesc("quickfix list"))
map("n", "<leader>lR", "<cmd>TroubleToggle lsp_references<cr>", optsWithDesc("lsp references"))
map("n", "<leader>lD", "<cmd>TroubleToggle lsp_definitions<cr>", optsWithDesc("lsp definitions"))
-- toggle keymappings for venn using <leader>v -- toggle keymappings for venn using <leader>v
map('n', '<leader>v', ":lua Toggle_venn()<CR>", { noremap = true }) map('n', '<leader>v', ":lua Toggle_venn()<CR>", optsWithDesc("toggle venn.nvim"))
-- treesj -- treesj
map('n', '<leader>j', ':TSJToggle<CR>', opts) map('n', '<leader>j', ':TSJToggle<CR>', optsWithDesc("treesitter split/join"))

View file

@ -9,27 +9,39 @@ local on_attach = function()
set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings. -- Mappings.
local opts = { noremap = true, silent = true } local function optsWithDesc(desc)
return { silent = true, desc = desc }
end
--setup leader-l prefix in whitch-key
local wk = require("which-key")
wk.register {
["<leader>l"]={
name="+lsp"
}
}
-- See `:help vim.lsp.*` for documentation on any of the below functions -- See `:help vim.lsp.*` for documentation on any of the below functions
set_keymap('', '<leader>lc', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts) set_keymap('', '<leader>lc', '<cmd>lua vim.lsp.buf.declaration()<CR>', optsWithDesc("jump to declaration"))
set_keymap('', '<leader>ld', '<cmd>lua vim.lsp.buf.definition()<CR>', opts) set_keymap('', '<leader>ld', '<cmd>lua vim.lsp.buf.definition()<CR>', optsWithDesc("jump to definition"))
set_keymap('', '<leader>lh', '<cmd>lua vim.lsp.buf.hover()<CR>', opts) set_keymap('', '<leader>lh', '<cmd>lua vim.lsp.buf.hover()<CR>', optsWithDesc("show lsp hover info"))
set_keymap('', '<leader>li', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts) set_keymap('', '<leader>li', '<cmd>lua vim.lsp.buf.implementation()<CR>', optsWithDesc("show implementations"))
set_keymap('', '<leader>ls', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) set_keymap('', '<leader>ls', '<cmd>lua vim.lsp.buf.signature_help()<CR>', optsWithDesc("show signature help"))
set_keymap('', '<leader>lwa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) set_keymap('', '<leader>lwa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', optsWithDesc("add workspace folder"))
set_keymap('', '<leader>lwr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) set_keymap('', '<leader>lwr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>',
set_keymap('', '<leader>lw', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) optsWithDesc("remove workspace folder"))
set_keymap('', '<leader>lt', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) set_keymap('', '<leader>lw', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>',
set_keymap('', '<leader>lr', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) optsWithDesc("show workspace folders"))
set_keymap('', '<leader>la', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts) set_keymap('', '<leader>lr', '<cmd>lua vim.lsp.buf.rename()<CR>', optsWithDesc("rename symbol"))
set_keymap('', '<leader>le', '<cmd>lua vim.lsp.buf.references()<CR>', opts) set_keymap('', '<leader>la', '<cmd>lua vim.lsp.buf.code_action()<CR>', optsWithDesc("lsp code action"))
set_keymap('', '<leader>lo', '<cmd>lua vim.diagnostic.open_float()<CR>', opts) set_keymap('', '<leader>le', '<cmd>lua vim.lsp.buf.references()<CR>', optsWithDesc("list references"))
set_keymap('', '<leader>ln', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts) set_keymap('', '<leader>lo', '<cmd>lua vim.diagnostic.open_float()<CR>',
set_keymap('', '<leader>lp', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts) optsWithDesc("show diagnostic in floating window"))
set_keymap('', '<leader>lm', '<cmd>lua vim.lsp.buf.format {async=true}<CR>', opts) set_keymap('', '<leader>ln', '<cmd>lua vim.diagnostic.goto_next()<CR>', optsWithDesc("next lsp diagnostic"))
set_keymap('', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts) set_keymap('', '<leader>lp', '<cmd>lua vim.diagnostic.goto_prev()<CR>', optsWithDesc("prev lsp diagnostic"))
set_keymap('', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts) set_keymap('', '<leader>lm', '<cmd>lua vim.lsp.buf.format {async=true}<CR>', optsWithDesc("format buffer"))
set_keymap('', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', optsWithDesc("next lsp diagnostic"))
set_keymap('', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', optsWithDesc("prev lsp diagnostic"))
end end
require("mason-lspconfig").setup_handlers({ require("mason-lspconfig").setup_handlers({
function(server_name) function(server_name)

View file

@ -207,7 +207,6 @@ return require('packer').startup(function(use)
local opts = { local opts = {
-- your configuration comes here -- your configuration comes here
-- or leave it empty to use the default settings -- or leave it empty to use the default settings
-- refer to the configuration section below
} }
require("todo-comments").setup(opts) require("todo-comments").setup(opts)
end end
@ -340,8 +339,37 @@ return require('packer').startup(function(use)
end end
} }
use {
"folke/which-key.nvim",
config = function()
vim.o.timeout = true
vim.o.timeoutlen = 300
-- default kemaps that whitch-key misses.
local wk = require("which-key")
wk.register {
g = {
t = "next tab",
T = "previous tab"
},
}
require("which-key").setup {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
-- local wk = require("which-key")
}
end
}
--UI stuff --UI stuff
use { "akinsho/toggleterm.nvim", tag = '*', config = function()
require("toggleterm").setup {
insert_mappings = false,
open_mapping = [[<c-\>]],
}
end }
use { 'simrat39/symbols-outline.nvim', use { 'simrat39/symbols-outline.nvim',
config = function() config = function()
local opts = { local opts = {
@ -451,7 +479,9 @@ return require('packer').startup(function(use)
config = function() require('gitsigns').setup() end config = function() require('gitsigns').setup() end
} }
use 'chentau/marks.nvim' use { 'chentau/marks.nvim' }
use { 'sitiom/nvim-numbertoggle' }
use { 'lukas-reineke/indent-blankline.nvim', use { 'lukas-reineke/indent-blankline.nvim',
config = function() config = function()

View file

@ -61,6 +61,9 @@ bind r source-file ~/.tmux.conf
#fix annoying escape behavior #fix annoying escape behavior
set -sg escape-time 0 set -sg escape-time 0
#pass through focus events
set -g focus-events on
#customizing ma tmux status line! #customizing ma tmux status line!
#make sure the left status line can hold the stuff we are about to give it. #make sure the left status line can hold the stuff we are about to give it.
set -g status-left-length 20 set -g status-left-length 20