require("nvim.colorscheme")
require("nvim.cmp")
require("nvim.lsp")
+require("nvim.telescope")
require("nvim.autopairs")
require("nvim.treesitter")
require("nvim.gitsigns")
+require("nvim.comment")
require("nvim.nvim-tree")
require("nvim.bufferline")
+require("nvim.null-ls")
-- If you want insert `(` after select function or method item
local status_ok, npairs = pcall(require, "nvim-autopairs")
if not status_ok then
- return
+ return
end
local Rule = require("nvim-autopairs.rule")
-npairs.setup ({
- check_ts = true,
- ts_config = {
- lua = {"string"}, -- it will not add a pair on that treesitter node
- javascript = {"template_string"},
- java = false, -- don't check treesitter on java
- },
- map_cr = true,
+npairs.setup({
+ check_ts = true,
+ ts_config = {
+ lua = { "string" }, -- it will not add a pair on that treesitter node
+ javascript = { "template_string" },
+ java = false, -- don't check treesitter on java
+ },
+ map_cr = true,
})
-- npairs.add_rules {
-- }
--Add spaces between parentheses
-npairs.add_rules {
- Rule('{%', '%'),
- Rule('{% ', ' '),
- Rule(' ', ' ')
- :with_pair(function (opts)
- local pair = opts.line:sub(opts.col - 1, opts.col)
- return vim.tbl_contains({ '()', '[]', '{}' }, pair)
- end),
- Rule('( ', ' )')
- :with_pair(function() return false end)
- :with_move(function(opts)
- return opts.prev_char:match('.%)') ~= nil
- end)
- :use_key(')'),
- Rule('{ ', ' }')
- :with_pair(function() return false end)
- :with_move(function(opts)
- return opts.prev_char:match('.%}') ~= nil
- end)
- :use_key('}'),
- Rule('[ ', ' ]')
- :with_pair(function() return false end)
- :with_move(function(opts)
- return opts.prev_char:match('.%]') ~= nil
- end)
- :use_key(']'),
-}
-
+npairs.add_rules({
+ Rule("{%", "%"),
+ Rule("{% ", " "),
+ Rule(" ", " "):with_pair(function(opts)
+ local pair = opts.line:sub(opts.col - 1, opts.col)
+ return vim.tbl_contains({ "()", "[]", "{}" }, pair)
+ end),
+ Rule("( ", " )")
+ :with_pair(function()
+ return false
+ end)
+ :with_move(function(opts)
+ return opts.prev_char:match(".%)") ~= nil
+ end)
+ :use_key(")"),
+ Rule("{ ", " }")
+ :with_pair(function()
+ return false
+ end)
+ :with_move(function(opts)
+ return opts.prev_char:match(".%}") ~= nil
+ end)
+ :use_key("}"),
+ Rule("[ ", " ]")
+ :with_pair(function()
+ return false
+ end)
+ :with_move(function(opts)
+ return opts.prev_char:match(".%]") ~= nil
+ end)
+ :use_key("]"),
+})
-local cmp_autopairs = require('nvim-autopairs.completion.cmp')
+local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local cmp_status_ok, cmp = pcall(require, "cmp")
if not cmp_status_ok then
- return
+ return
end
-cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } }))
-
-
-
+cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
-- add a lisp filetype (wrap my-function), FYI: Hardcoded = { "clojure", "clojurescript", "fennel", "janet" }
-cmp_autopairs.lisp[#cmp_autopairs.lisp+1] = "racket"
-
+cmp_autopairs.lisp[#cmp_autopairs.lisp + 1] = "racket"
return
end
-bufferline.setup {
+bufferline.setup({
options = {
numbers = "none",
close_command = "Bdelete! %d",
enforce_regular_tabs = true,
always_show_bufferline = true,
},
-}
+})
local cmp_status_ok, cmp = pcall(require, "cmp")
if not cmp_status_ok then
- print("Error loading cmp")
- return
+ print("Error loading cmp")
+ return
end
local snip_status_ok, luasnip = pcall(require, "luasnip")
if not snip_status_ok then
- print("Error loading snip")
- return
+ print("Error loading snip")
+ 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"
+ 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 = "",
+ 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 = "",
}
-cmp.setup {
- snippet = {
- expand = function(args)
- luasnip.lsp_expand(args.body)
- end,
- },
- mapping = {
- ["<C-k>"] = cmp.mapping.select_prev_item(),
- ["<C-j>"] = cmp.mapping.select_next_item(),
- ["<C-p>"] = cmp.mapping.select_prev_item(),
- ["<C-n>"] = 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-e>"] = cmp.mapping {
- i = cmp.mapping.abort(),
- c = cmp.mapping.close(),
- },
- ["<CR>"] = cmp.mapping.confirm { select = false },
- ["<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" },
- },
- sources = {
- { name = "nvim_lsp" },
- { name = "nvim_lua" },
- { name = "luasnip" },
- { name = "buffer" },
- { name = "path" },
- },
- confirm_opts = {
- behavior = cmp.ConfirmBehavior.Replace,
- select = false,
- },
- window = {
- completion = cmp.config.window.bordered(),
- documentation = cmp.config.window.bordered(),
- },
- experimental = {
- ghost_text = true,
- },
-}
+cmp.setup({
+ snippet = {
+ expand = function(args)
+ luasnip.lsp_expand(args.body)
+ end,
+ },
+ mapping = {
+ ["<C-k>"] = cmp.mapping.select_prev_item(),
+ ["<C-j>"] = cmp.mapping.select_next_item(),
+ ["<C-p>"] = cmp.mapping.select_prev_item(),
+ ["<C-n>"] = 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-e>"] = cmp.mapping({
+ i = cmp.mapping.abort(),
+ c = cmp.mapping.close(),
+ }),
+ ["<CR>"] = cmp.mapping.confirm({ select = false }),
+ ["<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" },
+ },
+ sources = {
+ { name = "nvim_lsp" },
+ { name = "nvim_lua" },
+ { name = "luasnip" },
+ { name = "buffer" },
+ { name = "path" },
+ },
+ confirm_opts = {
+ behavior = cmp.ConfirmBehavior.Replace,
+ select = false,
+ },
+ window = {
+ completion = cmp.config.window.bordered(),
+ documentation = cmp.config.window.bordered(),
+ },
+ experimental = {
+ ghost_text = true,
+ },
+})
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
-cmp.setup.cmdline('/', {
- mapping = cmp.mapping.preset.cmdline(),
- sources = {
- { name = 'buffer' }
- }
+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' }
- })
+cmp.setup.cmdline(":", {
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = cmp.config.sources({
+ { name = "path" },
+ }, {
+ { name = "cmdline" },
+ }),
})
local status_ok, onedark = pcall(require, "onedark")
if not status_ok then
- vim.notify("Error with colorscheme")
- return
+ vim.notify("Error with colorscheme")
+ return
end
-onedark.setup {
- style = "deep"
-}
+onedark.setup({
+ style = "deep",
+})
onedark.load()
return
end
-comment.setup {
+comment.setup({
pre_hook = function(ctx)
local U = require("Comment.utils")
location = require("ts_context_commentstring.utils").get_visual_start_location()
end
- return require("ts_context_commentstring.internal").calculate_commentstring {
+ return require("ts_context_commentstring.internal").calculate_commentstring({
key = ctx.ctype == U.ctype.line and "__default" or "__multiline",
location = location,
- }
+ })
end,
-}
+})
return
end
-gitsigns.setup {
- signs = {
- add = {hl = 'GitSignsAdd' , text = '▎', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'},
- change = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
- delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
- topdelete = {hl = 'GitSignsDelete', text = '‾', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
- changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
- },
- signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
- numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
- linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
- word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
- watch_gitdir = {
- interval = 1000,
- follow_files = true
- },
- attach_to_untracked = true,
- current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
- current_line_blame_opts = {
- virt_text = true,
- virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
- delay = 1000,
- ignore_whitespace = false,
- },
- current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
- sign_priority = 6,
- update_debounce = 100,
- status_formatter = nil, -- Use default
- max_file_length = 40000,
- preview_config = {
- -- Options passed to nvim_open_win
- border = 'single',
- style = 'minimal',
- relative = 'cursor',
- row = 0,
- col = 1
- },
- yadm = {
- enable = false
- },
-}
+gitsigns.setup({
+ signs = {
+ add = { hl = "GitSignsAdd", text = "▎", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
+ change = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
+ delete = { hl = "GitSignsDelete", text = "_", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
+ topdelete = { hl = "GitSignsDelete", text = "‾", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
+ changedelete = { hl = "GitSignsChange", text = "~", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
+ },
+ signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
+ numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
+ linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
+ word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
+ watch_gitdir = {
+ interval = 1000,
+ follow_files = true,
+ },
+ attach_to_untracked = true,
+ current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
+ current_line_blame_opts = {
+ virt_text = true,
+ virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align'
+ delay = 1000,
+ ignore_whitespace = false,
+ },
+ current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
+ sign_priority = 6,
+ update_debounce = 100,
+ status_formatter = nil, -- Use default
+ max_file_length = 40000,
+ preview_config = {
+ -- Options passed to nvim_open_win
+ border = "single",
+ style = "minimal",
+ relative = "cursor",
+ row = 0,
+ col = 1,
+ },
+ yadm = {
+ enable = false,
+ },
+})
local opts = { noremap = true, silent = true }
local function nnoremap(shortcut, command)
- vim.keymap.set("n", shortcut, command, opts)
+ vim.keymap.set("n", shortcut, command, opts)
end
local function inoremap(shortcut, command)
- vim.keymap.set("i", shortcut, command, opts)
+ vim.keymap.set("i", shortcut, command, opts)
end
local function vnoremap(shortcut, command)
- vim.keymap.set("v", shortcut, command, opts)
+ vim.keymap.set("v", shortcut, command, opts)
end
local function xnoremap(shortcut, command)
- vim.keymap.set("x", shortcut, command, opts)
+ vim.keymap.set("x", shortcut, command, opts)
end
local function tnoremap(shortcut, command)
- vim.keymap.set("t", shortcut, command, opts)
+ vim.keymap.set("t", shortcut, command, opts)
end
-- Define leader key
-- Don't copy replaced text into register
-- while in visual mode, when pasting
-vnoremap("p", "\"_dP")
+vnoremap("p", '"_dP')
-- Move text up and down
vnoremap("<M-j>", ":m .+1<CR>==")
tnoremap("<C-l>", "<C-\\><C-N><C-w>l")
-- Telescope
-nnoremap("<leader>f", "<cmd>lua require'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({ previewer = false }))<CR>")
+nnoremap(
+ "<leader>f",
+ "<cmd>lua require'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({ previewer = false }))<CR>"
+)
nnoremap("<C-t>", "<cmd>Telescope live_grep<CR>")
-- 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 signs = {
+ { name = "DiagnosticSignError", text = "" },
+ { name = "DiagnosticSignWarn", text = "" },
+ { name = "DiagnosticSignHint", text = "" },
+ { name = "DiagnosticSignInfo", text = "" },
+ }
- local config = {
- -- disable virtual text
- virtual_text = true,
- -- 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 = "",
- },
- }
+ for _, sign in ipairs(signs) do
+ vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
+ end
- vim.diagnostic.config(config)
+ local config = {
+ -- disable virtual text
+ virtual_text = true,
+ -- 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.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
- border = "rounded",
- })
+ vim.diagnostic.config(config)
- vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
- border = "rounded",
- })
+ 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.resolved_capabilities.document_highlight then
- vim.api.nvim_exec(
- [[
+ -- Set autocommands conditional on server_capabilities
+ if client.resolved_capabilities.document_highlight 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
+ 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.lsp.diagnostic.show_line_diagnostics({ border = "rounded" })<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()' ]]
+ 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.lsp.diagnostic.show_line_diagnostics({ border = "rounded" })<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.resolved_capabilities.document_formatting = false
- end
- lsp_keymaps(bufnr)
- lsp_highlight_document(client)
+ if client.name == "tsserver" or client.name == "sumneko_lua" then
+ client.resolved_capabilities.document_formatting = 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
+ return
end
M.capabilities = cmp_nvim_lsp.update_capabilities(capabilities)
local status_ok, _ = pcall(require, "lspconfig")
if not status_ok then
- print("Error with lspconfig")
- return
+ print("Error with lspconfig")
+ return
end
require("nvim.lsp.lsp-installer")
local status_ok, lsp_installer = pcall(require, "nvim-lsp-installer")
if not status_ok then
- print("Error with nvim-lsp-installer")
- return
+ print("Error with nvim-lsp-installer")
+ return
end
-- Register a handler that will be called for all installed servers.
-- Alternatively, you may also register handlers on specific server instances instead (see example below).
lsp_installer.on_server_ready(function(server)
- local opts = {
- on_attach = require("nvim.lsp.handlers").on_attach,
- capabilities = require("nvim.lsp.handlers").capabilities,
- }
+ local opts = {
+ on_attach = require("nvim.lsp.handlers").on_attach,
+ capabilities = require("nvim.lsp.handlers").capabilities,
+ }
- if server.name == "jsonls" then
- local jsonls_opts = require("nvim.lsp.settings.jsonls")
- opts = vim.tbl_deep_extend("force", jsonls_opts, opts)
- end
+ if server.name == "jsonls" then
+ local jsonls_opts = require("nvim.lsp.settings.jsonls")
+ opts = vim.tbl_deep_extend("force", jsonls_opts, opts)
+ end
- if server.name == "sumneko_lua" then
- local sumneko_opts = require("nvim.lsp.settings.sumneko_lua")
- opts = vim.tbl_deep_extend("force", sumneko_opts, opts)
- end
+ if server.name == "sumneko_lua" then
+ local sumneko_opts = require("nvim.lsp.settings.sumneko_lua")
+ opts = vim.tbl_deep_extend("force", sumneko_opts, opts)
+ end
- if server.name == "pyright" then
- local pyright_opts = require("nvim.lsp.settings.pyright")
- opts = vim.tbl_deep_extend("force", pyright_opts, opts)
- end
+ if server.name == "pyright" then
+ local pyright_opts = require("nvim.lsp.settings.pyright")
+ opts = vim.tbl_deep_extend("force", pyright_opts, opts)
+ end
- -- This setup() function is exactly the same as lspconfig's setup function.
- -- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
- server:setup(opts)
+ -- This setup() function is exactly the same as lspconfig's setup function.
+ -- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
+ server:setup(opts)
end)
-- Find more schemas here: https://www.schemastore.org/json/
local schemas = {
- {
- description = "TypeScript compiler configuration file",
- fileMatch = {
- "tsconfig.json",
- "tsconfig.*.json",
- },
- url = "https://json.schemastore.org/tsconfig.json",
- },
- {
- description = "Lerna config",
- fileMatch = { "lerna.json" },
- url = "https://json.schemastore.org/lerna.json",
- },
- {
- description = "Babel configuration",
- fileMatch = {
- ".babelrc.json",
- ".babelrc",
- "babel.config.json",
- },
- url = "https://json.schemastore.org/babelrc.json",
- },
- {
- description = "ESLint config",
- fileMatch = {
- ".eslintrc.json",
- ".eslintrc",
- },
- url = "https://json.schemastore.org/eslintrc.json",
- },
- {
- description = "Bucklescript config",
- fileMatch = { "bsconfig.json" },
- url = "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/8.2.0/docs/docson/build-schema.json",
- },
- {
- description = "Prettier config",
- fileMatch = {
- ".prettierrc",
- ".prettierrc.json",
- "prettier.config.json",
- },
- url = "https://json.schemastore.org/prettierrc",
- },
- {
- description = "Vercel Now config",
- fileMatch = { "now.json" },
- url = "https://json.schemastore.org/now",
- },
- {
- description = "Stylelint config",
- fileMatch = {
- ".stylelintrc",
- ".stylelintrc.json",
- "stylelint.config.json",
- },
- url = "https://json.schemastore.org/stylelintrc",
- },
- {
- description = "A JSON schema for the ASP.NET LaunchSettings.json files",
- fileMatch = { "launchsettings.json" },
- url = "https://json.schemastore.org/launchsettings.json",
- },
- {
- description = "Schema for CMake Presets",
- fileMatch = {
- "CMakePresets.json",
- "CMakeUserPresets.json",
- },
- url = "https://raw.githubusercontent.com/Kitware/CMake/master/Help/manual/presets/schema.json",
- },
- {
- description = "Configuration file as an alternative for configuring your repository in the settings page.",
- fileMatch = {
- ".codeclimate.json",
- },
- url = "https://json.schemastore.org/codeclimate.json",
- },
- {
- description = "LLVM compilation database",
- fileMatch = {
- "compile_commands.json",
- },
- url = "https://json.schemastore.org/compile-commands.json",
- },
- {
- description = "Config file for Command Task Runner",
- fileMatch = {
- "commands.json",
- },
- url = "https://json.schemastore.org/commands.json",
- },
- {
- description = "AWS CloudFormation provides a common language for you to describe and provision all the infrastructure resources in your cloud environment.",
- fileMatch = {
- "*.cf.json",
- "cloudformation.json",
- },
- url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/cloudformation.schema.json",
- },
- {
- description = "The AWS Serverless Application Model (AWS SAM, previously known as Project Flourish) extends AWS CloudFormation to provide a simplified way of defining the Amazon API Gateway APIs, AWS Lambda functions, and Amazon DynamoDB tables needed by your serverless application.",
- fileMatch = {
- "serverless.template",
- "*.sam.json",
- "sam.json",
- },
- url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/sam.schema.json",
- },
- {
- description = "Json schema for properties json file for a GitHub Workflow template",
- fileMatch = {
- ".github/workflow-templates/**.properties.json",
- },
- url = "https://json.schemastore.org/github-workflow-template-properties.json",
- },
- {
- description = "golangci-lint configuration file",
- fileMatch = {
- ".golangci.toml",
- ".golangci.json",
- },
- url = "https://json.schemastore.org/golangci-lint.json",
- },
- {
- description = "JSON schema for the JSON Feed format",
- fileMatch = {
- "feed.json",
- },
- url = "https://json.schemastore.org/feed.json",
- versions = {
- ["1"] = "https://json.schemastore.org/feed-1.json",
- ["1.1"] = "https://json.schemastore.org/feed.json",
- },
- },
- {
- description = "Packer template JSON configuration",
- fileMatch = {
- "packer.json",
- },
- url = "https://json.schemastore.org/packer.json",
- },
- {
- description = "NPM configuration file",
- fileMatch = {
- "package.json",
- },
- url = "https://json.schemastore.org/package.json",
- },
- {
- description = "JSON schema for Visual Studio component configuration files",
- fileMatch = {
- "*.vsconfig",
- },
- url = "https://json.schemastore.org/vsconfig.json",
- },
- {
- description = "Resume json",
- fileMatch = { "resume.json" },
- url = "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
- },
+ {
+ description = "TypeScript compiler configuration file",
+ fileMatch = {
+ "tsconfig.json",
+ "tsconfig.*.json",
+ },
+ url = "https://json.schemastore.org/tsconfig.json",
+ },
+ {
+ description = "Lerna config",
+ fileMatch = { "lerna.json" },
+ url = "https://json.schemastore.org/lerna.json",
+ },
+ {
+ description = "Babel configuration",
+ fileMatch = {
+ ".babelrc.json",
+ ".babelrc",
+ "babel.config.json",
+ },
+ url = "https://json.schemastore.org/babelrc.json",
+ },
+ {
+ description = "ESLint config",
+ fileMatch = {
+ ".eslintrc.json",
+ ".eslintrc",
+ },
+ url = "https://json.schemastore.org/eslintrc.json",
+ },
+ {
+ description = "Bucklescript config",
+ fileMatch = { "bsconfig.json" },
+ url = "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/8.2.0/docs/docson/build-schema.json",
+ },
+ {
+ description = "Prettier config",
+ fileMatch = {
+ ".prettierrc",
+ ".prettierrc.json",
+ "prettier.config.json",
+ },
+ url = "https://json.schemastore.org/prettierrc",
+ },
+ {
+ description = "Vercel Now config",
+ fileMatch = { "now.json" },
+ url = "https://json.schemastore.org/now",
+ },
+ {
+ description = "Stylelint config",
+ fileMatch = {
+ ".stylelintrc",
+ ".stylelintrc.json",
+ "stylelint.config.json",
+ },
+ url = "https://json.schemastore.org/stylelintrc",
+ },
+ {
+ description = "A JSON schema for the ASP.NET LaunchSettings.json files",
+ fileMatch = { "launchsettings.json" },
+ url = "https://json.schemastore.org/launchsettings.json",
+ },
+ {
+ description = "Schema for CMake Presets",
+ fileMatch = {
+ "CMakePresets.json",
+ "CMakeUserPresets.json",
+ },
+ url = "https://raw.githubusercontent.com/Kitware/CMake/master/Help/manual/presets/schema.json",
+ },
+ {
+ description = "Configuration file as an alternative for configuring your repository in the settings page.",
+ fileMatch = {
+ ".codeclimate.json",
+ },
+ url = "https://json.schemastore.org/codeclimate.json",
+ },
+ {
+ description = "LLVM compilation database",
+ fileMatch = {
+ "compile_commands.json",
+ },
+ url = "https://json.schemastore.org/compile-commands.json",
+ },
+ {
+ description = "Config file for Command Task Runner",
+ fileMatch = {
+ "commands.json",
+ },
+ url = "https://json.schemastore.org/commands.json",
+ },
+ {
+ description = "AWS CloudFormation provides a common language for you to describe and provision all the infrastructure resources in your cloud environment.",
+ fileMatch = {
+ "*.cf.json",
+ "cloudformation.json",
+ },
+ url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/cloudformation.schema.json",
+ },
+ {
+ description = "The AWS Serverless Application Model (AWS SAM, previously known as Project Flourish) extends AWS CloudFormation to provide a simplified way of defining the Amazon API Gateway APIs, AWS Lambda functions, and Amazon DynamoDB tables needed by your serverless application.",
+ fileMatch = {
+ "serverless.template",
+ "*.sam.json",
+ "sam.json",
+ },
+ url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/sam.schema.json",
+ },
+ {
+ description = "Json schema for properties json file for a GitHub Workflow template",
+ fileMatch = {
+ ".github/workflow-templates/**.properties.json",
+ },
+ url = "https://json.schemastore.org/github-workflow-template-properties.json",
+ },
+ {
+ description = "golangci-lint configuration file",
+ fileMatch = {
+ ".golangci.toml",
+ ".golangci.json",
+ },
+ url = "https://json.schemastore.org/golangci-lint.json",
+ },
+ {
+ description = "JSON schema for the JSON Feed format",
+ fileMatch = {
+ "feed.json",
+ },
+ url = "https://json.schemastore.org/feed.json",
+ versions = {
+ ["1"] = "https://json.schemastore.org/feed-1.json",
+ ["1.1"] = "https://json.schemastore.org/feed.json",
+ },
+ },
+ {
+ description = "Packer template JSON configuration",
+ fileMatch = {
+ "packer.json",
+ },
+ url = "https://json.schemastore.org/packer.json",
+ },
+ {
+ description = "NPM configuration file",
+ fileMatch = {
+ "package.json",
+ },
+ url = "https://json.schemastore.org/package.json",
+ },
+ {
+ description = "JSON schema for Visual Studio component configuration files",
+ fileMatch = {
+ "*.vsconfig",
+ },
+ url = "https://json.schemastore.org/vsconfig.json",
+ },
+ {
+ description = "Resume json",
+ fileMatch = { "resume.json" },
+ url = "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
+ },
}
local opts = {
- settings = {
- json = {
- schemas = schemas,
- },
- },
- setup = {
- commands = {
- Format = {
- function()
- vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 })
- end,
- },
- },
- },
+ settings = {
+ json = {
+ schemas = schemas,
+ },
+ },
+ setup = {
+ commands = {
+ Format = {
+ function()
+ vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line("$"), 0 })
+ end,
+ },
+ },
+ },
}
return opts
return {
- settings = {
- python = {
- analysis = {
- typeCheckingMode = "basic",
- }
- }
- },
+ settings = {
+ python = {
+ analysis = {
+ typeCheckingMode = "basic",
+ },
+ },
+ },
}
return {
- settings = {
- Lua = {
- diagnostics = {
- globals = { "vim" },
- },
- workspace = {
- library = {
- [vim.fn.expand("$VIMRUNTIME/lua")] = true,
- [vim.fn.stdpath("config") .. "/lua"] = true,
- },
- },
- },
- },
+ settings = {
+ Lua = {
+ diagnostics = {
+ globals = { "vim" },
+ },
+ workspace = {
+ library = {
+ [vim.fn.expand("$VIMRUNTIME/lua")] = true,
+ [vim.fn.stdpath("config") .. "/lua"] = true,
+ },
+ },
+ },
+ },
}
--- /dev/null
+local null_ls_status_ok, null_ls = pcall(require, "null-ls")
+if not null_ls_status_ok then
+ return
+end
+
+local formatting = null_ls.builtins.formatting
+local diagnostics = null_ls.builtins.diagnostics
+
+null_ls.setup({
+ debug = false,
+ sources = {
+ formatting.black,
+ formatting.stylua,
+ diagnostics.flake8,
+ },
+})
-- setup with all defaults
-- each of these are documented in `:help nvim-tree.OPTION_NAME`
-- nested options are documented by accessing them with `.` (eg: `:help nvim-tree.view.mappings.list`).
-require'nvim-tree'.setup { -- BEGIN_DEFAULT_OPTS
- auto_reload_on_write = true,
- create_in_closed_folder = false,
- disable_netrw = false,
- hijack_cursor = false,
- hijack_netrw = true,
- hijack_unnamed_buffer_when_opening = false,
- ignore_buffer_on_setup = false,
- open_on_setup = false,
- open_on_setup_file = false,
- open_on_tab = false,
- sort_by = "name",
- update_cwd = false,
- reload_on_bufenter = false,
- respect_buf_cwd = false,
- view = {
- adaptive_size = false,
- width = 20,
- height = 30,
- hide_root_folder = false,
- side = "left",
- preserve_window_proportions = false,
- number = false,
- relativenumber = false,
- signcolumn = "yes",
- mappings = {
- custom_only = false,
- list = {
- { key = { "l", "<CR>", "o" }, cb = tree_cb "edit" },
- { key = "h", cb = tree_cb "close_node" },
- { key = "v", cb = tree_cb "vsplit" },
- },
- },
- },
- renderer = {
- add_trailing = false,
- group_empty = false,
- highlight_git = false,
- highlight_opened_files = "none",
- root_folder_modifier = ":~",
- indent_markers = {
- enable = false,
- icons = {
- corner = "└ ",
- edge = "│ ",
- item = "│ ",
- none = " ",
- },
- },
- icons = {
- webdev_colors = true,
- git_placement = "before",
- padding = " ",
- symlink_arrow = " ➛ ",
- show = {
- file = true,
- folder = true,
- folder_arrow = true,
- git = true,
- },
- glyphs = {
- default = "",
- symlink = "",
- folder = {
- arrow_closed = "",
- arrow_open = "",
- default = "",
- open = "",
- empty = "",
- empty_open = "",
- symlink = "",
- symlink_open = "",
- },
- git = {
- unstaged = "✗",
- staged = "✓",
- unmerged = "",
- renamed = "➜",
- untracked = "★",
- deleted = "",
- ignored = "◌",
- },
- },
- },
- special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md" },
- },
- hijack_directories = {
- enable = true,
- auto_open = true,
- },
- update_focused_file = {
- enable = false,
- update_cwd = false,
- ignore_list = {},
- },
- ignore_ft_on_setup = {},
- system_open = {
- cmd = "",
- args = {},
- },
- diagnostics = {
- enable = true,
- show_on_dirs = true,
- icons = {
- hint = "",
- info = "",
- warning = "",
- error = "",
- },
- },
- filters = {
- dotfiles = false,
- custom = {},
- exclude = {},
- },
- filesystem_watchers = {
- enable = false,
- interval = 100,
- },
- git = {
- enable = true,
- ignore = true,
- timeout = 400,
- },
- actions = {
- use_system_clipboard = true,
- change_dir = {
- enable = true,
- global = false,
- restrict_above_cwd = false,
- },
- expand_all = {
- max_folder_discovery = 300,
- },
- open_file = {
- quit_on_open = false,
- resize_window = true,
- window_picker = {
- enable = true,
- chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
- exclude = {
- filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
- buftype = { "nofile", "terminal", "help" },
- },
- },
- },
- remove_file = {
- close_window = true,
- },
- },
- trash = {
- cmd = "trash",
- require_confirm = true,
- },
- live_filter = {
- prefix = "[FILTER]: ",
- always_show_folders = true,
- },
- log = {
- enable = false,
- truncate = false,
- types = {
- all = false,
- config = false,
- copy_paste = false,
- diagnostics = false,
- git = false,
- profile = false,
- watcher = false,
- },
- },
-} -- END_DEFAULT_OPTS
+require("nvim-tree").setup({ -- BEGIN_DEFAULT_OPTS
+ auto_reload_on_write = true,
+ create_in_closed_folder = false,
+ disable_netrw = false,
+ hijack_cursor = false,
+ hijack_netrw = true,
+ hijack_unnamed_buffer_when_opening = false,
+ ignore_buffer_on_setup = false,
+ open_on_setup = false,
+ open_on_setup_file = false,
+ open_on_tab = false,
+ sort_by = "name",
+ update_cwd = false,
+ reload_on_bufenter = false,
+ respect_buf_cwd = false,
+ view = {
+ adaptive_size = false,
+ width = 30,
+ height = 30,
+ hide_root_folder = false,
+ side = "left",
+ preserve_window_proportions = false,
+ number = false,
+ relativenumber = false,
+ signcolumn = "yes",
+ mappings = {
+ custom_only = false,
+ list = {
+ { key = { "l", "<CR>", "o" }, cb = tree_cb("edit") },
+ { key = "h", cb = tree_cb("close_node") },
+ { key = "v", cb = tree_cb("vsplit") },
+ },
+ },
+ },
+ renderer = {
+ add_trailing = false,
+ group_empty = false,
+ highlight_git = false,
+ highlight_opened_files = "none",
+ root_folder_modifier = ":~",
+ indent_markers = {
+ enable = false,
+ icons = {
+ corner = "└ ",
+ edge = "│ ",
+ item = "│ ",
+ none = " ",
+ },
+ },
+ icons = {
+ webdev_colors = true,
+ git_placement = "before",
+ padding = " ",
+ symlink_arrow = " ➛ ",
+ show = {
+ file = true,
+ folder = true,
+ folder_arrow = true,
+ git = true,
+ },
+ glyphs = {
+ default = "",
+ symlink = "",
+ folder = {
+ arrow_closed = "",
+ arrow_open = "",
+ default = "",
+ open = "",
+ empty = "",
+ empty_open = "",
+ symlink = "",
+ symlink_open = "",
+ },
+ git = {
+ unstaged = "✗",
+ staged = "✓",
+ unmerged = "",
+ renamed = "➜",
+ untracked = "★",
+ deleted = "",
+ ignored = "◌",
+ },
+ },
+ },
+ special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md" },
+ },
+ hijack_directories = {
+ enable = true,
+ auto_open = true,
+ },
+ update_focused_file = {
+ enable = false,
+ update_cwd = false,
+ ignore_list = {},
+ },
+ ignore_ft_on_setup = {},
+ system_open = {
+ cmd = "",
+ args = {},
+ },
+ diagnostics = {
+ enable = true,
+ show_on_dirs = true,
+ icons = {
+ hint = "",
+ info = "",
+ warning = "",
+ error = "",
+ },
+ },
+ filters = {
+ dotfiles = false,
+ custom = {},
+ exclude = {},
+ },
+ filesystem_watchers = {
+ enable = false,
+ interval = 100,
+ },
+ git = {
+ enable = true,
+ ignore = true,
+ timeout = 400,
+ },
+ actions = {
+ use_system_clipboard = true,
+ change_dir = {
+ enable = true,
+ global = false,
+ restrict_above_cwd = false,
+ },
+ expand_all = {
+ max_folder_discovery = 300,
+ },
+ open_file = {
+ quit_on_open = false,
+ resize_window = true,
+ window_picker = {
+ enable = true,
+ chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
+ exclude = {
+ filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
+ buftype = { "nofile", "terminal", "help" },
+ },
+ },
+ },
+ remove_file = {
+ close_window = true,
+ },
+ },
+ trash = {
+ cmd = "trash",
+ require_confirm = true,
+ },
+ live_filter = {
+ prefix = "[FILTER]: ",
+ always_show_folders = true,
+ },
+ log = {
+ enable = false,
+ truncate = false,
+ types = {
+ all = false,
+ config = false,
+ copy_paste = false,
+ diagnostics = false,
+ git = false,
+ profile = false,
+ watcher = false,
+ },
+ },
+}) -- END_DEFAULT_OPTS
local options = {
- backup = false,
- clipboard = "unnamedplus",
- cmdheight = 1,
- completeopt = { "menuone", "noselect" },
- conceallevel = 0,
- fileencoding = "utf-8",
- hlsearch = false,
- showtabline = 4,
- pumheight = 10,
- smartcase = true,
- smartindent = true,
- splitbelow = true,
- splitright = true,
- swapfile = false,
- termguicolors = true,
- timeoutlen = 1000,
- undofile = true,
- updatetime = 300,
- writebackup = false,
- expandtab = false,
- shiftwidth = 4,
- tabstop = 4,
- number = true,
- relativenumber = true,
- cursorline = true,
- numberwidth = 4,
- signcolumn = "yes",
- wrap = false,
- scrolloff = 8,
- sidescrolloff = 8,
- guifont = "monospace:h17",
+ backup = false,
+ clipboard = "unnamedplus",
+ cmdheight = 1,
+ completeopt = { "menuone", "noselect" },
+ conceallevel = 0,
+ fileencoding = "utf-8",
+ hlsearch = false,
+ showtabline = 4,
+ pumheight = 10,
+ smartcase = true,
+ smartindent = true,
+ splitbelow = true,
+ splitright = true,
+ swapfile = false,
+ termguicolors = true,
+ timeoutlen = 1000,
+ undofile = true,
+ updatetime = 300,
+ writebackup = false,
+ expandtab = false,
+ shiftwidth = 4,
+ tabstop = 4,
+ number = true,
+ relativenumber = true,
+ cursorline = true,
+ numberwidth = 4,
+ signcolumn = "yes",
+ wrap = false,
+ scrolloff = 8,
+ sidescrolloff = 8,
+ guifont = "monospace:h17",
}
-vim.opt.shortmess:append "c"
+vim.opt.shortmess:append("c")
for k, v in pairs(options) do
- vim.opt[k] = v
+ vim.opt[k] = v
end
local fn = vim.fn
-- Automatically install packer
-local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim"
+local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then
- PACKER_BOOTSTRAP = fn.system {
- "git",
- "clone",
- "--depth",
- "1",
- "https://github.com/wbthomason/packer.nvim",
- install_path,
- }
- print "Installing packer close and reopen Neovim ... "
- vim.cmd [[packadd packer.nvim]]
+ PACKER_BOOTSTRAP = fn.system({
+ "git",
+ "clone",
+ "--depth",
+ "1",
+ "https://github.com/wbthomason/packer.nvim",
+ install_path,
+ })
+ print("Installing packer close and reopen Neovim ... ")
+ vim.cmd([[packadd packer.nvim]])
end
-- Autocommand that reloads neovim whenver you save the plugins.lua file
-vim.cmd [[
+vim.cmd([[
augroup packer_user_config
autocmd!
autocmd BufWritePost plugins.lua source <afile> | PackerSync
augroup end
-]]
+]])
-- Use a protected call so we don't error out on the first use
local status_ok, packer = pcall(require, "packer")
if not status_ok then
- vim.notify("Error with require packer")
- return
+ vim.notify("Error with require packer")
+ return
end
-packer.init {
- display = {
- open_fn = function()
- return require("packer.util").float {}
- end,
- },
-}
+packer.init({
+ display = {
+ open_fn = function()
+ return require("packer.util").float({})
+ end,
+ },
+})
-- Install plugins here
return packer.startup(function(use)
- use "wbthomason/packer.nvim" -- Have packer manage itself
-
-
-
- -- PLUGINS BEGIN --
- -- An implementation of the Popup API from vim in Neovim
- use "nvim-lua/popup.nvim"
-
- -- Useful lua functions used by lots of plugins
- use "nvim-lua/plenary.nvim"
-
- -- Preview markdown files
- use({
- "iamcco/markdown-preview.nvim",
- run = function() vim.fn["mkdp#util#install"]() end,
- })
-
- -- Colorschemes
- use "navarasu/onedark.nvim"
-
- -- cmp Plugins
- use "hrsh7th/nvim-cmp"
- use "hrsh7th/cmp-buffer"
- use "hrsh7th/cmp-path"
- use "hrsh7th/cmp-cmdline"
- use "saadparwaiz1/cmp_luasnip"
- use "hrsh7th/cmp-nvim-lsp"
- use "hrsh7th/cmp-nvim-lua"
-
- -- snippets
- use "L3MON4D3/LuaSnip"
- use "rafamadriz/friendly-snippets" -- a bunch of snippets to use
-
- -- LSP
- use "neovim/nvim-lspconfig" -- enable LSP
- use "williamboman/nvim-lsp-installer" -- simple to use language server installer
-
- --Telescope
- use {
- "nvim-telescope/telescope.nvim",
- requires = {
- { "nvim-lua/plenary.nvim" },
- -- { "nvim-telescope/telescope-media-files.nvim" },
- { "BurntSushi/ripgrep" },
- },
- }
-
- -- Commenter
- use {
- "numToStr/Comment.nvim",
- config = function()
- require("Comment").setup()
- end
- }
- use 'JoosepAlviste/nvim-ts-context-commentstring'
-
- -- Treesitter
- use {
- "nvim-treesitter/nvim-treesitter",
- run = ":TSUpdate",
- }
- use { "p00f/nvim-ts-rainbow" ,
- requires = {
- { "nvim-treesitter/nvim-treesitter" }
- }
- }
-
- -- Autopairs
- use "windwp/nvim-autopairs"
-
- -- Git
- use "lewis6991/gitsigns.nvim"
-
- -- NvimTree
- use { "kyazdani42/nvim-tree.lua",
- requires = {
- "kyazdani42/nvim-web-devicons"
- },
- }
-
- -- Bufferline
- use { "akinsho/bufferline.nvim",
- requires = {
- "kyazdani42/nvim-web-devicons"
- },
- }
- use "moll/vim-bbye"
-
- -- PLUGINS END --
-
-
-
-
- -- Automatically set up your configuration after cloning packer.nvim
- -- Put this at the end after all plugins
- if PACKER_BOOTSTRAP then
- require("packer").sync()
- end
+ use("wbthomason/packer.nvim") -- Have packer manage itself
+
+ -- PLUGINS BEGIN --
+ -- An implementation of the Popup API from vim in Neovim
+ use("nvim-lua/popup.nvim")
+
+ -- Useful lua functions used by lots of plugins
+ use("nvim-lua/plenary.nvim")
+
+ -- Preview markdown files
+ use({
+ "iamcco/markdown-preview.nvim",
+ run = function()
+ vim.fn["mkdp#util#install"]()
+ end,
+ })
+
+ -- Colorschemes
+ use("navarasu/onedark.nvim")
+
+ -- cmp Plugins
+ use("hrsh7th/nvim-cmp")
+ use("hrsh7th/cmp-buffer")
+ use("hrsh7th/cmp-path")
+ use("hrsh7th/cmp-cmdline")
+ use("saadparwaiz1/cmp_luasnip")
+ use("hrsh7th/cmp-nvim-lsp")
+ use("hrsh7th/cmp-nvim-lua")
+
+ -- snippets
+ use("L3MON4D3/LuaSnip")
+ use("rafamadriz/friendly-snippets") -- a bunch of snippets to use
+
+ -- LSP
+ use("neovim/nvim-lspconfig") -- enable LSP
+ use("williamboman/nvim-lsp-installer") -- simple to use language server installer
+ use("jose-elias-alvarez/null-ls.nvim")
+
+ --Telescope
+ use({
+ "nvim-telescope/telescope.nvim",
+ requires = {
+ { "nvim-lua/plenary.nvim" },
+ -- { "nvim-telescope/telescope-media-files.nvim" },
+ { "BurntSushi/ripgrep" },
+ },
+ })
+
+ -- Commenter
+ use({
+ "numToStr/Comment.nvim",
+ config = function()
+ require("Comment").setup()
+ end,
+ })
+ use("JoosepAlviste/nvim-ts-context-commentstring")
+
+ -- Treesitter
+ use({
+ "nvim-treesitter/nvim-treesitter",
+ run = ":TSUpdate",
+ })
+ use({ "p00f/nvim-ts-rainbow", requires = {
+ { "nvim-treesitter/nvim-treesitter" },
+ } })
+
+ -- Autopairs
+ use("windwp/nvim-autopairs")
+
+ -- Git
+ use("lewis6991/gitsigns.nvim")
+
+ -- NvimTree
+ use({ "kyazdani42/nvim-tree.lua", requires = {
+ "kyazdani42/nvim-web-devicons",
+ } })
+
+ -- Bufferline
+ use({ "akinsho/bufferline.nvim", requires = {
+ "kyazdani42/nvim-web-devicons",
+ } })
+ use("moll/vim-bbye")
+
+ -- PLUGINS END --
+
+ -- Automatically set up your configuration after cloning packer.nvim
+ -- Put this at the end after all plugins
+ if PACKER_BOOTSTRAP then
+ require("packer").sync()
+ end
end)
local status_ok, telescope = pcall(require, "telescope")
if not status_ok then
- return
+ return
end
-- telescope.load_extension('media_files')
-local actions = require "telescope.actions"
+local actions = require("telescope.actions")
-telescope.setup {
- defaults = {
+telescope.setup({
+ defaults = {
- prompt_prefix = " ",
- selection_caret = " ",
- path_display = { "smart" },
+ prompt_prefix = " ",
+ selection_caret = " ",
+ path_display = { "smart" },
- mappings = {
- i = {
- ["<C-n>"] = actions.cycle_history_next,
- ["<C-p>"] = actions.cycle_history_prev,
-
- ["<C-j>"] = actions.move_selection_next,
- ["<C-k>"] = actions.move_selection_previous,
-
- ["<C-c>"] = actions.close,
-
- ["<Down>"] = actions.move_selection_next,
- ["<Up>"] = actions.move_selection_previous,
-
- ["<CR>"] = actions.select_default,
- ["<C-x>"] = actions.select_horizontal,
- ["<C-v>"] = actions.select_vertical,
- ["<C-t>"] = actions.select_tab,
-
- ["<C-u>"] = actions.preview_scrolling_up,
- ["<C-d>"] = actions.preview_scrolling_down,
-
- ["<PageUp>"] = actions.results_scrolling_up,
- ["<PageDown>"] = actions.results_scrolling_down,
-
- ["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
- ["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
- ["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
- ["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
- ["<C-l>"] = actions.complete_tag,
- ["<C-_>"] = actions.which_key, -- keys from pressing <C-/>
- },
-
- n = {
- ["<esc>"] = actions.close,
- ["<CR>"] = actions.select_default,
- ["<C-x>"] = actions.select_horizontal,
- ["<C-v>"] = actions.select_vertical,
- ["<C-t>"] = actions.select_tab,
-
- ["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
- ["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
- ["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
- ["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
-
- ["j"] = actions.move_selection_next,
- ["k"] = actions.move_selection_previous,
- ["H"] = actions.move_to_top,
- ["M"] = actions.move_to_middle,
- ["L"] = actions.move_to_bottom,
-
- ["<Down>"] = actions.move_selection_next,
- ["<Up>"] = actions.move_selection_previous,
- ["gg"] = actions.move_to_top,
- ["G"] = actions.move_to_bottom,
-
- ["<C-u>"] = actions.preview_scrolling_up,
- ["<C-d>"] = actions.preview_scrolling_down,
-
- ["<PageUp>"] = actions.results_scrolling_up,
- ["<PageDown>"] = actions.results_scrolling_down,
-
- ["?"] = actions.which_key,
- },
- },
- },
- pickers = {
- -- Default configuration for builtin pickers goes here:
- -- picker_name = {
- -- picker_config_key = value,
- -- ...
- -- }
- -- Now the picker_config_key will be applied every time you call this
- -- builtin picker
- },
- extensions = {
- -- media_files = {
- -- -- filetypes whitelist
- -- -- defaults to {"png", "jpg", "mp4", "webm", "pdf"}
- -- filetypes = {"png", "webp", "jpg", "jpeg"},
- -- find_cmd = "rg" -- find command (defaults to `fd`)
- -- }
- -- Your extension configuration goes here:
- -- extension_name = {
- -- extension_config_key = value,
- -- }
- -- please take a look at the readme of the extension you want to configure
- },
-}
+ mappings = {
+ i = {
+ ["<C-n>"] = actions.cycle_history_next,
+ ["<C-p>"] = actions.cycle_history_prev,
+ ["<C-j>"] = actions.move_selection_next,
+ ["<C-k>"] = actions.move_selection_previous,
+ ["<C-c>"] = actions.close,
+ ["<Down>"] = actions.move_selection_next,
+ ["<Up>"] = actions.move_selection_previous,
+ ["<CR>"] = actions.select_default,
+ ["<C-x>"] = actions.select_horizontal,
+ ["<C-v>"] = actions.select_vertical,
+ ["<C-t>"] = actions.select_tab,
+ ["<C-u>"] = actions.preview_scrolling_up,
+ ["<C-d>"] = actions.preview_scrolling_down,
+ ["<PageUp>"] = actions.results_scrolling_up,
+ ["<PageDown>"] = actions.results_scrolling_down,
+ ["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
+ ["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
+ ["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
+ ["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
+ ["<C-l>"] = actions.complete_tag,
+ ["<C-_>"] = actions.which_key, -- keys from pressing <C-/>
+ },
+ n = {
+ ["<esc>"] = actions.close,
+ ["<CR>"] = actions.select_default,
+ ["<C-x>"] = actions.select_horizontal,
+ ["<C-v>"] = actions.select_vertical,
+ ["<C-t>"] = actions.select_tab,
+ ["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
+ ["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
+ ["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
+ ["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
+ ["j"] = actions.move_selection_next,
+ ["k"] = actions.move_selection_previous,
+ ["H"] = actions.move_to_top,
+ ["M"] = actions.move_to_middle,
+ ["L"] = actions.move_to_bottom,
+ ["<Down>"] = actions.move_selection_next,
+ ["<Up>"] = actions.move_selection_previous,
+ ["gg"] = actions.move_to_top,
+ ["G"] = actions.move_to_bottom,
+ ["<C-u>"] = actions.preview_scrolling_up,
+ ["<C-d>"] = actions.preview_scrolling_down,
+ ["<PageUp>"] = actions.results_scrolling_up,
+ ["<PageDown>"] = actions.results_scrolling_down,
+ ["?"] = actions.which_key,
+ },
+ },
+ },
+ pickers = {
+ -- Default configuration for builtin pickers goes here:
+ -- picker_name = {
+ -- picker_config_key = value,
+ -- ...
+ -- }
+ -- Now the picker_config_key will be applied every time you call this
+ -- builtin picker
+ },
+ extensions = {
+ -- media_files = {
+ -- -- filetypes whitelist
+ -- -- defaults to {"png", "jpg", "mp4", "webm", "pdf"}
+ -- filetypes = {"png", "webp", "jpg", "jpeg"},
+ -- find_cmd = "rg" -- find command (defaults to `fd`)
+ -- }
+ -- Your extension configuration goes here:
+ -- extension_name = {
+ -- extension_config_key = value,
+ -- }
+ -- please take a look at the readme of the extension you want to configure
+ },
+})
local configs = require("nvim-treesitter.configs")
-configs.setup {
- ensure_installed = "all",
- sync_install = false,
- ignore_install = { "" }, -- List of parsers to ignore installing
- highlight = {
- enable = true, -- false will disable the whole extension
- disable = { "" }, -- list of language that will be disabled
- additional_vim_regex_highlighting = true,
- },
- indent = { enable = true, disable = { "yaml" } },
+configs.setup({
+ ensure_installed = "all",
+ sync_install = false,
+ ignore_install = { "" }, -- List of parsers to ignore installing
+ highlight = {
+ enable = true, -- false will disable the whole extension
+ disable = { "" }, -- list of language that will be disabled
+ additional_vim_regex_highlighting = true,
+ },
+ indent = { enable = true, disable = { "yaml" } },
rainbow = {
enable = true,
extended_mode = true,
enable = true,
enable_autocmd = false,
},
-}
+})
vim.cmd("hi rainbowcol1 guifg=#FFFFFF")
vim.cmd("hi rainbowcol2 guifg=#00FF00")
vim.cmd("hi rainbowcol3 guifg=#2244FF")