-- hi Normal guibg=NONE ctermbg=NONE -- require("config.lazy") vim.g.mapleader = ' ' vim.o.number = true vim.o.relativenumber = true vim.o.ignorecase = true vim.o.smartcase = true vim.o.tabstop = 2 vim.o.shiftwidth = 2 vim.o.expandtab = true vim.o.scrolloff = 5 vim.keymap.set('n', 'a', ':keepjumps normal! ggVG') vim.o.clipboard = "unnamedplus" require("nvim-treesitter").setup{ indent = { enable = true }, highlight = { enable = true, additional_vim_regex_highlighting = false, }, auto_install = false, ensure_installed = { "bash", "c", "diff", "html", "javascript", "json", "lua", "markdown", "markdown_inline", "python", "toml", "yaml", }, } vim.api.nvim_create_autocmd('FileType', { pattern = { '' }, callback = function() vim.treesitter.start() end, }) local builtin = require('telescope.builtin') vim.keymap.set('n', '', builtin.find_files, { desc = 'Telescope find files' }) vim.keymap.set('n', 's', builtin.live_grep, { desc = 'Telescope live grep' }) vim.keymap.set('n', 'f', builtin.git_files, { desc = 'Telescope git files' }) vim.cmd[[colorscheme tokyonight-night]] require('lualine').setup { options = { icons_enabled = true, theme = 'auto', component_separators = { left = '', right = ''}, section_separators = { left = '', right = ''}, disabled_filetypes = { statusline = {}, winbar = {}, }, ignore_focus = {}, always_divide_middle = true, always_show_tabline = true, globalstatus = false, refresh = { statusline = 1000, tabline = 1000, winbar = 1000, refresh_time = 16, -- ~60fps events = { 'WinEnter', 'BufEnter', 'BufWritePost', 'SessionLoadPost', 'FileChangedShellPost', 'VimResized', 'Filetype', 'CursorMoved', 'CursorMovedI', 'ModeChanged', }, } }, sections = { lualine_a = {'mode'}, lualine_b = {'branch', 'diff', 'diagnostics'}, lualine_c = {'filename'}, lualine_x = {'encoding', 'fileformat', 'filetype'}, lualine_y = {'progress'}, lualine_z = {'location'} }, inactive_sections = { lualine_a = {}, lualine_b = {}, lualine_c = {'filename'}, lualine_x = {'location'}, lualine_y = {}, lualine_z = {} }, tabline = {}, winbar = {}, inactive_winbar = {}, extensions = {} } -- An example nvim-lspconfig capabilities setting vim.lsp.enable("pyright") vim.lsp.enable("lua_ls") vim.lsp.enable("ts_ls") vim.lsp.enable("clangd") vim.keymap.set('n', 'd', vim.diagnostic.open_float) -- Set up nvim-cmp. local cmp = require'cmp' cmp.setup({ snippet = { -- REQUIRED - you must specify a snippet engine expand = function(args) -- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. -- require('snippy').expand_snippet(args.body) -- For `snippy` users. -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+) -- For `mini.snippets` users: -- local insert = MiniSnippets.config.expand.insert or MiniSnippets.default_insert -- insert({ body = args.body }) -- Insert at cursor -- cmp.resubscribe({ "TextChangedI", "TextChangedP" }) -- require("cmp.config").set_onetime({ sources = {} }) end, }, window = { completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(), }, mapping = cmp.mapping.preset.insert({ [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.abort(), [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. }), sources = cmp.config.sources({ { name = 'nvim_lsp' }, -- { name = 'vsnip' }, -- For vsnip users. -- { name = 'luasnip' }, -- For luasnip users. -- { name = 'ultisnips' }, -- For ultisnips users. -- { name = 'snippy' }, -- For snippy users. }, { { name = 'buffer' }, }) }) -- To use git you need to install the plugin petertriho/cmp-git and uncomment lines below -- Set configuration for specific filetype. --[[ cmp.setup.filetype('gitcommit', { sources = cmp.config.sources({ { name = 'git' }, }, { { name = 'buffer' }, }) }) require("cmp_git").setup() ]]-- -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). cmp.setup.cmdline({ '/', '?' }, { mapping = cmp.mapping.preset.cmdline(), sources = { { name = 'buffer' } } }) -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). cmp.setup.cmdline(':', { mapping = cmp.mapping.preset.cmdline(), sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }), matching = { disallow_symbol_nonprefix_matching = false } }) -- Set up lspconfig. local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) -- Replace with each lsp server you've enabled. vim.lsp.config("markdown_oxide", { -- Ensure that dynamicRegistration is enabled! This allows the LS to take into account actions like the -- Create Unresolved File code action, resolving completions for unindexed code blocks, ... capabilities = vim.tbl_deep_extend( 'force', capabilities, { workspace = { didChangeWatchedFiles = { dynamicRegistration = true, }, }, } ), on_attach = on_attach -- configure your on attach config }) vim.lsp.enable('markdown_oxide') require('cmp').setup { sources = { { name = 'hledger', } } }