diff --git a/config/nvim/init.lua b/config/nvim/init.lua deleted file mode 100644 index 38c4d4b..0000000 --- a/config/nvim/init.lua +++ /dev/null @@ -1,185 +0,0 @@ -require("packer").startup(function(use) - use({"wbthomason/packer.nvim"}) - - -- Colorscheme - use({"EdenEast/nightfox.nvim"}) - use({"projekt0n/github-nvim-theme"}) - use({"folke/tokyonight.nvim"}) - - -- Treesitter - use({ - "nvim-treesitter/nvim-treesitter", - run = ":TSUpdate", - { - {"p00f/nvim-ts-rainbow"}, - {"JoosepAlviste/nvim-ts-context-commentstring"}, - {"nvim-treesitter/playground"}, {"windwp/nvim-ts-autotag"} - } - }) - use({"haringsrob/nvim_context_vt"}) - - -- Make commenting code great - use({"tpope/vim-commentary"}) - - -- File tree - use({ - "kyazdani42/nvim-tree.lua", - requires = {"kyazdani42/nvim-web-devicons"} - }) - - -- Automatically close brackets and quotes - use({"windwp/nvim-autopairs"}) - - -- Telescope - use({"nvim-telescope/telescope.nvim", requires = {"nvim-lua/plenary.nvim"}}) - use({"nvim-telescope/telescope-symbols.nvim"}) - - -- Statusline - use({ - "nvim-lualine/lualine.nvim", - requires = {"kyazdani42/nvim-web-devicons"} - }) - - use({"iamcco/markdown-preview.nvim", run = "cd app && yarn install"}) - - -- Highlight colors in editor - use({"norcalli/nvim-colorizer.lua"}) - - -- LSP - use({"neovim/nvim-lspconfig", "williamboman/nvim-lsp-installer"}) - use({"hrsh7th/nvim-cmp"}) - use({"L3MON4D3/LuaSnip"}) - use({"rafamadriz/friendly-snippets"}) - use({ - "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", "hrsh7th/cmp-nvim-lua", - "saadparwaiz1/cmp_luasnip" - }) - use({"ray-x/lsp_signature.nvim"}) - - -- Tabs - use({"romgrk/barbar.nvim"}) - - -- Git - use({"lewis6991/gitsigns.nvim", requires = {"nvim-lua/plenary.nvim"}}) - use({"tpope/vim-fugitive"}) - - -- Formatter - use({"mhartington/formatter.nvim"}) - - use({"caenrique/nvim-toggle-terminal"}) - - use({"lukas-reineke/indent-blankline.nvim"}) - - -- NOTE: Don't need this for now - -- use({"folke/trouble.nvim"}) - - use({"folke/todo-comments.nvim"}) - - use({"luukvbaal/stabilize.nvim"}) -end) - --- require("nightfox").load() --- require("github-theme").setup({theme_style = "dark_default"}) -vim.g.tokyonight_style = "night" -vim.cmd([[colorscheme tokyonight]]) - -vim.o.tabstop = 2 -vim.o.shiftwidth = 2 -vim.o.expandtab = true -vim.o.autoindent = true -vim.o.number = true -vim.o.relativenumber = true -vim.o.wrap = true -vim.o.swapfile = false -vim.o.encoding = "utf-8" -vim.o.hidden = true -vim.o.writebackup = false -vim.o.updatetime = 300 -vim.o.shortmess = "filnxtToOFc" -vim.o.mouse = "a" -vim.o.cursorline = true -vim.o.clipboard = "unnamedplus" -vim.o.splitright = true -vim.o.splitbelow = true -vim.o.termguicolors = true -vim.o.signcolumn = "yes" -vim.opt.fillchars:append({eob = " "}) - --- Go and Lua specific settings -vim.cmd([[ -autocmd FileType go,lua set tabstop=4 -autocmd FileType go,lua set shiftwidth=4 -autocmd FileType go,lua set noexpandtab -]]) - -vim.g.mapleader = " " - -require("theme") -require("format") -require("lsp") -require("statusline") - -require("nvim-treesitter.configs").setup({ - ensure_installed = "maintained", - highlight = {enable = true}, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "", - scope_incremental = "", - node_incremental = "", - node_decremental = "" - } - }, - rainbow = {enable = true, extended_mode = true, disable = {"html"}}, - context_commentstring = {enable = true}, - autotag = {enable = true} -}) - -require("nvim-tree").setup({ - open_on_setup = true, - hijack_cursor = true, - open_on_tab = true, - update_cwd = true, - update_focused_file = {enable = true}, - view = {width = 30, side = "left", auto_resize = true}, - filters = {custom = {".git"}}, - git = {ignore = false} -}) -vim.g.nvim_tree_add_trailing = 1 -vim.g.nvim_tree_indent_markers = 1 -vim.g.nvim_tree_icons = {default = "", symlink = ""} - -require("telescope").setup({ - defaults = { - sorting_strategy = "ascending", - file_ignore_patterns = {".git", "node_modules"} - } -}) - -require("gitsigns").setup({ - current_line_blame = true, - keymaps = { - noremap = true, - ["n gs"] = [[:lua require("gitsigns").stage_hunk()]], - ["n gu"] = [[:lua require("gitsigns").undo_stage_hunk()]], - ["n gr"] = [[:lua require("gitsigns").reset_hunk()]] - } -}) - -require("indent_blankline").setup({show_end_of_line = true}) - --- require("trouble").setup() - -require("nvim-autopairs").setup() - -require("colorizer").setup() - -require("todo-comments").setup({signs = false}) - -require("stabilize").setup() - -require("nvim_context_vt").setup() - -require("remaps") diff --git a/config/nvim/lua/format.lua b/config/nvim/lua/format.lua deleted file mode 100644 index d105faa..0000000 --- a/config/nvim/lua/format.lua +++ /dev/null @@ -1,46 +0,0 @@ -local function prettierd() - return { - exe = "prettierd", - args = {vim.api.nvim_buf_get_name(0)}, - stdin = true - } -end - -local function luaformat() - return { - exe = "lua-format", - args = {vim.api.nvim_buf_get_name(0)}, - stdin = true - } -end - -local function gofmt() - return {exe = "gofmt", args = {vim.api.nvim_buf_get_name(0)}, stdin = true} -end - -local function goimports() - return { - exe = "goimports", - args = {vim.api.nvim_buf_get_name(0)}, - stdin = true - } -end - -require("formatter").setup({ - filetype = { - javascript = {prettierd}, - javascriptreact = {prettierd}, - typescript = {prettierd}, - typescriptreact = {prettierd}, - html = {prettierd}, - css = {prettierd}, - scss = {prettierd}, - json = {prettierd}, - svelte = {prettierd}, - lua = {luaformat}, - go = {gofmt, goimports} - } -}) - -vim.cmd( - [[autocmd BufWritePost *.js,*.jsx,*.ts,*.tsx,*.html,*.css,*.scss,*.json,*.svelte,*.lua,*.go FormatWrite]]) diff --git a/config/nvim/lua/lsp.lua b/config/nvim/lua/lsp.lua deleted file mode 100644 index cf5a25d..0000000 --- a/config/nvim/lua/lsp.lua +++ /dev/null @@ -1,174 +0,0 @@ -local lsp_installer = require("nvim-lsp-installer") -local cmp = require("cmp") -local configs = require("lspconfig.configs") -local nvim_lsp = require("lspconfig") - -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 = "" -} - -cmp.setup({ - snippet = { - expand = function(args) require("luasnip").lsp_expand(args.body) end - }, - mapping = { - [""] = cmp.mapping.select_next_item({ - behavior = cmp.SelectBehavior.Select - }), - [""] = cmp.mapping.select_prev_item({ - behavior = cmp.SelectBehavior.Select - }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.close() - else - cmp.complete() - end - end), - -- [""] = cmp.mapping.confirm({ - -- select = true, - -- behavior = cmp.SelectBehavior.Insert - -- }), - [""] = cmp.mapping.confirm({ - select = true, - behavior = cmp.SelectBehavior.Insert - }) - }, - sources = cmp.config.sources({ - {name = "nvim_lsp", trigger_characters = {".", "!", "#", ">", "*"}}, - {name = "luasnip"}, {name = "nvim_lua"} - }, {{name = "path"}, {name = "buffer"}}), - completion = {completeopt = "menu,menuone,noselect,noinsert,preview"}, - experimental = {ghost_text = true}, - sorting = { - comparators = { - cmp.config.compare.score, cmp.config.compare.sort_text, - cmp.config.compare.kind - } - }, - documentation = { - border = {"╭", "─", "╮", "│", "╯", "─", "╰", "│"}, - zindex = 999 - }, - formatting = { - format = function(entry, vim_item) - vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], - vim_item.kind) - vim_item.menu = ({ - buffer = "[Buffer]", - luasnip = "[Snippet]", - nvim_lua = "[Lua]", - path = "[File]" - })[entry.source.name] - return vim_item - end - } -}) - -vim.cmd([[ -highlight! CmpItemAbbrDeprecated guibg=NONE gui=strikethrough guifg=#808080 -]]) - -cmp.setup.cmdline("/", {sources = {{name = "buffer"}}}) - -cmp.setup.cmdline(":", {sources = {{name = "path"}, {name = "cmdline"}}}) - -local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp - .protocol - .make_client_capabilities()) -capabilities.textDocument.completion.completionItem.snippetSupport = true - -local function setupLspSignature() - require("lsp_signature").setup({ - bind = true, - hint_enable = false, - handler_opts = {border = "rounded"} - }) -end - -lsp_installer.on_server_ready(function(server) - local opts = {capabilities = capabilities} - - if server.name == "sumneko_lua" then - local runtime_path = vim.split(package.path, ';') - table.insert(runtime_path, "lua/?.lua") - table.insert(runtime_path, "lua/?/init.lua") - - opts.settings = { - Lua = { - runtime = {version = "LuaJIT", path = runtime_path}, - diagnostics = {globals = {"vim"}}, - workspace = {library = vim.api.nvim_get_runtime_file("", true)}, - telemetry = {enable = false} - } - } - end - - if server.name == "tsserver" then - opts.filetypes = { - "javascript", "javascriptreact", "typescript", "typescriptreact", - "svelte", "html" - } - end - - setupLspSignature() - - server:setup(opts) -end) - --- Use this emmet lsp - https://github.com/pedro757/emmet -if not configs.ls_emmet then - configs.ls_emmet = { - default_config = { - cmd = {'ls_emmet', '--stdio'}, - filetypes = { - 'html', 'css', 'scss', 'javascriptreact', 'typescriptreact', - 'haml', 'xml', 'xsl', 'pug', 'slim', 'sass', 'stylus', 'less', - 'sss' - }, - root_dir = function(fname) return vim.loop.cwd() end, - settings = {} - } - } -end -nvim_lsp.ls_emmet.setup({capabilities = capabilities}) - -nvim_lsp.gopls.setup({ - capabilities = capabilities, - on_attach = function() setupLspSignature() end, - settings = { - gopls = { - experimentalPostfixCompletions = true, - analyses = {unusedparams = true, shadow = true}, - staticcheck = true - } - } -}) - -require("luasnip/loaders/from_vscode").load({ - include = {"javascript", "typescript", "go", "html"} -}) diff --git a/config/nvim/lua/remaps.lua b/config/nvim/lua/remaps.lua deleted file mode 100644 index 8c1d1ed..0000000 --- a/config/nvim/lua/remaps.lua +++ /dev/null @@ -1,71 +0,0 @@ -local function map(mode, shortcut, command) - vim.api.nvim_set_keymap(mode, shortcut, command, - {noremap = true, silent = true}) -end - -local function nmap(shortcut, command) map("n", shortcut, command) end - -local function vmap(shortcut, command) map("v", shortcut, command) end - --- Quickly save/quit vim -nmap("w", ":w") -nmap("q", ":q") - --- Move line under the cursor up and down -nmap("", ":m .-2==") -nmap("", ":m .+1==") -vmap("K", ":m '<-2gv=gv") -vmap("J", ":m '>+1gv=gv") - --- Remove search highlighting -nmap("nh", ":nohl") - --- Escape from terminal -map("t", "", "") - --- Open splits -nmap("sv", ":vs") -nmap("sh", ":sp") - --- Move focus between splits -nmap("h", "h") -nmap("j", "j") -nmap("k", "k") -nmap("l", "l") - --- Resize splits -nmap("", ":resize -2") -nmap("", ":resize +2") -nmap("", ":vert resize -10") -nmap("", ":vert resize +10") - --- File Tree -nmap("b", ":NvimTreeToggle") - --- Telescope -nmap("p", ":Telescope") -nmap("f", ":Telescope find_files") - --- LSP -nmap("K", ":lua vim.lsp.buf.hover()") -nmap("gd", ":lua vim.lsp.buf.definition()") -nmap("gr", ":lua vim.lsp.buf.references()") -nmap(".", ":lua vim.lsp.buf.code_action()") -nmap("", ":lua vim.lsp.buf.rename()") - --- Tabs -nmap("1", ":BufferGoto 1") -nmap("2", ":BufferGoto 2") -nmap("3", ":BufferGoto 3") -nmap("4", ":BufferGoto 4") -nmap("5", ":BufferGoto 5") -nmap("6", ":BufferGoto 6") -nmap("7", ":BufferGoto 7") -nmap("8", ":BufferGoto 8") -nmap("9", ":BufferGoto 9") -nmap("e", ":BufferClose") - --- Git -nmap("gg", ":G | :resize -10") - -nmap("t", ":ToggleTerminal") diff --git a/config/nvim/lua/statusline.lua b/config/nvim/lua/statusline.lua deleted file mode 100644 index a6ff446..0000000 --- a/config/nvim/lua/statusline.lua +++ /dev/null @@ -1,21 +0,0 @@ -local function line_and_column() - local line, column = unpack(vim.api.nvim_win_get_cursor(0)) - - return "Ln " .. line .. ", Col " .. column -end - -require("lualine").setup({ - options = { - component_separators = {left = "", right = ""}, - section_separators = {left = "", right = ""}, - disabled_filetypes = {"NvimTree"} - }, - sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = {"branch", "diff", "filename"}, - lualine_x = {line_and_column, "encoding"}, - lualine_y = {}, - lualine_z = {} - } -}) diff --git a/config/nvim/lua/theme.lua b/config/nvim/lua/theme.lua deleted file mode 100644 index f94d524..0000000 --- a/config/nvim/lua/theme.lua +++ /dev/null @@ -1,16 +0,0 @@ --- General -vim.cmd([[ -hi Comment gui=italic -]]) - --- File tree -vim.cmd([[ -hi NvimTreeGitNew guibg=green -hi NvimTreeGitStaged guibg=lightgreen -hi NvimTreeGitDeleted guibg=red -hi NvimTreeGitDirty guibg=lightblue -hi NvimTreeGitMerge guibg=yellow -hi NvimTreeGitIgnored guibg=gray - -hi NvimTreeOpenedFolderName gui=italic,bold -]])