diff --git a/.gitmodules b/.gitmodules index 81ce725..e2dfbe8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,6 +7,9 @@ [submodule "root/usr/share/zsh/site-functions/zsh-syntax-highlighting"] path = "root/usr/share/zsh/site-functions/zsh-syntax-highlighting" url = "https://github.com/zsh-users/zsh-syntax-highlighting" +[submodule "root/usr/share/zsh/site-functions/zsh-you-should-use"] + path = "root/usr/share/zsh/site-functions/zsh-you-should-use" + url = "https://github.com/MichaelAquilina/zsh-you-should-use" [submodule "root/usr/local/src/z.lua"] path = "root/usr/local/src/z.lua" url = "https://github.com/skywind3000/z.lua" diff --git a/home/.config/nvim/init.vim b/home/.config/nvim/init.vim index 630f5b7..543c13d 100644 --- a/home/.config/nvim/init.vim +++ b/home/.config/nvim/init.vim @@ -1,142 +1,13 @@ -" Install plugins automatically -if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim"')) - echo "Downloading junegunn/vim-plug to manage plugins..." - silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/ - silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim - autocmd VimEnter * PlugInstall -endif +" Let init.vim handle sourcing other more specific +" vim configuration files, rather than keeping everything +" in a single huge config file -" Vim-Plug (Plugins) -call plug#begin(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/plugged"')) -Plug 'airblade/vim-gitgutter' " Shows Git diff -Plug 'preservim/nerdcommenter' " Language based comment syntax -Plug 'preservim/nerdtree' " File manager (nerdtree) -Plug 'tiagofumo/vim-nerdtree-syntax-highlight' " Highlighting for nerdtree -Plug 'joshdick/onedark.vim' " OneDark theme -Plug 'ryanoasis/vim-devicons' " Icons for nerdtree and airline -Plug 'vim-airline/vim-airline' " AirLine statusline -Plug 'vim-airline/vim-airline-themes' " AirLine statusline themes -Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } " Auto-completion [NVIM only] -Plug 'neomake/neomake' " Syntax checking -Plug 'zchee/deoplete-jedi' " Python jedi autocompletion -Plug 'wakatime/vim-wakatime' " Wakatime integration for coding stats -call plug#end() +let config_dir = system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim"') +let rc_dir = config_dir.'/rc' +execute 'source '.rc_dir.'/base.vim' +execute 'source '.rc_dir.'/mappings.vim' +execute 'source '.rc_dir.'/autocmd.vim' +execute 'source '.rc_dir.'/plugins.vim' +" Needs to be below plugins for colorscheme +execute 'source '.rc_dir.'/theme.vim' -" Some basics -filetype plugin on " Enable filetype detection -syntax on " Turn on syntax highlighting -set number relativenumber " Show relative line numbers -set wildmode=longest,list,full " Enable autocompletion -set undolevels=999 " Lots of these -set history=1000 " More history -set expandtab " Expand tabs to spaces (inverse: noexpandtab) -set tabstop=4 " Tab size -set shiftwidth=4 " Indentation size -set softtabstop=4 " Tabs/Spaces interrop -set tabpagemax=50 " More tabs -set autoindent " Enable autoindent -set cursorline " Highlight cursor line -set noruler " Don't show ruler, line is highlighted by above -set showmatch " Show matching brackets -set ignorecase " Do case insensitive matching -set incsearch " Show partial matches for a search phrase -set hlsearch " Highlight Search -set laststatus=2 " Always show status line -set splitbelow splitright " Split in more natural way -set autoread " Reload files on change -set mouse=a " Enable mouse mode -set encoding=utf-8 " Use UTF-8, not ASCII (May cause issues on TTY) -set path+=** " Search down into subfolders with tab completion -set wildmenu " Display all matching files when we tab complete -set scrolloff=5 " Keep 5 lines horizontal scrolloff -set sidescrolloff=5 " Keep 5 characters vertical scrolloff -"set termguicolors " Use true colors (256) (May cause issues on TTY) - -" Move ~/.viminfo to XDG_CACHE_HOME -"set viminfofile=$XDG_CACHE_HOME/vim/viminfo - -" Disable automatic commenting on newline -autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o - -" Have Vim jump to the last position when reopening a file -autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" - -" Automatically deletes all trailing whitespace on save -autocmd BufWritePre * %s/\s\+$//e - -" Remap splits navigation to just CTRL + hjkl -nnoremap h -nnoremap j -nnoremap k -nnoremap l - -" Make adjusting split sizes a bit more friendly -noremap :vertical resize +3 -noremap :vertical resize -3 -noremap :resize +3 -noremap :resize -3 - -" Spell-check set to o, 'o' for 'orthography' -map o :setlocal spell! spelllang=en_US - -" Stop search highlight (until next search) -map :noh - -" System clipboard interactions -map "+y -vnoremap "+p - -" Unmap arrow keys in normal mode to remove bad habits -nnoremap -nnoremap -nnoremap -nnoremap - -" Use shift to move 10 lines up/down quickly -noremap K 10k -noremap J 10j - -" User interface / Theme -colorscheme onedark -set guioptions-=m " remove menubar -set guioptions-=T " remove toolbar -set guioptions-=r " remove right-hand scrollbar -set guioptions-=L " remove left-hand scrollbar - -" Airline -let g:airline_theme='onedark' -let g:airline#extensions#tabline#enabled = 1 -let g:airline#tabline#formatter = 'unique_tail' -let g:webdevicons_enable_airline_statusline = 0 -if empty($DISPLAY) " Automatically apply ASCII only config if we don't have DISPLAY (TTY) - let g:airline_left_sep = '>' " Alternatively: '►' - let g:airline_right_sep = '<' " Alternatively: '◄' - let g:airline_symbols_ascii = 1 - let g:webdevicons_enable_airline_tabline = 0 " don't use symbols from vim-devicons -else - let g:airline_left_sep = "\uE0B0" - let g:airline_right_sep = "\uE0B2" - let g:airline_powerline_fonts = 1 " use nice symbols from powerline fonts -endif - -" Neomake -" Requires: pip install flake8 -let g:neomake_python_enabled_makers = ['flake8'] -let g:neomake_python_flake8_maker = {'args': ['--ignore=E501', '--format=default']} -call neomake#configure#automake('nrwi', 500) - -" Deoplete -" Requires: pip install pynvim -let g:deoplete#enable_at_startup = 1 - -" NERDTree -map :NERDTreeToggle -let g:NERDTreeDirArrowExpandable = '►' -let g:NERDTreeDirArrowCollapsible = '▼' -let NERDTreeShowLineNumbers=1 -let NERDTreeShowHidden=1 -let NERDTreeMinimalUI = 1 -let g:NERDTreeWinSize=38 -if empty($DISPLAY) " Disable devicons for nerdtree in TTY - let g:webdevicons_enable_nerdtree = 0 -endif diff --git a/home/.config/nvim/rc/autocmd.vim b/home/.config/nvim/rc/autocmd.vim new file mode 100644 index 0000000..be31f80 --- /dev/null +++ b/home/.config/nvim/rc/autocmd.vim @@ -0,0 +1,15 @@ +" Move ~/.viminfo to XDG_CACHE_HOME +"set viminfofile=$XDG_CACHE_HOME/vim/viminfo + +" Disable automatic commenting on newline +autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o + +" Have Vim jump to the last position when reopening a file +autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" + +" Automatically deletes all trailing whitespace on save +autocmd BufWritePre * %s/\s\+$//e + +" Vertically center document when entering insert mode +"autocmd InsertEnter * norm zz + diff --git a/home/.config/nvim/rc/base.vim b/home/.config/nvim/rc/base.vim new file mode 100644 index 0000000..88442d5 --- /dev/null +++ b/home/.config/nvim/rc/base.vim @@ -0,0 +1,24 @@ +filetype plugin on " Enable filetype detection +set undolevels=999 " Lots of these +set history=1000 " More history +set expandtab " Expand tabs to spaces (inverse: noexpandtab) +set tabstop=4 " Tab size +set shiftwidth=4 " Indentation size +set softtabstop=4 " Tabs/Spaces interrop +set tabpagemax=50 " More tabs +set autoindent " Enable autoindent +set showmatch " Show matching brackets +set ignorecase " Do case insensitive matching +set incsearch " Show partial matches for a search phrase +set hlsearch " Highlight Search +set laststatus=2 " Always show status line +set splitbelow splitright " Split in more natural way +set autoread " Reload files on change +set mouse=a " Enable mouse mode +set encoding=utf-8 " Use UTF-8, not ASCII (May cause issues on TTY) +set wildmode=longest,list,full " Enable autocompletion +set path+=** " Search down into subfolders with tab completion +set wildmenu " Display all matching files when we tab complete +set scrolloff=5 " Keep 5 lines horizontal scrolloff +set sidescrolloff=5 " Keep 5 characters vertical scrolloff + diff --git a/home/.config/nvim/rc/mappings.vim b/home/.config/nvim/rc/mappings.vim new file mode 100644 index 0000000..2d746c0 --- /dev/null +++ b/home/.config/nvim/rc/mappings.vim @@ -0,0 +1,32 @@ +" Remap splits navigation to just CTRL + hjkl +nnoremap h +nnoremap j +nnoremap k +nnoremap l + +" Make adjusting split sizes a bit more friendly +noremap :vertical resize +3 +noremap :vertical resize -3 +noremap :resize +3 +noremap :resize -3 + +" Spell-check set to o, 'o' for 'orthography' +map o :setlocal spell! spelllang=en_US + +" Stop search highlight (until next search) +map :noh + +" System clipboard interactions +map "+y +vnoremap "+p + +" Unmap arrow keys in normal mode to remove bad habits +nnoremap +nnoremap +nnoremap +nnoremap + +" Use shift to move 10 lines up/down quickly +noremap K 10k +noremap J 10j + diff --git a/home/.config/nvim/rc/plugins.d/airline.vim b/home/.config/nvim/rc/plugins.d/airline.vim new file mode 100644 index 0000000..c355d1b --- /dev/null +++ b/home/.config/nvim/rc/plugins.d/airline.vim @@ -0,0 +1,13 @@ +" Airline specific theming settings +let g:airline_theme='codedark' " Use codedark theme from vim-ariline-themes +let g:airline_right_sep = "" " Don't use special separators (<) +let g:airline_left_sep = "" " Don't use special separators (>) +let g:airline#extensions#tabline#enabled = 1 " Enable tabline (top line) +let g:airline#tabline#formatter = 'unique_tail' " Tabline filename formatter +let g:webdevicons_enable_airline_statusline = 0 " Use special icons from vim-devicons (requires nerdfonts) +let g:airline_powerline_fonts = 1 " Use special symbols from powerline fonts (line no, col no) + +if empty($DISPLAY) " Use ASCII-only if we're in TTY + let g:airline_symbols_ascii = 1 +endif + diff --git a/home/.config/nvim/rc/plugins.d/nerdtree.vim b/home/.config/nvim/rc/plugins.d/nerdtree.vim new file mode 100644 index 0000000..d789901 --- /dev/null +++ b/home/.config/nvim/rc/plugins.d/nerdtree.vim @@ -0,0 +1,12 @@ +" NERDTree config +map :NERDTreeToggle +let g:NERDTreeDirArrowExpandable = '►' +let g:NERDTreeDirArrowCollapsible = '▼' +let NERDTreeShowLineNumbers=1 +let NERDTreeShowHidden=1 +let NERDTreeMinimalUI = 1 +let g:NERDTreeWinSize=38 +if empty($DISPLAY) " Disable devicons for nerdtree in TTY + let g:webdevicons_enable_nerdtree = 0 +endif + diff --git a/home/.config/nvim/rc/plugins.d/python.vim b/home/.config/nvim/rc/plugins.d/python.vim new file mode 100644 index 0000000..0df3054 --- /dev/null +++ b/home/.config/nvim/rc/plugins.d/python.vim @@ -0,0 +1,12 @@ +" Define python-specific neomake config +" Neomake is python syntax checker, in this case, we use flake8 +" Requires: pip install flake8 +let g:neomake_python_enabled_makers = ['flake8'] +let g:neomake_python_flake8_maker = {'args': ['--ignore=E501', '--format=default']} +call neomake#configure#automake('nrwi', 500) + +" Enable deoplete on startup +" Deoplete provides autosuggestions from python standard library +" Requires: pip install pynvim +let g:deoplete#enable_at_startup = 1 + diff --git a/home/.config/nvim/rc/plugins.vim b/home/.config/nvim/rc/plugins.vim new file mode 100644 index 0000000..0ce4876 --- /dev/null +++ b/home/.config/nvim/rc/plugins.vim @@ -0,0 +1,40 @@ +" This file handles plugin management with plug.vim +" It contains an automatic first-time installer for plug.vim and plugins +" It also sources plugin specific config files + +" Install plugins automatically +if ! filereadable(config_dir."/autoload/plug.vim") + echo "Downloading junegunn/vim-plug to manage plugins..." + let x = system('mkdir -p '.config_dir.'/autoload') + let x = system('curl https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim > '.config_dir.'/autoload/plug.vim') + autocmd VimEnter * PlugInstall +endif + +" Plug.vim plugin list +call plug#begin(config_dir."/plugged") + +" Code completion +Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } +" Themes +Plug 'tomasiser/vim-code-dark' +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' +Plug 'ryanoasis/vim-devicons' +" Python +Plug 'neomake/neomake' +Plug 'zchee/deoplete-jedi' +" Misc +Plug 'airblade/vim-gitgutter' +Plug 'wakatime/vim-wakatime' +Plug 'preservim/nerdcommenter' +Plug 'preservim/nerdtree' +Plug 'tiagofumo/vim-nerdtree-syntax-highlight' + +call plug#end() + + +" Source more plugin-specific configuration files from here +let plugins_rc_dir = rc_dir."/plugins.d" +execute "source ".plugins_rc_dir."/airline.vim" +execute "source ".plugins_rc_dir."/nerdtree.vim" +execute "source ".plugins_rc_dir."/python.vim" diff --git a/home/.config/nvim/rc/theme.vim b/home/.config/nvim/rc/theme.vim new file mode 100644 index 0000000..3bcfe64 --- /dev/null +++ b/home/.config/nvim/rc/theme.vim @@ -0,0 +1,33 @@ +" General colorscheme settings +syntax on " Turn syntax highlighting on +colorscheme codedark " Requires vim-code-dark plugin + +set number relativenumber " Show relative line numbers +set cursorline " Highlight cursor line +set noruler " Don't show ruler, line is highlighted by above + +set guioptions-=m " Remove menubar +set guioptions-=T " Remove toolbar +set guioptions-=r " Remove right-hand scrollbar +set guioptions-=L " Remove left-hand scrollbar + +if empty($DISPLAY) " Don't use true colors (256) in TTY + set notermguicolors +else + set termguicolors +endif + + +" Airline specific theming settings +let g:airline_theme='codedark' " Use codedark theme from vim-ariline-themes +let g:airline_right_sep = "" " Don't use special separators (<) +let g:airline_left_sep = "" " Don't use special separators (>) +let g:airline#extensions#tabline#enabled = 1 " Enable tabline (top line) +let g:airline#tabline#formatter = 'unique_tail' " Tabline filename formatter +let g:webdevicons_enable_airline_statusline = 0 " Use special icons from vim-devicons (requires nerdfonts) +let g:airline_powerline_fonts = 1 " Use special symbols from powerline fonts (line no, col no) + +if empty($DISPLAY) " Use ASCII-only if we're in TTY + let g:airline_symbols_ascii = 1 +endif + diff --git a/home/.config/zsh/.zshrc b/home/.config/zsh/.zshrc index 9b490f8..a87fe64 100755 --- a/home/.config/zsh/.zshrc +++ b/home/.config/zsh/.zshrc @@ -11,16 +11,24 @@ setopt notify # report the status of background jobs immediately setopt numericglobsort # sort filenames numerically when it makes sense #setopt correct_all # autocorrect commands +# oh-my-zsh configuration (DISABLED by default, if you want oh-my-zsh, uncomment these) +#export ZSH="/usr/share/oh-my-zsh" +#ZSH_THEME="af-magic" +#UPDATE_ZSH_DAYS=8 +#ENABLE_CORRECTION="false" +#source $ZSH/oh-my-zsh.sh # Run oh-my-zsh + # ZSH files cleanup export ZSH_CACHE="$HOME/.cache/zsh" -export ZSH_COMPDUMP="$ZSH_CACHE/zcompdump-$ZSH_VERSION" # for auto/tab completion +HISTFILE="$ZSH_CACHE/history" +export ZSH_COMPDUMP="$ZSH_CACHE/zcompdump-$ZSH_VERSION" +# Auto-remove home clutter [ -f ~/.zsh-update ] && mv ~/.zsh-update $ZSH_CACHE/.zsh-update [ -f ~/.sudo_as_admin_sucessful ] && rm ~/.sudo_as_admin_successful [ -f ~/.bash_history ] && rm ~/.bash_history # History configuration -HISTFILE="$ZSH_CACHE/history" HISTSIZE=10000 SAVEHIST=10000 setopt appendhistory # save history entries as soon as they are entered @@ -30,21 +38,14 @@ setopt hist_verify # show commands with history expansion to user b #setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTFILE #setopt share_history # share command history data between terminals -# oh-my-zsh configuration (DISABLED by default, if you want oh-my-zsh, uncomment these) -#export ZSH="/usr/share/oh-my-zsh" -#ZSH_THEME="af-magic" -#UPDATE_ZSH_DAYS=8 -#ENABLE_CORRECTION="false" -#source $ZSH/oh-my-zsh.sh # Run oh-my-zsh - # Completion features (tab) autoload -Uz compinit -zmodload -i zsh/complist -compinit -d $ZSH_COMPDUMP -comp_options+=(globdots) -zstyle ':completion:*' menu select # select completions with arrow keys -zstyle ':completion:*' group-name '' # group results by category -zstyle ':completion:::::' completer _expand _complete _ignored _approximate #enable approximate matches for completio +zmodload -i zsh/complist # load completion list +compinit -d $ZSH_COMPDUMP # Specify compdump file +comp_options+=(globdots) # Enable completion on hidden files. +zstyle ':completion:*' menu select # select completions with arrow keys +zstyle ':completion:*' group-name '' # group results by category +zstyle ':completion:::::' completer _expand _complete _ignored _approximate #enable approximate matches for completion # Color support #autoload -U colors && colors @@ -61,5 +62,6 @@ zstyle ':completion:::::' completer _expand _complete _ignored _approximate #ena # Load extensions (should be last) . /usr/share/zsh/site-functions/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null . /usr/share/zsh/site-functions/zsh-autosuggestions/zsh-autosuggestions.zsh 2>/dev/null +. /usr/share/zsh/site-functions/zsh-you-should-use/you-should-use.plugin.zsh 2>/dev/null eval "$(lua /usr/local/src/z.lua/z.lua --init zsh enhanced)" diff --git a/root/usr/share/zsh/site-functions/zsh-you-should-use b/root/usr/share/zsh/site-functions/zsh-you-should-use new file mode 160000 index 0000000..b4aec74 --- /dev/null +++ b/root/usr/share/zsh/site-functions/zsh-you-should-use @@ -0,0 +1 @@ +Subproject commit b4aec740f23d195116d1fddec91d67b5e9c2c5c7