From ffd5a948e0a26ef274827760558590c502a87d1b Mon Sep 17 00:00:00 2001 From: AnInternetTroll Date: Tue, 17 May 2022 16:13:48 +0200 Subject: Add a bunch of plugins and make it cool --- .config/nvim/init.lua | 354 ++++++++++++++++++-------------------------------- bootstrap.sh | 1 - 2 files changed, 128 insertions(+), 227 deletions(-) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index f3b5f55..fdf2a11 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,18 +1,24 @@ +-- :vi ft=lua local fn = vim.fn -local install_path = fn.stdpath("data").."/site/pack/packer/start/packer.nvim" +local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" local packer_bootstrap 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}) + packer_bootstrap = fn.system({ + "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", + install_path, + }) end vim.api.nvim_set_option("mouse", "a") -vim.api.nvim_command("set number relativenumber mouse") +vim.api.nvim_command("set number relativenumber cursorline") +-- Comment the following lines to disable whitespace characters vim.opt.list = true vim.opt.listchars:append("space:⋅") vim.opt.listchars:append("eol:↴") vim.opt.listchars:append("tab:-->") +-- VSCode like moving lines up and down with alt+{j,k} vim.api.nvim_command("nnoremap :m .+1==") vim.api.nvim_command("nnoremap :m .-2==") vim.api.nvim_command("inoremap :m .+1==gi") @@ -22,260 +28,148 @@ vim.api.nvim_command("vnoremap :m '<-2gv=gv") return require("packer").startup(function(use) -- Package manager - use "wbthomason/packer.nvim" - -- My plugins here - -- use "foo1/bar1.nvim" - -- use "foo2/bar2.nvim" + use { "https://github.com/wbthomason/packer.nvim" } + + use { "https://github.com/vladdoster/remember.nvim" } + + use { + "https://github.com/filipdutescu/renamer.nvim", + branch = "master", + requires = { { "https://github.com/nvim-lua/plenary.nvim" } }, + config = function() + vim.api.nvim_set_keymap("i", "", + "lua require(\"renamer\").rename()", + { noremap = true, silent = true }) + vim.api.nvim_set_keymap("n", "rn", + "lua require(\"renamer\").rename()", + { noremap = true, silent = true }) + vim.api.nvim_set_keymap("v", "rn", + "lua require(\"renamer\").rename()", + { noremap = true, silent = true }) + + end, + } -- File tree use { - "kyazdani42/nvim-tree.lua", + "https://github.com/kyazdani42/nvim-tree.lua", requires = { - "kyazdani42/nvim-web-devicons", -- optional, for file icon + "https://github.com/kyazdani42/nvim-web-devicons", -- optional, for file icon }, cmd = { "NvimTreeToggle" }, setup = function() - vim.api.nvim_set_keymap('n', "", ":NvimTreeToggle", { noremap = true, silent = true }) + vim.api.nvim_set_keymap("n", "", ":NvimTreeToggle", + { noremap = true, silent = true }) end, config = function() - require'nvim-tree'.setup { -- BEGIN_DEFAULT_OPTS + require"nvim-tree".setup { auto_reload_on_write = true, - 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, + update_cwd = true, view = { width = 30, height = 30, hide_root_folder = false, side = "left", preserve_window_proportions = false, - number = false, - relativenumber = false, + number = true, + relativenumber = true, signcolumn = "yes", - mappings = { - custom_only = false, - list = { - -- user mappings go here - }, - }, - }, - renderer = { - indent_markers = { - enable = false, - icons = { - corner = "└ ", - edge = "│ ", - none = " ", - }, - }, - icons = { - webdev_colors = true, - git_placement = "before", - } - }, - 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 = {}, }, + renderer = { indent_markers = { enable = true } }, diagnostics = { - enable = false, - show_on_dirs = false, - icons = { - hint = "", - info = "", - warning = "", - error = "", - }, - }, - filters = { - dotfiles = false, - custom = {}, - exclude = {}, - }, - git = { enable = true, - ignore = true, - timeout = 400, + show_on_dirs = true, + icons = { hint = "", info = "", warning = "", error = "" }, }, - actions = { - use_system_clipboard = true, - change_dir = { - enable = true, - global = false, - restrict_above_cwd = false, - }, - open_file = { - quit_on_open = false, - resize_window = false, - window_picker = { - enable = true, - chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", - exclude = { - filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" }, - buftype = { "nofile", "terminal", "help" }, - }, - }, - }, - }, - trash = { - cmd = "trash", - require_confirm = true, - }, - log = { - enable = false, - truncate = false, - types = { - all = false, - config = false, - copy_paste = false, - diagnostics = false, - git = false, - profile = false, - }, - }, - } -- END_DEFAULT_OPTS - end + } + end, -- tag = "nightly" -- optional, updated every week. (see issue #1193) } use { - 'nvim-telescope/telescope.nvim', - requires = { {'nvim-lua/plenary.nvim'} }, - config = function() - vim.api.nvim_set_keymap('n', "", ":Telescope find_files", { noremap = true, silent = true }) - vim.api.nvim_set_keymap('n', "", ":Telescope buffers", { noremap = true, silent = true }) + "https://github.com/nvim-telescope/telescope.nvim", + cmd = { "Telescope" }, + requires = { { "https://github.com/nvim-lua/plenary.nvim" } }, + setup = function() + vim.api.nvim_set_keymap("n", "", ":Telescope find_files", + { noremap = true, silent = true }) + vim.api.nvim_set_keymap("n", "", ":Telescope buffers", + { noremap = true, silent = true }) end, } - use { - 'kdheepak/tabline.nvim', - config = function() - require'tabline'.setup { - -- Defaults configuration options - enable = true, - options = { - -- If lualine is installed tabline will use separators configured in lualine by default. - -- These options can be used to override those settings. - section_separators = {'', ''}, - component_separators = {'', ''}, - max_bufferline_percent = 66, -- set to nil by default, and it uses vim.o.columns * 2/3 - show_tabs_always = false, -- this shows tabs only when there are more than one tab or if the first tab is named - show_devicons = true, -- this shows devicons in buffer section - show_bufnr = false, -- this appends [bufnr] to buffer section, - show_filename_only = false, -- shows base filename only instead of relative path in filename - modified_icon = "+ ", -- change the default modified icon - modified_italic = false, -- set to true by default; this determines whether the filename turns italic if modified - show_tabs_only = false, -- this shows only tabs instead of tabs + buffers - } - } - vim.cmd[[ - set guioptions-=e " Use showtabline in gui vim - set sessionoptions+=tabpages,globals " store tabpages and globals in session - ]] - end, - requires = { { 'hoob3rt/lualine.nvim', opt=true }, {'kyazdani42/nvim-web-devicons', opt = true} } + "https://github.com/akinsho/bufferline.nvim", + config = function() require("bufferline").setup { diagnostics = "nvim_lsp" } end, } - use { - 'nvim-lualine/lualine.nvim', - requires = { 'kyazdani42/nvim-web-devicons', opt = true }, + "https://github.com/nvim-lualine/lualine.nvim", + requires = { "https://github.com/kyazdani42/nvim-web-devicons", opt = true }, config = function() - local tabline = require("tabline") - require('lualine').setup { + -- local tabline = require("tabline") + require("lualine").setup { options = { icons_enabled = true, - theme = 'auto', - component_separators = { left = '', right = ''}, - section_separators = { left = '', right = ''}, + theme = "auto", + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, disabled_filetypes = {}, always_divide_middle = true, globalstatus = false, }, sections = { - lualine_a = {'mode'}, - lualine_b = {'branch', 'diff', 'diagnostics'}, - lualine_c = {'filename'}, - lualine_x = {'encoding', 'fileformat', 'filetype'}, - lualine_y = {'progress'}, - lualine_z = {'location'} + lualine_a = { "mode" }, + lualine_b = { "branch", "diff", "diagnostics" }, + lualine_c = { "filename" }, + lualine_x = { "encoding", "fileformat", "filetype" }, + lualine_y = { "progress" }, + lualine_z = { "location" }, }, inactive_sections = { lualine_a = {}, lualine_b = {}, - lualine_c = {'filename'}, - lualine_x = {'location'}, - lualine_y = {}, - lualine_z = {} - }, - tabline = { - lualine_a = {}, - lualine_b = {}, - lualine_c = { tabline.tabline_buffers }, - lualine_x = { tabline.tabline_tabs }, + lualine_c = { "filename" }, + lualine_x = { "location" }, lualine_y = {}, lualine_z = {}, - }, - extensions = {} + extensions = {}, } end, } use { - "karb94/neoscroll.nvim", - config = function() - require("neoscroll").setup() - end, + "https://github.com/karb94/neoscroll.nvim", + config = function() require("neoscroll").setup() end, } use { - "lukas-reineke/indent-blankline.nvim", + "https://github.com/lukas-reineke/indent-blankline.nvim", config = function() vim.opt.termguicolors = true - -- vim.cmd [[highlight IndentBlanklineIndent1 guifg=#E06C75 gui=nocombine]] - -- vim.cmd [[highlight IndentBlanklineIndent2 guifg=#E5C07B gui=nocombine]] - -- vim.cmd [[highlight IndentBlanklineIndent3 guifg=#98C379 gui=nocombine]] - -- vim.cmd [[highlight IndentBlanklineIndent4 guifg=#56B6C2 gui=nocombine]] - -- vim.cmd [[highlight IndentBlanklineIndent5 guifg=#61AFEF gui=nocombine]] - -- vim.cmd [[highlight IndentBlanklineIndent6 guifg=#C678DD gui=nocombine]] + vim.cmd [[highlight IndentBlanklineIndent1 guifg=#E06C75 gui=nocombine]] + vim.cmd [[highlight IndentBlanklineIndent2 guifg=#E5C07B gui=nocombine]] + vim.cmd [[highlight IndentBlanklineIndent3 guifg=#98C379 gui=nocombine]] + vim.cmd [[highlight IndentBlanklineIndent4 guifg=#56B6C2 gui=nocombine]] + vim.cmd [[highlight IndentBlanklineIndent5 guifg=#61AFEF gui=nocombine]] + vim.cmd [[highlight IndentBlanklineIndent6 guifg=#C678DD gui=nocombine]] require("indent_blankline").setup { show_end_of_line = true, space_char_blankline = " ", - -- char_highlight_list = { - -- "IndentBlanklineIndent1", - -- "IndentBlanklineIndent2", - -- "IndentBlanklineIndent3", - -- "IndentBlanklineIndent4", - -- "IndentBlanklineIndent5", - -- "IndentBlanklineIndent6", - -- }, + char_highlight_list = { + "IndentBlanklineIndent1", "IndentBlanklineIndent2", + "IndentBlanklineIndent3", "IndentBlanklineIndent4", + "IndentBlanklineIndent5", "IndentBlanklineIndent6", + }, } - end + end, } use { - "nvim-treesitter/nvim-treesitter", + "https://github.com/nvim-treesitter/nvim-treesitter", config = function() - require'nvim-treesitter.configs'.setup { + require"nvim-treesitter.configs".setup { -- A list of parser names, or "all" ensure_installed = { "javascript", "lua", "rust" }, @@ -302,68 +196,76 @@ return require("packer").startup(function(use) additional_vim_regex_highlighting = false, }, } - end + end, } - use { - "norcalli/nvim-colorizer.lua" - } + use { "https://github.com/norcalli/nvim-colorizer.lua" } use { - "google/vim-coverage", - requires = "google/vim-maktaba", + "https://github.com/google/vim-coverage", + requires = "https://github.com/google/vim-maktaba", } - use { - "prettier/vim-prettier", - } + use { "https://github.com/prettier/vim-prettier", cmd = { "Prettier" } } - use { - "editorconfig/editorconfig-vim", - } + use { "https://github.com/editorconfig/editorconfig-vim" } use { - requires = "neovim/nvim-lspconfig", - "williamboman/nvim-lsp-installer", + requires = "https://github.com/neovim/nvim-lspconfig", + "https://github.com/williamboman/nvim-lsp-installer", config = function() - local lsp_installer = require "nvim-lsp-installer" + local lsp_installer = require("nvim-lsp-installer") - lsp_installer.on_server_ready(function(server) - local opts = {} + lsp_installer.on_server_ready(function(server) + local opts = {} - if server.name == "denols" then - opts.root_dir = vim.loop.cwd - end + if server.name == "denols" then opts.root_dir = vim.loop.cwd end - server:setup(opts) - vim.cmd [[ do User LspAttachBuffers ]] - end) + server:setup(opts) + vim.cmd [[ do User LspAttachBuffers ]] + end) end, - } + } - use "nathom/filetype.nvim" + use { + "https://github.com/nathom/filetype.nvim", + setup = function() vim.g.did_load_filetypes = 1 end, + } use { - "dracula/vim", - config = function() - vim.api.nvim_command("colorscheme dracula") - end + "https://github.com/dracula/vim", + config = function() vim.api.nvim_command("colorscheme dracula") end, } use { - "lukas-reineke/lsp-format.nvim", + "https://github.com/lukas-reineke/lsp-format.nvim", config = function() - require "lsp-format".setup { + require"lsp-format".setup { typescript = { tab_width = 4 }, yaml = { tab_width = 2 }, } end, } + use { "https://github.com/github/copilot.vim" } + + use { + "https://github.com/ms-jpq/coq_nvim", + requires = { + "https://github.com/ms-jpq/coq.artifacts", + "https://github.com/ms-jpq/coq.thirdparty", + }, + config = function() + vim.g.coq_settings = { + auto_start = "shut-up", + clients = { tabnine = { enabled = true } }, + } + require("coq") + 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 + if packer_bootstrap then require("packer").sync() end end) diff --git a/bootstrap.sh b/bootstrap.sh index 1a14e05..b2f37ce 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -29,7 +29,6 @@ fi; git pull origin main; function doIt() { - git clone https://github.com/NvChad/NvChad.git ~/.config/nvim rsync --exclude ".git/" \ --exclude ".DS_Store" \ --exclude ".osx" \ -- cgit v1.2.3