require("config.lazy") vim.opt.mouse = '' vim.opt.number = true vim.opt.relativenumber = true vim.opt.rnu = true -- length of an actual \t character: vim.opt.tabstop=2 -- length to use when editing text (eg. TAB and BS keys) -- (0 for ‘tabstop’, -1 for ‘shiftwidth’): vim.opt.softtabstop=-1 -- length to use when shifting text (eg. <<, >> and == commands) -- (0 for ‘tabstop’): vim.opt.shiftwidth=0 -- round indentation to multiples of 'shiftwidth' when shifting text -- (so that it behaves like Ctrl-D / Ctrl-T): vim.opt.shiftround = true -- if set, only insert spaces; otherwise insert \t and complete with spaces: vim.opt.expandtab = true -- reproduce the indentation of the previous line: vim.opt.autoindent = true -- keep indentation produced by 'autoindent' if leaving the line blank: -- vim.opt.cpoptions+=I -- try to be smart (increase the indenting level after ‘{’, -- decrease it after ‘}’, and so on): vim.opt.smartindent = true -- a stricter alternative which works better for the C language: vim.opt.cindent = true -- use language‐specific plugins for indenting (better): vim.cmd("filetype plugin indent on") vim.cmd("syntax on") vim.keymap.set('n', 'p', 'pu') vim.g.mapleader = " " vim.keymap.set("n", "ll", vim.cmd.Ex) -- Telescope local builtin = require('telescope.builtin') vim.keymap.set('n', 'ff', builtin.find_files, { desc = 'Telescope find files' }) vim.keymap.set('n', 'fg', builtin.git_files, { desc = 'Telescope find git files' }) vim.keymap.set('n', 'fG', function() builtin.grep_string({ search = vim.fn.input("grep > ") } ); end ) -- Harpoon local mark = require("harpoon.mark") local ui = require("harpoon.ui") vim.keymap.set("n", "a", mark.add_file) vim.keymap.set("n", "", ui.toggle_quick_menu) vim.keymap.set("n", "", function() ui.nav_file(1) end) vim.keymap.set("n", "", function() ui.nav_file(2) end) vim.keymap.set("n", "", function() ui.nav_file(3) end) vim.keymap.set("n", "", function() ui.nav_file(4) end) -- UndoTree vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" vim.opt.undofile = true -- Reserve a space in the gutter vim.opt.signcolumn = 'yes' -- Add cmp_nvim_lsp capabilities settings to lspconfig -- This should be executed before you configure any language server local lspconfig_defaults = require('lspconfig').util.default_config lspconfig_defaults.capabilities = vim.tbl_deep_extend( 'force', lspconfig_defaults.capabilities, require('cmp_nvim_lsp').default_capabilities() ) -- This is where you enable features that only work -- if there is a language server active in the file vim.api.nvim_create_autocmd('LspAttach', { desc = 'LSP actions', callback = function(event) local opts = {buffer = event.buf} vim.keymap.set('n', 'K', 'lua vim.lsp.buf.hover()', opts) vim.keymap.set('n', 'gd', 'lua vim.lsp.buf.definition()', opts) vim.keymap.set('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) vim.keymap.set('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) vim.keymap.set('n', 'go', 'lua vim.lsp.buf.type_definition()', opts) vim.keymap.set('n', 'gr', 'lua vim.lsp.buf.references()', opts) vim.keymap.set('n', 'gs', 'lua vim.lsp.buf.signature_help()', opts) vim.keymap.set('n', '', 'lua vim.lsp.buf.rename()', opts) vim.keymap.set({'n', 'x'}, '', 'lua vim.lsp.buf.format({async = true})', opts) vim.keymap.set('n', '', 'lua vim.lsp.buf.code_action()', opts) end, }) -- You'll find a list of language servers here: -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md -- These are example language servers. require('lspconfig').gleam.setup({}) require('lspconfig').ocamllsp.setup({}) -- NOTE: to make any of this work you need a language server. -- If you don't know what that is, watch this 5 min video: -- https://www.youtube.com/watch?v=LaS32vctfOY local cmp = require('cmp') cmp.setup({ sources = { {name = 'nvim_lsp'}, }, snippet = { expand = function(args) -- You need Neovim v0.10 to use vim.snippet vim.snippet.expand(args.body) end, }, mapping = cmp.mapping.preset.insert({}), }) vim.api.nvim_create_autocmd("Filetype", { pattern = { "html", "shtml", "htm" }, callback = function() vim.lsp.start({ name = "superhtml", cmd = { "superhtml", "lsp" }, root_dir = vim.fs.dirname(vim.fs.find({".git"}, { upward = true })[1]) }) end }) require'lspconfig'.terraformls.setup({}) require'lspconfig'.pylsp.setup{ settings = { pylsp = { plugins = { pycodestyle = { ignore = {'W391'}, maxLineLength = 120 } } } } }