DEVZGQYDMMD2ZMJKQX5M72L4LTYAZEIVEDXSYNIMHMRBT5CJIERAC 3BK5VANZFIJ3MOFXL66FHO372G3XSVJP6YJFXW24KY4QL62MHLTAC MTBVSWE2XCQ3F3MBM2Q6H5BU5TYJPRKQVPYNUG7TAD4TEFKDUEKQC YSKR5RAG56GA3T554X2S5QNFQSHAYFXU3QT5QMU5A5OUGLPAMJ2AC 4LSO4STLQJZ7TXVI3BYUXAG7UV3LAICU65B52RUKABD3KHQ2G7GAC ULKBUZEBFCZOZ5BTUW6262LG5DK6BUOVN6STTKCFLZFG3EE6PFPAC QWJ5FBQ7ZL75GTXLYEVPTLK7AEMBMBEYE7536WFLGINTG332LAIAC UNMO22GQRCYHMIXPFTZTQVVPCOFSBVU2YV5CKLO72ZRDZ2AJ46WQC AD3GGMJYYDKYXMTBCQK7IHKTVSM75XFTBHZSMFXFAQYWSPRHSCBAC PS5PXTHFTQDM4WVNMXEJUPLQVGQWULYJ5IVAXZ7LJX4ZUSICUKDAC XCR34YPGC3GY7CKQTQX4WUEKLRLAZKNSUPWOKGD5HUHK2RN7RKGAC 5U2BEZGMRUSG3OQM3VGNF3XINPCKRLGU7CJJDUVRHHORN3IED2HQC JTTWOADMNTGEUL5TBJSC5PEXSW6GMBZLY6TWLN2DHV26REVMZOZAC K5EUTRJG3IQJGSDDG3WVBYKQOOR5MIXHQG3JDSQXDEBAQLSGV7EQC HWLVSY6UL5VDMK7NLQB2LJYEHV6KNKP4QIUWJKYTKKYW3L5ZLQBAC " show existing tab with 2 spaces widthsetlocal tabstop=2" when indenting with '>', use 2 spaces width" also sets the number of spaces to be inserted b/c softtabstop=-1setlocal shiftwidth=2" the above wasn't working...?setlocal tabstop=2 softtabstop=-1 expandtab shiftwidth=2 smarttab
" Show whitespaceset listset listchars=tab:→\ ,space:·,nbsp:␣,trail:•,eol:¶,precedes:«,extends:»" Line number gutter configurationset number relativenumber" Show when I'm in an open foldset foldcolumn=1" Automatically close folds when leaving themset foldclose=all
" Keep the cursor 10 lines from the top/bottom of the screenset scrolloff=10" Automatically hit enter for meset textwidth=80
set completeopt=noinsert,menuone,noselectset shortmess+=c " avoid extra messages during completionset pumheight=20 " display 20 items at most
" use normal regex when searching in normal/visual modennoremap / /\v" search for highlighted text when entering search from visual modevnoremap / y/\V<c-r>=escape(@",'/\')<cr><cr>
"{{{ Plugin Options" highlight the buffer linehighlight link BufferCurrent Titlehighlight link BufferCurrentMod Titlehighlight link BufferCurrentSign Titlehighlight link BufferCurrentIndex Titlehighlight link BufferCurrentTarget Titlelet bufferline = get(g:, 'bufferline', {})let bufferline.animation = v:falselet bufferline.icons = v:false
" showmode hides the echodoc function signatures," and airline already shows the modeset noshowmode" persist undo history between sessionsset undofileset undodir=~/.local/share/nvim/undo/" List all open buffers at the top of the screenlet g:airline#extensions#tabline#enabled = 1
" Trigger completion with <Tab>inoremap <silent><expr> <tab>\ pumvisible() ? "\<c-n>" :\ <sid>check_back_space() ? "\<tab>" :\ completion#trigger_completion()inoremap <silent><expr> <s-tab>\ pumvisible() ? "\<c-p>" :\ <sid>check_back_space() ? "\<s-tab>" :\ completion#trigger_completion()function! s:check_back_space() abortlet col = col('.') - 1return !col || getline('.')[col - 1] =~ '\s'endfunction" highlight yanked textau TextYankPost * lua vim.highlight.on_yank {on_visual = false, timeout = 200}" Enable type inlay hintsautocmd CursorMoved,InsertLeave,BufEnter,BufWinEnter,TabEnter,BufWritePost *\ lua require'lsp_extensions'.inlay_hints{prefix = '', highlight = "NonText"}" set up the lsp settings for each language upon entering a buffer:lua << EOFlocal lspconfig = require('lspconfig')local buf_set_keymap = vim.api.nvim_buf_set_keymaplocal capabilities = {textDocument = {completion = {completionItem = {snippetSupport = false}}}}local on_attach = function(client, bufnr)require('completion').on_attach(client)local opts = { noremap=true, silent=true }-- there are several goto def/impl/decl actions. this first one is my favoritebuf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts)buf_set_keymap(bufnr, 'n', '<c-]>', '<cmd>lua vim.lsp.buf.definition()<cr>', opts) -- the traditional mappingbuf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts)buf_set_keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts)buf_set_keymap(bufnr, 'n', '<c-k>', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts)buf_set_keymap(bufnr, 'n', '1gD', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts)buf_set_keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts)buf_set_keymap(bufnr, 'n', 'g0', '<cmd>lua vim.lsp.buf.document_symbol()<cr>', opts)buf_set_keymap(bufnr, 'n', 'gW', '<cmd>lua vim.lsp.buf.workspace_symbol()<cr>', opts)buf_set_keymap(bufnr, 'n', '<localleader>r', '<cmd>lua vim.lsp.buf.rename()<cr>', opts)buf_set_keymap(bufnr, 'n', '<localleader>d', '<cmd>lua vim.lsp.util.show_line_diagnostics()<cr>', opts)-- configuration for diagnosticsbuf_set_keymap(bufnr, 'n', 'g[', '<cmd>lua vim.lsp.diagnostic.goto_prev()<cr>', opts)buf_set_keymap(bufnr, 'n', 'g]', '<cmd>lua vim.lsp.diagnostic.goto_next()<cr>', opts)-- TODO: add a mapping for goto implementation-- buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts)endlocal servers = {["rust_analyzer"] = {},["pyls"] = {},["clangd"] = {},["gopls"] = {},["tsserver"] = {},["texlab"] = {},["bashls"] = {},["html"] = {},["cssls"] = {}}for lsp, setup_config in pairs(servers) do-- these settings are shared among all the serverssetup_config.on_attach = on_attachsetup_config.capabilities = capabilitieslspconfig[lsp].setup(setup_config)endEOF
set completeopt=noinsert,menuone,noselectset shortmess+=c " avoid extra messages during completionset pumheight=20 " display 20 items at most
let g:completion_chain_complete_list = {\'default' : [\ {'complete_items': ['lsp', 'snippet', 'path']},\ {'mode': '<c-p>'},\ {'mode': '<c-n>'}\]\}
" Enable and select color schemessyntax oncolorscheme onedarklet g:airline_theme = 'onedark'let g:airline_section_z = '%l/%L :%c'" create a homerow shortcut for escapeinoremap <silent> <c-space> <esc>vnoremap <silent> <c-space> <esc>nnoremap <silent> <c-space> <esc>snoremap <silent> <c-space> <esc>tnoremap <silent> <c-space> <c-\><c-n>" easier window navigationvmap <silent> <c-l> <c-space><c-w>limap <silent> <c-l> <c-space><c-w>lnmap <silent> <c-l> <c-space><c-w>lsmap <silent> <c-l> <c-space><c-w>ltmap <silent> <c-l> <c-space><c-w>lvmap <silent> <c-h> <c-space><c-w>himap <silent> <c-h> <c-space><c-w>hnmap <silent> <c-h> <c-space><c-w>hsmap <silent> <c-h> <c-space><c-w>htmap <silent> <c-h> <c-space><c-w>hvmap <silent> <c-j> <c-space><c-w>jimap <silent> <c-j> <c-space><c-w>jnmap <silent> <c-j> <c-space><c-w>jsmap <silent> <c-j> <c-space><c-w>jtmap <silent> <c-j> <c-space><c-w>jvmap <silent> <c-k> <c-space><c-w>kimap <silent> <c-k> <c-space><c-w>knmap <silent> <c-k> <c-space><c-w>ksmap <silent> <c-k> <c-space><c-w>ktmap <silent> <c-k> <c-space><c-w>k
"{{{ Mappings
" quickly switch back to previous buffernnoremap <leader><space> <cmd>b#<cr>" easier way to clear search highlightingnnoremap <leader>n <cmd>noh<cr>" delete a buffer without deleting the windownnoremap <leader>q <cmd>Bdelete<cr>" Open the file explorer in the current windownnoremap <leader>t <cmd>Fern . -reveal=%<cr>" Quickly splitting windowsnnoremap <leader>v <C-w>v" Searching with fzfnnoremap <leader>f <cmd>Files<cr>" nnoremap <leader>f <cmd>lua require'telescope.builtin'.find_files{}<cr>nnoremap <leader>b <cmd>Buffers<cr>nnoremap <leader>g <cmd>Rg<cr>nnoremap <leader>c <cmd>Commands<cr>nnoremap <leader>h <cmd>Helptags<cr>nnoremap <leader>m <cmd>Marks<cr>nnoremap <leader>j <cmd>lua require'telescope.builtin'.lsp_document_symbols{}<cr>nnoremap <leader>J <cmd>lua require'telescope.builtin'.lsp_workspace_symbols{}<cr>" Session managementnnoremap <leader>ss <cmd>Obsess<cr>nnoremap <leader>sd <cmd>Obsess!<cr>" Quick, section-based foldingnnoremap <leader>z zfa{
" use normal regex when searching in normal/visual modennoremap / /\v" search for highlighted text when entering search from visual modevnoremap / y/\V<c-r>=escape(@",'/\')<cr><cr>" Trigger completion with <Tab>inoremap <silent><expr> <tab>\ pumvisible() ? "\<c-n>" :\ <sid>check_back_space() ? "\<tab>" :\ completion#trigger_completion()inoremap <silent><expr> <s-tab>\ pumvisible() ? "\<c-p>" :\ <sid>check_back_space() ? "\<s-tab>" :\ completion#trigger_completion()function! s:check_back_space() abortlet col = col('.') - 1return !col || getline('.')[col - 1] =~ '\s'endfunctionlua require 'lsp'lua require 'options'lua require 'mappings'lua require 'treesitter'" lua require 'snippets-config'lua require 'statusline'
local cmd = vim.cmd -- to execute Vim commands e.g. cmd('pwd')local fn = vim.fn -- to call Vim functions e.g. fn.bufnr()local g = vim.g -- a table to access global variableslocal lspconfig = require('lspconfig')local buf_set_keymap = vim.api.nvim_buf_set_keymap-- disable snippets by defaultlocal capabilities = {textDocument = {completion = {completionItem = {snippetSupport = false}}}}local on_attach = function(client, bufnr)require('completion').on_attach(client)local opts = { noremap=true, silent=true }-- there are several goto def/impl/decl actions. this first one is my favoritebuf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts)-- the traditional mappingbuf_set_keymap(bufnr, 'n', '<c-]>', '<cmd>lua vim.lsp.buf.definition()<cr>', opts)buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts)buf_set_keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts)buf_set_keymap(bufnr, 'n', '<c-k>', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts)buf_set_keymap(bufnr, 'n', '1gD', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts)buf_set_keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts)buf_set_keymap(bufnr, 'n', 'g0', '<cmd>lua vim.lsp.buf.document_symbol()<cr>', opts)buf_set_keymap(bufnr, 'n', 'gW', '<cmd>lua vim.lsp.buf.workspace_symbol()<cr>', opts)buf_set_keymap(bufnr, 'n', '<localleader>r', '<cmd>lua vim.lsp.buf.rename()<cr>', opts)buf_set_keymap(bufnr, 'n', '<localleader>d', '<cmd>lua vim.lsp.util.show_line_diagnostics()<cr>', opts)-- configuration for diagnosticsbuf_set_keymap(bufnr, 'n', 'g[', '<cmd>lua vim.lsp.diagnostic.goto_prev()<cr>', opts)buf_set_keymap(bufnr, 'n', 'g]', '<cmd>lua vim.lsp.diagnostic.goto_next()<cr>', opts)-- TODO: add a mapping for goto implementation-- buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts)endlocal servers = {["rust_analyzer"] = {},["pyls"] = {},["clangd"] = {},["gopls"] = {},["tsserver"] = {},["texlab"] = {},["bashls"] = {},["html"] = {},["cssls"] = {}}for lsp, server_tweaks in pairs(servers) do-- these settings are shared among all the serverslocal server_defaults = {capabilities = capabilities,on_attach = on_attach}local server_setup = vim.tbl_extend('force', server_defaults, server_tweaks)lspconfig[lsp].setup(server_setup)end
local o = vim.olocal wo = vim.wolocal bo = vim.bolocal function map_modes(modes, shortcut, action, options)local default_options = {silent = true,noremap = true}options = options or {}options = vim.tbl_extend('force', default_options, options)for _, mode in ipairs(modes) dovim.api.nvim_set_keymap(mode, shortcut, action, options)endendlocal function nmap(shortcut, action, options)map_modes({'n'}, shortcut, action, options)end-- more accessible shortcut for escape-- also more consistent when using the terminalmap_modes({'i', 'v', 'n', 's'}, '<c-space>', '<esc>')map_modes({'t'}, '<c-space>', '<c-\\><c-n>')-- easier window navigationlocal nav_modes = {'i', 'v', 'n', 's', 't'}local remap = {noremap = false}map_modes(nav_modes, '<c-l>', '<c-space><c-w>l', remap)map_modes(nav_modes, '<c-h>', '<c-space><c-w>h', remap)map_modes(nav_modes, '<c-j>', '<c-space><c-w>j', remap)map_modes(nav_modes, '<c-k>', '<c-space><c-w>k', remap)-- easier tab navigationmap_modes(nav_modes, '<a-l>', '<c-space><cmd>tabn<cr>', remap)map_modes(nav_modes, '<a-h>', '<c-space><cmd>tabp<cr>', remap)-- quickly switch back to previous buffernmap('<leader><space>', '<cmd>b#<cr>')-- easier way to clear search highlightingnmap('<leader>n', '<cmd>noh<cr>')-- delete a buffer without deleting the windownmap('<leader>q', '<cmd>BufferClose<cr>')-- Open the file explorer in the current windownmap('<leader>t', '<cmd>Fern . -reveal=%<cr>')-- Quickly splitting windowsnmap('<leader>v', '<C-w>v')-- Searching with fzfnmap('<leader>f', '<cmd>Files<cr>')-- nmap('<leader>f', '<cmd>lua require\'telescope.builtin\'.find_files{}<cr>')nmap('<leader>b', '<cmd>Buffers<cr>')nmap('<leader>g', '<cmd>Rg<cr>')nmap('<leader>c', '<cmd>Commands<cr>')nmap('<leader>h', '<cmd>Helptags<cr>')nmap('<leader>m', '<cmd>Marks<cr>')nmap('<leader>j', '<cmd>lua require\'telescope.builtin\'.lsp_document_symbols{}<cr>')nmap('<leader>J', '<cmd>lua require\'telescope.builtin\'.lsp_workspace_symbols{}<cr>')-- Session managementnmap('<leader>ss', '<cmd>Obsess<cr>')nmap('<leader>sd', '<cmd>Obsess!<cr>')-- Convenient terminal windownmap('<leader>;', '<cmd>FloatermToggle<cr>')
local o = vim.olocal wo = vim.wolocal bo = vim.bo-- no automatic word-wrappingbo.tw = 0-- only redraw when necessary (makes macros run faster)o.lazyredraw = true-- show whitespacewo.list = trueo.listchars = 'tab:→ ,space:·,nbsp:␣,trail:•,eol:¶,precedes:«,extends:»'-- show line numbers relative to the current positionwo.number = truewo.relativenumber = true-- Show when I'm in an open foldwo.foldcolumn = '1'-- Automatically close folds when leaving themo.foldclose = 'all'-- Keep the cursor 10 lines from the top/bottom of the screeno.scrolloff = 10-- Automatically hit enter for mebo.textwidth=80-- Required for operations modifying multiple buffers like rename.o.hidden = true-- Highlight the line your cursor is onwo.cursorline = true-- Prevent the window from resizing due to the gitgutter being addedwo.signcolumn = 'yes'-- ignore casing when searching w/ all lower-case letterso.ignorecase = trueo.smartcase = true-- showmode hides the echodoc function signatures,-- and airline already shows the modeo.showmode = false-- persist undo history between sessionsbo.undofile = true
local manager = require 'snippets'local guard = [[#ifndef ${1:UNIT_NAME}_H_#define $1_H_#endif // $1_H_]]local U = require 'snippets.utils'local snippets = {_global = {mpl2 = U.force_comment [[This Source Code Form is subject to the terms of the Mozilla PublicLicense, v. 2.0. If a copy of the MPL was not distributed with thisfile, You can obtain one at https://mozilla.org/MPL/2.0/.]],copyright = U.force_comment [[Copyright (C) Ian Boll ${=os.date("%Y")}]]},c = {guard = guard},cpp = {guard = guard}}manager.use_suggested_mappings()manager.snippets = snippets
local lualine = require 'lualine'local options = lualine.optionsoptions.theme = 'onedark'options.section_separators = niloptions.component_separators = niloptions.icons_enabled = falselualine.extensions = {'fzf'}lualine.status()
local o = vim.olocal wo = vim.wolocal bo = vim.bo-- not using expr until I can get it to only fold functionswo.foldmethod = 'manual'vim.cmd 'set foldexpr=nvim_treesitter#foldexpr()'require'nvim-treesitter.configs'.setup {ensure_installed = 'maintained',highlight = {enable = true,disable = {'rust'} -- list of languages to disable},incremental_selection = {enable = true,keymaps = {init_selection = 's',node_incremental = 'sn',scope_incremental = 'ss',node_decremental = 'sd'}},indent = {enable = true,disable = {'rust'}},playground = {enable = true,disable = {},updatetime = 25,persist_queries = false}}