diff --git a/neovim/.clang-format b/neovim/.clang-format index c44d557..c68dd42 100644 --- a/neovim/.clang-format +++ b/neovim/.clang-format @@ -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. +PointerAlignment: Left +ColumnLimit: 120 IndentWidth: 4 TabWidth: 4 UseCRLF: false diff --git a/neovim/.config/nvim/init.lua b/neovim/.config/nvim/init.lua index 26d32a0..1af14d7 100644 --- a/neovim/.config/nvim/init.lua +++ b/neovim/.config/nvim/init.lua @@ -2,13 +2,14 @@ local cmd = vim.cmd local opt = vim.opt 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. 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. ---require('impatient') +require('impatient') --do package management require('packages') @@ -33,7 +34,7 @@ opt.linebreak = true opt.breakindent = true --add ruler to side of screen. opt.number = true -opt.numberwidth=2 +opt.numberwidth=3 --displays cordinates of your cursor in statusbar opt.ruler = true --always leave 5 cells between cursor and side of window. @@ -67,7 +68,7 @@ cmd([[source ~/.config/nvim/foldtext.vimrc]]) opt.foldmethod = 'indent' opt.foldtext = 'minimal_foldtext()' opt.fillchars = 'stl:=,stlnc: ,vert:|,fold:-' -opt.foldcolumn = '4' +opt.foldcolumn = 'auto:4' opt.foldenable = true opt.foldignore = '' @@ -96,52 +97,68 @@ function _G.Toggle_venn() end --keyboard mappings -local opts = { noremap = true, silent = true } +local function optsWithDesc(desc) + return {silent=true, desc=desc} +end --toggle spell check -map('n', 'sp', ':setlocal spell!', opts) +map('n', 'sp', ':setlocal spell!', optsWithDesc("toggle spell check")) --use ctrl+direction to move between splits. -map('n', '', 'h', opts) -map('n', '', 'j', opts) -map('n', '', 'k', opts) -map('n', '', 'l', opts) +map('n', '', 'h', optsWithDesc("move to split to the right")) +map('n', '', 'j', optsWithDesc("move to split below")) +map('n', '', 'k', optsWithDesc("move to split above")) +map('n', '', 'l', optsWithDesc("move to split to the left")) --toggle folds with space. -map('', '', 'za', opts) +map('n', '', 'za', optsWithDesc("toggle fold")) --clear highlighting with leader+h -map('', 'h', ':nohls', opts) ---open nvim-tree with leader+t -map('n', 't', ':NvimTreeToggle', opts) +map('', 'h', ':nohls', optsWithDesc("clear highlighting")) +--open file browser with leader+t +map('n', 't', ':NvimTreeToggle', optsWithDesc("toggle file browser")) +--open terminal with ctrl-\ --open symbols-outline with leader+o -map('n', 'o', ':SymbolsOutline', opts) +map('n', 'o', ':SymbolsOutline', optsWithDesc("toggle LSP symbol outline")) --telescope stuff -map('n', 'ff', ':Telescope find_files', opts) -map('n', 'fg', ':Telescope live_grep', opts) -map('n', 'fb', ':Telescope buffers', opts) -map('n', 'fm', ':Telescope marks', opts) -map('n', 'fp', ':Telescope registers', opts) -map('n', 'fs', ':Telescope spell_suggest', opts) -map('n', 'fh', ':Telescope keymaps', opts) -map('n', 'fz', ':Telescope current_buffer_fuzzy_find', opts) -map('n', 'fgc', ':Telescope git_commits', opts) -map('n', 'fgb', ':Telescope git_branches', opts) -map('n', 'fgs', ':Telescope git_stash', opts) -map('n', 'fto', ':TodoTelescope', opts) -map('n', 'ft', ':Telescope treesitter', opts) +--setup leader-f prefix in whitch-key +wk.register { + ["f"]={ + name="+telescope" + } +} +map('n', 'ff', ':Telescope find_files', optsWithDesc("find files")) +map('n', 'fg', ':Telescope live_grep', optsWithDesc("grep")) +map('n', 'fb', ':Telescope buffers', optsWithDesc("find buffers")) +map('n', 'fm', ':Telescope marks', optsWithDesc("find marks")) +map('n', 'fp', ':Telescope registers', optsWithDesc("search registers")) +map('n', 'fs', ':Telescope spell_suggest', optsWithDesc("search spelling suggestions")) +map('n', 'fh', ':Telescope keymaps', optsWithDesc("search keymaps")) +map('n', 'fz', ':Telescope current_buffer_fuzzy_find', optsWithDesc("fuzzy find")) +map('n', 'fgc', ':Telescope git_commits', optsWithDesc("search git commits")) +map('n', 'fgb', ':Telescope git_branches', optsWithDesc("search git branches")) +map('n', 'fgs', ':Telescope git_stash', optsWithDesc("search git stash")) +map('n', 'fto', ':TodoTelescope', optsWithDesc("search todos")) +map('n', 'ft', ':Telescope treesitter', optsWithDesc("search treesitter")) --Treesitter context -map('n', 'c', ':TSContextToggle', opts) +map('n', 'c', ':TSContextToggle', optsWithDesc("toggle ts context")) --tabline stuff (gt and gT are prev/next tab in stock vim) -map('n', 'gf', ':TablineBufferNext', opts) -map('n', 'gF', ':TablineBufferPrevious', opts) +map('n', 'gf', ':TablineBufferNext', optsWithDesc("next buffer")) +map('n', 'gF', ':TablineBufferPrevious', optsWithDesc("prev buffer")) --gitsigns -map('n', 'bl', ':Gitsigns toggle_current_line_blame', opts) +map('n', 'bl', ':Gitsigns toggle_current_line_blame', optsWithDesc("toggle inline git blame")) --trouble plugin. -vim.keymap.set("n", "xx", "TroubleToggle", opts) -vim.keymap.set("n", "xw", "TroubleToggle workspace_diagnostics", opts) -vim.keymap.set("n", "xd", "TroubleToggle document_diagnostics", opts) -vim.keymap.set("n", "xl", "TroubleToggle loclist", opts) -vim.keymap.set("n", "xq", "TroubleToggle quickfix", opts) -vim.keymap.set("n", "lR", "TroubleToggle lsp_references", opts) -vim.keymap.set("n", "lD", "TroubleToggle lsp_definitions", opts) +wk.register { + ["x"]={ + name="+trouble" + } +} +map("n", "xx", "TroubleToggle", optsWithDesc("toggle trouble")) +map("n", "xw", "TroubleToggle workspace_diagnostics", optsWithDesc("workspace diagnostics")) +map("n", "xd", "TroubleToggle document_diagnostics", optsWithDesc("document diagnostics")) +map("n", "xl", "TroubleToggle loclist", optsWithDesc("location list")) +map("n", "xq", "TroubleToggle quickfix", optsWithDesc("quickfix list")) +map("n", "lR", "TroubleToggle lsp_references", optsWithDesc("lsp references")) +map("n", "lD", "TroubleToggle lsp_definitions", optsWithDesc("lsp definitions")) -- toggle keymappings for venn using v -map('n', 'v', ":lua Toggle_venn()", { noremap = true }) +map('n', 'v', ":lua Toggle_venn()", optsWithDesc("toggle venn.nvim")) -- treesj -map('n', 'j', ':TSJToggle', opts) +map('n', 'j', ':TSJToggle', optsWithDesc("treesitter split/join")) + + diff --git a/neovim/.config/nvim/lua/LSPconfig.lua b/neovim/.config/nvim/lua/LSPconfig.lua index 12e4319..6405c55 100644 --- a/neovim/.config/nvim/lua/LSPconfig.lua +++ b/neovim/.config/nvim/lua/LSPconfig.lua @@ -9,27 +9,39 @@ local on_attach = function() set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') -- 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 { + ["l"]={ + name="+lsp" + } + } -- See `:help vim.lsp.*` for documentation on any of the below functions - set_keymap('', 'lc', 'lua vim.lsp.buf.declaration()', opts) - set_keymap('', 'ld', 'lua vim.lsp.buf.definition()', opts) - set_keymap('', 'lh', 'lua vim.lsp.buf.hover()', opts) - set_keymap('', 'li', 'lua vim.lsp.buf.implementation()', opts) - set_keymap('', 'ls', 'lua vim.lsp.buf.signature_help()', opts) - set_keymap('', 'lwa', 'lua vim.lsp.buf.add_workspace_folder()', opts) - set_keymap('', 'lwr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) - set_keymap('', 'lw', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) - set_keymap('', 'lt', 'lua vim.lsp.buf.type_definition()', opts) - set_keymap('', 'lr', 'lua vim.lsp.buf.rename()', opts) - set_keymap('', 'la', 'lua vim.lsp.buf.code_action()', opts) - set_keymap('', 'le', 'lua vim.lsp.buf.references()', opts) - set_keymap('', 'lo', 'lua vim.diagnostic.open_float()', opts) - set_keymap('', 'ln', 'lua vim.diagnostic.goto_next()', opts) - set_keymap('', 'lp', 'lua vim.diagnostic.goto_prev()', opts) - set_keymap('', 'lm', 'lua vim.lsp.buf.format {async=true}', opts) - set_keymap('', ']d', 'lua vim.diagnostic.goto_next()', opts) - set_keymap('', '[d', 'lua vim.diagnostic.goto_prev()', opts) + set_keymap('', 'lc', 'lua vim.lsp.buf.declaration()', optsWithDesc("jump to declaration")) + set_keymap('', 'ld', 'lua vim.lsp.buf.definition()', optsWithDesc("jump to definition")) + set_keymap('', 'lh', 'lua vim.lsp.buf.hover()', optsWithDesc("show lsp hover info")) + set_keymap('', 'li', 'lua vim.lsp.buf.implementation()', optsWithDesc("show implementations")) + set_keymap('', 'ls', 'lua vim.lsp.buf.signature_help()', optsWithDesc("show signature help")) + set_keymap('', 'lwa', 'lua vim.lsp.buf.add_workspace_folder()', optsWithDesc("add workspace folder")) + set_keymap('', 'lwr', 'lua vim.lsp.buf.remove_workspace_folder()', + optsWithDesc("remove workspace folder")) + set_keymap('', 'lw', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', + optsWithDesc("show workspace folders")) + set_keymap('', 'lr', 'lua vim.lsp.buf.rename()', optsWithDesc("rename symbol")) + set_keymap('', 'la', 'lua vim.lsp.buf.code_action()', optsWithDesc("lsp code action")) + set_keymap('', 'le', 'lua vim.lsp.buf.references()', optsWithDesc("list references")) + set_keymap('', 'lo', 'lua vim.diagnostic.open_float()', + optsWithDesc("show diagnostic in floating window")) + set_keymap('', 'ln', 'lua vim.diagnostic.goto_next()', optsWithDesc("next lsp diagnostic")) + set_keymap('', 'lp', 'lua vim.diagnostic.goto_prev()', optsWithDesc("prev lsp diagnostic")) + set_keymap('', 'lm', 'lua vim.lsp.buf.format {async=true}', optsWithDesc("format buffer")) + set_keymap('', ']d', 'lua vim.diagnostic.goto_next()', optsWithDesc("next lsp diagnostic")) + set_keymap('', '[d', 'lua vim.diagnostic.goto_prev()', optsWithDesc("prev lsp diagnostic")) end require("mason-lspconfig").setup_handlers({ function(server_name) diff --git a/neovim/.config/nvim/lua/packages.lua b/neovim/.config/nvim/lua/packages.lua index 9b29611..3dce1e3 100644 --- a/neovim/.config/nvim/lua/packages.lua +++ b/neovim/.config/nvim/lua/packages.lua @@ -207,7 +207,6 @@ return require('packer').startup(function(use) local opts = { -- your configuration comes here -- or leave it empty to use the default settings - -- refer to the configuration section below } require("todo-comments").setup(opts) end @@ -340,8 +339,37 @@ return require('packer').startup(function(use) 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 + use { "akinsho/toggleterm.nvim", tag = '*', config = function() + require("toggleterm").setup { + insert_mappings = false, + open_mapping = [[]], + } + end } + use { 'simrat39/symbols-outline.nvim', config = function() local opts = { @@ -451,7 +479,9 @@ return require('packer').startup(function(use) config = function() require('gitsigns').setup() end } - use 'chentau/marks.nvim' + use { 'chentau/marks.nvim' } + + use { 'sitiom/nvim-numbertoggle' } use { 'lukas-reineke/indent-blankline.nvim', config = function() diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index ed1b476..abb88b0 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -61,6 +61,9 @@ bind r source-file ~/.tmux.conf #fix annoying escape behavior set -sg escape-time 0 +#pass through focus events +set -g focus-events on + #customizing ma tmux status line! #make sure the left status line can hold the stuff we are about to give it. set -g status-left-length 20