From 792b5d2892343a21159e61dcc40986e59d618f59 Mon Sep 17 00:00:00 2001 From: TiagoRG Date: Tue, 5 Mar 2024 11:19:49 +0000 Subject: [PATCH] Add setup script Signed-off-by: TiagoRG --- .config/nvim/after/plugin/nvim-tree.lua | 2 +- .config/nvim/after/plugin/treesitter.lua | 10 ++--- .config/nvim/after/plugin/trouble.lua | 2 +- .config/nvim/data/colorscheme.txt | 2 +- .../{after/plugin => lua/tiagorg}/colors.lua | 13 +++--- .config/nvim/lua/tiagorg/init.lua | 2 +- .config/nvim/lua/tiagorg/packer.lua | 1 + .config/nvim/plugin/packer_compiled.lua | 10 ++--- .gitignore | 2 + .vimrc | 2 + .zsh/.zshrc | 1 + .zsh/zsh-autosuggestions | 1 - .zsh/zsh-syntax-highlighting | 1 - setup.sh | 45 +++++++++++++++++++ 14 files changed, 72 insertions(+), 22 deletions(-) rename .config/nvim/{after/plugin => lua/tiagorg}/colors.lua (81%) delete mode 160000 .zsh/zsh-autosuggestions delete mode 160000 .zsh/zsh-syntax-highlighting create mode 100644 setup.sh diff --git a/.config/nvim/after/plugin/nvim-tree.lua b/.config/nvim/after/plugin/nvim-tree.lua index e44ef94..7f25cc2 100644 --- a/.config/nvim/after/plugin/nvim-tree.lua +++ b/.config/nvim/after/plugin/nvim-tree.lua @@ -21,5 +21,5 @@ require("nvim-tree").setup({ }, }) -vim.api.nvim_set_keymap('n', '', ':NvimTreeToggle', { noremap = true, silent = true }) +vim.keymap.set({'n', 'i'}, '', 'NvimTreeToggle', { noremap = true, silent = true }) vim.keymap.set("n", "e", "NvimTreeFocus") diff --git a/.config/nvim/after/plugin/treesitter.lua b/.config/nvim/after/plugin/treesitter.lua index 77fd0e6..5187a68 100644 --- a/.config/nvim/after/plugin/treesitter.lua +++ b/.config/nvim/after/plugin/treesitter.lua @@ -1,9 +1,9 @@ require 'nvim-treesitter.configs'.setup { -- A list of parser names, or "all" (the five listed parsers should always be installed) - -- ensure_installed = { "bash", "lua", "vim", "vimdoc", "query", "regex", - -- "c", "cpp", "c_sharp", "rust", "python", - -- "html", "css", "php", "javascript", "typescript", "sql" - -- }, + ensure_installed = { "bash", "lua", "vim", "vimdoc", "query", "regex", + "c", "cpp", "c_sharp", "rust", "python", + "html", "css", "php", "javascript", "typescript", "sql" + }, -- Install parsers synchronously (only applied to `ensure_installed`) sync_install = false, @@ -25,7 +25,7 @@ require 'nvim-treesitter.configs'.setup { rainbow = { enable = true, -- list of languages you want to disable the plugin for - disable = { 'jsx' }, + disable = { 'jsx', 'cpp' }, -- Which query to use for finding delimiters query = 'rainbow-parens', -- Highlight the entire buffer all at once diff --git a/.config/nvim/after/plugin/trouble.lua b/.config/nvim/after/plugin/trouble.lua index ab36824..a70883f 100644 --- a/.config/nvim/after/plugin/trouble.lua +++ b/.config/nvim/after/plugin/trouble.lua @@ -1,7 +1,7 @@ require("trouble").setup { position = "bottom", auto_open = true, - auto_close = false, + auto_close = true, auto_preview = false, icons = true, } diff --git a/.config/nvim/data/colorscheme.txt b/.config/nvim/data/colorscheme.txt index 75be144..8c32236 100644 --- a/.config/nvim/data/colorscheme.txt +++ b/.config/nvim/data/colorscheme.txt @@ -1 +1 @@ -monokai-pro \ No newline at end of file +vscode \ No newline at end of file diff --git a/.config/nvim/after/plugin/colors.lua b/.config/nvim/lua/tiagorg/colors.lua similarity index 81% rename from .config/nvim/after/plugin/colors.lua rename to .config/nvim/lua/tiagorg/colors.lua index e3818b0..b9398b2 100644 --- a/.config/nvim/after/plugin/colors.lua +++ b/.config/nvim/lua/tiagorg/colors.lua @@ -2,7 +2,7 @@ local function trim(str) return str:gsub("^%s*(.-)%s*$", "%1") end -function ColorMyPencils() +function LoadColors() local color = nil local file = io.open("/home/tiagorg/.config/nvim/data/colorscheme.txt", "r") @@ -24,10 +24,6 @@ function ColorMyPencils() end vim.cmd.colorscheme(color) - - --vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) - - --vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) end -- Define a function to be called when the colorscheme changes @@ -41,7 +37,12 @@ function OnColorschemeChanged() file:write(newColorscheme) end -ColorMyPencils() +LoadColors() -- Set up an autocmd to trigger the function when the colorscheme changes vim.cmd([[autocmd ColorScheme * lua OnColorschemeChanged()]]) +vim.api.nvim_create_user_command("TransparentBackground", function(opts) + vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) +end, {}) + diff --git a/.config/nvim/lua/tiagorg/init.lua b/.config/nvim/lua/tiagorg/init.lua index 21cf19f..7d3d47d 100644 --- a/.config/nvim/lua/tiagorg/init.lua +++ b/.config/nvim/lua/tiagorg/init.lua @@ -1,6 +1,6 @@ require("tiagorg.set") require("tiagorg.remap") +require('tiagorg.colors') require('Comment').setup() -require("liveshare").setup() require("nvim-surround").setup() diff --git a/.config/nvim/lua/tiagorg/packer.lua b/.config/nvim/lua/tiagorg/packer.lua index 9d245b5..d5d9763 100644 --- a/.config/nvim/lua/tiagorg/packer.lua +++ b/.config/nvim/lua/tiagorg/packer.lua @@ -83,4 +83,5 @@ return require('packer').startup(function(use) "nvim-telescope/telescope.nvim" } } + use 'mfussenegger/nvim-jdtls' end) diff --git a/.config/nvim/plugin/packer_compiled.lua b/.config/nvim/plugin/packer_compiled.lua index e983011..52baef7 100644 --- a/.config/nvim/plugin/packer_compiled.lua +++ b/.config/nvim/plugin/packer_compiled.lua @@ -154,11 +154,6 @@ _G.packer_plugins = { path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim", url = "https://github.com/lukas-reineke/indent-blankline.nvim" }, - ["liveshare.nvim"] = { - loaded = true, - path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/liveshare.nvim", - url = "https://github.com/TiagoRG/liveshare.nvim" - }, ["lsp-zero.nvim"] = { loaded = true, path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim", @@ -194,6 +189,11 @@ _G.packer_plugins = { path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/nvim-cmp", url = "https://github.com/hrsh7th/nvim-cmp" }, + ["nvim-jdtls"] = { + loaded = true, + path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/nvim-jdtls", + url = "https://github.com/mfussenegger/nvim-jdtls" + }, ["nvim-lspconfig"] = { loaded = true, path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", diff --git a/.gitignore b/.gitignore index eb4eaa3..8cb97fc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ .vim/.netrwhist .vim/undodir/ .vim/pack/ +.zsh/zsh-autosuggestions +.zsh/zsh-syntax-highlighting diff --git a/.vimrc b/.vimrc index d9d69ef..19abaee 100644 --- a/.vimrc +++ b/.vimrc @@ -1,3 +1,5 @@ +set clipboard+="unnamedplus" + set number set relativenumber set signcolumn=auto diff --git a/.zsh/.zshrc b/.zsh/.zshrc index b920022..0ba36d4 100644 --- a/.zsh/.zshrc +++ b/.zsh/.zshrc @@ -293,6 +293,7 @@ alias s='sudo' alias grepf='grep -sirnIE' alias tl='telnet localhost' alias py='python' +alias mkjava='javac -d bin/ src/**/*.java' alias core='echo "core.%e.%p" | sudo tee /proc/sys/kernel/core_pattern' # uaveiro-leci repository diff --git a/.zsh/zsh-autosuggestions b/.zsh/zsh-autosuggestions deleted file mode 160000 index a411ef3..0000000 --- a/.zsh/zsh-autosuggestions +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a411ef3e0992d4839f0732ebeb9823024afaaaa8 diff --git a/.zsh/zsh-syntax-highlighting b/.zsh/zsh-syntax-highlighting deleted file mode 160000 index 143b25e..0000000 --- a/.zsh/zsh-syntax-highlighting +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 143b25eb98aa3227af63bd7f04413e1b3e7888ec diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..458ca35 --- /dev/null +++ b/setup.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# Install the required packages +# print in green +echo -e "\e[32m$1\e[0mInstalling the required packages" +sudo pacman -Sy stow vim neovim zsh git clang nodejs npm --noconfirm + +# Clone the dotfiles if it's not the current directory +if [ "$(pwd)" != "$HOME/.dotfiles" ]; then + echo -e "\e[32m$1\e[0mCloning the dotfiles repository" + git clone "https://github.com/TiagoRG/.dotfiles.git" "$HOME/.dotfiles" + cd "$HOME/.dotfiles" || exit +fi + +# Setup stow +echo -e "\e[32m$1\e[0mSetting up stow" +stow -t "$HOME" -d "$HOME/.dotfiles" dotfiles + +# Setup Vim +echo -e "\e[32m$1\e[0mSetting up Vim" +echo -e "\e[32m$1\e[0mInstalling OneDark theme" +curl -fLo "$HOME/.vim/colors/onedark.vim" --create-dirs "https://raw.githubusercontent.com/joshdick/onedark.vim/master/colors/onedark.vim" +curl -fLo "$HOME/.vim/autoload/onedark.vim" --create-dirs "https://raw.githubusercontent.com/joshdick/onedark.vim/master/autoload/onedark.vim" +echo -e "\e[32m$1\e[0mInstalling Copilot" +git clone "https://github.com/github/copilot.vim.git" "$HOME/.vim/pack/github/start/copilot.vim" +echo -e "\e[32m$1\e[0mSetting up Copilot" +/bin/vim -c 'Copilot setup' -c 'qa!' + +# Setup Neovim +echo -e "\e[32m$1\e[0mSetting up Neovim" +echo -e "\e[32m$1\e[0mInstalling Packer" +git clone --depth 1 "https://github.com/wbthomason/packer.nvim" "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" +cd "$HOME/.dotfiles/.config/nvim" || exit +echo -e "\e[32m$1\e[0mInstalling Plugins" +/bin/nvim --headless -c 'source lua/tiagorg/packer.lua' -c 'PackerSync' -c 'qa!' +cd "$OLDPWD" || exit + +# Setup zsh +echo -e "\e[32m$1\e[0mSetting up zsh" +chsh -s /bin/zsh +echo -e "\e[32m$1\e[0mInstalling zsh-autosuggestions" +git clone "https://github.com/zsh-users/zsh-autosuggestions.git" "$HOME/.zsh/zsh-autosuggestions" +echo -e "\e[32m$1\e[0mInstalling zsh-syntax-highlighting" +git clone "https://github.com/zsh-users/zsh-syntax-highlighting.git" "$HOME/.zsh/zsh-syntax-highlighting" +