summaryrefslogtreecommitdiff
path: root/nvim/lua
diff options
context:
space:
mode:
authorTimmy Keller <tjk@tjkeller.xyz>2024-09-02 08:42:34 -0500
committerTimmy Keller <tjk@tjkeller.xyz>2024-09-02 08:42:34 -0500
commit4e70e2bac0d6eead8508b4625cfb8967771bd5f2 (patch)
tree6b651a905ceaeeca047ca4bb4cf7ca21059ead16 /nvim/lua
parent692b2f5f5231dddfbaab92f749ee9513e423be60 (diff)
downloaddotconfig-4e70e2bac0d6eead8508b4625cfb8967771bd5f2.tar.xz
dotconfig-4e70e2bac0d6eead8508b4625cfb8967771bd5f2.zip
nvim vimscript to lua
Diffstat (limited to 'nvim/lua')
-rw-r--r--nvim/lua/init.lua1
-rw-r--r--nvim/lua/tjk/keybindings.lua46
-rw-r--r--nvim/lua/tjk/lazy.lua39
-rw-r--r--nvim/lua/tjk/misc.lua75
-rw-r--r--nvim/lua/tjk/options.lua38
-rw-r--r--nvim/lua/tjk/plugins/autoclose.lua9
-rw-r--r--nvim/lua/tjk/plugins/colorizer.lua4
-rw-r--r--nvim/lua/tjk/plugins/colorscheme.lua81
-rw-r--r--nvim/lua/tjk/plugins/manageself.lua3
-rw-r--r--nvim/lua/tjk/plugins/treesitter.lua32
-rw-r--r--nvim/lua/user/cmp.lua129
-rw-r--r--nvim/lua/user/lsp/handlers.lua104
-rw-r--r--nvim/lua/user/lsp/init.lua7
-rw-r--r--nvim/lua/user/lsp/mason.lua47
-rw-r--r--nvim/lua/user/lsp/null-ls.lua19
15 files changed, 327 insertions, 307 deletions
diff --git a/nvim/lua/init.lua b/nvim/lua/init.lua
deleted file mode 100644
index 7a62678..0000000
--- a/nvim/lua/init.lua
+++ /dev/null
@@ -1 +0,0 @@
-require "user.cmp"
diff --git a/nvim/lua/tjk/keybindings.lua b/nvim/lua/tjk/keybindings.lua
new file mode 100644
index 0000000..563d843
--- /dev/null
+++ b/nvim/lua/tjk/keybindings.lua
@@ -0,0 +1,46 @@
+local key = vim.keymap.set
+
+vim.g.mapleader = ","
+
+-- toggle spellcheck
+key("n", "<leader>l", [[:setlocal spell! spelllang=en_us<CR>]])
+-- toggle cursorcolumn
+key("n", "<leader>c", [[:set cursorcolumn!<CR>]])
+
+-- scroll doc with ctrl+[jk]
+key({ "n", "v" }, "<C-j>", "<C-e>")
+key({ "n", "v" }, "<C-k>", "<C-y>")
+-- go to begining or end of line with ctrl+[hl]
+key({ "n", "v" }, "<C-h>", "zh")
+key({ "n", "v" }, "<C-l>", "zl")
+
+-- split navigation with ctrl+shift+[hjkl]
+key("n", "<C-S-h>", "<C-w>h")
+key("n", "<C-S-j>", "<C-w>j")
+key("n", "<C-S-k>", "<C-w>k")
+key("n", "<C-S-l>", "<C-w>l")
+
+-- browser like tab shortcuts
+key("n", "<C-Tab>", "gt")
+key("n", "<C-S-Tab>", "gT")
+--key("n", "<C-t>", [[:tabe<CR>]])
+--key("n", "<C-w>", [[:tabclose<CR>]]) -- <C-w> is already used lol
+-- additional tab shortcuts
+key("n", "<C-t>", "gt")
+key("n", "<C-T>", "gT")
+
+
+-- copy text to x11 buffer
+key("", "<C-c>", [["+y]])
+key("", "<C-x>", [["+x]])
+key("", "<C-S-c>", [["+y]])
+key("", "<C-S-x>", [["+x]])
+
+-- unmap ex mode
+key("", "Q", "<NOP>")
+
+-- repeat commands with visual blocks using period
+key("v", ".", [[:normal .<CR>]])
+
+-- save files with root permissions with command `w!!`
+key("c", "w!!", [[execute 'silent! write !doas tee % >/dev/null' <bar> edit!]])
diff --git a/nvim/lua/tjk/lazy.lua b/nvim/lua/tjk/lazy.lua
new file mode 100644
index 0000000..164d968
--- /dev/null
+++ b/nvim/lua/tjk/lazy.lua
@@ -0,0 +1,39 @@
+-- install lazy.nvim via instructions from github
+local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
+if not (vim.uv or vim.loop).fs_stat(lazypath) then
+ vim.fn.system({
+ "git",
+ "clone",
+ "--filter=blob:none",
+ "https://github.com/folke/lazy.nvim.git",
+ "--branch=stable", -- latest stable release
+ lazypath,
+ })
+end
+vim.opt.rtp:prepend(lazypath)
+
+-- require lazy module with safety check
+local success, lazy = pcall(require, "lazy")
+
+if not success then
+ vim.notify("Failed to load lazy.nvim plugin manager")
+ return
+end
+
+-- setup lazy & enable plugins
+return lazy.setup(
+ {
+ { import = "tjk.plugins" }
+ },
+ {
+ -- auto update plugins
+ checker = {
+ enabled = true,
+ notify = false
+ },
+ -- disable change notification
+ change_detection = {
+ notify = false
+ },
+ }
+)
diff --git a/nvim/lua/tjk/misc.lua b/nvim/lua/tjk/misc.lua
new file mode 100644
index 0000000..14c5bd8
--- /dev/null
+++ b/nvim/lua/tjk/misc.lua
@@ -0,0 +1,75 @@
+-- Use tabs instead of spaces for certain filetypes
+local tabs_instead_of_spaces_filetypes = {
+ "sass",
+ "scss",
+}
+
+local tabs_instead_of_spaces = function(args)
+ local o = vim.opt_local
+ o.expandtab = false
+ --o.cinoptions = true
+ o.preserveindent = true
+ o.softtabstop = 0
+ o.shiftwidth = 4
+ o.tabstop = 4
+end
+vim.api.nvim_create_autocmd("FileType", { pattern = tabs_instead_of_spaces_filetypes, callback = tabs_instead_of_spaces })
+
+
+vim.cmd [[
+ "" Extra functionality
+
+ "" Functions for changing the terminal emulator's class name to 'Vim'
+ "function GetTermPID(temu)
+ " let pinfo = ['', getpid(), '']
+ " while !(pinfo[2] =~ a:temu || pinfo[1] == '0')
+ " let pinfo = split(system('ps h -o pid,ppid,command= -p' . pinfo[1]))
+ " endwhile
+ " return pinfo[0]
+ "endfunction
+
+ "function SetTermClassName(termpid, name)
+ " " Command chaining in xdotool doesn't work here for some reason
+ " silent exec "!xdotool set_window --class " . a:name . " $(xdotool search --pid " . a:termpid . ")"
+ "endfunction
+
+ "" Behaviors exclusive to either a tty or a graphical terminal emulator
+ "if empty($DISPLAY)
+ " " Clear the tty screen after exiting vim
+ " autocmd VimLeave * :clear
+ "else
+ " " Highlight current line
+ " set cursorline
+ " " Change window title
+ " autocmd BufEnter * :set title
+ " let &titleold="st"
+ " " Change class name
+ " let temu = "st"
+ " let temupid = GetTermPID(temu)
+ " if (temupid != 1)
+ " autocmd VimEnter * call SetTermClassName(temupid, "Vim")
+ " autocmd VimLeave * call SetTermClassName(temupid, temu)
+ " endif
+ "endif
+
+ " Automatically deletes all trailing whitespace on save
+ function DelWS()
+ let l:save_view = winsaveview()
+ :%s/\s*$//e
+ call winrestview(l:save_view)
+ endfunction
+ autocmd BufWritePre * call DelWS()
+
+
+ " vim -b : edit binary using xxd-format!
+ augroup Binary
+ au!
+ au BufReadPre *.bin let &bin=1
+ au BufReadPost *.bin if &bin | %!xxd
+ au BufReadPost *.bin set ft=xxd | endif
+ au BufWritePre *.bin if &bin | %!xxd -r
+ au BufWritePre *.bin endif
+ au BufWritePost *.bin if &bin | %!xxd
+ au BufWritePost *.bin set nomod | endif
+ augroup END
+]]
diff --git a/nvim/lua/tjk/options.lua b/nvim/lua/tjk/options.lua
new file mode 100644
index 0000000..989c6c7
--- /dev/null
+++ b/nvim/lua/tjk/options.lua
@@ -0,0 +1,38 @@
+local opt = vim.opt
+local api = vim.api
+
+-- misc
+opt.autochdir = true -- stay in current directory when opening a file
+opt.splitright = true -- open splits on right instead of left
+opt.splitbelow = true -- open splits on bottom instead of top
+opt.termguicolors = true -- truecolor in terminal, will be disabled in tty
+opt.wrap = false -- disable word wrapping
+opt.cursorline = true -- highlight current line
+
+-- line numbers
+opt.number = true -- enable line numbers
+opt.relativenumber = true -- enable relative line numbers
+
+-- show whitespace characters
+opt.list = true -- show whitespace characters defined in listchars
+opt.listchars = "tab:▏ ,space:·" -- highlight tabs and spaces
+
+-- tabbing
+opt.tabstop = 4 -- set tabwidth to 4 instead of 8
+opt.shiftwidth = 4 -- tab key will only insert one tab
+
+-- search
+opt.ignorecase = true -- case-insensitive search...
+opt.smartcase = true -- ...unless the search term is capital
+
+-- experimental
+opt.smartindent = true
+opt.wildmode = "longest:list:full" -- Better auto-complete
+
+-- dont continue comments on to new lines (:help fo-table)
+api.nvim_create_autocmd("FileType", { pattern = "*", callback = function()
+ opt.formatoptions:remove { "c", "r", "o" }
+end})
+
+-- ignore __pycache__ directories in file listings
+opt.wildignore = "__pycache__/,*/__pycache__/"
diff --git a/nvim/lua/tjk/plugins/autoclose.lua b/nvim/lua/tjk/plugins/autoclose.lua
new file mode 100644
index 0000000..32afa9f
--- /dev/null
+++ b/nvim/lua/tjk/plugins/autoclose.lua
@@ -0,0 +1,9 @@
+return {
+ "m4xshen/autoclose.nvim", -- autoclose parenthesis
+ opts = {
+ options = {
+ pair_spaces = true,
+ },
+ },
+ config = true,
+}
diff --git a/nvim/lua/tjk/plugins/colorizer.lua b/nvim/lua/tjk/plugins/colorizer.lua
new file mode 100644
index 0000000..ac24b23
--- /dev/null
+++ b/nvim/lua/tjk/plugins/colorizer.lua
@@ -0,0 +1,4 @@
+return {
+ "norcalli/nvim-colorizer.lua", -- css color highlighter
+ config = true,
+}
diff --git a/nvim/lua/tjk/plugins/colorscheme.lua b/nvim/lua/tjk/plugins/colorscheme.lua
new file mode 100644
index 0000000..2307097
--- /dev/null
+++ b/nvim/lua/tjk/plugins/colorscheme.lua
@@ -0,0 +1,81 @@
+local root_mode = os.getenv "USER" == "root"
+local tty_mode = os.getenv "DISPLAY" == nil
+
+-- load condition
+local enable_gruvbox = not root_mode and not tty_mode
+
+-- use another colorscheme if running as root
+if root_mode then
+ vim.cmd.colorscheme "koehler"
+end
+
+-- disable termguicolors when in a tty
+if tty_mode then
+ vim.opt.termguicolors = false
+end
+
+return {
+ "ellisonleao/gruvbox.nvim",
+ cond = enable_gruvbox,
+ priority = 9001,
+ config = function()
+ vim.o.background = "dark"
+
+ local gruvbox = require("gruvbox")
+ local colors = gruvbox.palette
+
+ gruvbox.setup({
+ italic = {
+ strings = false,
+ emphasis = true,
+ comments = false,
+ operators = false,
+ folds = true,
+ },
+ invert_selection = true,
+ contrast = "hard",
+ palette_overrides = {
+ light0 = "#ffffff", -- use white instead of the default off-white for text
+ light1 = "#ffffff",
+ dark2 = "#363636", -- darker whitespace characters
+ },
+ overrides = {
+ CursorLine = { bg = "#282828" }, -- dark0 (non hard)
+ Directory = { link = "GruvboxGreenBold" },
+ -- treesitter overrides (more similar to builtin python syntax highlighting)
+ -- treesitter selectors can be overridden per language using @selector.language
+ ["@variable"] = { link = "GruvboxFg0" },
+ ["@punctuation.bracket"] = { link = "GruvboxFg0" },
+ ["@punctuation.delimiter"] = { link = "GruvboxFg0" },
+ ["@keyword.import"] = { link = "GruvboxBlue" },
+ ["@function"] = { link = "GruvboxAqua" },
+ ["@function.method"] = { link = "GruvboxAqua" },
+ ["@function.method"] = { link = "GruvboxAqua" },
+ ["@attribute.builtin"] = { link = "GruvboxGreenBold" },
+ ["@attribute"] = { link = "GruvboxGreenBold" },
+ ["@operator"] = { link = "GruvboxRed" },
+ ["@variable.member"] = { link = "GruvboxFg0" },
+ ["@variable.parameter"] = { link = "GruvboxFg0" },
+ ["@function.call"] = { link = "GruvboxPurple" },
+ ["@function.method.call"] = { link = "GruvboxPurple" },
+ -- rainbow delimiters colors
+ RainbowDelimiterRed = { fg = "#ff4433" },
+ RainbowDelimiterYellow = { fg = "#ffff22" },
+ RainbowDelimiterBlue = { fg = "#66f3ff" },
+ RainbowDelimiterOrange = { fg = "#ffaa00" },
+ RainbowDelimiterGreen = { fg = "#99ff44" },
+ RainbowDelimiterViolet = { fg = "#aa00ff" },
+ RainbowDelimiterCyan = { fg = "#22ddff" },
+ -- TODO italic string start / end
+ --["@string_start"] = { italic = true },
+ --["@string_end"] = { italic = true },
+ },
+ })
+
+ -- set colorscheme
+ vim.cmd.colorscheme "gruvbox"
+
+ -- fix todo comment highlighting (here instead of theme overrides since this replaces the bg w/ default)
+ vim.api.nvim_set_hl(0, "Todo", { fg = "#ffffff", bold = true })
+ end,
+}
diff --git a/nvim/lua/tjk/plugins/manageself.lua b/nvim/lua/tjk/plugins/manageself.lua
new file mode 100644
index 0000000..098c300
--- /dev/null
+++ b/nvim/lua/tjk/plugins/manageself.lua
@@ -0,0 +1,3 @@
+return {
+ "folke/lazy.nvim", -- so lazy can manage itself
+}
diff --git a/nvim/lua/tjk/plugins/treesitter.lua b/nvim/lua/tjk/plugins/treesitter.lua
new file mode 100644
index 0000000..925fb13
--- /dev/null
+++ b/nvim/lua/tjk/plugins/treesitter.lua
@@ -0,0 +1,32 @@
+return {
+ "nvim-treesitter/nvim-treesitter",
+ build = ":TSUpdate",
+ dependencies = {
+ --{
+ -- "nvim-treesitter/playground", -- inspect treesitter structure
+ -- cmd = "TSPlaygroundToggle"
+ --},
+ "HiPhish/rainbow-delimiters.nvim", -- colored delimiters per scope level
+ {
+ "windwp/nvim-ts-autotag", -- close tags in html/xml type languages
+ opts = {
+ per_filetype = {
+ ["html"] = {
+ enable_close = true
+ }
+ }
+ }
+ },
+ },
+ config = function()
+ local configs = require("nvim-treesitter.configs")
+ configs.setup({
+ ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "comment",
+ "javascript", "html", "css", "scss", "python", "php" },
+ auto_install = true, -- install available parsers when entering new buffers
+ highlight = { enable = true, disable = { "yaml", "bash", "latex" } },
+ indent = { enable = true, disable = { "yaml" } },
+ --playground = { enable = true }, -- treesitter debug
+ })
+ end
+}
diff --git a/nvim/lua/user/cmp.lua b/nvim/lua/user/cmp.lua
deleted file mode 100644
index c83ddce..0000000
--- a/nvim/lua/user/cmp.lua
+++ /dev/null
@@ -1,129 +0,0 @@
-local cmp_status_ok, cmp = pcall(require, "cmp")
-if not cmp_status_ok then
- return
-end
-
-local snip_status_ok, luasnip = pcall(require, "luasnip")
-if not snip_status_ok then
- return
-end
-
-require("luasnip/loaders/from_vscode").lazy_load()
-
-local check_backspace = function()
- local col = vim.fn.col "." - 1
- return col == 0 or vim.fn.getline("."):sub(col, col):match "%s"
-end
-
---   פּ ﯟ   some other good icons
-local kind_icons = {
- Text = "",
- Method = "m",
- Function = "",
- Constructor = "",
- Field = "",
- Variable = "",
- Class = "",
- Interface = "",
- Module = "",
- Property = "",
- Unit = "",
- Value = "",
- Enum = "",
- Keyword = "",
- Snippet = "",
- Color = "",
- File = "",
- Reference = "",
- Folder = "",
- EnumMember = "",
- Constant = "",
- Struct = "",
- Event = "",
- Operator = "",
- TypeParameter = "",
-}
--- find more here: https://www.nerdfonts.com/cheat-sheet
-
-cmp.setup {
- snippet = {
- expand = function(args)
- luasnip.lsp_expand(args.body) -- For `luasnip` users.
- end,
- },
- mapping = {
- ["<C-k>"] = cmp.mapping.select_prev_item(),
- ["<C-j>"] = cmp.mapping.select_next_item(),
- ["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
- ["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
- ["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
- ["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
- ["<C-e>"] = cmp.mapping {
- i = cmp.mapping.abort(),
- c = cmp.mapping.close(),
- },
- -- Accept currently selected item. If none selected, `select` first item.
- -- Set `select` to `false` to only confirm explicitly selected items.
- ["<CR>"] = cmp.mapping.confirm { select = true },
- ["<Tab>"] = cmp.mapping(function(fallback)
- if cmp.visible() then
- cmp.select_next_item()
- elseif luasnip.expandable() then
- luasnip.expand()
- elseif luasnip.expand_or_jumpable() then
- luasnip.expand_or_jump()
- elseif check_backspace() then
- fallback()
- else
- fallback()
- end
- end, {
- "i",
- "s",
- }),
- ["<S-Tab>"] = cmp.mapping(function(fallback)
- if cmp.visible() then
- cmp.select_prev_item()
- elseif luasnip.jumpable(-1) then
- luasnip.jump(-1)
- else
- fallback()
- end
- end, {
- "i",
- "s",
- }),
- },
- formatting = {
- fields = { "kind", "abbr", "menu" },
- format = function(entry, vim_item)
- -- Kind icons
- vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
- -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind
- vim_item.menu = ({
- luasnip = "[Snippet]",
- buffer = "[Buffer]",
- path = "[Path]",
- })[entry.source.name]
- return vim_item
- end,
- },
- sources = {
- { name = "nvim_lsp" },
- { name = "nvim_lua" },
- { name = "luasnip" },
- { name = "buffer" },
- { name = "path" },
- },
- confirm_opts = {
- behavior = cmp.ConfirmBehavior.Replace,
- select = false,
- },
- window = {
- documentation = cmp.config.window.bordered(),
- },
- experimental = {
- ghost_text = false,
- native_menu = false,
- },
-}
diff --git a/nvim/lua/user/lsp/handlers.lua b/nvim/lua/user/lsp/handlers.lua
deleted file mode 100644
index 8de0abd..0000000
--- a/nvim/lua/user/lsp/handlers.lua
+++ /dev/null
@@ -1,104 +0,0 @@
-local M = {}
-
--- TODO: backfill this to template
-M.setup = function()
- local signs = {
- { name = "DiagnosticSignError", text = "" },
- { name = "DiagnosticSignWarn", text = "" },
- { name = "DiagnosticSignHint", text = "" },
- { name = "DiagnosticSignInfo", text = "" },
- }
-
- for _, sign in ipairs(signs) do
- vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
- end
-
- local config = {
- -- disable virtual text
- virtual_text = false,
- -- show signs
- signs = {
- active = signs,
- },
- update_in_insert = true,
- underline = true,
- severity_sort = true,
- float = {
- focusable = false,
- style = "minimal",
- border = "rounded",
- source = "always",
- header = "",
- prefix = "",
- },
- }
-
- vim.diagnostic.config(config)
-
- vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
- border = "rounded",
- })
-
- vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
- border = "rounded",
- })
-end
-
-local function lsp_highlight_document(client)
- -- Set autocommands conditional on server_capabilities
- if client.server_capabilities.documentHighlight then
- vim.api.nvim_exec(
- [[
- augroup lsp_document_highlight
- autocmd! * <buffer>
- autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
- autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
- augroup END
- ]],
- false
- )
- end
-end
-
-local function lsp_keymaps(bufnr)
- local opts = { noremap = true, silent = true }
- vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
- vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
- vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
- vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
- vim.api.nvim_buf_set_keymap(bufnr, "n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
- -- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
- vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
- -- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
- -- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>f", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
- vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", '<cmd>lua vim.diagnostic.goto_prev({ border = "rounded" })<CR>', opts)
- vim.api.nvim_buf_set_keymap(
- bufnr,
- "n",
- "gl",
- '<cmd>lua vim.diagnostic.open_float()<CR>',
- opts
- )
- vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts)
- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>q", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
- vim.cmd [[ command! Format execute 'lua vim.lsp.buf.formatting()' ]]
-end
-
-M.on_attach = function(client, bufnr)
- if client.name == "tsserver" then
- client.server_capabilities.documentFormattingProvider = false
- end
- lsp_keymaps(bufnr)
- lsp_highlight_document(client)
-end
-
-local capabilities = vim.lsp.protocol.make_client_capabilities()
-
-local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
-if not status_ok then
- return
-end
-
-M.capabilities = cmp_nvim_lsp.default_capabilities(capabilities)
-
-return M
diff --git a/nvim/lua/user/lsp/init.lua b/nvim/lua/user/lsp/init.lua
deleted file mode 100644
index 8a84467..0000000
--- a/nvim/lua/user/lsp/init.lua
+++ /dev/null
@@ -1,7 +0,0 @@
-local status_ok, _ = pcall(require, "lspconfig")
-if not status_ok then
- return
-end
-
-require "user.lsp.mason"
-require("user.lsp.handlers").setup()
diff --git a/nvim/lua/user/lsp/mason.lua b/nvim/lua/user/lsp/mason.lua
deleted file mode 100644
index a2e5384..0000000
--- a/nvim/lua/user/lsp/mason.lua
+++ /dev/null
@@ -1,47 +0,0 @@
-local servers = {
- "lua_ls",
- "pyright",
- "jsonls",
-}
-
-local settings = {
- ui = {
- border = "none",
- icons = {
- package_installed = "◍",
- package_pending = "◍",
- package_uninstalled = "◍",
- },
- },
- log_level = vim.log.levels.INFO,
- max_concurrent_installers = 4,
-}
-
-require("mason").setup(settings)
-require("mason-lspconfig").setup({
- ensure_installed = servers,
- automatic_installation = true,
-})
-
-local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig")
-if not lspconfig_status_ok then
- return
-end
-
-local opts = {}
-
-for _, server in pairs(servers) do
- opts = {
- on_attach = require("user.lsp.handlers").on_attach,
- capabilities = require("user.lsp.handlers").capabilities,
- }
-
- server = vim.split(server, "@")[1]
-
- local require_ok, conf_opts = pcall(require, "user.lsp.settings." .. server)
- if require_ok then
- opts = vim.tbl_deep_extend("force", conf_opts, opts)
- end
-
- lspconfig[server].setup(opts)
-end
diff --git a/nvim/lua/user/lsp/null-ls.lua b/nvim/lua/user/lsp/null-ls.lua
deleted file mode 100644
index 874e19c..0000000
--- a/nvim/lua/user/lsp/null-ls.lua
+++ /dev/null
@@ -1,19 +0,0 @@
-local null_ls_status_ok, null_ls = pcall(require, "null-ls")
-if not null_ls_status_ok then
- return
-end
-
--- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
-local formatting = null_ls.builtins.formatting
--- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
-local diagnostics = null_ls.builtins.diagnostics
-
-null_ls.setup({
- debug = false,
- sources = {
- formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }),
- formatting.black.with({ extra_args = { "--fast" } }),
- formatting.stylua,
- -- diagnostics.flake8
- },
-})