def zsh_syntax_highlighting(c): """Installs zsh-syntax-highlighting, an extension for oh-my-zsh.""" source = "https://github.com/zsh-users/zsh-syntax-highlighting.git" destination = os.path.expanduser("~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting") if os.path.exists(destination): return utils.print_run(c, f"git clone --depth=1 {source} {destination}", hide="out")
def powerlevel10k(c): """Installs powerlevel10k, a theme for oh-my-zsh.""" source = "https://github.com/romkatv/powerlevel10k.git" destination = os.path.expanduser("~/.oh-my-zsh/custom/themes/powerlevel10k") if os.path.exists(destination): return utils.print_run(c, f"git clone --depth=1 {source} {destination}", hide="out")
def fzf(c): """Install fzf, a fuzzy file finder.""" if utils.command_exists(c, "fzf"): return if not os.path.exists(os.path.expanduser("~/.fzf")): utils.print_run(c, "git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf") utils.print_run(c, "~/.fzf/install --all")
def tmux(c): """Install tmux, a terminal multiplexer, from source.""" if os.path.exists(os.path.expanduser("~/bin/tmux")): return import requests # install dependencies. utils.apt_install(c, [ "libevent-dev", "ncurses-dev", "build-essential", "bison", "pkg-config", ]) # Downlaod tarball. response = requests.get( "https://github.com/tmux/tmux/releases/download/3.1b/tmux-3.1b.tar.gz") tar_path = "/tmp/tmux.tar.gz" with open(tar_path, "wb") as tarfile: tarfile.write(response.content) # Extract its contents. utils.print_run(c, f"tar -zxf {tar_path} --directory /tmp", hide="out") with utils.chdir("/tmp/tmux-3.1b"): # Build it. utils.print_run(c, "./configure --enable-static", hide="out") utils.print_run(c, "make", hide="out") # Move it $HOME/bin. destination_dir = os.path.join(os.path.expanduser("~"), "bin") if not os.path.exists(destination_dir): os.makedirs(destination_dir) utils.print_run(c, f"cp ./tmux {destination_dir}/tmux", hide="out") print(colors.OKRED + "Run CTRL+b I the next time you open tmux to install plugins." + colors.ENDC)
def create_symlink(source, target): print_run(ctx, f'ln -s "{source}" "{target}"')
def maestral(c): """Install maestral, an open source Dropbox client.""" if os.path.exists(os.path.expanduser('~/.local/bin/maestral')): return utils.pip_install(c, "maestral") # TODO(duckworthd): Re-enable maestral[gui] when "pip3 install PyQT5" works again. utils.print_run(c, "~/.local/bin/maestral autostart --yes", hide="out")
def git_init_submodules(c): "Initialize all submodules in this repository." utils.print_run(c, "git submodule update --init --recursive", hide="out")
def oh_my_zsh(c): """Installs oh-my-zsh, an extension suite for ZSH.""" destination = os.path.expanduser("~/.oh-my-zsh") if os.path.exists(destination): return utils.print_run(c, 'sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"')
def zsh(c): "Install zsh, an alternative to bash." if utils.command_exists(c, 'zsh'): return utils.apt_install(c, "zsh") utils.print_run(c, "chsh -s $(which zsh)")