From e3326d1b0295aa5c25a3f96a62f347f370156d11 Mon Sep 17 00:00:00 2001 From: Luca Matei Pintilie Date: Sun, 14 Aug 2022 14:32:27 +0200 Subject: Add more configs for wezterm, swappy, electron and git, as well as a better neovim config --- .bashrc | 32 ++++++++++ .config/electron-flags.conf | 3 + .config/nvim/init.lua | 151 ++++++++++++++++++++++++++++++++++---------- .config/swappy/config | 7 ++ .config/wezterm/wezterm.lua | 6 ++ .gitconfig | 11 ++++ .profile | 27 ++++++++ bootstrap.sh | 3 +- 8 files changed, 206 insertions(+), 34 deletions(-) create mode 100644 .bashrc create mode 100644 .config/electron-flags.conf create mode 100644 .config/swappy/config create mode 100644 .config/wezterm/wezterm.lua create mode 100644 .gitconfig create mode 100644 .profile diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..ef47356 --- /dev/null +++ b/.bashrc @@ -0,0 +1,32 @@ +# /etc/skel/.bashrc +# +# This file is sourced by all *interactive* bash shells on startup, +# including some apparently interactive shells such as scp and rcp +# that can't tolerate any output. So make sure this doesn't display +# anything or bad things will happen ! + + +# Test for an interactive shell. There is no need to set anything +# past this point for scp and rcp, and it's important to refrain from +# outputting anything in those cases. +if [[ $- != *i* ]] ; then + # Shell is non-interactive. Be done now! + return +fi + + +# Put your fun stuff here. +alias cls="clear" +alias cat="bat -p" +alias ls="lsd" +alias sudo="doas" +alias codium="flatpak run com.vscodium.codium --no-sandbox --enable-features=UseOzonePlatform --ozone-platform=wayland" + +for f in $HOME/.local/share/bash-completion/*; do + . "$f" +done + +GPG_TTY="$(tty)" export GPG_TTY; + +eval "$(starship init bash)" + diff --git a/.config/electron-flags.conf b/.config/electron-flags.conf new file mode 100644 index 0000000..13a7f51 --- /dev/null +++ b/.config/electron-flags.conf @@ -0,0 +1,3 @@ +--enable-features=UseOzonePlatform,WaylandWindowDecorations +--ozone-platform=wayland + diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 91f2d88..62149da 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -11,7 +11,7 @@ end vim.api.nvim_set_option("mouse", "a") vim.api.nvim_command("set number relativenumber") - +vim.api.nvim_set_option("termguicolors", true) -- Comment the following lines to disable whitespace characters vim.opt.list = true vim.opt.listchars:append("space:⋅") @@ -25,6 +25,8 @@ vim.api.nvim_command("inoremap :m .+1==gi") vim.api.nvim_command("inoremap :m .-2==gi") vim.api.nvim_command("vnoremap :m '>+1gv=gv") vim.api.nvim_command("vnoremap :m '<-2gv=gv") +vim.api.nvim_command( + "nnoremap :lua vim.lsp.buf.code_action()") return require("packer").startup(function(use) -- Package manager @@ -144,27 +146,16 @@ return require("packer").startup(function(use) use { "https://github.com/lukas-reineke/indent-blankline.nvim", - setup = function() - vim.api.nvim_set_option("termguicolors", true) - end, + setup = function() vim.api.nvim_set_option("termguicolors", true) end, config = function() - 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", - }, + show_current_context = true, + show_current_context_start = true, } + end, } @@ -203,9 +194,7 @@ return require("packer").startup(function(use) use { "https://github.com/norcalli/nvim-colorizer.lua", - config = function () - require('colorizer').setup() - end + config = function() require("colorizer").setup() end, } use { @@ -222,11 +211,21 @@ return require("packer").startup(function(use) "https://github.com/williamboman/nvim-lsp-installer", config = function() local lsp_installer = require("nvim-lsp-installer") + -- local nvim_lsp = require'nvim_lsp' + -- Disable Diagnostcs globally + -- vim.lsp.handlers["textDocument/publishDiagnostics"] = function() end 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 + opts.init_options = { + enable = true, + unstable = false, + config = "./deno.jsonc" + } + end server:setup(opts) vim.cmd [[ do User LspAttachBuffers ]] @@ -234,6 +233,88 @@ return require("packer").startup(function(use) end, } + use { + "https://github.com/hrsh7th/nvim-cmp", + requires = { + "https://github.com/neovim/nvim-lspconfig", + "https://github.com/hrsh7th/cmp-nvim-lsp", + "https://github.com/hrsh7th/cmp-buffer", + "https://github.com/hrsh7th/cmp-path", + "https://github.com/hrsh7th/cmp-cmdline", + "https://github.com/hrsh7th/cmp-vsnip", + "https://github.com/hrsh7th/vim-vsnip", + "https://github.com/onsails/lspkind.nvim", + }, + config = function() + -- Setup nvim-cmp. + local cmp = require "cmp" + + cmp.setup({ + snippet = { + -- REQUIRED - you must specify a snippet engine + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + 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 }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, { name = "vsnip" }, -- For vsnip users. + }, { { name = "buffer" } }), + }) + + -- Set configuration for specific filetype. + cmp.setup.filetype("gitcommit", { + sources = cmp.config.sources({ + { name = "cmp_git" }, -- You can specify the `cmp_git` source if you were installed it. + }, { { name = "buffer" } }), + }) + + -- 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" } }, + }) + + -- 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" } }), + }) + + -- Setup lspconfig. + local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp + .protocol + .make_client_capabilities()) + -- Replace with each lsp server you've enabled. + require("lspconfig")["denols"].setup { capabilities = capabilities } + local lspkind = require("lspkind") + cmp.setup { + formatting = { + format = lspkind.cmp_format({ + mode = "symbol", -- show only symbol annotations + maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) + + -- The function below will be called before any actual modifications from lspkind + -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) + before = function(entry, vim_item) return vim_item end, + }), + }, + } + + end, + } + use { "https://github.com/nathom/filetype.nvim", setup = function() vim.g.did_load_filetypes = 1 end, @@ -246,6 +327,7 @@ return require("packer").startup(function(use) use { "https://github.com/lukas-reineke/lsp-format.nvim", + requires = { "https://github.com/neovim/nvim-lspconfig" }, config = function() require"lsp-format".setup { typescript = { tab_width = 4 }, @@ -254,26 +336,29 @@ return require("packer").startup(function(use) end, } - use { "https://github.com/github/copilot.vim" } - use { - disable = true, - "https://github.com/ms-jpq/coq_nvim", - requires = { - "https://github.com/ms-jpq/coq.artifacts", - "https://github.com/ms-jpq/coq.thirdparty", - }, + "https://github.com/folke/trouble.nvim", + requires = "https://github.com/kyazdani42/nvim-web-devicons", config = function() - vim.g.coq_settings = { - auto_start = "shut-up", - clients = { tabnine = { enabled = true } }, + require("trouble").setup { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below } - require("coq") + vim.api.nvim_command("nnoremap :TroubleToggle") end, } + use { + "https://github.com/wfxr/minimap.vim", + setup = function() + vim.g["minimap_auto_start"] = 1 + vim.api.nvim_command("nnoremap :MinimapToggle") + end, + cmd = { "MinimapToggle" }, + } + -- 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) - diff --git a/.config/swappy/config b/.config/swappy/config new file mode 100644 index 0000000..779d225 --- /dev/null +++ b/.config/swappy/config @@ -0,0 +1,7 @@ +[Default] +save_dir=$HOME/Pictures/screenshots +save_filename_format=%Y%m%d-%H%M%S.png +show_panel=false +line_size=20 +text_size=20 +text_font=sans-serif diff --git a/.config/wezterm/wezterm.lua b/.config/wezterm/wezterm.lua new file mode 100644 index 0000000..f0bea3b --- /dev/null +++ b/.config/wezterm/wezterm.lua @@ -0,0 +1,6 @@ +local wezterm = require 'wezterm' +return { + color_scheme = 'Dracula', + font = wezterm.font 'JetBrains Mono', +} + diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 0000000..ccd5d64 --- /dev/null +++ b/.gitconfig @@ -0,0 +1,11 @@ +[user] + signingKey = CA875B8CE4FF7C9F + name = Luca Matei Pintilie + email = lucafulger@gmail.com +[commit] + gpgSign = true +[tag] + gpgSign = true +[pull] + rebase = false + diff --git a/.profile b/.profile new file mode 100644 index 0000000..2755d19 --- /dev/null +++ b/.profile @@ -0,0 +1,27 @@ +#!/usr/bin/env sh +if [ -z "${XDG_RUNTIME_DIR}" ]; then + XDG_RUNTIME_DIR="/tmp/${UID}-runtime-dir"; export XDG_RUNTIME_DIR; + if [ ! -d "${XDG_RUNTIME_DIR}" ]; then + mkdir "${XDG_RUNTIME_DIR}"; + chmod 0700 "${XDG_RUNTIME_DIR}"; + fi +fi + +DENO_INSTALL="$HOME/.deno"; export DENO_INSTALL; +BUN_INSTALL="/home/luca/.bun" + +EDITOR="nvim"; export EDITOR; +MANPAGER="sh -c 'col -bx | bat -l man -p'"; export MANPAGER; +GPG_TTY="$(tty)" export GPG_TTY; + +# Sway specific +SDL_VIDEODRIVER=wayland; export SDL_VIDEODRIVER; +_JAVA_AWT_WM_NONREPARENTING=1; export _JAVA_AWT_WM_NONREPARENTING; +QT_QPA_PLATFORM=wayland; export QT_QPA_PLATFORM; +XDG_CURRENT_DESKTOP=sway; export XDG_CURRENT_DESKTOP; +XDG_SESSION_DESKTOP=sway; export XDG_SESSION_DESKTOP; +GPG_TTY="$(tty)" export GPG_TTY; + +PATH="$PATH:$HOME/go/bin:$DENO_INSTALL/bin:$BUN_INSTALL/bin"; + + diff --git a/bootstrap.sh b/bootstrap.sh index 02ef1df..5a0e117 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -36,7 +36,8 @@ function doIt() { --exclude "bootstrap.sh" \ --exclude "README.md" \ --exclude "LICENSE.md" \ - -avh --no-perms ./.config/ ~/.config + --exclude "dwm" \ + -avh --no-perms ./ ~/ } if [ "$1" == "--force" -o "$1" == "-f" ]; then -- cgit v1.2.3