From 66c0c25fbd52b2953132e7e28e67ec5fc19d97d9 Mon Sep 17 00:00:00 2001 From: Andrejus Date: Sun, 31 May 2020 15:01:47 +0100 Subject: [PATCH] Fish/nvim config --- Makefile | 2 ++ bash/.bashrc | 1 - bash/.profile | 7 ------- fish/config.fish | 35 +++++------------------------------ fish/fishfile | 2 +- install/01-bash.sh | 2 ++ install/02-fish.sh | 11 +---------- install/05-vim.sh | 13 +++++++++++++ install/13-nvm.sh | 2 ++ vim/init.vim | 37 +++++++++++++++++++++++++++++++++++++ 10 files changed, 63 insertions(+), 49 deletions(-) create mode 100755 install/05-vim.sh create mode 100644 vim/init.vim diff --git a/Makefile b/Makefile index 15fb736..b452f6a 100644 --- a/Makefile +++ b/Makefile @@ -5,9 +5,11 @@ SHELL := /bin/bash .PHONY: clean all: + # Install dotfiles ./bootstrap.sh clean: + # Remove all temporary files and artefacts rm -rf .dotlock tmp # ---------------------------------------------------------------------------- # diff --git a/bash/.bashrc b/bash/.bashrc index 35413bd..7c9b322 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -79,6 +79,5 @@ if ! shopt -oq posix; then fi fi -export NVM_DIR="$HOME/.config/nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion diff --git a/bash/.profile b/bash/.profile index aa5f908..2042fb4 100644 --- a/bash/.profile +++ b/bash/.profile @@ -1,5 +1,4 @@ if [ -z "$PROFILE_LOCK" ]; then - echo "acquiring profile lock" export PROFILE_LOCK=1 # set PATH so it includes user's private bin if it exists @@ -53,10 +52,4 @@ if [ -z "$PROFILE_LOCK" ]; then export PATH="$YARN_DIR/bin:$PATH" fi - # if ! [ -x "$(command -v yarn)" ]; then - # export PATH="$YARN_DIR/bin:$PATH" - # else - # export PATH="$(yarn global bin):$PATH" - # fi - fi diff --git a/fish/config.fish b/fish/config.fish index 35a233f..5339b1f 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -1,37 +1,12 @@ # ---------------------------------------------------------------------------- # -# Cross-shell +# Cross-shell (only import if environment has been setup) # ---------------------------------------------------------------------------- # - -# # config -# set XDG_CONFIG_HOME $HOME/.config - -# # workspace -# set WORKSPACE $HOME/workspace - -# # .local -# set -x PATH $HOME/.local/bin $PATH - -# # pyenv -# set PYENV_ROOT $HOME/.pyenv -# set -x PATH $PYENV_ROOT/bin $PATH -# set -x PATH $PYENV_ROOT/shims $PATH -# type -q pyenv && pyenv init - | source - -# # poetry -# set POETRY_ROOT $HOME/.poetry -# set -x PATH $POETRY_ROOT/bin $PATH - -# # nvm -# set NVM_ROOT $HOME/.nvm -# set -x PATH $NVM_ROOT/bin $PATH - -# # yarn -# set YARN_DIR $HOME/.yarn -# set -x PATH $YARN_DIR/bin $PATH +if test -e ~/.profile + bass source ~/.profile + bass source "$NVM_DIR/nvm.sh" --no-use ';' nvm use iojs +end # ---------------------------------------------------------------------------- # # Fish specific # ---------------------------------------------------------------------------- # - -# Wipe greeting set fish_greeting diff --git a/fish/fishfile b/fish/fishfile index 69245b2..1e53a38 100644 --- a/fish/fishfile +++ b/fish/fishfile @@ -1,2 +1,2 @@ rafaelrinaldi/pure -jorgebucaran/fish-nvm +edc/bass diff --git a/install/01-bash.sh b/install/01-bash.sh index 39483e1..7484052 100755 --- a/install/01-bash.sh +++ b/install/01-bash.sh @@ -5,4 +5,6 @@ bash_target="$HOME" link_folder "$bash_source" "$bash_target" echo "bash dotfiles are linked" +sudo chmod -R 0644 /etc/update-motd.d/ + bash --version diff --git a/install/02-fish.sh b/install/02-fish.sh index 7cea9dd..b8d27d2 100755 --- a/install/02-fish.sh +++ b/install/02-fish.sh @@ -9,15 +9,6 @@ if not_installed "fish"; then fi echo "fish is installed" -# current_shell="$(getent passwd $USER | cut -d: -f7)" -# fish_path="$(which fish)" -# if [ "$current_shell" != "$fish_path" ]; then -# echo "setting fish as default, current shell was $current_shell" -# sudo chsh -s "$fish_path" "$USER" -# sudo usermod -s "$fish_path" "$USER" -# fi -# echo "fish is default login shell" - fish_source="$dotfiles_dir/fish" fish_target="$XDG_CONFIG_HOME/fish" link_folder "$fish_source" "$fish_target" @@ -31,7 +22,7 @@ if ! [ -f "$fisher_location" ]; then curl https://git.io/fisher --create-dirs -sLo "$fisher_location" fi echo "fisher is installed, updating..." -fish -c "fisher" +sh -c 'env HOME=$(mktemp -d) fish -c "fisher"' fish -c "fisher --version" diff --git a/install/05-vim.sh b/install/05-vim.sh new file mode 100755 index 0000000..46e1ac6 --- /dev/null +++ b/install/05-vim.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +vim_source="$dotfiles_dir/vim" +vim_target="$XDG_CONFIG_HOME/nvim" +link_folder "$vim_source" "$vim_target" +echo "vim dotfiles are linked" + +sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \ + https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' +nvim -E PlugInstall -c q + +nvim --version + diff --git a/install/13-nvm.sh b/install/13-nvm.sh index 90a7c59..ba801fe 100755 --- a/install/13-nvm.sh +++ b/install/13-nvm.sh @@ -9,6 +9,8 @@ if not_installed "nvm"; then run "https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh" \ "bash" source "$NVM_DIR/nvm.sh" + nvm alias default lts + nvm default fi diff --git a/vim/init.vim b/vim/init.vim new file mode 100644 index 0000000..2b802f7 --- /dev/null +++ b/vim/init.vim @@ -0,0 +1,37 @@ +set termguicolors + +call plug#begin() + +Plug 'tpope/vim-sensible' + +Plug 'tpope/vim-fugitive' +Plug 'APZelos/blamer.nvim' + +Plug 'tpope/vim-surround' + +if has('nvim') + Plug 'Shougo/denite.nvim', { 'do': ':UpdateRemotePlugins' } +else + Plug 'Shougo/denite.nvim' + Plug 'roxma/nvim-yarp' + Plug 'roxma/vim-hug-neovim-rpc' +endif + +call plug#end() + +" Define mappings +autocmd FileType denite call s:denite_my_settings() +function! s:denite_my_settings() abort + nnoremap + \ denite#do_map('do_action') + nnoremap d + \ denite#do_map('do_action', 'delete') + nnoremap p + \ denite#do_map('do_action', 'preview') + nnoremap q + \ denite#do_map('quit') + nnoremap i + \ denite#do_map('open_filter_buffer') + nnoremap + \ denite#do_map('toggle_select').'j' +endfunction