Merge branch 'dev'

This commit is contained in:
Daniel Flanagan 2020-11-07 22:28:25 -06:00
commit 89d316a57a
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
25 changed files with 250 additions and 761 deletions

View file

@ -1,10 +1,3 @@
/* /*
!/scripts/
!/ftplugin/
!/.gitignore !/.gitignore
!/init.vim !/init.vim
!/settings.vim
!/bindings.vim
!/plugins.vim
!/airline.vim
!/commands.vim

View file

@ -1,28 +0,0 @@
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'
let g:airline#extensions#tabline#left_sep = ''
let g:airline#extensions#tabline#left_alt_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_left_alt_sep= ''
let g:airline_left_sep = ''
let g:airline#extensions#tabline#buffers_label = ''
let g:airline_mode_map = {
\ '__' : '-',
\ 'n' : 'N',
\ 'i' : 'I',
\ 'R' : 'R',
\ 'T' : 'T',
\ 't' : 'T',
\ 'c' : 'C',
\ 'v' : 'V',
\ 'V' : 'V',
\ '' : 'V',
\ 's' : 'S',
\ 'S' : 'S',
\ '' : 'S',
\ }

View file

@ -1,260 +0,0 @@
" common typo fixes
command! WQ wq
command! Wq wq
command! Wqa wqa
command! W w
command! Q q
" best leader
let mapleader = "\<Space>"
" enter insert mode when entering a terminal buffer
augroup InsertModeOnBlankTerminal
autocmd BufWinEnter,WinEnter term://* startinsert
augroup END
" terminal mappings
nnoremap <leader>t :split term://$SHELL<CR><C-\><C-n>:resize 24<CR>i
nnoremap <C-t> :split term://$SHELL<CR><C-\><C-n>:resize 24<CR>i
nnoremap <leader><leader>t :vsplit term://$SHELL<CR><C-\><C-n>:vertical resize 120<CR>i
" nnoremap <C-S-T> :vsplit term://$SHELL<CR><C-\><C-n>:vertical resize 120<CR>i
nnoremap <C-y> :vsplit term://$SHELL<CR><C-\><C-n>:vertical resize 120<CR>i
" close the terminal
tnoremap <C-w> <C-\><C-n>:q!<CR>
tnoremap <leader>w <C-\><C-n>:q!<CR>
" tnoremap <C-n> <C-\><C-n>
tnoremap <C-[> <C-\><C-n>
" moving between terminal splits
tnoremap <C-h> <C-\><C-n>:TmuxNavigateLeft<CR>
tnoremap <C-j> <C-\><C-n>:TmuxNavigateDown<CR>
tnoremap <C-k> <C-\><C-n>:TmuxNavigateUp<CR>
tnoremap <C-l> <C-\><C-n>:TmuxNavigateRight<CR>
" Jump to the next or previous line that has the same level or a lower
" level of indentation than the current line.
"
" exclusive (bool): true: Motion is exclusive
" false: Motion is inclusive
" fwd (bool): true: Go to next line
" false: Go to previous line
" lowerlevel (bool): true: Go to line with lower indentation level
" false: Go to line with the same indentation level
" skipblanks (bool): true: Skip blank lines
" false: Don't skip blank lines
function! NextIndent(exclusive, fwd, lowerlevel, skipblanks)
let line = line('.')
let column = col('.')
let lastline = line('$')
let indent = indent(line)
let stepvalue = a:fwd ? 1 : -1
while (line > 0 && line <= lastline)
let line = line + stepvalue
if ( a:lowerlevel == 0 && indent(line) == indent ||
\ a:lowerlevel == 1 && indent(line) < indent ||
\ a:lowerlevel == -1 && indent(line) > indent)
if (! a:skipblanks || strlen(getline(line)) > 0)
if (a:exclusive)
let line = line - stepvalue
endif
exe line
exe 'normal ' (column+1) . '|'
return
endif
endif
endwhile
endfunction
" moving back and forth between lines of same or lower indentation should be sane
nnoremap <silent> [l :call NextIndent(0, 0, 0, 1)<CR>
nnoremap <silent> ]l :call NextIndent(0, 1, 0, 1)<CR>
nnoremap <silent> [L :call NextIndent(0, 0, 1, 1)<CR>
nnoremap <silent> ]L :call NextIndent(0, 1, 1, 1)<CR>
nnoremap <silent> [<C-l> :call NextIndent(0, 0, -1, 1)<CR>
nnoremap <silent> ]<C-l> :call NextIndent(0, 1, -1, 1)<CR>
vnoremap <silent> [l <Esc>:call NextIndent(0, 0, 0, 1)<CR>m'gv''
vnoremap <silent> ]l <Esc>:call NextIndent(0, 1, 0, 1)<CR>m'gv''
vnoremap <silent> [L <Esc>:call NextIndent(0, 0, 1, 1)<CR>m'gv''
vnoremap <silent> ]L <Esc>:call NextIndent(0, 1, 1, 1)<CR>m'gv''
onoremap <silent> [l :call NextIndent(0, 0, 0, 1)<CR>
onoremap <silent> ]l :call NextIndent(0, 1, 0, 1)<CR>
onoremap <silent> [L :call NextIndent(1, 0, 1, 1)<CR>
onoremap <silent> ]L :call NextIndent(1, 1, 1, 1)<CR>
" run make with leader,m
nnoremap <leader>m :call RunMake()<CR>
" NERDTree bindings
" show file manager in current directory
nnoremap <C-f> :NERDTreeToggle<CR>
" show file manager in git repo root
nnoremap <leader>n :call NERDProjectViewer()<CR>
" focus the current file in NERDTree
nnoremap <leader>gn :NERDTreeFind<CR>
" don't kill vim
" REBIND
nnoremap <leader>K <Nop>
nnoremap <S-K> <NOP>
" quick paragraph formatting
vmap Q gq
nmap Q gqap
" launch fzf for the current git repo
nnoremap <C-p> :GitFiles<CR>
" launch fzf for files in the current directory
nnoremap <C-o> :Files<CR>
" launch fzf for files modified or not in git
nnoremap <C-u> :GFiles?<CR>
" launch fzf for open buffers (files)
nnoremap <C-b> :Buffers<CR>
" launch fzf for open buffers (files)
nnoremap <leader>l :Buffers<CR>
if has("nvim")
au FileType fzf tnoremap <Esc> <C-c><C-c>
endif
" switch to previous buffer
nnoremap <leader>h :b#<CR>
" use leader j and k to switch buffers as well
nnoremap <leader>k :bnext<CR>
nnoremap <leader>j :bprevious<CR>
" window/pane navigation
nnoremap <C-h> :TmuxNavigateLeft<CR>
nnoremap <C-j> :TmuxNavigateDown<CR>
nnoremap <C-k> :TmuxNavigateUp<CR>
nnoremap <C-l> :TmuxNavigateRight<CR>
if has('nvim')
nnoremap <leader>r :source $vimdir/init.vim<CR>
else
nnoremap <leader>r :source $HOME/.vimrc<CR>
endif
" change buffers with leader,tab
nnoremap <leader><Tab> :bnext<CR>
nnoremap <leader><S-Tab> :bprevious<CR>
" fast word change
nnoremap <leader>c ciw
nnoremap <leader>C ciW
" fast splits
nnoremap <silent> <leader>s :split<CR>
nnoremap <silent> <leader>v :vsplit<CR>
" fast split closing
nnoremap <silent> <leader>q <C-w>q
" fast force quit
nnoremap <silent> <leader>Q :qall!<CR>
" clear search higlight
nnoremap <silent> <leader>/ :let @/ = ""<CR>:<BACKSPACE>
" remap jk/jj and its variants to escape
inoremap jj <Esc>
inoremap Jj <Esc>
inoremap Jj <Esc>
inoremap JJ <Esc>
inoremap jk <Esc>
inoremap Jk <Esc>
inoremap jK <Esc>
inoremap JK <Esc>
" use hjkl-movement between rows when soft wrapping:
nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk
" camel case motions
map <silent> ,w <Plug>CamelCaseMotion_w
map <silent> ,b <Plug>CamelCaseMotion_b
map <silent> ,e <Plug>CamelCaseMotion_e
map <silent> ,ge <Plug>CamelCaseMotion_ge
" inner _ objects
omap <silent> ib <Plug>CamelCaseMotion_ib
xmap <silent> ib <Plug>CamelCaseMotion_ib
omap <silent> ie <Plug>CamelCaseMotion_ie
xmap <silent> ie <Plug>CamelCaseMotion_ie
" remove trailing whitespace
map <F3> mw:%s/\s\+$//<CR>:let @/ = ""<CR>'w
" close buffer with leader-w
nnoremap <silent> <leader>w :bd<CR>
" toggle spell checking:
map <F4> :setlocal spell!<CR>
" open urls, files, etc. example: http://google.com:
noremap <leader>o :!xdg-open <cfile><CR><CR>
" insert newline
" NOTE: doesn't work in terminals?
" noremap <S-Enter> i<Enter><Esc>
" noremap <C-o> i<Enter><Esc>
" prevent wildmenu
map q: :q
noremap qqq: q:
" sane n/N behavior
nnoremap <expr> n 'Nn'[v:searchforward]
nnoremap <expr> N 'nN'[v:searchforward]
" better command history navigation
cnoremap <c-n> <down>
cnoremap <c-p> <up>
" keep selection after indenting visual selection
xnoremap < <gv
xnoremap > >gv
" distraction-free mode
nnoremap <silent> <leader>df :DistractionFreeMode<CR>
" recalc syntax highlighting
nnoremap <leader>gs :syntax sync fromstart<CR>
" lsp bindings
" coc
" open coc config
nnoremap <leader><space>c :CocConfig<CR>
" smart jumps
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
nmap <silent> g[ <Plug>(coc-diagnostic-prev)
nmap <silent> g] <Plug>(coc-diagnostic-next)
nmap <leader>ac <Plug>(coc-codeaction)
nmap <leader>qf <Plug>(coc-fix-current)
nmap <leader>f <Plug>(coc-format)
vmap <leader>f <Plug>(coc-format-selected)
" ale
" go to definitions
" nnoremap <leader>gd :ALEGoToDefinition<CR>
" nnoremap <leader>gh :ALEGoToDefinitionInSplit<CR>
" nnoremap <leader>gv :ALEGoToDefinitionInVSplit<CR>
" misc plugins
nmap <leader>aa :%ArrangeColumn!<CR>

View file

@ -1,84 +0,0 @@
" TODO: need a way to toggle this and maybe make it on by default except in
" files where space indentation is expected
fun! ShowSpaceIndentation()
hi LeadingWhiteSpaces ctermfg=black ctermbg=8
endfunction
fun! HideSpaceIndentation()
hi LeadingWhiteSpaces ctermfg=black ctermbg=black
endfunction
hi LeadingWhiteSpaces ctermfg=black ctermbg=black
:command! SpaceIndents call ShowSpaceIndentation()
:command! ShowSpaceIndents call ShowSpaceIndentation()
:command! HideSpaceIndents call HideSpaceIndentation()
" jump to last opened position in file except in git commits
let jump_to_pos_blacklist = ['gitcommit']
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") && index(jump_to_pos_blacklist, &ft) | exe "normal! g'\"" | endif
endif
" make any necessary directories in the path when saving a file
fun! <SID>AutoMakeDirectory()
let s:directory = expand("<afile>:p:h")
if !isdirectory(s:directory)
call mkdir(s:directory, "p")
endif
endfun
autocmd BufWritePre,FileWritePre * :call <SID>AutoMakeDirectory()
" run make from vim smartly
if !exists("g:make_args")
let g:make_args="default"
endif
fun! RunMake()
split
if has('nvim')
" run from the root of the current git repository
let path = system("git rev-parse --show-toplevel | tr -d '\\n'")
" TODO: handle non-git situations
execute 'terminal cd ' . path . ' && make ' . g:make_args
startinsert
else
execute '!make ' . g:make_args
endif
endfun
" kill the terminal buffer when the process exits
autocmd TermClose * call feedkeys('<cr>')
fun! NERDProjectViewer()
let path = system("git rev-parse --show-toplevel | tr -d '\\n'")
execute 'NERDTree' path
endfun
" a toggle-able minimalistic distraction-free text editing mode
let s:distractionFreeMode = 0
fun! DistractionFreeModeFunc()
if s:distractionFreeMode == 0
let s:distractionFreeMode = 1
AirlineToggle
Goyo
else
let s:distractionFreeMode = 0
Goyo!
AirlineToggle
AirlineRefresh
endif
endfunction
" prevents normal window navigation and closing while in DistractionFreeMode
fun! CheckCloseDistractionFreeMode()
if s:distractionFreeMode == 1
call DistractionFreeModeFunc()
endif
endfunction
" run the previous checking function every time we leave a window
if has('autocmd')
" autocmd WinLeave * call CheckCloseDistractionFreeMode()
endif
" AddTabularPattern! ssv /\s/r0c0l0
command! DistractionFreeMode call DistractionFreeModeFunc()

View file

@ -1,28 +1,131 @@
scriptencoding utf-8 scriptencoding utf-8
set fileencoding=utf8 set fileencoding=utf8
let $vimdir = $HOME.'/.vim' let $vimdir = $XDG_CONFIG_HOME.'/nvim'
if has('nvim')
let $vimdir = $XDG_CONFIG_HOME.'/nvim' 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 --sync | source $vimdir.'init.vim'
endif endif
if filereadable("$ENV_PATH/vim") let g:indent_guide_auto_colors = 1
source "$ENV_PATH/vim" let g:indent_guides_enable_on_vim_startup = 1
endif let g:prosession_dir = $vimdir."/session/"
let g:jsonnet_fmt_on_save = 0
call plug#begin($vimdir.'/bundle') call plug#begin($vimdir.'/plugged')
source $vimdir/plugins.vim Plug 'junegunn/vim-plug' " plugin manager should manage itself
source $vimdir/airline.vim Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim' " helpers for using fzf in vim
Plug 'nathanaelkane/vim-indent-guides' " indentation guides
Plug 'bkad/CamelCaseMotion' " camel case and underscore word movements
Plug 'vim-scripts/LargeFile' " gracefully handle very large files
Plug 'tpope/vim-commentary' " toggle comments in code easily
Plug 'tpope/vim-repeat' " better vim repeating for plugin-provided actions
Plug 'christoomey/vim-tmux-navigator' " allow window navigation to play nicely with tmux
Plug 'machakann/vim-sandwich' " quickly modify text surrounding objects
Plug 'michaeljsmith/vim-indent-object' " adds an indentation level text object
Plug 'wellle/targets.vim' " adds some more handy text objects
Plug 'junegunn/goyo.vim' " better distraction-free editing
Plug 'tpope/vim-sleuth' " try and detect indent method
Plug 'editorconfig/editorconfig-vim' " loads project-specific editor settings
Plug 'google/vim-jsonnet', {'for': ['jsonnet', 'libsonnet']}
Plug 'calviken/vim-gdscript3', {'for': ['gdscript']}
call plug#end() call plug#end()
filetype on filetype on
filetype indent on filetype indent on
filetype plugin on filetype plugin on
source $vimdir/settings.vim " use :h option-list if you need to know what these do
source $vimdir/commands.vim set fcs=eob:\+
source $vimdir/bindings.vim set encoding=utf8
set tabstop=2 shiftwidth=2 softtabstop=2 noexpandtab
set autoindent smartindent
set list nostartofline listchars=trail,tab:\ \ ,trail:~
set linebreak formatoptions=crql1jn " TODO: anything else useful? :h fo-table
set synmaxcol=200
set lazyredraw
set scrolloff=8 sidescrolloff=15
set mouse=a
set splitright splitbelow
set noerrorbells visualbell t_vb=
set nobackup nowritebackup noswapfile
set timeout ttimeoutlen=100 timeoutlen=150
set hidden shortmess+=Ia
set history=1000
set undofile undodir=$vimdir/undo undolevels=1000 undoreload=10000
set spellfile=$vimdir/spell/en.utf-8.add
set ignorecase smartcase incsearch wrapscan hlsearch
set foldmethod=syntax foldlevel=99 foldnestmax=10 foldlevelstart=99 " TODO: get good at folding
set noautowrite autochdir autoread
set nomodeline noshowmode noshowcmd laststatus=0 " TODO: custom modeline and buffer list?
set clipboard+=unnamedplus
set t_Co=256
if filereadable("$ENV_PATH/vim-after") syntax enable
source "$ENV_PATH/vim-after" colorscheme base16-donokai
endif
call matchadd('ColorColumn', '\%81v', 100)
hi Search cterm=NONE ctermbg=blue ctermfg=black
hi LineNr ctermbg=none ctermfg=8
hi CursorLineNr ctermbg=18 ctermfg=gray
hi IndentGuidesEven ctermbg=18
hi Normal ctermbg=NONE
hi ColorColumn ctermbg=7 ctermfg=0
" jump to last opened position in file except in git commits
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") && index(['gitcommit'], &ft) | exe "normal! g'\"" | endif
inoremap jj <Esc>
inoremap jk <Esc>
nnoremap <C-p> :GitFiles<CR>
nnoremap <C-o> :Files<CR>
nnoremap <C-u> :GFiles?<CR>
nnoremap <C-b> :Buffers<CR>
au FileType fzf tnoremap <Esc> <C-c><C-c>
nnoremap <C-h> :TmuxNavigateLeft<CR>
nnoremap <C-j> :TmuxNavigateDown<CR>
nnoremap <C-k> :TmuxNavigateUp<CR>
nnoremap <C-l> :TmuxNavigateRight<CR>
tnoremap <C-h> <C-\><C-n>:TmuxNavigateLeft<CR>
tnoremap <C-j> <C-\><C-n>:TmuxNavigateDown<CR>
tnoremap <C-k> <C-\><C-n>:TmuxNavigateUp<CR>
tnoremap <C-l> <C-\><C-n>:TmuxNavigateRight<CR>
map <silent> ,w <Plug>CamelCaseMotion_w
map <silent> ,b <Plug>CamelCaseMotion_b
map <silent> ,e <Plug>CamelCaseMotion_e
map <silent> ,ge <Plug>CamelCaseMotion_ge
omap <silent> ib <Plug>CamelCaseMotion_ib
xmap <silent> ib <Plug>CamelCaseMotion_ib
omap <silent> ie <Plug>CamelCaseMotion_ie
xmap <silent> ie <Plug>CamelCaseMotion_ie
map <F3> mw:%s/\s\+$//<CR>:let @/ = ""<CR>'w
map <F4> :setlocal spell!<CR>
nnoremap <expr> n 'Nn'[v:searchforward]
nnoremap <expr> N 'nN'[v:searchforward]
cnoremap <c-n> <down>
cnoremap <c-p> <up>
xnoremap < <gv
xnoremap > >gv
let mapleader = "\<Space>"
nnoremap <silent> <leader>w :bd<CR>
nnoremap <leader>h :b#<CR>
nnoremap <leader>k :bnext<CR>
nnoremap <leader>j :bprevious<CR>
nnoremap <silent> <leader>/ :let @/ = ""<CR>:<BACKSPACE>
nnoremap <leader>t :split<CR>:term<CR>:resize 24<CR>:startinsert<CR>
tnoremap <C-w> <C-\><C-n>:q!<CR>
" TODO: learn about the wildmenu `q:`

View file

@ -1,68 +0,0 @@
" install plugin manager if needed
augroup PluginManagerInstaller
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:indent_guide_auto_colors = 1
let g:indent_guides_enable_on_vim_startup = 1
let g:prosession_dir = $vimdir."/session/"
let g:polyglot_disabled = ['cue', 'cuesheet']
let g:jsonnet_fmt_on_save = 0
" let g:fzf_layout = { 'window': 'enew' }
" check if we're using vim as the manpage viewer before loading session plugins
if exists('asmanviewer') || exists('nosession')
let g:prosession_dir = '/dev/null'
else
Plug 'tpope/vim-obsession' " session ease-of-use
Plug 'dhruvasagar/vim-prosession' " more session ease-of-use
endif
Plug 'junegunn/vim-plug' " plugin manager should manage itself
Plug 'junegunn/fzf', {'dir': '~/.fzf', 'do': './install --all'} " fuzzy file finding
Plug 'junegunn/fzf.vim' " helpers for using fzf in vim
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 'SirVer/ultisnips' " snippet manager
Plug 'bkad/CamelCaseMotion' " camel case and underscore word movements
Plug 'vim-scripts/LargeFile' " gracefully handle very large files
Plug 'tpope/vim-commentary' " toggle comments in code easily
Plug 'tpope/vim-repeat' " better vim repeating for plugin-provided actions
Plug 'vim-scripts/SyntaxRange' " define syntax ranges
Plug 'tmux-plugins/vim-tmux-focus-events' " allow transitions from tmux
Plug 'christoomey/vim-tmux-navigator' " allow transitions to tmux
Plug 'godlygeek/tabular' " commands for aligning text
Plug 'lytedev/vim-superman' " view man pages with vim
Plug 'machakann/vim-sandwich' " quickly modify text surrounding objects
Plug 'tpope/vim-speeddating' " date-like text objects
Plug 'tpope/vim-fugitive' " git commands
Plug 'michaeljsmith/vim-indent-object' " adds an indentation level text object
Plug 'wellle/targets.vim' " adds some more handy text objects
Plug 'dbakker/vim-projectroot' " adds helper functions for getting to a project's root directory
Plug 'junegunn/goyo.vim' " better distraction-free editing
Plug 'junegunn/limelight.vim' " dim inactive blocks of code
Plug 'tpope/vim-sleuth' " try and detect indent method
Plug 'editorconfig/editorconfig-vim' " loads project-specific editor settings
Plug 'tpope/vim-eunuch' " unix helper commands
Plug 'mbbill/undotree' " undo tree visualizer
" Plug 'junegunn/vim-peekaboo' " preview registers
" language support
Plug 'sheerun/vim-polyglot' " vim plugin loader for many languages
Plug 'OmniSharp/omnisharp-vim', {'for': ['cs']} " C# language
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 interface
Plug 'tpope/vim-dadbod' " vim database functions
Plug 'lytedev/elm-vim', {'for': ['elm']} " elm lang
Plug 'google/vim-jsonnet', {'for': ['jsonnet', 'libsonnet']} " jsonnet
Plug 'sirtaj/vim-openscad', {'for': ['scad']} " openscad
Plug 'jjo/vim-cue' " cuelang
Plug 'calviken/vim-gdscript3', {'for': ['gdscript']} " godot scripts
" Plug 'chrisbra/csv.vim'
" Plug 'ssh://git@git.lyte.dev:2222/lytedev/vim-lytlang.git'

View file

@ -1,165 +0,0 @@
scriptencoding utf-8
set fileencoding=utf8
set encoding=utf8
" ALE completeopt recommendation
set completeopt=menu,menuone,preview,noselect,noinsert
" line number defaults
set nonumber
set norelativenumber
" different settings if using vim as a manpage viewer
" if exists('asmanviewer')
" set nonumber " no line numbers when viewing a man page
" set norelativenumber " no line numbers when viewing a man page
" else
" set nonumber " line numbers
" set norelativenumber " line numbers
" endif
" use tabs at a two-space width like God intended
set tabstop=2
set shiftwidth=2
set softtabstop=2
set noexpandtab
" auto/smart indent
set autoindent smartindent
" show certain whitespace characters
set list
set nostartofline
set listchars=trail,tab:\ \ ,trail:~
" set listchars=eol:\ ,tab:>-,trail:~,extends:>,precedes:<,space:·
" try and keep text (and code) to a width of 80 characters
set wrap
set linebreak
set breakindent
set textwidth=80
set formatoptions=crql1j " :h fo-table
" handle window title
set title
" limit syntax highlighting line length
set synmaxcol=500
" don't highlight the current line
set nocursorline
" don't highlight the current column
" set nocursorcolumn
" OBSOLETE: colors columns past 80
" let &colorcolumn=join(range(81,400),",")
" highlight the 81st character in a line where it exists
highlight ColorColumn ctermbg=magenta ctermfg=7
call matchadd('ColorColumn', '\%81v', 100)
" set noshowcmd
" set nowildmenu
" set wildmode=longest,list,full
set cpoptions-=$ " make buffer options more global
set noshowmatch " don't briefly highlight matching brackets
set mouse=a " enable mouse use
set mousehide " hide mouse when typing
set backspace=indent,eol,start " sane backspace
set noruler " hide the ruler - we have airline
set lazyredraw " don't draw during macros and other such things
set scrolloff=8 " keep lines above and below cursor (padding)
set sidescrolloff=15 " same but for columns
set splitright " don't split left
set splitbelow " don't split top
set noerrorbells " shhhh, vim
set visualbell " but visual noise for alerts is ok
set nobackup " sessions handle this quite nicely
set nowritebackup " no, but really, they do
set noswapfile " no, seriously, sessions are cool
set timeout " key combo mapping timeout
set ttimeoutlen=100 " ms delay for tapping key combos
set timeoutlen=150 " ms for key combo mapping timeout
set isfname+=32 " allow filenames to show them 32s
set updatetime=300 " recommended for coc.nvim
" no freakin' bell
set visualbell t_vb=
if has('autocmd')
augroup DisableVisualBell
autocmd GUIEnter * set visualbell t_vb=
augroup END
endif
syntax enable
colorscheme base16-donokai
" hide stuff
highlight SignColumn ctermbg=black guibg=black
highlight GitGutterAdd ctermbg=black guibg=black
highlight GitGutterDelete ctermbg=black guibg=black
highlight GitGutterChange ctermbg=black guibg=black
highlight GitGutterChangeDelete ctermbg=black guibg=black
hi NonText ctermfg=black guifg=black
hi DiffAdd ctermfg=black ctermbg=2
hi DiffChange ctermfg=black ctermbg=4
hi DiffDelete ctermfg=black ctermbg=10
hi DiffText ctermfg=white ctermbg=10
set hidden " allows buffer switching without saving
set shortmess+=Ia " hide vim intro, skip lots of file messages/prompts
set history=1000
" undo files
set undofile
set undodir=$vimdir/undo
set undolevels=1000
set undoreload=10000
" spell file
set spellfile=$vimdir/spell/en.utf-8.add
" more sane search settings
set ignorecase
set smartcase
set incsearch
set wrapscan
" highlight search matches
set hlsearch
" enable syntax folding
set foldmethod=syntax
set foldlevel=99
set foldnestmax=10
set foldlevelstart=99
set noautowrite " let me do the writing
set autochdir " `:e` all day
set autoread " this is fine with `u`
set nomodeline " airline wins
set noshowmode " airline is really good
set noshowcmd " be clean
set laststatus=0 " be clean
" yank to OS clipboard by default
set clipboard+=unnamedplus
" no empty buffer on startup
augroup DisableEmptyBuffer
autocmd VimEnter * nested if bufname('')=='' && line('$') == 1 && col('$')==1 && !&modified | bd % | endif
augroup END
" modify higlight colors
hi Search cterm=NONE ctermbg=blue ctermfg=black
highlight LineNr ctermbg=none ctermfg=8
highlight CursorLineNr ctermbg=18 ctermfg=gray
hi IndentGuidesEven ctermbg=18
hi Normal ctermbg=NONE
let b:csv_arrange_align = 'l*'

View file

@ -1,5 +1,8 @@
#!/usr/bin/env sh #!/usr/bin/env sh
head /etc/os-release -n 1 | grep 'NixOS$'; test $? -eq 1; is_nixos=$?
head /etc/os-release -n 1 | grep 'Arch Linux'; test $? -eq 1; is_arch_linux=$?
set -e set -e
# NOTE: run this from inside a Linux installation, not from the live USB/CD # NOTE: run this from inside a Linux installation, not from the live USB/CD
@ -16,11 +19,13 @@ add_unstable_channel() {
} }
clone_dotfiles() { clone_dotfiles() {
if test $is_arch_linux -eq 1; then
pacman -S --needed git
fi
echo "Setting up dotfiles for $USER..." echo "Setting up dotfiles for $USER..."
mkdir --parents "$1" mkdir --parents "$1"
set +e rm -r "$1"
git clone "https://git.lyte.dev/lytedev/dotfiles" "$1" &>/dev/null git clone "https://git.lyte.dev/lytedev/dotfiles" "$1"
set -e
} }
symlink_nixos() { symlink_nixos() {
@ -58,11 +63,36 @@ setup_home_manager() {
nix-shell '<home-manager>' -A install nix-shell '<home-manager>' -A install
} }
init_for_root() { setup_dotfiles() {
clone_dotfiles "$root_home$dotfiles" cd "$daniel_home$dotfiles"
./bin/setup-dotfiles
}
distro_specific_root_setup() {
if test $is_nixos -eq 1; then
symlink_nixos "$root_home$dotfiles/env/nix/" symlink_nixos "$root_home$dotfiles/env/nix/"
add_unstable_channel add_unstable_channel
nixos-rebuild switch nixos-rebuild switch # this should create the `daniel` user
elif test $is_arch_linux -eq 1; then
# TODO: install any necessary packages for remaining setup portion
"$root_home$dotfiles/env/arch-linux/provision.d/00-add-user.bash"
printf ''
fi
}
distro_specific_user_setup() {
if test $is_nixos -eq 1; then
FUNC=$(declare -f symlink_nixos)
sudo sh -c "$FUNC; symlink_nixos \"$daniel_home$dotfiles/env/nix/\""
elif test $is_arch_linux -eq 1; then
# TODO: setup all the things
printf ''
fi
}
init_for_root() {
clone_dotfiles "$root_home$dotfiles"
distro_specific_root_setup
chown daniel:users "$daniel_home" chown daniel:users "$daniel_home"
echo "Re-running as user daniel..." echo "Re-running as user daniel..."
sudo --user daniel "$root_home$dotfiles/init.sh" sudo --user daniel "$root_home$dotfiles/init.sh"
@ -71,12 +101,14 @@ init_for_root() {
init_for_daniel() { init_for_daniel() {
clone_dotfiles "$daniel_home$dotfiles" clone_dotfiles "$daniel_home$dotfiles"
generate_ssh_key generate_ssh_key
FUNC=$(declare -f symlink_nixos) distro_specific_user_setup
sudo sh -c "$FUNC; symlink_nixos \"$daniel_home$dotfiles/env/nix/\""
setup_wallpaper setup_wallpaper
# TODO: setup ssh/gpg keys # TODO: setup ssh/gpg keys
# TODO: setup password store # TODO: setup password store
fix_dotfiles_origin fix_dotfiles_origin
setup_dotfiles
# TODO: fetch password store
# TODO: fetch notes database
} }
if [ "$EUID" -eq 0 ]; then if [ "$EUID" -eq 0 ]; then

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# TODO: use nix-shell because it's cool? sudo nix-collect-garbage -d
nix-collect-garbage -d sudo nixos-rebuild switch

17
env/arch-linux/provision.d/00-add-user.bash vendored Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
u=daniel
ud="/home/$u"
# user exists - we will assume setup has already run
if getent passwd "$u"; then exit 0; fi
groupadd admin 2>/dev/null
mkdir --parents "$ud/.home" "$ud/dl"
useradd --home-dir "$ud/.home" \
--groups "admin,users" \
--shell "/bin/bash" \
"$u"
chown --recursive "$u:$u" "$ud"
echo "Setting password for user '$u'"
passwd "$u"

View file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
REPOSITORY_PATH="/tmp/provisioning"
pacman -S --needed git base-devel
mkdir -p "$REPOSITORY_PATH"
rm -rf "$REPOSITORY_PATH/yay"
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
yay -S yay
rm -rf "$REPOSITORY_PATH/yay"

View file

@ -5,10 +5,9 @@ if egrep -q '^\[multilib\]$' /etc/pacman.conf; then
else else
echo "Enabling Multilib Repository (with sudo)..." echo "Enabling Multilib Repository (with sudo)..."
sudo sh -c 'echo -e "\n\n[multilib]\nInclude = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf' sudo sh -c 'echo -e "\n\n[multilib]\nInclude = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf'
yay -Sy
fi fi
yay -S \ yay -Sy \
xf86-input-libinput \ xf86-input-libinput \
bluez bluez-libs bluez-utils bluez-tools `# Bluetooth` \ bluez bluez-libs bluez-utils bluez-tools `# Bluetooth` \
pigz `# Multi-core gzipping` \ pigz `# Multi-core gzipping` \
@ -44,6 +43,48 @@ yay -S \
libinput libinput-gestures `# Trackpad Control` \ libinput libinput-gestures `# Trackpad Control` \
efibootmgr efivar `# UEFI Boot CLI Stuff` \ efibootmgr efivar `# UEFI Boot CLI Stuff` \
glu mesa wxgtk2 libpng `# Various` \ glu mesa wxgtk2 libpng `# Various` \
gammastep `# Redshift for Wayland` gammastep `# Redshift for Wayland` \
weechat `# IRC Client` \
curl -L -o "$HOME/.emoji.txt" https://lyte.dev/uploads/emoji.txt aria2 `# Downloads Manager` \
tree `# Handy Filesystem Viewing Utility` \
dmenu `# Application Launcher` \
ripgrep `# Code Search Utilities` \
fd `# File Search` \
sd `# Easy Find/Replace` \
fzf `# Fuzzy File Finder` \
htop `# Process Management and System Resources Monitoring` \
openssh mosh `# Remote Access` \
openssl `# Crypto` \
asdf-vm `# Runtime Version Manager` \
python python-pip `# Python 3 Language` \
pass `# Password Management` \
firefox-developer-edition `# Default Web Browser` \
rsync `# File Transfer` \
alsa-utils `# Audio Utilities` \
alsa-plugins `# Plugins for ALSA` \
pulseaudio pavucontrol pulsemixer `# Audio Backend and Controls` \
neovim `# Text Editors` \
unzip `# Simple Unzipping` \
tmux `# Terminal Multiplexer` \
kitty `# Almost Better Terminal Emulator` \
feh `# Image Viewer & Wallpaper Manager` \
wlroots-git sway-git `# Wayland Compositor` \
swaylock-git swayidle-git `# Auto-Locking for Sway` \
kanshi-git `# Monitor Management for Sway` \
waybar-git mako-git `# Sway Bar & Notifications` \
slurp grim wl-clipboard `# Sway Screen Selection & Clipping` \
ttf-iosevka `# Primary Fonts` \
ttf-font-awesome `# Icon Font` \
curl `# HTTP Utility` \
w3m `# Viewing Images in Terminals` \
jq `# CLI for Interacting with JSON` \
ranger `# CLI File Manager` \
httpie `# httpie and neovim dependencies` \
docker docker-compose `# Yummy containers` \
inotify-tools `# Watching` \
fish `# Shell` \
time `# GNU time` \
fortune-mod fortune-mod-archlinux `# Fortune` \
diff-so-fancy `# Fancy Diffs` \
oath-toolkit `# One-Time Passwords` \
sysstat `# System Statistics`

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
mkdir -p "$HOME/.config/systemd/user" mkdir -p "$XDG_CONFIG_HOME/systemd/user"
[ ! -d "$XDG_CONFIG_HOME/tmux/plugins/tpm" ] && \ [ ! -d "$XDG_CONFIG_HOME/tmux/plugins/tpm" ] && \
git clone https://github.com/tmux-plugins/tpm "$XDG_CONFIG_HOME/tmux/plugins/tpm" git clone https://github.com/tmux-plugins/tpm "$XDG_CONFIG_HOME/tmux/plugins/tpm"

2
env/arch-linux/provision.sh vendored Executable file
View file

@ -0,0 +1,2 @@
#!/usr/bin/env sh
for file in "$(dirname "$0")/provision.d"/*; do "$file"; done

View file

@ -1,15 +0,0 @@
#!/usr/bin/env bash
USERNAME=daniel
GROUPS="admin,users"
groupadd admin 2>/dev/null
mkdir --parents "/home/$USERNAME/.home"
mkdir --parents "/home/$USERNAME/dl"
useradd --home-dir "/home/$USERNAME/.home" \
--groups "${GROUPS}" \
--shell "/bin/bash" \
"$USERNAME"
chown --recursive "$USERNAME:$USERNAME" "/home/$USERNAME"
echo "Setting password for user '$USERNAME'"
passwd "$USERNAME"

View file

@ -1,36 +0,0 @@
#!/usr/bin/env bash
# TODO: this script is out of date!
# installs pacaur on a fresh arch install
# install the dependencies
sudo pacman -S git curl openssl perl expac yajl meson gmock gtest jq make pkginfo --noconfirm
# setup a temporary place to install the packages from
REPOSITORY_PATH="/tmp/provisioning"
mkdir -p "$REPOSITORY_PATH"
# clone the repositories
rm -rf "$REPOSITORY_PATH/auracle-git"
rm -rf "$REPOSITORY_PATH/pacaur"
git clone https://aur.archlinux.org/auracle-git.git "$REPOSITORY_PATH/auracle-git"
git clone https://aur.archlinux.org/pacaur.git "$REPOSITORY_PATH/pacaur"
# build and install auracle
cd "$REPOSITORY_PATH/auracle-git"
makepkg -i --noconfirm
cd -
# build and install pacaur
cd "$REPOSITORY_PATH/pacaur"
makepkg -i --noconfirm
cd -
# cleanup
rm -rf "$REPOSITORY_PATH/auracle-git"
rm -rf "$REPOSITORY_PATH/pacaur"
# once installed, let the package manager manage itself and its dependencies
pacaur -S auracle-git pacaur --noconfirm --noedit

View file

@ -1,47 +0,0 @@
#!/usr/bin/env sh
yay -S \
weechat `# IRC Client` \
aria2 `# Downloads Manager` \
tree `# Handy Filesystem Viewing Utility` \
dmenu `# Application Launcher` \
ripgrep `# Code Search Utilities` \
fd `# File Search` \
sd `# Easy Find/Replace` \
fzf `# Fuzzy File Finder` \
htop `# Process Management and System Resources Monitoring` \
openssh mosh `# Remote Access` \
openssl `# Crypto` \
asdf-vm `# Runtime Version Manager` \
python python-pip `# Python 3 Language` \
pass `# Password Management` \
firefox-developer-edition `# Default Web Browser` \
rsync `# File Transfer` \
alsa-utils `# Audio Utilities` \
alsa-plugins `# Plugins for ALSA` \
pulseaudio pavucontrol pulsemixer `# Audio Backend and Controls` \
neovim `# Text Editors` \
unzip `# Simple Unzipping` \
tmux `# Terminal Multiplexer` \
kitty `# Almost Better Terminal Emulator` \
feh `# Image Viewer & Wallpaper Manager` \
wlroots-git sway-git `# Wayland Compositor` \
swaylock-git swayidle-git `# Auto-Locking for Sway` \
kanshi-git `# Monitor Management for Sway` \
waybar-git mako-git `# Sway Bar & Notifications` \
slurp grim wl-clipboard `# Sway Screen Selection & Clipping` \
ttf-iosevka `# Primary Fonts` \
ttf-font-awesome `# Icon Font` \
curl `# HTTP Utility` \
w3m `# Viewing Images in Terminals` \
jq `# CLI for Interacting with JSON` \
ranger `# CLI File Manager` \
httpie `# httpie and neovim dependencies` \
docker docker-compose `# Yummy containers` \
inotify-tools `# Watching` \
fish `# Shell` \
time `# GNU time` \
fortune-mod fortune-mod-archlinux `# Fortune` \
diff-so-fancy `# Fancy Diffs` \
oath-toolkit `# One-Time Passwords` \
sysstat `# System Statistics`

View file

@ -1,13 +0,0 @@
#!/usr/bin/env bash
yay -S weechat-poljar-matrix-git weechat-discord-git wee-slack
wcpm="/usr/lib/weechat/python/matrix"
hwcp="${HOME}/.weechat/python"
ln -s "${wcpm}/" "${hwcp}/"
ln -s "${wcpm}.py" "${hwcp}/"
ln -s "${wcpm}.py" "${hwcp}/autoload/"
ln -s "/usr/lib/weechat/python/wee_slack.py" "${hwcp}/"
ln -s "/usr/lib/weechat/python/wee_slack.py" "${hwcp}/autoload/"
# Scripts are in /usr/lib/weechat/python/matrix/contrib/

View file

@ -1,7 +1,3 @@
" Base16 Donokai (https://github.com/chriskempson/base16)
" Scheme: Daniel Flanagan(https://lytedev.io)
" GUI color definitions
let s:gui00 = "111111" let s:gui00 = "111111"
let s:gui01 = "383830" let s:gui01 = "383830"
let s:gui02 = "49483e" let s:gui02 = "49483e"

View file

@ -1,4 +1,6 @@
exec libinput-gestures -c $HOME/.config/lytedev-dotfiles/apps/de/libinput/sway-gestures.conf exec libinput-gestures -c $HOME/.config/lytedev-dotfiles/apps/de/libinput/sway-gestures.conf
exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK DBUS_SESSION_BUS_ADDRESS
exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK DBUS_SESSION_BUS_ADDRESS
bindswitch lid:toggle exec swaylock bindswitch lid:toggle exec swaylock
input type:keyboard { input type:keyboard {
xkb_options ctrl:nocaps xkb_options ctrl:nocaps

View file

@ -9,6 +9,7 @@ in {
services = { services = {
pipewire.enable = true; pipewire.enable = true;
xserver = { xserver = {
desktopManager.gnome3.enable = true;
libinput = { libinput = {
enable = true; enable = true;
tapping = true; tapping = true;

View file

@ -11,6 +11,7 @@ in {
sway = { sway = {
enable = true; enable = true;
extraPackages = with pkgs; [ extraPackages = with pkgs; [
unstable.pipewire
swaylock swaylock
swayidle swayidle
unstable.mako unstable.libnotify unstable.mako unstable.libnotify

View file

@ -1,4 +1,7 @@
{ config, pkgs, ... }: { { config, pkgs, ... }:
let
unstable = import <nixos-unstable> { config = { allowUnfree = true; }; };
in {
fonts.fonts = with pkgs; [ fonts.fonts = with pkgs; [
# helvetica # needed by zoom # helvetica # needed by zoom
]; ];
@ -13,7 +16,7 @@
pulsemixer # audio pulsemixer # audio
file # identify file types file # identify file types
kitty # terminal emulator kitty # terminal emulator
fzf # fuzzy finder unstable.fzf # fuzzy finder
dmenu # TODO: currently only using this for dmenu_path in `bin/launch` dmenu # TODO: currently only using this for dmenu_path in `bin/launch`
ranger # tui for file management ranger # tui for file management
pass # the standard unix password manager pass # the standard unix password manager
@ -36,12 +39,13 @@
mpd # music player daemon mpd # music player daemon
ncmpcpp # ncurses music player client ncmpcpp # ncurses music player client
vlc # video player vlc # video player
google-chrome # sometimes ya gotta screenshare
# TODO: work module? # TODO: work module?
google-cloud-sdk # gcloud google-cloud-sdk # gcloud
kubectl # kubernetes cli kubectl # kubernetes cli
awscli # aws cli awscli # aws cli
zoom # video conferencing zoom-us # video conferencing
lastpass-cli lastpass-cli
# TODO: move this one to just laptop? # TODO: move this one to just laptop?

View file

@ -16,6 +16,8 @@ curl -s -L https://git.lyte.dev/lytedev/dotfiles/raw/branch/master/bin/init-dotf
# To Do # To Do
+ Fix sway workspaces on desktop
+ Neovim LSP
+ Setup `nnn` + Setup `nnn`
+ Move to NixOS (WIP) or Guix? Declarative is the future! + Move to NixOS (WIP) or Guix? Declarative is the future!
+ Custom Iosevka font with kitty-compatible ligatures? + Custom Iosevka font with kitty-compatible ligatures?