Giter VIP home page Giter VIP logo

dotfiles's Introduction

dotfiles's People

Contributors

alexanderjeurissen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dotfiles's Issues

Move statusline to lua

scriptencoding utf-8
function! statusline#Init()
let l:statusline_items = ' ' " left padding
let l:statusline_items .= '%{statusline#FileInfoFlag()}'
let l:statusline_items .= '%t'
let l:statusline_items .= '%='
let l:statusline_items .= '%{statusline#PasteFlag()}'
let l:statusline_items .= '%{statusline#SpellFlag()}'
let l:statusline_items .= '%{statusline#HardTimeFlag()}'
let l:statusline_items .= '%{statusline#BranchFlag()}'
return l:statusline_items
endfunction
function! statusline#FileInfoFlag()
if &readonly
return ' ξ‚’ '
elseif &modified
return '  '
else
return ' '
endif
endfunction
function! statusline#PasteFlag()
return &paste ? '  ' : ''
endfunction
function! statusline#SpellFlag()
return &spell ? ' ΒΆ ' : ''
endfunction
function! statusline#SyntaxFlag()
let l:res = ale#statusline#Status()
if l:res ==# 'OK'
return ''
else
return '  '
end
endfunction
function! statusline#HardTimeFlag()
if exists('b:hardtime_on') && b:hardtime_on == 1
return '  '
else
return ''
endif
endfunction
function! statusline#BranchFlag()
let l:branch = split(fugitive#head(),'\/')
if len(l:branch) >= 1
return l:branch[0].' '
endif
return ''
endfunction

There are several lua plugins that facilitate lightweight definition of statusline in lua.

There is also the option to write it ourselves in a lua module.

Use vim make programs / Dispatch instead of vim-test

Currently we use vim-test

we only use the Testfile and TestNearest commands.

The same functionality can likely be achieved using designated vim make programs for specific file types (.rb / .feature).
Or by ensuring Dispatch knows how to dispatch the given files

ref:

submodule update changelog

Seems that from initial investigation, the only way to get a changelog (commits) when updating all submodules is using the foreach option in the git submodule command in conjuction with the lg option I have defined in .gitconfig

git submodule foreach 'git fetch origin && git lg origin/master..master && git submodule update'
This requires fetching prior to updating to show the change log for each update. And as a result is much slower then simply calling git submodule update --recursive in the root directory.

convert general#preserve() to lua

function! general#Preserve(command)
" Preparation: save last search, and cursor position.
let l:s = @/
let l:l = line('.')
let l:c = col('.')
" Do the business unless filetype is blacklisted
let l:blacklist = ['sql']
if index(l:blacklist, &filetype) < 0
execute a:command
endif
" Clean up: restore previous search history, and cursor position
let @/ = l:s
call cursor(l:l, l:c)
endfunction

Used to preserve cursor position and registers when removing trailing whitespace.
Function itself is straightforward, usage is tightly coupled and prone to break several mappings and autocommands.

investigate if there is a lua plugin that already exists to remove trailing whitespace if not consider writing this functionality in lua, test it out for a couple of days and evaluate if it makes sense to create as separate plugin for this.

Deprecate fixX zsh aliases in favor of having neovim snippets

relevant line: /Users/alexanderjeurissen/.zshrc:167

Instead of having to create git commit aliases to auto fill a certain commit message, consider just using git commit (which allows for seeing a git diff before committing) and having snippets/vim abbreviations that expand to the desired common commit messages

Colours do not look right?

I have installed the gotham theme but the colours in the tmux bar are all wrong. How did you get them to look so good? I am using gnome-terminal.

Edit: added scrot.

Convert navigation/search keybindings to lua

" KEYBINDINGS: Navigation/search {{{
" Go to previous and next item in quickfix list
noremap <leader>cw :cwindow<CR><C-w>J
noremap <leader>cq <C-w><C-p>:cclose<CR>
noremap <leader>cn :cnext<CR>
noremap <leader>cN :cnfile<CR>
noremap <leader>cp :cprev<CR>
noremap <leader>cP :cpfile<CR>
noremap <leader>ln :lnext<CR>
noremap <leader>lN :lnfile<CR>
noremap <leader>lp :lprev<CR>
noremap <leader>lP :lpfile<CR>
" Split creation
noremap <silent> <leader>wv <C-w>v
noremap <silent> <leader>ws <C-w>s
" Split resizing
nmap <left> <C-w>5<
nmap <up> <C-w>5+
nmap <down> <C-w>5-
nmap <right> <C-w>5>
" Split navigation
noremap <silent> <c-h> <C-w><left>
noremap <silent> <c-j> <C-w><down>
noremap <silent> <c-k> <C-w><up>
noremap <silent> <c-l> <C-w><right>
noremap <silent> <c-\> <C-w><w>
" NOTE: disable arrows and BS in insert mode
imap <left> <nop>
imap <up> <nop>
imap <down> <nop>
imap <right> <nop>
imap <BS> <nop>
imap <DEL> <nop>
" Wrapped lines goes down/up to next row, rather than next line in file.
noremap j gj
noremap k gk
" Find merge conflict markers
noremap <leader>gm /\v^[<\|=>]{7}( .*\|$)<CR>
" default to very magic
noremap / /\v
noremap ? ?\v
" bind <leader>/ to grep
nmap <leader>/ :grep -F ""<LEFT>
" bind K to grep word under cursor
nnoremap K :grep! "\b<C-R><C-W>\b"<CR><CR>:cw<CR>
" Repurpose the s and S key for search and replace
nmap S :%s//g<LEFT><LEFT>
vmap s :Blockwise s//g<LEFT><LEFT>
" Repurpose the H and L keys to quickly switch buffers
nnoremap H :bp<CR>
nnoremap L :bn<CR>
" Rebind the old H and L keyt to zh, zl
nnoremap zh H
nnoremap zm M
nnoremap zl L
" Create some additional fold movements
" nnoremap zn :normal zj<CR>:normal za<CR>:normal zt<CR>
nnoremap zN :normal zC<CR>/^diff --git<CR>:nohl<CR>:normal zA<CR>:normal zt<CR>
nnoremap zP :normal zC<CR>?^diff --git<CR>:nohl<CR>:normal zA<CR>:normal zt<CR>
nnoremap zn :normal zc<CR>/^@@<CR>:nohl<CR>:normal zv<CR>:normal zt<CR>
nnoremap zp :normal zc<CR>?^@@<CR>:nohl<CR>:normal zv<CR>:normal zb<CR>
nnoremap zgg :normal 100000000zk<CR>
nnoremap zG :normal 100000000zj<CR>
" auto-center on specific movement keys, and blink current search match
nnoremap G Gzz
nnoremap <silent>n nzz:lua require('general').hl_next(100)<cr>
nnoremap <silent>N Nzz:lua require('general').hl_next(100)<cr>
nnoremap } }zz
nnoremap { {zz
" }}}

Collection of navigation keybindings, can all be converted to lua using the Util.nnoremap etc functions.
Whilst going over all keybindings evaluate where possible to co-locate the keybindings with their respective functions / modules.

Explore using nvimux + abduco + neovim remote as tmux replacement

The idea is that abduco can provide persisting sessions, neovim can act as terminal multiplexer with the :terminal buffers, and nvimux can help with muscle memory of tmux keybinds.

The intended result is a more lean and more easy to script terminal multiplexer.

ref:

https://www.reddit.com/r/neovim/comments/936obn/make_neovim_open_with_terminal_ontop_by_default/

https://github.com/mhinz/neovim-remote

https://github.com/Vigemus/nvimux

https://github.com/martanne/abduco

https://twitter.com/nelstrom/status/935489435206127621

containerize dot files

Context

Current dot files setup still requires manual installing of several dependencies.
Most of these are captured in bundle files that are consumed by brew or yarn-bundle.

What I want is to create a new docker file as described in https://bergie.iki.fi/blog/docker-developer-shell/ to have the option to containerize the complete setup.

Convert misc keybindings to lua

scriptencoding utf-8
" KEYBINDINGS: General {{{
" Use <space> as leader
let mapleader="\<Space>"
" Fix annoying typo's of WQ, QA and Q, and report
cnoreabbrev qw wq
cnoreabbrev Wq wq
cnoreabbrev WQ wq
cnoreabbrev QA qa
cnoreabbrev Qa qa
cnoreabbrev W w
cnoreabbrev WW w
cnoreabbrev Q q
inoreabbr <buffer> reprot report
inoreabbr <buffer> Reprot Report
" Open highlighted text with default program
vnoremap o :call general#ExecVisualSelection()<cr>
" NOTE: show the highlight group under the cursor ighl
nnoremap <leader>toh :echom "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>"
" }}}

Collection of misc keybindings, can all be converted to lua using the Util.nnoremap etc functions.
Whilst going over all keybindings evaluate where possible to co-locate the keybindings with their respective functions / modules.

Create shell method that opens the workboard of current phabricator milestone

It's currently a bit annoying to go to the milestone workboard in Phabricator, it requires either:

  1. Go to the project workboard -> scroll to the far right -> click the heading of the milestone column
  2. Go to the project -> click the overview menu item -> scan the milestone list -> click the active one

preferably a shell alias like milestonew or openw should exist. It should:

  1. Query Phabricator and obtain the active milestones of the provided project (which should be a arg)
  2. show all milestones in FZF (fuzzy selector)
  3. When pressing enter on one of the items, arc browse said milestone

Rewrite neovim config to LUA

With Neovim providing a very comprehensive LUA api it's worth exploring rewriting the following vim configuration segments to LUA:

  • autoloads files containing namespaced vim functions
  • vim options in init.vim

references:

Change plugin manager in neovim

Currently using dein but not really content with it.

drawbacks:

  1. Progress indicator of installing plugins is less clear then vimplug.
  2. the necessity to recache the runtimepath.
  3. too many options for lazy loading, whilst plenty of plugins already have that in place.
  4. Uninstalling plugins sometimes requires multiple recach attempts / vimrc sourcing, and leaves empty folders in the file system.
  5. documentation is less clear then vimplug / pathogen.

Basically since I'm cutting down on plugin usage, removing anything I don't use often enough or where the added value compared to default vim is non present, the use for a complex plugin manager is not there..

potential alternatives

  1. vim-plug
  2. pathogen

Convert editing keybindings to lua

" KEYBINDINGS: Editing {{{
" Macro related mappings
command! Bufmacro bufdo execute "normal @a" | write
command! Cmacro cdo execute "normal@a" | write
xnoremap @ :<C-u>call general#ExecuteMacroOverVisualRange()<CR>
" Move visual block
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv
" custom comma motion mapping
nnoremap di, f,dT,
nnoremap ci, f,cT,
"delete argument
nnoremap da, f,ld2F,i,<ESC>l
"delete arg and insert
nnoremap ca, f,ld7F,i,<ESC>a
"FIXME: Replace mappings
nnoremap <leader>rp {ma}mb:'a,'bs/
" (upper|lower)case word under cursor
nnoremap g^ gUiW
nnoremap gv guiW
" Create newline before/after current row
nnoremap go o<ESC>k
nnoremap gO O<ESC>j
" Paste and keep pasting same thing, don't take what was removed
vnoremap <Leader>p "_dP
" Make Y behave like other capital commands.
" Hat-tip http://vimbits.com/bits/11
nnoremap Y y$
" keep selection after indent
vnoremap < <gv
vnoremap > >gv
" }}}

Collection of editing related keybindings, can all be converted to lua using the Util.nnoremap etc functions.
Whilst going over all keybindings evaluate where possible to co-locate the keybindings with their respective functions / modules.

convert general#get/exec visual selection to lua

function! general#ExecVisualSelection()
let l:selection = s:get_visual_selection()
call jobstart("open -a '/Applications/Google Chrome.app' --args '" . l:selection . "'")
endfunc
" NOTE: get string that contains the visual selection
" SOURCE: http://stackoverflow.com/questions/1533565/how-to-get-visually-selected-text-in-vimscript#6271254
function! s:get_visual_selection()
" Why is this not a built-in Vim script function?!
let [l:lnum1, l:col1] = getpos("'<")[1:2]
let [l:lnum2, l:col2] = getpos("'>")[1:2]
let l:lines = getline(l:lnum1, l:lnum2)
let l:lines[-1] = l:lines[-1][: l:col2 - (&selection ==# 'inclusive' ? 1 : 2)]
let l:lines[0] = l:lines[0][l:col1 - 1:]
return join(l:lines, '\n')
endfunction

These functions are only referencing each other, it's referenced by a single normal mode mapping o which allows for visually selecting urls and opening them in chrome.

Investigate Fish shell and how it compares to ZSH

I'v been a long time user of zsh, but there are several things I'm dissatisfied with with zsh:

  1. Config bloat: basic things such as autocomplete, history, syntax highlighting require a lot of configuration and setup upfront.
  2. Configuration spread: cofiguration is spread amongst .zshenv, .zshhrc, .zprofile. Reasoning is to support scenario's where there is a dumb terminal and to reduce the amount of configuration that is loaded in such terminals. Given that most of my terminals are --login terminals that don't require this it ends up overcomplicating the configuration.
  3. Prompt slowness: prompt speed has been hit and miss for me.

There are some ways to speed up zsh, most notably I've been looking into:
https://carlosbecker.com/posts/speeding-up-zsh/

But I also want to explore if Fish addresses some of those pain points.

Remove / convert autocommands to lua

scriptencoding utf-8
" AUTOCMD: Autocmd groups {{{
augroup ALEXANDER_GENERAL " {{{
autocmd!
" When editing a file, always jump to the last known cursor position.
" Don't do it for commit messages, when the position is invalid, or when
" inside an event handler (happens when dropping a file on gvim).
" In addition open folds till the cursor is visible
autocmd BufReadPost *
\ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") |
\ execute "normal g`\"" |
\ execute "normal zv" |
\ endif
" Disable linting and syntax highlighting for large files
autocmd BufReadPre *
\ if getfsize(expand("%")) > 10000000 |
\ syntax off |
\ let g:ale_enabled=0 |
\ let g:coc_enabled=0 |
\ endif
" http://vim.wikia.com/wiki/Speed_up_Syntax_Highlighting
autocmd Syntax * if 2000 < line('$') | syntax sync maxlines=200 | endif
" Automatically remove fugitive buffers
autocmd BufReadPost fugitive://* set bufhidden=delete
" Set syntax highlighting for specific file types
autocmd BufRead,BufNewFile Appraisals setlocal filetype=ruby
" Add html highlighting when editing rails views
autocmd BufRead,BufNewFile *.html setlocal filetype=html.javascript
autocmd BufRead,BufNewFile *.erb setlocal filetype=eruby.html
" Add sh highlighthing when editing fish files
autocmd BufRead,BufNewfile *.fish setlocal filetype=sh
" Automatically remove trailing whitespaces unless file is blacklisted
autocmd BufWritePre *.* :call general#Preserve("%s/\\s\\+$//e")
" Update filetype on save if empty
autocmd BufWritePost * nested
\ if &l:filetype ==# '' || exists('b:ftdetect')
\ | unlet! b:ftdetect
\ | filetype detect
\ | endif
" NOTE: Ensure directory structure exists when opening a new file
autocmd BufNewFile * :lua require('general').EnsureDirExists()
augroup END " }}}
" NOTE: reload init.vim when saving it to disk
augroup ALEXANDER_VIMRC_RELOAD " {{{
autocmd!
autocmd BufWritePost init.vim source %
autocmd BufWritePost init.lua luafile %
augroup END " }}}
" NOTE: open quickfix window after vim grep
" ref: https://www.reddit.com/r/vim/comments/bmh977/automatically_open_quickfix_window_after/
augroup quickfix
autocmd!
autocmd QuickFixCmdPost [^l]* cwindow
autocmd QuickFixCmdPost l* lwindow
augroup END
" }}}
" vim: foldmethod=marker:sw=2:foldlevel=10

Propper support is not implemented yet: https://github.com/nanotee/nvim-lua-guide#defining-autocommands

Decide if I want to continue using code ligatures

I'm currently using the https://www.jetbrains.com/lp/mono/ font

In order to be able to use the ligatures in a fast minimal terminal I had to move from Alacritty to Kitty:

alacritty/alacritty#50

However, Kitty comes with it's own challenges:

  • More "User friendly" features that I will never use such as shortcuts and scrollback
  • binary is bigger
  • Alacritty is faster from my testing, most notably in rendering and scrolling in bigger files.

There have also been instances where ligatures caused friction in my workflow:

  • Occasionally ligatures were undesirably rendered in comments or documentation.
  • Pairing partners that occasionally got confused by the ligatures
  • When editing ligatures such as !== in vim, sometimes the wrong character is removed if you edit in the wrong character position of the ligature.

I'm aware that there are workarounds for some of these issues, but the question is if it is worth it to invest in those.

As such I'm going to review the following posts and think if I can live without code ligatures and move back to Alacritty:

convert general#HLNext() to lua

" NOTE: copied from Damian Conway's vimrc
" SOURCE: https://github.com/thoughtstream/Damian-Conway-s-Vim-Setup/blob/master/.vimrc
function! general#HLNext(blinktime)
let l:target_pat = '\c\%#'.@/
let l:ring = matchadd('CurrentSearchMatch', l:target_pat, 101)
redraw
exec 'sleep ' . float2nr(a:blinktime * 1000) . 'm'
call matchdelete(l:ring)
redraw
endfunction

This function is only referenced in the n and N normal mode mappings to make navigating between incsearch results and substitute invocations easier to spot visually.

convert to lua and update mappings accordingly.

Icons Tmux

I don't understand, how you add icons to tmux. I added characters from mac but look like not good. I need transparent icons. Maybe you can help me?

Fix/repurpose nexttask shell method

Currently the nexttask shell method is not really useful. It lists all tasks that are assigned to me and uses head -1 to get the first one.

I should either remove said method, or opt for repurposing it so that the method will arc browse to the first unclaimed task on the sprint workboard

Move general#renameFile to lua

" FIXME: this is current bugged due to conflicting tpope plugin
" rename current file, via Gary Bernhardt
function! general#RenameFile()
let l:old_name = expand('%')
let l:new_name = input('New file name: ', expand('%'))
if l:new_name !=# '' && l:new_name != l:old_name
execute ':Rename ' . l:new_name
redraw!
endif
endfunction

This function is rather straightforward, and can easily be converted to lua.

  • Ensure we also update or move any mappings / ex commands that reference this function.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.