From 3bfed39c11483ad7d0af185ddabb28ce6f88896e Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Tue, 21 Feb 2023 15:00:51 +0200 Subject: [PATCH] Updates to: - neovim - tmux - alacritty --- .gitlab-ci.yml | 3 +- ansible.cfg | 1 + files/dotfiles/alacritty.yml | 107 +++++++++++++++++- files/dotfiles/nvim/init.lua | 1 - files/dotfiles/nvim/lua/user/cmp.lua | 1 + files/dotfiles/nvim/lua/user/colors.lua | 21 +++- files/dotfiles/nvim/lua/user/init.lua | 7 +- files/dotfiles/nvim/lua/user/init_plugins.lua | 6 - files/dotfiles/nvim/lua/user/lsp/handlers.lua | 21 ++-- files/dotfiles/nvim/lua/user/lualine.lua | 7 +- files/dotfiles/nvim/lua/user/packer.lua | 6 + files/dotfiles/nvim/lua/user/settings.lua | 2 + files/dotfiles/nvim/lua/user/vars.lua | 30 ++++- files/dotfiles/shellconfig/common.sh | 24 ++-- files/dotfiles/tmux.conf | 15 +-- roles/gh_release_bin/tasks/main.yml | 17 ++- 16 files changed, 213 insertions(+), 56 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 82a8ee0..e656e46 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,8 +14,9 @@ Ansible Lint: - ansible-lint --version script: - ansible-lint --force-color . &> lint-output.txt + - echo $? > status - cat lint-output.txt - - if [ ! -z "$(cat lint-output.txt)" ]; then echo "Lint returned with warnings/fails"; exit 1; fi + - if [ $(cat status) -ne 0 ]; then echo "Lint returned with warnings/fails"; exit 1; fi Run Workstation playbook on fedora: stage: x86 Systems diff --git a/ansible.cfg b/ansible.cfg index 12c1609..031aa78 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -2,4 +2,5 @@ output_dir = /tmp/artifacts transport = local +callbacks_enabled = junit, timer, profile_roles callback_whitelist = junit, timer, profile_roles diff --git a/files/dotfiles/alacritty.yml b/files/dotfiles/alacritty.yml index 0820549..14d7bf7 100644 --- a/files/dotfiles/alacritty.yml +++ b/files/dotfiles/alacritty.yml @@ -1,5 +1,6 @@ --- window: + opacity: 0.9 # Blank space added around the window in pixels padding: x: 2 @@ -47,6 +48,110 @@ cursor: # Themes # ########################################################### schemes: + nordfox: &nordfox + primary: + background: '0x2e3440' + foreground: '0xcdcecf' + # Normal colors + normal: + black: '0x3b4252' + red: '0xbf616a' + green: '0xa3be8c' + yellow: '0xebcb8b' + blue: '0x81a1c1' + magenta: '0xb48ead' + cyan: '0x88c0d0' + white: '0xe5e9f0' + # Bright colors + bright: + black: '0x465780' + red: '0xd06f79' + green: '0xb1d196' + yellow: '0xf0d399' + blue: '0x8cafd2' + magenta: '0xc895bf' + cyan: '0x93ccdc' + white: '0xe7ecf4' + indexed_colors: + - { index: 16, color: '0xc9826b' } + - { index: 17, color: '0xbf88bc' } + terafox: &terafox + primary: + background: '0x152528' + foreground: '0xe6eaea' + # Normal colors + normal: + black: '0x2f3239' + red: '0xe85c51' + green: '0x7aa4a1' + yellow: '0xfda47f' + blue: '0x5a93aa' + magenta: '0xad5c7c' + cyan: '0xa1cdd8' + white: '0xebebeb' + # Bright colors + bright: + black: '0x4e5157' + red: '0xeb746b' + green: '0x8eb2af' + yellow: '0xfdb292' + blue: '0x73a3b7' + magenta: '0xb97490' + cyan: '0xafd4de' + white: '0xeeeeee' + indexed_colors: + - { index: 16, color: '0xff8349' } + - { index: 17, color: '0xcb7985' } + nightfox: &nightfox + # Default colors + primary: + background: '0x192330' + foreground: '0xcdcecf' + # Normal colors + normal: + black: '0x393b44' + red: '0xc94f6d' + green: '0x81b29a' + yellow: '0xdbc074' + blue: '0x719cd6' + magenta: '0x9d79d6' + cyan: '0x63cdcf' + white: '0xdfdfe0' + # Bright colors + bright: + black: '0x575860' + red: '0xd16983' + green: '0x8ebaa4' + yellow: '0xe0c989' + blue: '0x86abdc' + magenta: '0xbaa1e2' + cyan: '0x7ad4d6' + white: '0xe4e4e5' + indexed_colors: + - { index: 16, color: '0xf4a261' } + - { index: 17, color: '0xd67ad2' } + melange: &melange + primary: + foreground: '#ECE1D7' + background: '#2A2520' + normal: + black: '#352F2A' + red: '#B65C60' + green: '#78997A' + yellow: '#EBC06D' + blue: '#9AACCE' + magenta: '#B380B0' + cyan: '#86A3A3' + white: '#A38D78' + bright: + black: '#4D453E' + red: '#F17C64' + green: '#99D59D' + yellow: '#EBC06D' + blue: '#9AACCE' + magenta: '#CE9BCB' + cyan: '#88B3B2' + white: '#C1A78E' # For themes -> https://github.com/aarowill/base16-alacritty # Base16 Monokai 256 - alacritty color config # Wimer Hazenberg (http://www.monokai.nl) @@ -319,4 +424,4 @@ schemes: white: '#aeb3bb' draw_bold_text_with_bright_colors: true -colors: *gruvbox +colors: *nightfox diff --git a/files/dotfiles/nvim/init.lua b/files/dotfiles/nvim/init.lua index ea773f2..ea49ffa 100644 --- a/files/dotfiles/nvim/init.lua +++ b/files/dotfiles/nvim/init.lua @@ -1,2 +1 @@ require("user") - diff --git a/files/dotfiles/nvim/lua/user/cmp.lua b/files/dotfiles/nvim/lua/user/cmp.lua index ccb5974..b90d5a9 100644 --- a/files/dotfiles/nvim/lua/user/cmp.lua +++ b/files/dotfiles/nvim/lua/user/cmp.lua @@ -50,5 +50,6 @@ cmp.setup({ { name = "path" }, { name = "luasnip" }, { name = "buffer" }, + { name = 'nvim_lsp_signature_help' }, }, }) diff --git a/files/dotfiles/nvim/lua/user/colors.lua b/files/dotfiles/nvim/lua/user/colors.lua index 49a9253..9ee36c1 100644 --- a/files/dotfiles/nvim/lua/user/colors.lua +++ b/files/dotfiles/nvim/lua/user/colors.lua @@ -10,7 +10,22 @@ if gb_status_ok then have_theme = true end -vim.opt.background = "dark" -if have_theme then - vim.cmd("colorscheme " .. vars.colorscheme) +local nightfox_status_ok, nightfox = pcall(require, 'nightfox') +if nightfox_status_ok then + have_theme = true + nightfox.setup({ + options = { + dim_inactive = false + } + }) +end +vim.opt.background = "dark" +local colorscheme = vars.themes[vars.colorscheme].colorscheme +if have_theme then + vim.cmd("colorscheme " .. colorscheme) +end + + +if vars.transparent_bg then + vim.cmd("highlight Normal guibg=none") end diff --git a/files/dotfiles/nvim/lua/user/init.lua b/files/dotfiles/nvim/lua/user/init.lua index e82b82a..75f4f76 100644 --- a/files/dotfiles/nvim/lua/user/init.lua +++ b/files/dotfiles/nvim/lua/user/init.lua @@ -1,7 +1,9 @@ -require("user.settings") require("user.packer") -require("user.init_plugins") +vim.cmd(":PackerInstall") + +require("user.settings") +require("user.init_plugins") require("user.lsp") require("user.cmp") require("user.treesitter") @@ -11,4 +13,3 @@ require("user.colors") -- Make sure plugins are installed --vim.cmd(":PackerClean") -vim.cmd(":PackerInstall") diff --git a/files/dotfiles/nvim/lua/user/init_plugins.lua b/files/dotfiles/nvim/lua/user/init_plugins.lua index a584fc9..abb47eb 100644 --- a/files/dotfiles/nvim/lua/user/init_plugins.lua +++ b/files/dotfiles/nvim/lua/user/init_plugins.lua @@ -22,9 +22,3 @@ local autopairs_status_ok, autopairs = pcall(require, "nvim-autopairs") if autopairs_status_ok then autopairs.setup {} end - --- Illuminate ---local status_ok, illuminate = pcall(require, "illuminate") ---if status_ok then --- illuminate.configure() ---end diff --git a/files/dotfiles/nvim/lua/user/lsp/handlers.lua b/files/dotfiles/nvim/lua/user/lsp/handlers.lua index c2c6919..402cfe1 100644 --- a/files/dotfiles/nvim/lua/user/lsp/handlers.lua +++ b/files/dotfiles/nvim/lua/user/lsp/handlers.lua @@ -1,3 +1,4 @@ +local vars = require('user.vars') local M = {} M.setup = function() @@ -49,11 +50,12 @@ local function lsp_highlight_document(client, bufnr) group = "lsp_document_highlight", desc = "Clear All the References", }) - vim.cmd [[ - highlight LspReferenceText guifg=NONE guibg=#928374 - highlight LspReferenceRead guifg=NONE guibg=#928374 - highlight LspReferenceWrite guifg=NONE guibg=#928374 - ]] + local h_bg = vars.themes[vars.colorscheme].highlight_bg_color + if h_bg then + vim.cmd('highlight LspReferenceText guifg=NONE guibg=' .. h_bg) + vim.cmd('highlight LspReferenceWrite guifg=NONE guibg=' .. h_bg) + vim.cmd('highlight LspReferenceRead guifg=NONE guibg=' .. h_bg) + end end end @@ -65,15 +67,16 @@ local function lsp_keymaps(bufnr) vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "lua vim.lsp.buf.implementation()", opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "", "lua vim.lsp.buf.signature_help()", opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "rn", "lua vim.lsp.buf.rename()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "e", "lua vim.diagnostic.open_float()", opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "lua vim.lsp.buf.references()", opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "", "lua vim.lsp.buf.format { async = true }", opts) - vim.cmd [[ command! Format execute 'lua vim.lsp.buf.formatting()' ]] + vim.cmd [[ command! Format execute 'lua vim.lsp.buf.formatting_sync' ]] end M.on_attach = function(client, bufnr) - if client.name == "tsserver" then - client.server_capabilities.documentFormattingProvider = false - end + --if client.name == "tsserver" then + -- client.server_capabilities.documentFormattingProvider = false + --end lsp_keymaps(bufnr) lsp_highlight_document(client, bufnr) vim.cmd [[autocmd BufWritePre lua vim.lsp.buf.formatting_sync()]] diff --git a/files/dotfiles/nvim/lua/user/lualine.lua b/files/dotfiles/nvim/lua/user/lualine.lua index 10970aa..be6883a 100644 --- a/files/dotfiles/nvim/lua/user/lualine.lua +++ b/files/dotfiles/nvim/lua/user/lualine.lua @@ -5,8 +5,9 @@ if not status_ok then return end -lualine.setup({ +lualine.setup { options = { - theme = vars.colorscheme, + -- theme = vars.colorscheme, --https://github.com/nvim-lualine/lualine.nvim/blob/master/THEMES.md + theme = vars.themes[vars.colorscheme].lualine_theme } -}) +} diff --git a/files/dotfiles/nvim/lua/user/packer.lua b/files/dotfiles/nvim/lua/user/packer.lua index c9bb7d8..fc55375 100644 --- a/files/dotfiles/nvim/lua/user/packer.lua +++ b/files/dotfiles/nvim/lua/user/packer.lua @@ -10,6 +10,7 @@ return require("packer").startup(function(use) 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-buffer', 'hrsh7th/nvim-cmp', + 'hrsh7th/cmp-nvim-lsp-signature-help', 'onsails/lspkind.nvim', 'nvim-lua/lsp_extensions.nvim', 'glepnir/lspsaga.nvim', @@ -33,8 +34,13 @@ return require("packer").startup(function(use) requires = { 'kyazdani42/nvim-web-devicons', opt = true } } + -- -- Colorshemes -- -- -- Gruvbox use 'ellisonleao/gruvbox.nvim' + -- Melange + use 'savq/melange' + -- Nightfox + use 'EdenEast/nightfox.nvim' -- Git Gutter use { diff --git a/files/dotfiles/nvim/lua/user/settings.lua b/files/dotfiles/nvim/lua/user/settings.lua index 4bd8e9f..cb5c0be 100644 --- a/files/dotfiles/nvim/lua/user/settings.lua +++ b/files/dotfiles/nvim/lua/user/settings.lua @@ -47,3 +47,5 @@ vim.wo.cursorline = true -- Enable mouse support vim.opt.mouse = 'a' + +vim.opt.termguicolors = true diff --git a/files/dotfiles/nvim/lua/user/vars.lua b/files/dotfiles/nvim/lua/user/vars.lua index fb8562f..c8f06de 100644 --- a/files/dotfiles/nvim/lua/user/vars.lua +++ b/files/dotfiles/nvim/lua/user/vars.lua @@ -1,5 +1,33 @@ local M = {} -M.colorscheme = 'gruvbox' +M.colorscheme = 'nightfox' +M.transparent_bg = true + +M.themes = { + gruvbox = { + colorscheme = 'gruvbox', + lualine_theme = 'gruvbox', + }, + melange = { + colorscheme = 'melange', + lualine_theme = 'OceanicNext', + }, + nightfox = { + colorscheme = 'nightfox', + lualine_theme = 'nightfox' + } +} + +-- Gruvbox +local st_ok, palette = pcall(require, M.colorscheme .. '.palette') +if st_ok then + M.themes.gruvbox.highlight_bg_color = palette.gray +end +-- melange +st_ok, palette = pcall(require, M.colorscheme .. '.palettes.dark') +if st_ok then + M.themes.melange.highlight_bg_color = palette.a.sel +end + return M diff --git a/files/dotfiles/shellconfig/common.sh b/files/dotfiles/shellconfig/common.sh index 66c3265..b225408 100644 --- a/files/dotfiles/shellconfig/common.sh +++ b/files/dotfiles/shellconfig/common.sh @@ -30,8 +30,8 @@ nord="Nord" export BAT_THEME="$nord" -export VISUAL=vim; -export EDITOR=vim; +export VISUAL=nvim; +export EDITOR=nvim; @@ -66,16 +66,16 @@ function huh() { TITLE="${1:=$CURRENT_DIR}" echo "=-=-=-=-=-=-=-=-=-=-=-=-=-="; \ - echo "${TITLE}"; \ - echo "=-=-=-=-=-=-=-=-=-=-=-=-=-="; \ - echo;echo Status:; \ - echo -=-=-=-; \ - git status; \ - echo; \ - echo Remotes:; \ - echo -=-=-=-=; \ - git remote -v | cat; \ - echo;echo; + echo "${TITLE}"; \ + echo "=-=-=-=-=-=-=-=-=-=-=-=-=-="; \ + echo;echo Status:; \ + echo -=-=-=-; \ + git status; \ + echo; \ + echo Remotes:; \ + echo -=-=-=-=; \ + git remote -v | cat; \ + echo;echo; } diff --git a/files/dotfiles/tmux.conf b/files/dotfiles/tmux.conf index df7b38f..35f2be8 100644 --- a/files/dotfiles/tmux.conf +++ b/files/dotfiles/tmux.conf @@ -26,7 +26,7 @@ setw -g mouse on # Set easier window split keys bind-key | split-window -h -c "#{pane_current_path}" -bind-key \\ split-window -h -c "#{pane_current_path}" +bind-key \ split-window -h -c "#{pane_current_path}" bind-key - split-window -v -c "#{pane_current_path}" # close window with bind-key q kill-window @@ -60,7 +60,7 @@ bind-key b run-shell "tmux neww -n ' Git Branches' 'cd #{pane_current_path} & bind-key g run-shell "tmux neww -n ' 🞥 Git Add' 'cd #{pane_current_path} && (git ls-files -m -o --exclude-standard | fzf -m --print0 --reverse --header \"🞥 Select files to stage. use [tab] for multi selection\" --preview \"bat --diff --color=always --style=numbers,changes,grid {}\" | xargs -0 -o -t git add)'" # Get weather (Prefix-!) -bind-key \! run-shell "tmux neww -n '🌡️ Weather Peek' '(echo \"Fetching Weather...\" && curl -s \"https://wttr.in/?lang=en\") | bat --paging always -p'" +bind-key ! run-shell "tmux neww -n '🌡️ Weather Peek' '(echo \"Fetching Weather...\" && curl -s \"https://wttr.in/?lang=en\") | bat --paging always -p'" ############################ # Themes @@ -89,7 +89,8 @@ set -g history-limit 5000 bind -n C-k clear-history # Default Colors -set -g default-terminal "tmux-256color" +set -g default-terminal "xterm-256color" +set-option -ga terminal-overrides ",xterm-256color:Tc" # Home/End support bind -n End send-key C-e @@ -107,8 +108,8 @@ setw -g window-status-current-style bg="#282a2e" setw -g window-status-current-style fg="#81a2be" ## highlight active window -setw -g window-style 'bg=#282a2e' -setw -g window-active-style 'bg=#1d1f21' +#setw -g window-style 'bg=#282a2e' +#setw -g window-active-style 'bg=#1d1f21' setw -g pane-active-border-style '' ## highlight activity in status bar @@ -143,13 +144,13 @@ set -g status-left '#[fg=#f99157,bg=#2d2d2d]  #S #[fg=#f99157,bg=colour235] ' set -g status-right-length 100 set -g status-right-style fg=black set -g status-right-style bold -set -g status-right '#[fg=#6699cc,bg=#2d4d2d]  #[fg=#f99157,bg=#2d2d2d] %H:%M:%S #[fg=colour235]|#[fg=#6699cc,bg=#2d4d2d] #[fg=#f99157,bg=#2d2d2d] %y/%m/%d #[fg=colour235]|#[fg=#6699cc,bg=#2d4d2d] #[fg=#f99157,bg=#2d2d2d] @#H ' +set -g status-right '#[fg=#6699cc,bg=#464646]  #[fg=#f99157,bg=#2d2d2d] %H:%M:%S #[fg=colour235]|#[fg=#6699cc,bg=#464646]  #[fg=#f99157,bg=#2d2d2d] %y/%m/%d #[fg=colour235]|#[fg=#6699cc,bg=#464646]  #[fg=#f99157,bg=#2d2d2d] @#H ' # make background window look like white tab set-window-option -g window-status-style bg=default set-window-option -g window-status-style fg=white set-window-option -g window-status-style none -set-window-option -g window-status-format '#[fg=#6699cc,bg=#2d4d2d] #I #[fg=#999999,bg=#2d2d2d] #W #[default]' +set-window-option -g window-status-format '#[fg=#6699cc,bg=#464646] #I #[fg=#999999,bg=#2d2d2d] #W #[default]' # make foreground window look like bold yellow foreground tab set-window-option -g window-status-current-style none diff --git a/roles/gh_release_bin/tasks/main.yml b/roles/gh_release_bin/tasks/main.yml index adc6184..9cd58c3 100644 --- a/roles/gh_release_bin/tasks/main.yml +++ b/roles/gh_release_bin/tasks/main.yml @@ -10,14 +10,13 @@ local_version_file: "~/.ansible_gh_release_versions/{{ name }}" - name: Fetch latest release tarball url - shell: - cmd: curl -s https://api.github.com/repos/{{ repo }}/releases/latest | jq -r '.assets[] | select(.browser_download_url|test("{{ filter }}")) | .browser_download_url' - warn: false + ansible.builtin.shell: + cmd: curl -s https://api.github.com/repos/{{ repo }}/releases/latest | jq -r '.assets[] | select(.browser_download_url|test("{{ filter }}")) | .browser_download_url' register: tar_url changed_when: false - name: Get latest version tag from github - shell: + ansible.builtin.shell: cmd: 'echo {{ tar_url.stdout }} | grep -oP "(?<=download\/).*(?=\/)"' changed_when: false register: version @@ -46,28 +45,28 @@ - name: Moving bin to /usr/local/bin become: true - shell: | + ansible.builtin.shell: | cp /tmp{{ bin_path }} /usr/local/bin/ when: version != local_version - name: Adding man page if needed become: true - shell: | + ansible.builtin.shell: | cp /tmp{{ man_path }} /usr/share/man/man1/ register: added_man when: man_path is defined and (version != local_version) - name: Update mandb if needed become: true - shell: mandb || true + ansible.builtin.shell: mandb || true when: added_man is defined and (version != local_version) - name: Adding autocomplete if needed - shell: | + ansible.builtin.shell: | cp /tmp/{{ autocomplete_path }} ~/.shellconfig/autocomplete/{{ name }}.autocomplete when: autocomplete_path is defined and (version != local_version) - name: Updating local version entry - shell: echo {{ version }} > {{ local_version_file }} + ansible.builtin.shell: echo {{ version }} > {{ local_version_file }} when: version != local_version