From 7feed56ec2d4cc4e7bd03f691d358ab7482cea23 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Mon, 3 Jan 2022 11:46:10 +0200 Subject: [PATCH] Rust tools for brebuilt repos/releases to speed things up Some tmux/vim tweaks Added TLDR via pip3 --- .gitlab-ci.yml | 2 +- files/dotfiles/tmux.conf | 15 +++++- files/dotfiles/vimrc | 15 +++--- roles/base/tasks/main.yml | 35 ++------------ roles/gh_release_bin/tasks/main.yml | 46 ++++++++++++++++++ roles/gitui_user/tasks/main.yml | 28 ----------- roles/modern_unix_tools/tasks/main.yml | 64 ++++++++++++++++++++++++++ roles/ncspot_user/tasks/main.yml | 53 ++++----------------- roles/vim_user/tasks/main.yml | 5 +- 9 files changed, 148 insertions(+), 115 deletions(-) create mode 100644 roles/gh_release_bin/tasks/main.yml delete mode 100644 roles/gitui_user/tasks/main.yml create mode 100644 roles/modern_unix_tools/tasks/main.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 14e7c63..58a8a11 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,7 +18,7 @@ Run Workstation playbook on fedora: Run cli-tools playbook on centos: stage: x86 Systems - image: centos:8 + image: centos:latest script: - dnf install -y epel-release dnf-plugins-core - dnf install -y --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm diff --git a/files/dotfiles/tmux.conf b/files/dotfiles/tmux.conf index 44c44f9..64bfbb2 100644 --- a/files/dotfiles/tmux.conf +++ b/files/dotfiles/tmux.conf @@ -22,7 +22,15 @@ setw -g mouse on 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 +# refresh window with +bind-key e respawn-window -k + +# -j/k for up down (useful to move between history commands) +bind-key k send-keys Up +bind-key j send-keys Down + # Easy config reload bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded." ############################ @@ -34,7 +42,6 @@ set -g @plugin "arcticicestudio/nord-tmux" # set -g @plugin 'egel/tmux-gruvbox' # set -g @tmux-gruvbox 'dark' # or 'light' - # Tmux yank (For clipboard integration) set -g @plugin 'tmux-plugins/tmux-yank' # Mouse select to clipboard @@ -55,3 +62,7 @@ set -g default-terminal "xterm-256color" # Home/End support bind -n End send-key C-e bind -n Home send-key C-a + +# Set active pane border background +set-option -g pane-active-border-style bg=#8abeb7 + diff --git a/files/dotfiles/vimrc b/files/dotfiles/vimrc index ec0f1f4..8e8bfbb 100644 --- a/files/dotfiles/vimrc +++ b/files/dotfiles/vimrc @@ -51,10 +51,12 @@ autocmd VimEnter * " Toggle NerdTree with Ctrl+n map :NERDTreeToggle -" Open fzf Files search +" Open fzf Files search Ctrl+p map :Files -" Open file search +" Open file search Ctrl+f map :BLines +" Open Global search Ctrl+s +map :Ag " Indent Guides auto start let g:indent_guides_enable_on_vim_startup = 1 @@ -66,10 +68,10 @@ map :tabnew noremap :tabn " Insert mode navigation Alt+hjkl -imap -imap -imap -imap +imap +imap +imap +imap " Set line heighlight on by default set cursorline @@ -336,6 +338,7 @@ set statusline+=\ %P "percent through file " Note: must appear after the last line that is altering colorscheme hi clear SpellBad hi SpellBad cterm=underline +set spell "============================================================================== " Delete settings diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index ae78a48..728bcfe 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -9,6 +9,7 @@ - wget - git - ranger + - jq state: present - name: Some more packages (RedHat based) @@ -70,13 +71,6 @@ dest: ~/.shellconfig/common.sh force: yes -- name: verify Bat (better Cat) theme - changed_when: false - ansible.builtin.lineinfile: - path: "~/.shellconfig/common.sh" - regexp: "^export BAT_THEME=" - line: 'export BAT_THEME="${{theme}}"' - - name: Copy shell aliases copy: src: dotfiles/shellconfig/aliases.sh @@ -95,30 +89,7 @@ dest: ~/.shellconfig/environment.sh force: no -- name: Verifying gitui config folder - file: - path: ~/.config/gitui - state: directory -- name: Copy gitui keybindings config file - copy: - src: dotfiles/gitui/key_config.ron - dest: ~/.config/gitui/key_config.ron - force: yes - -- name: Copy gitui theme config file - copy: - src: dotfiles/gitui/theme.ron - dest: ~/.config/gitui/theme.ron - force: yes - -- name: Install rust and common tooling - vars: - rustup_user: "{{ running_user }}" - rustup_cargo_crates: [bat,lsd,bottom] - ansible.builtin.include_role: - name: hurricanehrndz.rustup - -- name: Gitui user +- name: Install modern UNIX tools include_role: - name: gitui_user + name: modern_unix_tools diff --git a/roles/gh_release_bin/tasks/main.yml b/roles/gh_release_bin/tasks/main.yml new file mode 100644 index 0000000..9690a7e --- /dev/null +++ b/roles/gh_release_bin/tasks/main.yml @@ -0,0 +1,46 @@ +--- +- name: Validate manual versioning folder + ansible.builtin.file: + state: directory + path: ~/.ansible_gh_release_versions + +- name: Setting local release file path + set_fact: + 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 + register: tar_url + changed_when: false + +- name: Get latest version tag from github + shell: echo {{ tar_url.stdout }} | grep -oP "(?<=download\/).*(?=\/)" + changed_when: false + register: version + +- name: Get latest version from local entry + set_fact: + local_version: "{{ lookup('file', local_version_file, errors='ignore') }}" + version: "{{ version.stdout }}" + tar_url: "{{ tar_url.stdout }}" + tar_download_location: "/tmp/{{ name }}.tar.gz" + failed_when: false + +- name: Unarchive the release + ansible.builtin.unarchive: + src: "{{ tar_url }}" + dest: /tmp/ + remote_src: yes + when: version != local_version + +- name: Moving bin to /usr/local/bin + become: true + shell: | + cp /tmp{{ bin_path }} /usr/local/bin/{{ name }} + when: version != local_version + +- name: Updating local version entry + shell: echo {{ version }} > {{ local_version_file }} + when: version != local_version diff --git a/roles/gitui_user/tasks/main.yml b/roles/gitui_user/tasks/main.yml deleted file mode 100644 index 8b516b2..0000000 --- a/roles/gitui_user/tasks/main.yml +++ /dev/null @@ -1,28 +0,0 @@ -- name: Install gitui dependencies (RHEL) - become: true - package: - name: &gitui_deps_rhel - - perl - state: present - when: ansible_facts['os_family'] == "RedHat" - -- name: Installing gitui - vars: - rustup_user: "{{ running_user }}" - rustup_cargo_crates: [gitui] - ansible.builtin.include_role: - name: hurricanehrndz.rustup - -- name: Setting up ncspot alias (spot) - ansible.builtin.lineinfile: - line: alias spot=ncspot - state: present - path: ~/.shellconfig/aliases.sh - insertafter: EOF - -- name: Remove gitui dependencies (RHEL) - become: true - package: - name: *gitui_deps_rhel - state: absent - when: ansible_facts['os_family'] == "RedHat" diff --git a/roles/modern_unix_tools/tasks/main.yml b/roles/modern_unix_tools/tasks/main.yml new file mode 100644 index 0000000..fcbda4b --- /dev/null +++ b/roles/modern_unix_tools/tasks/main.yml @@ -0,0 +1,64 @@ +--- +- name: Installing bat (cat like) + ansible.builtin.include_role: + name: gh_release_bin + vars: + name: bat + repo: sharkdp/bat + bin_path: "/bat*/bat" + filter: x86_64-unknown-linux-gnu + +- name: verify Bat (better Cat) theme + changed_when: false + ansible.builtin.lineinfile: + path: "~/.shellconfig/common.sh" + regexp: "^export BAT_THEME=" + line: 'export BAT_THEME="${{theme}}"' + +- name: Instaling TLDR (pip3) + shell: pip3 install tldr + +- name: Installing bottom (btm) (Top like) + ansible.builtin.include_role: + name: gh_release_bin + vars: + name: btm + repo: ClementTsang/bottom + bin_path: "/btm" + filter: bottom_x86_64-unknown-linux-gnu.tar.gz + +- name: Installing gitui + ansible.builtin.include_role: + name: gh_release_bin + vars: + name: gitui + repo: extrawurst/gitui + bin_path: "/gitui" + filter: gitui-linux-musl + +- name: Verifying gitui config + file: + path: ~/.config/gitui + state: directory + +- name: Copy gitui keybindings + copy: + src: dotfiles/gitui/key_config.ron + dest: ~/.config/gitui/key_config.ron + force: yes + +- name: Copy gitui theme config + copy: + src: dotfiles/gitui/theme.ron + dest: ~/.config/gitui/theme.ron + force: yes + +- name: Installing LSD (ls like) + ansible.builtin.include_role: + name: gh_release_bin + vars: + name: lsd + repo: Peltoche/lsd + bin_path: "/lsd-*/lsd" + filter: x86_64-unknown-linux-gnu.tar.gz + diff --git a/roles/ncspot_user/tasks/main.yml b/roles/ncspot_user/tasks/main.yml index 33dddf2..94314ff 100644 --- a/roles/ncspot_user/tasks/main.yml +++ b/roles/ncspot_user/tasks/main.yml @@ -1,36 +1,12 @@ -- name: Install ncspot dependencies (RHEL) - become: true - package: - name: &ncspot_deps_rhel - - pulseaudio-libs-devel - - libxcb-devel - - openssl-devel - - ncurses-devel - - dbus-devel - state: present - when: ansible_facts['os_family'] == "RedHat" - -- name: Install ncspot dependencies (Debian) - become: true - package: - name: &ncspot_deps_debian - - libncursesw5-dev - - libdbus-1-dev - - libpulse-dev - - libssl-dev - - libxcb1-dev - - libxcb-render0-dev - - libxcb-shape0-dev - - libxcb-xfixes0-dev - state: present - when: ansible_facts['os_family'] == "Debian" - -- name: Installing nscpot - vars: - rustup_user: "{{ running_user }}" - rustup_cargo_crates: [ncspot] +--- +- name: Installing ncspot (Spotify) ansible.builtin.include_role: - name: hurricanehrndz.rustup + name: gh_release_bin + vars: + name: ncspot + repo: hrkfdn/ncspot + bin_path: "/ncspot" + filter: linux-x86_64.tar.gz - name: Setting up ncspot alias (spot) ansible.builtin.lineinfile: @@ -39,16 +15,3 @@ path: ~/.shellconfig/aliases.sh insertafter: EOF -- name: Remove ncspot dependencies (RHEL) - become: true - package: - name: *ncspot_deps_rhel - state: absent - when: ansible_facts['os_family'] == "RedHat" - -- name: Remove ncspot dependencies (Debian) - become: true - package: - name: *ncspot_deps_debian - state: absent - when: ansible_facts['os_family'] == "Debian" diff --git a/roles/vim_user/tasks/main.yml b/roles/vim_user/tasks/main.yml index 17d1ba7..f60833f 100644 --- a/roles/vim_user/tasks/main.yml +++ b/roles/vim_user/tasks/main.yml @@ -3,13 +3,16 @@ package: name: - vim-X11 + - the_silver_searcher state: latest when: ansible_facts['os_family'] == "RedHat" - name: Install vim (Debian based) become: true package: - name: vim-gtk + name: + - vim-gtk + - silversearcher-ag state: present when: ansible_facts['os_family'] == "Debian"