commit 82feb6f59f010f8e8fa4dc256552554c7be81c52 Author: Andre Henriques Date: Mon May 8 18:41:49 2023 +0100 Inital Commit diff --git a/after/plugin/airline.lua b/after/plugin/airline.lua new file mode 100644 index 0000000..e45841a --- /dev/null +++ b/after/plugin/airline.lua @@ -0,0 +1,36 @@ +vim.g["airline#extensions#tabline#enabled"] = 1 + +--vim.g.airline_left_sep = '»' +--vim.g.airline_left_sep = '▶' +--vim.g.airline_right_sep = '«' +--vim.g.airline_right_sep = '◀' + +vim.g.airline_left_sep = '' +vim.g.airline_left_alt_sep = '' +vim.g.airline_right_sep = '' +vim.g.airline_right_alt_sep = '' +vim.g.airline_symbols.branch = '' +vim.g.airline_symbols.readonly = '' +vim.g.airline_symbols.linenr = '☰' +vim.g.airline_symbols.maxlinenr = '' + + +-- vim.g.airline_symbols = {} +vim.g.airline_symbols.crypt = '🔒' +vim.g.airline_symbols.linenr = '☰' +vim.g.airline_symbols.linenr = '␊' +vim.g.airline_symbols.linenr = '␤' +vim.g.airline_symbols.linenr = '¶' +vim.g.airline_symbols.maxlinenr = '' +vim.g.airline_symbols.maxlinenr = '㏑' +vim.g.airline_symbols.branch = '⎇' +vim.g.airline_symbols.paste = 'ρ' +vim.g.airline_symbols.paste = 'Þ' +vim.g.airline_symbols.paste = '∥' +vim.g.airline_symbols.spell = 'Ꞩ' +vim.g.airline_symbols.notexists = 'Ɇ' +vim.g.airline_symbols.whitespace = 'Ξ' + +vim.g.airline_powerline_fonts = 1 + +-- vim.g.airline_theme='cyberpunk' diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua new file mode 100644 index 0000000..46260d6 --- /dev/null +++ b/after/plugin/colors.lua @@ -0,0 +1,282 @@ +vim.opt.termguicolors = true + +vim.ayucolor="dark" + +vim.g.indentLine_char = "" +vim.g.indentLine_first_char = "" +vim.g.indentLine_showFirstIndentLevel = 1 +vim.g.indentLine_setColors = 0 + +vim.opt.cursorline = true +-- vim.g.cyberpunk_cursorline='black' + +-- vim.cmd('colorscheme ayu') +-- vim.cmd('colorscheme night_owl_light') +-- vim.cmd('colorscheme eva01') +-- vim.cmd('colorscheme cyberpunk') +vim.cmd('colorscheme catppuccin-latte') + +-- examples for your init.lua + +-- disable netrw at the very start of your init.lua (strongly advised) +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + +-- setup with some options +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, +ignore_buf_on_tab_change = {}, +sort_by = "name", +root_dirs = {}, +prefer_startup_root = false, +sync_root_with_cwd = false, +reload_on_bufenter = false, +respect_buf_cwd = false, +on_attach = "disable", +remove_keymaps = false, +select_prompts = false, +view = { + adaptive_size = false, + centralize_selection = false, + width = 30, + hide_root_folder = false, + side = "left", + preserve_window_proportions = false, + number = false, + relativenumber = false, + signcolumn = "yes", + mappings = { + custom_only = false, + list = { + -- user mappings go here + }, + }, + float = { + enable = false, + quit_on_focus_loss = true, + open_win_config = { + relative = "editor", + border = "rounded", + width = 30, + height = 30, + row = 1, + col = 1, + }, + }, +}, +renderer = { + add_trailing = false, + group_empty = false, + highlight_git = false, + full_name = false, + highlight_opened_files = "none", + root_folder_modifier = ":~", + indent_width = 2, + indent_markers = { + enable = false, + inline_arrows = true, + icons = { + corner = "└", + edge = "│", + item = "│", + bottom = "─", + none = " ", + }, + }, + icons = { + webdev_colors = true, + git_placement = "before", + padding = " ", + symlink_arrow = " ➛ ", + show = { + file = true, + folder = true, + folder_arrow = true, + git = true, + }, + glyphs = { + default = "", + symlink = "", + bookmark = "", + 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" }, + symlink_destination = true, +}, +hijack_directories = { + enable = true, + auto_open = true, +}, +update_focused_file = { + enable = false, + update_root = false, + ignore_list = {}, +}, +ignore_ft_on_setup = {}, +system_open = { + cmd = "", + args = {}, +}, +diagnostics = { + enable = true, + show_on_dirs = false, + debounce_delay = 50, + icons = { error = "☣️ ", warning = "😞", hint = "❤️ ", info = "ℹ️ " } +, +}, +filters = { + dotfiles = false, + custom = {}, + exclude = {}, +}, +filesystem_watchers = { + enable = true, + debounce_delay = 50, +}, +git = { + enable = true, + ignore = true, + show_on_dirs = true, + timeout = 400, +}, +actions = { + use_system_clipboard = true, + change_dir = { + enable = true, + global = false, + restrict_above_cwd = false, + }, + expand_all = { + max_folder_discovery = 300, + exclude = {}, + }, + file_popup = { + open_win_config = { + col = 1, + row = 1, + relative = "cursor", + border = "shadow", + style = "minimal", + }, + }, + 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 = "gio 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, + dev = false, + diagnostics = false, + git = false, + profile = false, + watcher = false, + }, +}, +notify = { + threshold = vim.log.levels.INFO, +}, + } + + + +local hls = { + PmenuSel = { bg = "#282C34", fg = "NONE" }, + Pmenu = { fg = "#C5CDD9", bg = "#22252A" }, + + CmpItemAbbrDeprecated = { fg = "#7E8294", bg = "NONE", strikethrough = true }, + CmpItemAbbrMatch = { fg = "#82AAFF", bg = "NONE", bold = true }, + CmpItemAbbrMatchFuzzy = { fg = "#82AAFF", bg = "NONE", bold = true }, + CmpItemMenu = { fg = "#C792EA", bg = "NONE", italic = true }, + + CmpItemKindField = { fg = "#EED8DA", bg = "#B5585F" }, + CmpItemKindProperty = { fg = "#EED8DA", bg = "#B5585F" }, + CmpItemKindEvent = { fg = "#EED8DA", bg = "#B5585F" }, + + CmpItemKindText = { fg = "#C3E88D", bg = "#9FBD73" }, + CmpItemKindEnum = { fg = "#C3E88D", bg = "#9FBD73" }, + CmpItemKindKeyword = { fg = "#C3E88D", bg = "#9FBD73" }, + + CmpItemKindConstant = { fg = "#FFE082", bg = "#D4BB6C" }, + CmpItemKindConstructor = { fg = "#FFE082", bg = "#D4BB6C" }, + CmpItemKindReference = { fg = "#FFE082", bg = "#D4BB6C" }, + + CmpItemKindFunction = { fg = "#EADFF0", bg = "#A377BF" }, + CmpItemKindStruct = { fg = "#EADFF0", bg = "#A377BF" }, + CmpItemKindClass = { fg = "#EADFF0", bg = "#A377BF" }, + CmpItemKindModule = { fg = "#EADFF0", bg = "#A377BF" }, + CmpItemKindOperator = { fg = "#EADFF0", bg = "#A377BF" }, + + CmpItemKindVariable = { fg = "#C5CDD9", bg = "#7E8294" }, + CmpItemKindFile = { fg = "#C5CDD9", bg = "#7E8294" }, + + CmpItemKindUnit = { fg = "#F5EBD9", bg = "#D4A959" }, + CmpItemKindSnippet = { fg = "#F5EBD9", bg = "#D4A959" }, + CmpItemKindFolder = { fg = "#F5EBD9", bg = "#D4A959" }, + + CmpItemKindMethod = { fg = "#DDE5F5", bg = "#6C8ED4" }, + CmpItemKindValue = { fg = "#DDE5F5", bg = "#6C8ED4" }, + CmpItemKindEnumMember = { fg = "#DDE5F5", bg = "#6C8ED4" }, + + CmpItemKindInterface = { fg = "#D8EEEB", bg = "#58B5A8" }, + CmpItemKindColor = { fg = "#D8EEEB", bg = "#58B5A8" }, + CmpItemKindTypeParameter = { fg = "#D8EEEB", bg = "#58B5A8" }, +} + +for key, value in pairs(hls) do + vim.api.nvim_set_hl(0, key, value) +end + + diff --git a/after/plugin/keys.lua b/after/plugin/keys.lua new file mode 100644 index 0000000..41c1735 --- /dev/null +++ b/after/plugin/keys.lua @@ -0,0 +1,13 @@ +-- This file sets the fzf and side tree +vim.keymap.set("n", " ", "", { silent = true, remap = false }) +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +local opts = { noremap=true } + +vim.keymap.set('n', 'f', function () vim.cmd('Telescope find_files') end, { remap = true }) + +vim.keymap('v', 'c', function () vim.cmd('\'<,\'>Commentary') end, { noremap = true, silent = true }) +vim.keymap('n', 'c', function () vim.cmd('Commentary') end, { noremap = true, silent = true }) + +vim.keymap.set("n", "", "NvimTreeToggle", { silent = true }) diff --git a/after/plugin/svelte.lua b/after/plugin/svelte.lua new file mode 100644 index 0000000..e5b7bb9 --- /dev/null +++ b/after/plugin/svelte.lua @@ -0,0 +1,10 @@ +-- To disable indentation on the script and style +-- vim.g.svelte_indent_script = 0 +-- vim.g.svelte_indent_style = 0 + +vim.g.svelte_preprocessor_tags = { + {name = "ts", tag = "script", as = "typescript"}, +} + +vim.g.svelte_preprocessors = {"typescript", "scss"} + diff --git a/after/plugin/tree-sitter.lua b/after/plugin/tree-sitter.lua new file mode 100644 index 0000000..39d30c1 --- /dev/null +++ b/after/plugin/tree-sitter.lua @@ -0,0 +1,5 @@ +require'nvim-treesitter.configs'.setup { + highlight = { + enable = true + } +} diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..d42d09b --- /dev/null +++ b/init.lua @@ -0,0 +1 @@ +require('andr3') diff --git a/lua/andr3/init.lua b/lua/andr3/init.lua new file mode 100644 index 0000000..c5cac97 --- /dev/null +++ b/lua/andr3/init.lua @@ -0,0 +1,7 @@ +if vim.g.vscode then + -- VSCode extension +else + require('andr3.set') + require('andr3.packer') + require('andr3.lsp') +end diff --git a/lua/andr3/langs/ccls.lua b/lua/andr3/langs/ccls.lua new file mode 100644 index 0000000..78872cf --- /dev/null +++ b/lua/andr3/langs/ccls.lua @@ -0,0 +1,12 @@ +local O = {}; +local lspConfig = require('lspconfig') + +function O.setup(on_attach, lsp_flags, capabilities) + lspConfig['ccls'].setup{ + on_attach = on_attach, + flags = lsp_flags, + capabilities = capabilities, + } +end + +return O diff --git a/lua/andr3/langs/prisma.lua b/lua/andr3/langs/prisma.lua new file mode 100644 index 0000000..004afb1 --- /dev/null +++ b/lua/andr3/langs/prisma.lua @@ -0,0 +1,9 @@ +local O = {} + +local lspConfig = require('lspconfig') +function O.setup(on_attach, lsp_flags, capabilities) + lspConfig.prismals.setup{} +end + +return O + diff --git a/lua/andr3/langs/rust.lua b/lua/andr3/langs/rust.lua new file mode 100644 index 0000000..4677492 --- /dev/null +++ b/lua/andr3/langs/rust.lua @@ -0,0 +1,16 @@ +local O = {} +local lspConfig = require('lspconfig') + +function O.setup(on_attach, lsp_flags, capabilities) + lspConfig['rust_analyzer'].setup{ + on_attach = on_attach, + flags = lsp_flags, + capabilities = capabilities, + -- Server-specific settings... + settings = { + ["rust-analyzer"] = {} + } + } +end + +return O diff --git a/lua/andr3/langs/svelte.lua b/lua/andr3/langs/svelte.lua new file mode 100644 index 0000000..8877c2b --- /dev/null +++ b/lua/andr3/langs/svelte.lua @@ -0,0 +1,10 @@ +local O = {}; +local lspConfig = require('lspconfig') +function O.setup(on_attach, lsp_flags, capabilities) + lspConfig['svelte'].setup{ + on_attach = on_attach, + flags = lsp_flags, + capabilities = capabilities, + } +end +return O diff --git a/lua/andr3/langs/ts.lua b/lua/andr3/langs/ts.lua new file mode 100644 index 0000000..7d4575b --- /dev/null +++ b/lua/andr3/langs/ts.lua @@ -0,0 +1,12 @@ +local O = {}; +local lspConfig = require('lspconfig') + +function O.setup(on_attach, lsp_flags, capabilities) + lspConfig['tsserver'].setup{ + on_attach = on_attach, + flags = lsp_flags, + capabilities = capabilities, + } +end + +return O diff --git a/lua/andr3/langs/vlang.lua b/lua/andr3/langs/vlang.lua new file mode 100644 index 0000000..aad042c --- /dev/null +++ b/lua/andr3/langs/vlang.lua @@ -0,0 +1,12 @@ +local O = {}; +local lspConfig = require('lspconfig') + +function O.setup(on_attach, lsp_flags, capabilities) + lspConfig.vls.setup{ + on_attach=on_attach, + lsp_flags=lsp_flags, + capabilities=capabilities + } +end + +return O diff --git a/lua/andr3/lsp.lua b/lua/andr3/lsp.lua new file mode 100644 index 0000000..8eb6dd1 --- /dev/null +++ b/lua/andr3/lsp.lua @@ -0,0 +1,286 @@ +require 'andr3.lsp_adds.prettier' +require 'andr3.lsp_adds.null-ls' + +-- Items +require('vim.lsp.protocol').CompletionItemKind = { + '', -- Text + '', -- Method + '', -- Function + '', -- Constructor + '', -- Field + '', -- Variable + 'ﴯ', -- Class + '', -- Interface + '', -- Module + 'ﰠ', -- Property + '', -- Unit + '', -- Value + '', -- Enum + '', -- Keyword + '', -- Snippet + '', -- Color + '', -- File + '', -- Reference + '', -- Folder + '', -- EnumMember + '', -- Constant + '', -- Struct + '', -- Event + '', -- Operator + '', -- TypeParameter +} + +vim.diagnostic.config({ virtual_text = { prefix = '🅰', } }) + +local warn = "😞"; +local signs = { Error = "☣️ ", Warn = warn, Hint = "❤️ ", Info = "🆓" } + +for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) +end + +local kind_icons = { + Text = "", + Method = "", + Function = "", + Constructor = "", + Field = "", + Variable = "", + Class = "ﴯ", + Interface = "", + Module = "", + Property = "ﰠ", + Unit = "", + Value = "", + Enum = "", + Keyword = "", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "", + Event = "", + Operator = "", + TypeParameter = "" +} + +-- lspkind + +require('lspkind').init({ + mode = 'symbol_text', + preset = 'codicons', + symbol_map = kind_icons, +}) + +-- Saga + +local keymap = vim.keymap.set +local saga = require'lspsaga' + +-- saga.init_lsp_saga{ +saga.setup{ + border_style = "single", + saga_winblend = 0, + move_in_saga = { prev = '',next = ''}, + diagnostic_header = { "☣️ ", warn, "❤️ ", "🆓" }, + max_preview_lines = 10, + code_action_icon = "🈁", + code_action_num_shortcut = true, + code_action_lightbulb = { + enable = true, + enable_in_insert = true, + cache_code_action = true, + sign = true, + update_time = 150, + sign_priority = 20, + virtual_text = true, + }, + finder_icons = { + def = ' ', + ref = '諭 ', + link = ' ', + }, + finder_request_timeout = 1500, + finder_action_keys = { + open = {'o', ''}, + vsplit = 's', + split = 'i', + tabe = 't', + quit = {'q', ''}, + }, + code_action_keys = { + quit = 'q', + exec = '', + }, + definition_action_keys = { + edit = 'o', + vsplit = 'v', + split = 'i', + tabe = 't', + quit = 'q', + }, + rename_action_quit = '', + rename_in_select = true, + symbol_in_winbar = { + in_custom = false, + enable = true, + separator = ' ', + show_file = true, + file_formatter = "", + click_support = false, + }, + show_outline = { + win_position = 'right', + win_with = '', + win_width = 30, + auto_enter = true, + auto_preview = true, + virt_text = '┃', + jump_key = 'o', + auto_refresh = true, + }, + custom_kind = {}, + server_filetype_map = {}, +} + +keymap("n", "gh", "Lspsaga lsp_finder", { silent = true }) +keymap({"n","v"}, "ca", function () saga.code_action() end, {}) +keymap("n", "gr", "Lspsaga rename", { silent = true }) +keymap("n", "gd", "Lspsaga peek_definition", { silent = true }) +keymap("n", "cd", "Lspsaga show_line_diagnostics", { silent = true }) +keymap("n", "cd", "Lspsaga show_cursor_diagnostics", { silent = true }) +keymap("n", "[e", "Lspsaga diagnostic_jump_prev", { silent = true }) +keymap("n", "]e", "Lspsaga diagnostic_jump_next", { silent = true }) + +keymap("n", "[E", function() + require("lspsaga.diagnostic").goto_prev({ severity = vim.diagnostic.severity.ERROR }) +end, { silent = true }) +keymap("n", "]E", function() + require("lspsaga.diagnostic").goto_next({ severity = vim.diagnostic.severity.ERROR }) +end, { silent = true }) + +keymap("n","o", "LSoutlineToggle",{ silent = true }) +keymap("n", "K", "Lspsaga hover_doc", { silent = true }) +keymap("n", "", "Lspsaga open_floaterm", { silent = true }) +keymap("n", "", "Lspsaga open_floaterm lazygit", { silent = true }) +keymap("t", "", [[Lspsaga close_floaterm]], { silent = true }) + +-- Comp + +local cmp = require'cmp' + +cmp.setup{ + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) + end, + }, + window = { + completion = { + winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None", + col_offset = -3, + side_padding = 0, + }, + }, + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function(entry, vim_item) + local kind = require("lspkind").cmp_format({ mode = "symbol_text", maxwidth = 50 })(entry, vim_item) + local strings = vim.split(kind.kind, "%s", { trimempty = true }) + kind.kind = " " .. strings[1] .. " " + + if entry.completion_item.detail then + kind.menu = ' "'..entry.completion_item.detail..'"' + end + + kind.menu = (kind.menu or "").." (" .. strings[2] .. ") " + + return kind + end, + }, + 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 }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'vsnip' }, + }, { + { name = 'buffer' }, + }) +} + +-- 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' } + }) +}) + +-- Set up lspconfig. +local capabilities = require('cmp_nvim_lsp').default_capabilities() + +-- Mappings. +-- See `:help vim.diagnostic.*` for documentation on any of the below functions +local opts = { noremap=true, silent=true } +vim.keymap.set('n', 'e', vim.diagnostic.open_float, opts) +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) + +-- Use an on_attach function to only map the following keys +-- after the language server attaches to the current buffer +local on_attach = function(client, bufnr) + + -- Enable completion triggered by + vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + + -- Mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local bufopts = { noremap=true, silent=true, buffer=bufnr } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) + vim.keymap.set('n', '', vim.lsp.buf.signature_help, bufopts) + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, bufopts) + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, bufopts) + vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, bufopts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) + vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) + vim.keymap.set('n', 'gf', function() vim.lsp.buf.format { async = true } end, bufopts) +end + +local lsp_flags = { + -- This is the default in Nvim 0.7+ + debounce_text_changes = 150, +} + +require 'andr3.langs.rust'.setup(on_attach, lsp_flags, capabilities) +require 'andr3.langs.ts'.setup(on_attach, lsp_flags, capabilities) +require 'andr3.langs.prisma'.setup(on_attach, lsp_flags, capabilities) +require 'andr3.langs.svelte'.setup(on_attach, lsp_flags, capabilities) +require 'andr3.langs.ccls'.setup(on_attach, lsp_flags, capabilities) + diff --git a/lua/andr3/lsp_adds/null-ls.lua b/lua/andr3/lsp_adds/null-ls.lua new file mode 100644 index 0000000..e3666f2 --- /dev/null +++ b/lua/andr3/lsp_adds/null-ls.lua @@ -0,0 +1,7 @@ +local null_ls = require('null-ls') + +null_ls.setup({ + sources = { + null_ls.builtins.diagnostics.eslint, + }, +}) diff --git a/lua/andr3/lsp_adds/prettier.lua b/lua/andr3/lsp_adds/prettier.lua new file mode 100644 index 0000000..f1f6711 --- /dev/null +++ b/lua/andr3/lsp_adds/prettier.lua @@ -0,0 +1,35 @@ +-- prettier + +local prettier = require("prettier") + +prettier.setup({ + bin = 'prettier', + filetypes = { + "css", + "graphql", + "html", + "javascript", + "javascriptreact", + "json", + "less", + "markdown", + "scss", + "typescript", + "typescriptreact", + "yaml", + "svelte", + }, + ["null-ls"] = { + condition = function() + return prettier.config_exists({ + -- if `false`, skips checking `package.json` for `"prettier"` key + check_package_json = true, + }) + end, + runtime_condition = function(params) + -- return false to skip running prettier + return true + end, + timeout = 5000, + } +}) diff --git a/lua/andr3/packer.lua b/lua/andr3/packer.lua new file mode 100644 index 0000000..255beda --- /dev/null +++ b/lua/andr3/packer.lua @@ -0,0 +1,71 @@ + +vim.cmd [[packadd packer.nvim]] + +return require('packer').startup(function() + + use 'wbthomason/packer.nvim' + + -- themes + use 'macguirerintoul/night_owl_light.vim' + use 'ayu-theme/ayu-vim' + use 'hachy/eva01.vim' + use 'thedenisnikulin/vim-cyberpunk' + use { "catppuccin/nvim", as = "catppuccin" } + + -- other stuff + + use 'neovim/nvim-lspconfig' + + use 'jose-elias-alvarez/null-ls.nvim' + + use 'MunifTanjim/prettier.nvim' + + use 'hrsh7th/cmp-nvim-lsp' + use 'hrsh7th/cmp-buffer' + use 'hrsh7th/cmp-path' + use 'hrsh7th/cmp-cmdline' + use 'hrsh7th/nvim-cmp' + use 'hrsh7th/vim-vsnip' + + use 'chrisbra/vim-commentary' + + use 'onsails/lspkind.nvim' + + use({ + "glepnir/lspsaga.nvim", + branch = "main", + }) + + -- use 'junegunn/fzf.vim' + use 'nvim-telescope/telescope.nvim' + + use 'othree/html5.vim' + use 'pangloss/vim-javascript' + use 'evanleck/vim-svelte' + + use 'vim-airline/vim-airline' + use 'vim-airline/vim-airline-themes' + + use 'airblade/vim-gitgutter' + + use 'mbbill/undotree' + + use "nvim-lua/plenary.nvim" + + use { + 'nvim-tree/nvim-tree.lua', + requires = { + 'nvim-tree/nvim-web-devicons', -- optional, for file icons + }, + tag = 'nightly' -- optional, updated every week. (see issue #1193) + } + + use { + 'nvim-treesitter/nvim-treesitter', + run = function() + local ts_update = require('nvim-treesitter.install').update({ with_sync = true }) + ts_update() + end, + } +end) + diff --git a/lua/andr3/set.lua b/lua/andr3/set.lua new file mode 100644 index 0000000..36d813f --- /dev/null +++ b/lua/andr3/set.lua @@ -0,0 +1,20 @@ +vim.opt.nu = true +vim.opt.relativenumber = true + +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.laststatus = 3 +vim.opt.expandtab = true +vim.opt.hlsearch = false +vim.opt.incsearch = true + +vim.opt.smartindent = true + +vim.opt.wrap = true + +vim.opt.clipboard = "unnamedplus" +vim.opt.signcolumn = "number" + +vim.g.mapleader = " " +vim.g.maplocalleader = " " diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua new file mode 100644 index 0000000..310b803 --- /dev/null +++ b/plugin/packer_compiled.lua @@ -0,0 +1,244 @@ +-- Automatically generated packer.nvim plugin loader code + +if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then + vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') + return +end + +vim.api.nvim_command('packadd packer.nvim') + +local no_errors, error_msg = pcall(function() + +_G._packer = _G._packer or {} +_G._packer.inside_compile = true + +local time +local profile_info +local should_profile = false +if should_profile then + local hrtime = vim.loop.hrtime + profile_info = {} + time = function(chunk, start) + if start then + profile_info[chunk] = hrtime() + else + profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 + end + end +else + time = function(chunk, start) end +end + +local function save_profiles(threshold) + local sorted_times = {} + for chunk_name, time_taken in pairs(profile_info) do + sorted_times[#sorted_times + 1] = {chunk_name, time_taken} + end + table.sort(sorted_times, function(a, b) return a[2] > b[2] end) + local results = {} + for i, elem in ipairs(sorted_times) do + if not threshold or threshold and elem[2] > threshold then + results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' + end + end + if threshold then + table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)') + end + + _G._packer.profile_output = results +end + +time([[Luarocks path setup]], true) +local package_path_str = "/home/andr3/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/andr3/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/andr3/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/andr3/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/andr3/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" +if not string.find(package.path, package_path_str, 1, true) then + package.path = package.path .. ';' .. package_path_str +end + +if not string.find(package.cpath, install_cpath_pattern, 1, true) then + package.cpath = package.cpath .. ';' .. install_cpath_pattern +end + +time([[Luarocks path setup]], false) +time([[try_loadstring definition]], true) +local function try_loadstring(s, component, name) + local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) + if not success then + vim.schedule(function() + vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) + end) + end + return result +end + +time([[try_loadstring definition]], false) +time([[Defining packer_plugins]], true) +_G.packer_plugins = { + ["ayu-vim"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/ayu-vim", + url = "https://github.com/ayu-theme/ayu-vim" + }, + catppuccin = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/catppuccin", + url = "https://github.com/catppuccin/nvim" + }, + ["cmp-buffer"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/cmp-buffer", + url = "https://github.com/hrsh7th/cmp-buffer" + }, + ["cmp-cmdline"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/cmp-cmdline", + url = "https://github.com/hrsh7th/cmp-cmdline" + }, + ["cmp-nvim-lsp"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", + url = "https://github.com/hrsh7th/cmp-nvim-lsp" + }, + ["cmp-path"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/cmp-path", + url = "https://github.com/hrsh7th/cmp-path" + }, + ["eva01.vim"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/eva01.vim", + url = "https://github.com/hachy/eva01.vim" + }, + ["html5.vim"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/html5.vim", + url = "https://github.com/othree/html5.vim" + }, + ["lspkind.nvim"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/lspkind.nvim", + url = "https://github.com/onsails/lspkind.nvim" + }, + ["lspsaga.nvim"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/lspsaga.nvim", + url = "https://github.com/glepnir/lspsaga.nvim" + }, + ["night_owl_light.vim"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/night_owl_light.vim", + url = "https://github.com/macguirerintoul/night_owl_light.vim" + }, + ["null-ls.nvim"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/null-ls.nvim", + url = "https://github.com/jose-elias-alvarez/null-ls.nvim" + }, + ["nvim-cmp"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/nvim-cmp", + url = "https://github.com/hrsh7th/nvim-cmp" + }, + ["nvim-lspconfig"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", + url = "https://github.com/neovim/nvim-lspconfig" + }, + ["nvim-tree.lua"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", + url = "https://github.com/nvim-tree/nvim-tree.lua" + }, + ["nvim-treesitter"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/nvim-treesitter", + url = "https://github.com/nvim-treesitter/nvim-treesitter" + }, + ["nvim-web-devicons"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", + url = "https://github.com/nvim-tree/nvim-web-devicons" + }, + ["packer.nvim"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/packer.nvim", + url = "https://github.com/wbthomason/packer.nvim" + }, + ["plenary.nvim"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/plenary.nvim", + url = "https://github.com/nvim-lua/plenary.nvim" + }, + ["prettier.nvim"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/prettier.nvim", + url = "https://github.com/MunifTanjim/prettier.nvim" + }, + ["telescope.nvim"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/telescope.nvim", + url = "https://github.com/nvim-telescope/telescope.nvim" + }, + undotree = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/undotree", + url = "https://github.com/mbbill/undotree" + }, + ["vim-airline"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/vim-airline", + url = "https://github.com/vim-airline/vim-airline" + }, + ["vim-airline-themes"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/vim-airline-themes", + url = "https://github.com/vim-airline/vim-airline-themes" + }, + ["vim-commentary"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/vim-commentary", + url = "https://github.com/chrisbra/vim-commentary" + }, + ["vim-cyberpunk"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/vim-cyberpunk", + url = "https://github.com/thedenisnikulin/vim-cyberpunk" + }, + ["vim-gitgutter"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/vim-gitgutter", + url = "https://github.com/airblade/vim-gitgutter" + }, + ["vim-javascript"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/vim-javascript", + url = "https://github.com/pangloss/vim-javascript" + }, + ["vim-svelte"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/vim-svelte", + url = "https://github.com/evanleck/vim-svelte" + }, + ["vim-vsnip"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/vim-vsnip", + url = "https://github.com/hrsh7th/vim-vsnip" + } +} + +time([[Defining packer_plugins]], false) + +_G._packer.inside_compile = false +if _G._packer.needs_bufread == true then + vim.cmd("doautocmd BufRead") +end +_G._packer.needs_bufread = false + +if should_profile then save_profiles() end + +end) + +if not no_errors then + error_msg = error_msg:gsub('"', '\\"') + vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') +end