From f2a5060e7dd7e77a10e6e75e25b3a178ee2c7c03 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Mon, 20 Jan 2020 11:40:26 -0600 Subject: [PATCH] Things --- apps/elixir/iex.exs | 13 +++++++ apps/kitty/kitty.conf | 2 ++ apps/neovim/bindings.vim | 6 +++- apps/neovim/init.vim | 51 ++++++--------------------- apps/neovim/plugins.vim | 53 ++++++++--------------------- apps/neovim/settings.vim | 5 +-- apps/shell/tmux/{tmux.conf => conf} | 12 +++---- bin/vman | 13 ++----- setup.bash | 5 ++- 9 files changed, 61 insertions(+), 99 deletions(-) create mode 100644 apps/elixir/iex.exs rename apps/shell/tmux/{tmux.conf => conf} (90%) diff --git a/apps/elixir/iex.exs b/apps/elixir/iex.exs new file mode 100644 index 0000000..dd92e92 --- /dev/null +++ b/apps/elixir/iex.exs @@ -0,0 +1,13 @@ +Application.put_env(:elixir, :ansi_enabled, true) + +IEx.configure( + colors: [enabled: true], + default_prompt: [ + "\e[G", # ANSI CHA, move cursor to column 1 + :magenta, + "%prefix", # IEx prompt variable + ">", # plain string + :reset + ] |> IO.ANSI.format |> IO.chardata_to_string +) + diff --git a/apps/kitty/kitty.conf b/apps/kitty/kitty.conf index b41b34a..631b23a 100644 --- a/apps/kitty/kitty.conf +++ b/apps/kitty/kitty.conf @@ -31,3 +31,5 @@ color12 #a59f85 color13 #f5f4f1 color14 #cc6633 color15 #f9f8f5 + +color18 #333333 diff --git a/apps/neovim/bindings.vim b/apps/neovim/bindings.vim index dd72c4c..0934dfb 100644 --- a/apps/neovim/bindings.vim +++ b/apps/neovim/bindings.vim @@ -124,7 +124,11 @@ nnoremap j :bprevious nnoremap :bnext nnoremap :bprevious -nnoremap r :source ~/.config/nvim/init.vim +if has('nvim') + nnoremap r :source $vimdir/init.vim +else + nnoremap r :source $HOME/.vimrc +endif " change buffers with leader,tab nnoremap :bnext diff --git a/apps/neovim/init.vim b/apps/neovim/init.vim index e9d7256..e2280bc 100644 --- a/apps/neovim/init.vim +++ b/apps/neovim/init.vim @@ -1,56 +1,25 @@ -" vim compatibility let $vimdir = $HOME.'/.vim' if has('nvim') - let $vimdir = $HOME.'/.config/nvim' + let $vimdir = $XDG_CONFIG_HOME.'/nvim' endif -" utf8 encoding -if has('vim_starting') - set encoding=utf8 -endif - -" os detection functions -silent function! OSX() - return has('macunix') -endfunction -silent function! LINUX() - return has('unix') && !has('macunix') && !has('win32unix') -endfunction -silent function! WINDOWS() - return (has('win32') || has('win64')) -endfunction - " load a per-environment file if one exists -if filereadable(expand('$HOME/.env_init.vim')) - source "$HOME/.env_init.vim" +if filereadable("$ENV_PATH/vim") + source "$ENV_PATH/vim" endif -" initialize plugin manager -if has('nvim') - call plug#begin('~/.config/nvim/bundle') -else - call plug#begin('~/.vim/bundle') -endif - -let pluginsfile=$vimdir.'/plugins.vim' -exec 'source ' . pluginsfile - +call plug#begin($vimdir.'/bundle') +source $vimdir/plugins.vim call plug#end() filetype on filetype indent on filetype plugin on -let settingsfile=$vimdir.'/settings.vim' -exec 'source ' . settingsfile +source $vimdir/settings.vim +source $vimdir/commands.vim +source $vimdir/bindings.vim -let commandsfile=$vimdir.'/commands.vim' -exec 'source ' . commandsfile - -let bindingsfile=$vimdir.'/bindings.vim' -exec 'source ' . bindingsfile - -" load a per-environment file if one exists -if filereadable(expand('$HOME/.env_init_after.vim')) - source "$HOME/.env_init_after.vim" +if filereadable("$ENV_PATH/vim-after") + source "$ENV_PATH/vim-after" endif diff --git a/apps/neovim/plugins.vim b/apps/neovim/plugins.vim index 884e943..2d5e6f5 100644 --- a/apps/neovim/plugins.vim +++ b/apps/neovim/plugins.vim @@ -1,25 +1,15 @@ " install plugin manager if needed augroup PluginManagerInstaller - if has('nvim') - if empty(glob('~/.config/nvim/autoload/plug.vim')) - silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - autocmd VimEnter * PlugInstall - endif - else - if empty(glob('~/.vim/autoload/plug.vim')) - silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - autocmd VimEnter * PlugInstall - endif - end + if empty(glob("$vimdir/autoload/plug.vim")) + silent !curl -fLo "$vimdir/autoload/plug.vim" --create-dirs 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' + autocmd VimEnter * PlugInstall + endif augroup End let g:airline_powerline_fonts = 1 let g:airline#extensions#tabline#enabled = 1 " automatically displays all buffers when there's only one tab open let g:airline#extensions#tabline#fnamemod = ':t' -" set laststatus=2 " always show statusline -" set noshowmode " hides default mode -" cleanup/simplify airline let g:airline#extensions#tabline#left_sep = '' let g:airline#extensions#tabline#left_alt_sep = '' let g:airline_right_alt_sep = '' @@ -28,7 +18,6 @@ let g:airline_left_alt_sep= '' let g:airline_left_sep = '' let g:airline#extensions#tabline#buffers_label = '' -" short mode texts let g:airline_mode_map = { \ '__' : '-', \ 'n' : 'N', @@ -47,36 +36,22 @@ let g:airline_mode_map = { let g:indent_guide_auto_colors = 1 let g:indent_guides_enable_on_vim_startup = 1 +let g:prosession_dir = $vimdir."/session/" -" no ALE gutter -" let g:ale_sign_column_always = 0 -" let g:ale_set_signs = 0 -" highlight clear ALEErrorSign -" highlight clear ALEWarningSign - -" fix me, baby -" let g:ale_fix_on_save = 1 - -" autocomplete -" let g:ale_completion_enabled = 1 -" let g:ale_typescript_tslint_use_global = 1 - -let g:fzf_layout = { 'window': 'enew' } +" let g:fzf_layout = { 'window': 'enew' } " check if we're using vim as the manpage viewer before loading session plugins if exists('asmanviewer') let g:prosession_dir = '/dev/null' else - Plug 'tpope/vim-obsession' " session ease-of-use + Plug 'tpope/vim-obsession' " session ease-of-use Plug 'dhruvasagar/vim-prosession' " more session ease-of-use - let g:prosession_dir = '~/.config/nvim/session/' endif Plug 'junegunn/vim-plug' " plugin manager should manage itself Plug 'vim-airline/vim-airline' " status line Plug 'vim-airline/vim-airline-themes' " more minimal status line Plug 'nathanaelkane/vim-indent-guides' " indentation guides -" Plug 'w0rp/ale' " syntax checker Plug 'SirVer/ultisnips' " snippet manager Plug 'junegunn/fzf', {'dir': '~/.fzf', 'do': './install --all'} " fuzzy file finding Plug 'junegunn/fzf.vim' " helpers for using fzf in vim @@ -101,16 +76,18 @@ Plug 'editorconfig/editorconfig-vim' " loads project- Plug 'sheerun/vim-polyglot' " vim plugin loader for many languages Plug 'leafo/moonscript-vim', {'for': ['moon', 'moonscript']} " moonscript language Plug 'OmniSharp/omnisharp-vim', {'for': ['cs']} " C# language -" Plug 'junegunn/vim-peekaboo' " preview registers Plug 'scrooloose/nerdtree' " file browser Plug 'tpope/vim-eunuch' " unix helper commands +" Plug 'junegunn/vim-peekaboo' " preview registers + +" language support Plug 'sheerun/vim-polyglot' " vim plugin loader for many languages Plug 'leafo/moonscript-vim', {'for': ['moon', 'moonscript']} " moonscript language Plug 'OmniSharp/omnisharp-vim', {'for': ['cs']} " C# language Plug 'neoclide/coc.nvim', {'branch': 'release'} " language server completion Plug 'JakeBecker/elixir-ls', {'for': ['elixir', 'eelixir'], 'do': { -> g:elixirls.compile() }} -Plug 'tpope/vim-dadbod' " databasing in vim -Plug 'lytedev/elm-vim' " elm lang -Plug 'google/vim-jsonnet' " jsonnet -Plug 'sirtaj/vim-openscad' " openscad -Plug 'ssh://git@git.lyte.dev:2222/lytedev/vim-lytlang.git' +Plug 'tpope/vim-dadbod' " vim +Plug 'lytedev/elm-vim', {'for': ['elm']} " elm lang +Plug 'google/vim-jsonnet', {'for': ['jsonnet', 'libsonnet']} " jsonnet +Plug 'sirtaj/vim-openscad', {'for': ['scad']} " openscad +" Plug 'ssh://git@git.lyte.dev:2222/lytedev/vim-lytlang.git' diff --git a/apps/neovim/settings.vim b/apps/neovim/settings.vim index b332e90..7c2946f 100644 --- a/apps/neovim/settings.vim +++ b/apps/neovim/settings.vim @@ -1,4 +1,5 @@ scriptencoding utf8 +set encoding=utf8 " ALE completeopt recommendation set completeopt=menu,menuone,preview,noselect,noinsert @@ -90,8 +91,8 @@ if has('autocmd') endif " color scheme -let base16colorspace=16 -let &t_Co=16 +let base16colorspace=256 +let &t_Co=256 set background=dark syntax enable colorscheme base16-donokai diff --git a/apps/shell/tmux/tmux.conf b/apps/shell/tmux/conf similarity index 90% rename from apps/shell/tmux/tmux.conf rename to apps/shell/tmux/conf index ecdad7f..865fe65 100644 --- a/apps/shell/tmux/tmux.conf +++ b/apps/shell/tmux/conf @@ -4,9 +4,9 @@ set -g prefix C-s bind-key s send-prefix # reload tmux.conf -bind-key T source-file ~/.tmux.conf \; display-message "source-file done" +bind-key T source-file "$HOME/.tmux.conf" \; display-message "source-file done" unbind r -bind r source-file ~/.tmux.conf +bind r source-file "$HOME/.tmux.conf" set -as terminal-overrides ',xterm*:smxx=\E[9m' @@ -46,7 +46,7 @@ bind-key j switch-client -p bind-key h switch-client -p bind-key k switch-client -n bind-key l switch-client -n -bind s run-shell "tmux new-window 'sh -c ~/.config/dotfiles/bin/tmuxswitcher'" +bind s run-shell "tmux new-window tmuxswitcher" # reset the working directory of the current session bind-key P attach-session -t . -c '#{pane_current_path}' \; display-message 'Reset session dir to #{pane_current_path}' @@ -60,9 +60,9 @@ set -g status-interval 5 set -g status-right-length 80 set -g status-right "#[fg=colour4]#W#[fg=default]#[bg=default] #H" set -g status-left-length 200 -set -g status-left "#[fg=colour7]#(~/.config/dotfiles/bin/tmux-session-list #S)" +set -g status-left "#[fg=colour7]#(tmux-session-list #S)" -bind-key O run-shell "~/.config/dotfiles/bin/tmux-save-buffer #S" \; display-message "Saved buffer to ~/..tmux-buffer.log" +bind-key O run-shell "tmux-save-buffer #S" \; display-message "Saved buffer to ~/..tmux-buffer.log" # pane split line colors set -g pane-active-border-style bg=black,fg=blue @@ -135,7 +135,7 @@ set -g @resurrect-save 'C-v' set -g @resurrect-restore 'R' # initialize tmux plugin manager -run '~/.tmux/plugins/tpm/tpm' +run '$HOME/.tmux/plugins/tpm/tpm' # attempt at integrating nested tmux sessions nicely # bind -T root F12 \ diff --git a/bin/vman b/bin/vman index fa4b287..238809e 100755 --- a/bin/vman +++ b/bin/vman @@ -1,15 +1,8 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh # our vim config is setup to not auto-load sessions if we set the # `asmanviewer` variable, so launch vim that way when using vim as our man # page viewer -if command -v nvim >/dev/null 2>&1; then - nvim --cmd "let asmanviewer=1" -c "SuperMan $*" -else - vim --cmd "let asmanviewer=1" -c "SuperMan $*" -fi -# proper error handling -if [ "$?" != "0" ]; then - echo "No manual entry for $*" -fi +vim --cmd "let asmanviewer=1" -c "SuperMan $*" +[ "$?" != "0" ] && echo "No manual entry for $*" && exit 1 diff --git a/setup.bash b/setup.bash index ead2fac..3fbcc3f 100755 --- a/setup.bash +++ b/setup.bash @@ -35,7 +35,7 @@ links=( # shell files "$dfp/apps/shell/bash/rc" "$HOME/.bashrc" "$dfp/apps/shell/bash/profile" "$HOME/.bash_profile" - "$dfp/apps/shell/tmux/tmux.conf" "$HOME/.tmux.conf" + "$dfp/apps/shell/tmux/conf" "$HOME/.tmux.conf" "$dfp/apps/shell/tmux/layouts" "$HOME/.tmux/layouts" "$dfp/apps/shell/fish/" "$XDG_CONFIG_HOME/fish" @@ -100,6 +100,9 @@ links=( # fontconfig "$dfp/apps/de/fontconfig/" "$XDG_CONFIG_HOME/fontconfig" + # fontconfig + "$dfp/apps/elixir/iex.exs" "$HOME/.iex.exs" + # XDG user directories "$dfp/apps/shell/user-dirs" "$XDG_CONFIG_HOME/user-dirs.dirs" )