diff --git a/neovim/.config/nvim/init.lua b/neovim/.config/nvim/init.lua index d352c0f..9cf2d13 100644 --- a/neovim/.config/nvim/init.lua +++ b/neovim/.config/nvim/init.lua @@ -1,8 +1,8 @@ --set some aliases to make typing this faster. -local cmd=vim.cmd -local opt=vim.opt -local fn=vim.fn -local map=vim.api.nvim_set_keymap +local cmd = vim.cmd +local opt = vim.opt +local fn = vim.fn +local map = vim.api.nvim_set_keymap --leader key is set through a variable, for some reason. vim.g.mapleader = ';' @@ -13,63 +13,63 @@ require('impatient') require('packages') --helper functions - local function keyCode(string) - return vim.api.nvim_replace_termcodes(str, true, true, true, true) - end +local function keyCode(string) + return vim.api.nvim_replace_termcodes(str, true, true, true, true) +end --options using vim.opt (aliased, of course.) - opt.mouse='a' - opt.lazyredraw=true - opt.termguicolors=true - opt.autoread=true - opt.swapfile=false - opt.history=500 - opt.formatoptions='rojq' - --disable hard text wrapping, will only wrap visually. - opt.textwidth=0 - opt.wrapmargin=0 - opt.wrap=true - opt.linebreak=true - opt.breakindent=true - --add ruler to side of screen. - opt.number=true - --displays cordinates of your cursor in statusbar - opt.ruler=true - --always leave 5 cells between cursor and side of window. - opt.scrolloff=5 - opt.sidescrolloff=5 - --better command line completion - opt.wildmenu=true - --ignore case in search if search is all lowercase. - opt.ignorecase=true - opt.smartcase=true - --show unfinished commands in statusbar. - opt.showcmd=true - --regex stuff - opt.magic=true - --always have a status line - opt.laststatus=2 - --tab stuff - opt.tabstop=4 - opt.shiftwidth=0 --zero inherrits tabstop. - opt.autoindent=true - opt.smartindent=true - opt.smarttab=true - --space based tabs. - -- opt.softtabstop=-1 --negative value inherrits shiftwidth. - -- opt.expandtab=true - --highlight search results as you type. - opt.hlsearch=true - opt.incsearch=true - --foling stuff - opt.foldlevelstart=5 - cmd([[source ~/.config/nvim/foldtext.vimrc]]) - opt.foldmethod='indent' - opt.foldtext='minimal_foldtext()' - opt.fillchars='stl:=,stlnc: ,vert:|,fold:-' - opt.foldcolumn='4' - opt.foldenable=true - opt.foldignore='' +opt.mouse = 'a' +opt.lazyredraw = true +opt.termguicolors = true +opt.autoread = true +opt.swapfile = false +opt.history = 500 +opt.formatoptions = 'rojq' +--disable hard text wrapping, will only wrap visually. +opt.textwidth = 0 +opt.wrapmargin = 0 +opt.wrap = true +opt.linebreak = true +opt.breakindent = true +--add ruler to side of screen. +opt.number = true +--displays cordinates of your cursor in statusbar +opt.ruler = true +--always leave 5 cells between cursor and side of window. +opt.scrolloff = 5 +opt.sidescrolloff = 5 +--better command line completion +opt.wildmenu = true +--ignore case in search if search is all lowercase. +opt.ignorecase = true +opt.smartcase = true +--show unfinished commands in statusbar. +opt.showcmd = true +--regex stuff +opt.magic = true +--always have a status line +opt.laststatus = 2 +--tab stuff +opt.tabstop = 4 +opt.shiftwidth = 0 --zero inherrits tabstop. +opt.autoindent = true +opt.smartindent = true +opt.smarttab = true +--space based tabs. +-- opt.softtabstop=-1 --negative value inherrits shiftwidth. +-- opt.expandtab=true +--highlight search results as you type. +opt.hlsearch = true +opt.incsearch = true +--foling stuff +opt.foldlevelstart = 5 +cmd([[source ~/.config/nvim/foldtext.vimrc]]) +opt.foldmethod = 'indent' +opt.foldtext = 'minimal_foldtext()' +opt.fillchars = 'stl:=,stlnc: ,vert:|,fold:-' +opt.foldcolumn = '4' +opt.foldenable = true +opt.foldignore = '' --sets colorscheme. to get a list of avalible options, do colorscheme vim.cmd 'colorscheme moonfly' @@ -77,71 +77,71 @@ vim.cmd 'colorscheme moonfly' --function for venn.nvim -- venn.nvim: enable or disable keymappings function _G.Toggle_venn() - local venn_enabled = vim.inspect(vim.b.venn_enabled) - if venn_enabled == "nil" then - vim.b.venn_enabled = true - vim.cmd[[setlocal ve=all]] - -- draw a line on HJKL keystokes - vim.api.nvim_buf_set_keymap(0, "n", "J", "j:VBox", {noremap = true}) - vim.api.nvim_buf_set_keymap(0, "n", "K", "k:VBox", {noremap = true}) - vim.api.nvim_buf_set_keymap(0, "n", "L", "l:VBox", {noremap = true}) - vim.api.nvim_buf_set_keymap(0, "n", "H", "h:VBox", {noremap = true}) - -- draw a box by pressing "f" with visual selection - vim.api.nvim_buf_set_keymap(0, "v", "f", ":VBox", {noremap = true}) - else - vim.cmd[[setlocal ve=]] - vim.cmd[[mapclear ]] - vim.b.venn_enabled = nil - end + local venn_enabled = vim.inspect(vim.b.venn_enabled) + if venn_enabled == "nil" then + vim.b.venn_enabled = true + vim.cmd [[setlocal ve=all]] + -- draw a line on HJKL keystokes + vim.api.nvim_buf_set_keymap(0, "n", "J", "j:VBox", { noremap = true }) + vim.api.nvim_buf_set_keymap(0, "n", "K", "k:VBox", { noremap = true }) + vim.api.nvim_buf_set_keymap(0, "n", "L", "l:VBox", { noremap = true }) + vim.api.nvim_buf_set_keymap(0, "n", "H", "h:VBox", { noremap = true }) + -- draw a box by pressing "f" with visual selection + vim.api.nvim_buf_set_keymap(0, "v", "f", ":VBox", { noremap = true }) + else + vim.cmd [[setlocal ve=]] + vim.cmd [[mapclear ]] + vim.b.venn_enabled = nil + end end --keyboard mappings - local opts = { noremap=true, silent=true } - --toggle spell check - map('n', 'sp', ':setlocal spell!', opts) - --[[ --easily create splits +local opts = { noremap = true, silent = true } +--toggle spell check +map('n', 'sp', ':setlocal spell!', opts) +--[[ --easily create splits map('n', '|', ':vs', opts) ]] - --[[ map('n', '-', ':sp', opts) +--[[ map('n', '-', ':sp', opts) --use ctrl+direction to move between splits. ]] - map('n', '', 'h', opts) - map('n', '', 'j', opts) - map('n', '', 'k', opts) - map('n', '', 'l', opts) - --toggle folds with space. - map('', '', 'za', opts) - --clear highlighting with leader+h - map('', 'h', ':nohls', opts) - --open nvim-tree with leader+t - map('n', 't', ':NvimTreeToggle', opts) - --open symbols-outline with leader+o - map('n', 'o', ':SymbolsOutline', opts) - --telescope stuff - map('n', 'ff', ':lua require "telescope".extensions.file_browser.file_browser()', 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', 'ft', ':Telescope treesitter', opts) - --Treesitter context - map('n', 'c', ':TSContextToggle', opts) - --tabline stuff (gt and gT are prev/next tab in stock vim) - map('n', 'gf', ':TablineBufferNext', opts) - map('n', 'gF', ':TablineBufferPrevious', opts) - --gitsigns - map('n', 'bl', ':Gitsigns toggle_current_line_blame', opts) - --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) - -- toggle keymappings for venn using v - vim.api.nvim_set_keymap('n', 'v', ":lua Toggle_venn()", { noremap = true}) +map('n', '', 'h', opts) +map('n', '', 'j', opts) +map('n', '', 'k', opts) +map('n', '', 'l', opts) +--toggle folds with space. +map('', '', 'za', opts) +--clear highlighting with leader+h +map('', 'h', ':nohls', opts) +--open nvim-tree with leader+t +map('n', 't', ':NvimTreeToggle', opts) +--open symbols-outline with leader+o +map('n', 'o', ':SymbolsOutline', opts) +--telescope stuff +map('n', 'ff', ':lua require "telescope".extensions.file_browser.file_browser()', 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', 'ft', ':Telescope treesitter', opts) +--Treesitter context +map('n', 'c', ':TSContextToggle', opts) +--tabline stuff (gt and gT are prev/next tab in stock vim) +map('n', 'gf', ':TablineBufferNext', opts) +map('n', 'gF', ':TablineBufferPrevious', opts) +--gitsigns +map('n', 'bl', ':Gitsigns toggle_current_line_blame', opts) +--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) +-- toggle keymappings for venn using v +vim.api.nvim_set_keymap('n', 'v', ":lua Toggle_venn()", { noremap = true }) diff --git a/neovim/.config/nvim/lua/LSPconfig.lua b/neovim/.config/nvim/lua/LSPconfig.lua index 929a10d..0b8f184 100644 --- a/neovim/.config/nvim/lua/LSPconfig.lua +++ b/neovim/.config/nvim/lua/LSPconfig.lua @@ -2,17 +2,18 @@ local opts = {} local on_attach = function() local function set_keymap(...) vim.api.nvim_set_keymap(...) end + local function set_option(...) vim.api.nvim_set_option(...) end -- Enable completion triggered by set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') -- Mappings. - local opts = { noremap=true, silent=true } + local opts = { noremap = true, silent = true } -- See `:help vim.lsp.*` for documentation on any of the below functions set_keymap('', 'lc', 'lua vim.lsp.buf.declaration()', opts) - set_keymap('', 'lf', 'lua vim.lsp.buf.definition()', 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) @@ -26,18 +27,18 @@ local on_attach = function() set_keymap('', 'lo', 'lua vim.diagnostic.open_float()', opts) set_keymap('', 'ln', 'lua vim.diagnostic.goto_prev()', opts) set_keymap('', 'lp', 'lua vim.diagnostic.goto_next()', opts) - set_keymap('', 'lm', 'lua vim.lsp.buf.formatting()', opts) + set_keymap('', 'lm', 'lua vim.lsp.buf.format {async=true}', opts) end require("mason-lspconfig").setup_handlers({ function(server_name) - require("lspconfig")[server_name].setup{} + require("lspconfig")[server_name].setup {} on_attach() end, ["rust_analyzer"] = function() require('rust-tools-setup') on_attach() end, - ["sumneko_lua"] = function () + ["sumneko_lua"] = function() require('lspconfig').sumneko_lua.setup { settings = { Lua = {