diff options
author | Nicholas Noll <nnoll523@gmail.com> | 2021-10-06 15:10:33 -0700 |
---|---|---|
committer | Nicholas Noll <nnoll523@gmail.com> | 2021-10-06 15:10:33 -0700 |
commit | 6389492da2b7d75ce045f584f99ead9d1cc0960a (patch) | |
tree | 242e64fb4ad75ebd7b58bbcce8ad8128f52df1e2 | |
parent | 29a92a72299dfa7d70429645b2927962bc94a8a8 (diff) | |
parent | 6026ec7f698e573f56e7915811a055c580763f6d (diff) |
merge(update): sync with master
35 files changed, 839 insertions, 517 deletions
diff --git a/.config/fish/config.fish b/.config/fish/config.fish new file mode 100644 index 0000000..e92ca09 --- /dev/null +++ b/.config/fish/config.fish @@ -0,0 +1,72 @@ +# Add paths to the system path +set -g -x XDG_DOCUMENTS_DIR "$HOME/docs" +set -g -x XDG_DOWNLOAD_DIR "$HOME/pulls" +set -g -x XDG_PICTURES_DIR "$HOME/media/pics" +set -g -x XDG_VIDEOS_DIR "$HOME/media" + +set -g -x PYTHONPATH "$HOME/root/lib/py/" $PYTHONPATH +set -g -x PATH $PATH "$HOME/code/bio/pangraph/bin" + +# Set global environmental variables +set -g -x MAILCAPS /home/nolln/.config/mutt/mailcap +set -g -x TEXINPUTS .:/home/nolln/docs//:/usr/share/texmf-dist/tex// +set -g -x QT_QPA_PLATFORM xcb +set -g -x LS_COLORS 'ow=36:di=34:fi=0:ex=32:ln=35:' + +set -g -x JULIA_NUM_THREADS 4 + +# Set system apps +set EDITOR nvim +set BROWSER qutebrowser +set PAGER less -r + +# Set to Vim modal editing +fish_vi_key_bindings + +# Remove greeting +set -U fish_greeting + +# Useful aliases +# set -xU LS_COLORS "di=34:ln=35:so=32:pi=33:ex=32:bd=34;46:cd=34:su=0:sg=0:tw=0:ow=0:*.gz=01;31:*.tgz=01;31:*.zip=01;31" +alias ls='ls -hlS --color=auto' +alias ll='ls -alF' +alias la='ls -A' +alias l='ls -CF' + +alias ..='cd ..' +alias ...='cd ../..' +alias ....='cd ../../..' + +alias vim='nvim' +alias gdb='gdb -q' +alias mail='neomutt' +alias tmux='tmux -f $HOME/.config/tmux/config' +alias screenshot='grim -g (slurp) - | wl-copy' +alias lofi="mpv 'https://www.youtube.com/watch?v=5qap5aO4i9A' --no-video" +alias wttr='curl wttr.in' +alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME' +alias dbg='~/pyenv/bin/gdbgui' + +# remote +alias vpn-ucsb='sudo openconnect --protocol=pulse https://ps.vpn.ucsb.edu/ra' + +alias ssh-pod='ssh -X nbnoll@pod-login1.cnsi.ucsb.edu -t "zsh --login"' +alias mnt-pod='sshfs nbnoll@pod-login1.cnsi.ucsb.edu:/home/nbnoll $HOME/mnt/cluster' + +alias ssh-knot='ssh -X nbnoll@knot7.cnsi.ucsb.edu' +alias mnt-knot='sshfs nbnoll@knot7.cnsi.ucsb.edu:/home/nbnoll $HOME/mnt/cluster' + +alias ssh-server='ssh admin@nbnoll.xyz' + +alias umnt-cluster='umount $HOME/mnt/cluster' + +# Prompt configuration. +set PURE_REVERSE_PROMPT_SYMBOL_IN_VIMODE false + +# Colored man pages +set -xU LESS_TERMCAP_md (printf "\e[01;31m") +set -xU LESS_TERMCAP_me (printf "\e[0m") +set -xU LESS_TERMCAP_se (printf "\e[0m") +set -xU LESS_TERMCAP_so (printf "\e[01;44;33m") +set -xU LESS_TERMCAP_ue (printf "\e[0m") +set -xU LESS_TERMCAP_us (printf "\e[01;32m") diff --git a/.config/fish/fish_variables b/.config/fish/fish_variables new file mode 100644 index 0000000..33bb6b2 --- /dev/null +++ b/.config/fish/fish_variables @@ -0,0 +1,83 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR FZF_DEFAULT_OPTS:\x2d\x2dheight\x2040\x25 +SETUVAR FZF_LEGACY_KEYBINDINGS:0 +SETUVAR FZF_PREVIEW_DIR_CMD:ls +SETUVAR FZF_PREVIEW_FILE_CMD:head\x20\x2dn\x2010 +SETUVAR FZF_TMUX_HEIGHT:40\x25 +SETUVAR --export LESS_TERMCAP_md:\x1b\x5b01\x3b31m +SETUVAR --export LESS_TERMCAP_me:\x1b\x5b0m +SETUVAR --export LESS_TERMCAP_se:\x1b\x5b0m +SETUVAR --export LESS_TERMCAP_so:\x1b\x5b01\x3b44\x3b33m +SETUVAR --export LESS_TERMCAP_ue:\x1b\x5b0m +SETUVAR --export LESS_TERMCAP_us:\x1b\x5b01\x3b32m +SETUVAR __fish_init_2_39_8:\x1d +SETUVAR __fish_init_2_3_0:\x1d +SETUVAR __fish_init_3_x:\x1d +SETUVAR __fish_initialized:3100 +SETUVAR fish_color_autosuggestion:brblack +SETUVAR fish_color_cancel:\x2dr +SETUVAR fish_color_command:brgreen +SETUVAR fish_color_comment:brmagenta +SETUVAR fish_color_cwd:green +SETUVAR fish_color_cwd_root:red +SETUVAR fish_color_end:brmagenta +SETUVAR fish_color_error:brred +SETUVAR fish_color_escape:brcyan +SETUVAR fish_color_history_current:\x2d\x2dbold +SETUVAR fish_color_host:normal +SETUVAR fish_color_host_remote:yellow +SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue +SETUVAR fish_color_normal:normal +SETUVAR fish_color_operator:cyan +SETUVAR fish_color_param:brblue +SETUVAR fish_color_quote:yellow +SETUVAR fish_color_redirection:bryellow +SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_status:red +SETUVAR fish_color_user:brgreen +SETUVAR fish_color_valid_path:\x2d\x2dunderline +SETUVAR fish_greeting:\x1d +SETUVAR fish_key_bindings:fish_vi_key_bindings +SETUVAR fish_pager_color_completion:normal +SETUVAR fish_pager_color_description:yellow +SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline +SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan +SETUVAR fish_user_paths:/home/nolln/\x2epoetry/bin\x1e/home/nolln/root/bin\x1e/home/nolln/\x2eyarn/bin\x1e/home/nolln/code/bin\x1e/home/nolln/go/bin\x1e/home/nolln/\x2elocal/bin\x1e/home/nolln/code/muon/bin\x1e/home/nolln/\x2efzf/bin\x1e/home/nolln/opt/Vivado/2019\x2e2/bin +SETUVAR pure_begin_prompt_with_current_directory:true +SETUVAR pure_color_command_duration:pure_color_warning +SETUVAR pure_color_current_directory:pure_color_primary +SETUVAR pure_color_danger:red +SETUVAR pure_color_dark:black +SETUVAR pure_color_git_branch:pure_color_mute +SETUVAR pure_color_git_dirty:pure_color_mute +SETUVAR pure_color_git_unpulled_commits:pure_color_info +SETUVAR pure_color_git_unpushed_commits:pure_color_info +SETUVAR pure_color_info:cyan +SETUVAR pure_color_jobs:pure_color_normal +SETUVAR pure_color_light:white +SETUVAR pure_color_mute:brblack +SETUVAR pure_color_normal:normal +SETUVAR pure_color_primary:blue +SETUVAR pure_color_prompt_on_error:pure_color_danger +SETUVAR pure_color_prompt_on_success:pure_color_success +SETUVAR pure_color_ssh_hostname:pure_color_mute +SETUVAR pure_color_ssh_separator:pure_color_mute +SETUVAR pure_color_ssh_user_normal:pure_color_mute +SETUVAR pure_color_ssh_user_root:pure_color_light +SETUVAR pure_color_success:magenta +SETUVAR pure_color_virtualenv:pure_color_mute +SETUVAR pure_color_warning:yellow +SETUVAR pure_enable_git:true +SETUVAR pure_reverse_prompt_symbol_in_vimode:true +SETUVAR pure_separate_prompt_on_error:false +SETUVAR pure_show_jobs:false +SETUVAR pure_symbol_git_dirty:\x2a +SETUVAR pure_symbol_git_unpulled_commits:\u21e3 +SETUVAR pure_symbol_git_unpushed_commits:\u21e1 +SETUVAR pure_symbol_prompt:\u276f +SETUVAR pure_symbol_reverse_prompt:\u276e +SETUVAR pure_symbol_title_bar_separator:\u2014 +SETUVAR pure_threshold_command_duration:5 +SETUVAR pure_version:2\x2e1\x2e5 diff --git a/.config/msmtp/config b/.config/msmtp/config index 45405ff..7ab7008 100644 --- a/.config/msmtp/config +++ b/.config/msmtp/config @@ -13,12 +13,20 @@ from nbnoll@eml.cc user nbnoll@eml.cc passwordeval "gpg --quiet --for-your-eyes-only --no-tty --decrypt ~/.config/password/fastmail.gpg" -# workmail -account work -host smtp-ext.unibas.com +# gmail +account gmail +host smtp.gmail.com port 587 -from nicholas.noll@unibas.ch -user nicholas.noll@unibas.ch -passwordeval "gpg --quiet --for-your-eyes-only --no-tty --decrypt ~/.config/password/workmail.gpg" +from nnoll523@gmail.com +user nnoll523@gmail.com +passwordeval "gpg --quiet --for-your-eyes-only --no-tty --decrypt ~/.config/password/gmail.gpg" + +# gmail +account kitp +host smtp.gmail.com +port 587 +from nnoll@ucsb.edu +user nnoll@ucsb.edu +passwordeval "gpg --quiet --for-your-eyes-only --no-tty --decrypt ~/.config/password/ucsb.gpg" account default : main diff --git a/.config/mutt/mail b/.config/mutt/mail index 3c374c2..bc98f1f 100644 --- a/.config/mutt/mail +++ b/.config/mutt/mail @@ -27,9 +27,12 @@ set crypt_replysignencrypted named-mailboxes "----------- Main -----------" =main named-mailboxes "main/Inbox" =main/INBOX mailboxes =main/Archive =main/Drafts =main/Sent =main/Trash -named-mailboxes "----------- Work -----------" =work -named-mailboxes "work/Inbox" =work/INBOX -mailboxes =work/Drafts =work/Sent =work/Trash +named-mailboxes "----------- Kitp -----------" =kitp +named-mailboxes "kitp/Inbox" =kitp/INBOX +named-mailboxes "kitp/Drafts" =kitp/[Gmail].Drafts +named-mailboxes "kitp/Trash" =kitp/[Gmail].Trash +named-mailboxes "kitp/Sent" ="kitp/[Gmail].Sent Mail" +named-mailboxes "kitp/Archive" ="kitp/_Archive" named-mailboxes "----------- Gmail -----------" =gmail named-mailboxes "gmail/Inbox" =gmail/INBOX named-mailboxes "gmail/Drafts" =gmail/[Gmail].Drafts @@ -41,5 +44,5 @@ named-mailboxes "gmail/Archive" ="gmail/[Gmail].Store" source ~/.config/mutt/usr/main folder-hook main/* source ~/.config/mutt/usr/main -folder-hook work/* source ~/.config/mutt/usr/work +folder-hook kitp/* source ~/.config/mutt/usr/kitp folder-hook gmail/* source ~/.config/mutt/usr/gmail diff --git a/.config/mutt/muttrc b/.config/mutt/muttrc index 74cff72..c214105 100644 --- a/.config/mutt/muttrc +++ b/.config/mutt/muttrc @@ -1,5 +1,5 @@ ######################## -# Basic settings +# basic settings source $HOME/.config/mutt/mail source $HOME/.config/mutt/display @@ -9,11 +9,17 @@ source $HOME/.config/mutt/colors auto_view text/plain text/html set sleep_time = 0 -# Sidebar +# sidebar set sidebar_visible set sidebar_format = "%B%?F? [%F]?%* %?N?%N/?%S" set mail_check_stats -# Aliases +# threads +set uncollapse_new = yes +set uncollapse_jump = yes +set collapse_unread = no +folder-hook . push '<collapse-all>' #collapse by default + +# aliases alias erik.vannimwegen Erik van Nimwegen <erik.vannimwegen@unibas.ch> alias boris Boris Shraiman <shraiman@kitp.ucsb.edu> diff --git a/.config/mutt/usr/gmail b/.config/mutt/usr/gmail index c2a2e7d..15bc439 100644 --- a/.config/mutt/usr/gmail +++ b/.config/mutt/usr/gmail @@ -6,6 +6,7 @@ set spoolfile = "+gmail/INBOX" set postponed = "+gmail/[Gmail].Drafts" set trash = "+gmail/[Gmail].Trash" set record = "+gmail/[Gmail].Sent Mail" +set sendmail = "/usr/bin/msmtp -a gmail" # account specific macros macro index,pager a "<save-message>+gmail/[Gmail].Store<enter>" "Archive Message" diff --git a/.config/mutt/usr/main b/.config/mutt/usr/main index 27f127e..fe4cf57 100644 --- a/.config/mutt/usr/main +++ b/.config/mutt/usr/main @@ -7,6 +7,7 @@ set record = "+main/Sent" set postponed = "+main/Drafts" set trash = "+main/Trash" set mbox = "+main/Archive" +set sendmail = "/usr/bin/msmtp -a main" # account specific macros macro index,pager a "<save-message>+main/Archive<enter>" "Archive Message" diff --git a/.config/mutt/usr/work b/.config/mutt/usr/work deleted file mode 100644 index c00f3b3..0000000 --- a/.config/mutt/usr/work +++ /dev/null @@ -1,12 +0,0 @@ -# vim: ft=muttrc - -# Unibas account -set from = "nicholas.noll@unibas.ch" -set spoolfile = "+work/INBOX" -set record = "+work/Sent" -set postponed = "+work/Drafts" -set trash = "+work/Trash" -set mbox = "+work/Archive" - -macro index,pager a "<save-message>+work/Archive<enter>" "Archive Message" -macro index,pager D "<save-message>+work/Trash<enter>" "Trash Message" diff --git a/.config/nvim/after/syntax/c.vim b/.config/nvim/after/syntax/c.vim index 019af16..04896e7 100644 --- a/.config/nvim/after/syntax/c.vim +++ b/.config/nvim/after/syntax/c.vim @@ -1,6 +1,6 @@ syn keyword cgoInt uint8 uint16 uint32 uint64 int8 int16 int32 int64 uint uintptr intptr byte ubyte sbyte ulong vlong uvlong rune syn keyword cgoFloat float32 float64 -syn keyword cgoType error string +syn keyword cgoType string syn keyword cgoConstant nil syn keyword cgoPanic panicf diff --git a/.config/nvim/colors.vim b/.config/nvim/colors.vim deleted file mode 100644 index e905710..0000000 --- a/.config/nvim/colors.vim +++ /dev/null @@ -1,13 +0,0 @@ -hi Normal guibg=NONE ctermbg=NONE -hi NonText guibg=NONE ctermbg=NONE -hi EndOfBuffer guibg=NONE ctermbg=NONE -hi LineNr guibg=NONE ctermbg=NONE -hi SignColumn guibg=NONE ctermbg=NONE -hi VertSplit guibg=NONE ctermbg=NONE - -hi Pmenu ctermbg=237 ctermfg=NONE cterm=NONE guibg=#3a3a3a guifg=NONE gui=NONE -hi PmenuSbar ctermbg=236 ctermfg=NONE cterm=NONE guibg=#303030 guifg=NONE gui=NONE -hi PmenuSel ctermbg=236 ctermfg=140 cterm=NONE guibg=#303030 guifg=#af87d7 gui=NONE -hi PmenuThumb ctermbg=167 ctermfg=NONE cterm=NONE guibg=#d75f5f guifg=NONE gui=NONE - -set pumblend=10 diff --git a/.config/nvim/commandmode.vim b/.config/nvim/commandmode.vim deleted file mode 100644 index b09043e..0000000 --- a/.config/nvim/commandmode.vim +++ /dev/null @@ -1,6 +0,0 @@ -"""""""""""""""""""""""""""" -" Mappings -"""""""""""""""""""""""""""" - -cnoremap <C-a> <Home> -cnoremap <C-e> <End> diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..ee1370e --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,35 @@ +local home = vim.env.HOME +local config = home .. '/.config/nvim' +local root = vim.env.USER == 'root' +local vi = vim.v.progname == 'vi' + +-------------------------------------------------------------------------- +-- plugins + +local packages = string.gmatch(vim.fn.glob(config .. "/pack/vendor/opt/*"), "[^\n]+") + +for package in packages do + local basename, _ = package:gsub("(.*/)(.*)", "%2") + if vim.v.vim_did_enter == 1 then + vim.cmd("packadd " .. basename) + else + vim.cmd("packadd! " .. basename) + end +end +vim.cmd("packadd termdebug") + +-------------------------------------------------------------------------- +-- commands + +vim.cmd('filetype indent plugin on') +vim.cmd('syntax enable') + +-------------------------------------------------------------------------- +-- includes + +require("settings") +require("theme") +require("function") +require("keybind") +require("lsp") +require("todo") diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim deleted file mode 100644 index 05ad1c6..0000000 --- a/.config/nvim/init.vim +++ /dev/null @@ -1,71 +0,0 @@ -"""""""""""""""""""""""""""""""""""""""""""""""" -" plugins - -call plug#begin('~/.config/nvim/plugged') - -" Themes & ornamentation -Plug 'junegunn/seoul256.vim' -Plug 'noahfrederick/vim-noctu' - -" Universal coding help -Plug 'tpope/vim-surround' " Extend vim's ability to change surronding marks. -Plug 'tpope/vim-repeat' " Extend vim's ability to '.' repeat -Plug 'tpope/vim-vinegar' " Extend vim's ability to move around file system -Plug 'tpope/vim-commentary' " Extend vim's ability to comment things. -Plug 'nathanaelkane/vim-indent-guides' " Indent blocks. -Plug 'unblevable/quick-scope' " Quick horizontal movements. -Plug 'https://github.com/adelarsq/vim-matchit' " Extended match operations for % operator - -Plug 'neovim/nvim-lsp' -Plug 'haorenW1025/diagnostic-nvim' -Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } -Plug 'Shougo/deoplete-lsp' - -Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } -Plug 'junegunn/fzf.vim' " Fuzzy file searchs -Plug 'junegunn/vim-easy-align' - -Plug 'simeji/winresizer' " Nice window resize - -" Version control -Plug 'airblade/vim-gitgutter' -Plug 'tpope/vim-fugitive' - -" Language specific -Plug 'lervag/vimtex' " LaTeX -Plug 'plasticboy/vim-markdown' " Markdown -Plug 'vim-python/python-syntax' " Python - -" Formatting -Plug 'sbdchd/neoformat' - -call plug#end() - -packadd termdebug - -"""""""""""""""""""""""""""""""""""""""""""""""" -" color scheme - -syntax enable -if $DISPLAY == "" - colorscheme noctu -else - set termguicolors - colorscheme seoul256 - let g:seoul256_srgb=1 -endif - -set laststatus=2 - -"""""""""""""""""""""""""""""""""""""""""""""""" -" modules - -source ~/.config/nvim/leaders.vim -source ~/.config/nvim/normalmode.vim -source ~/.config/nvim/insertmode.vim -source ~/.config/nvim/visualmode.vim -source ~/.config/nvim/commandmode.vim -source ~/.config/nvim/macros.vim -source ~/.config/nvim/settings.vim -source ~/.config/nvim/plugins.vim -source ~/.config/nvim/colors.vim diff --git a/.config/nvim/insertmode.vim b/.config/nvim/insertmode.vim deleted file mode 100644 index 6fe9e9f..0000000 --- a/.config/nvim/insertmode.vim +++ /dev/null @@ -1 +0,0 @@ -inoremap <C-D> · diff --git a/.config/nvim/leaders.vim b/.config/nvim/leaders.vim deleted file mode 100644 index 2c72a41..0000000 --- a/.config/nvim/leaders.vim +++ /dev/null @@ -1,26 +0,0 @@ -let mapleader = ' ' - -" fuzzy finder -nnoremap <Leader>f :Files<CR> -nnoremap <Leader>b :Buffers<CR> -nnoremap <Leader>l :Lines<CR> -nnoremap <Leader>w :BLines<CR> - -" buffer management -nnoremap <Leader>o :only<CR> -nnoremap <Leader>\| :wincmd \|<CR> -nnoremap <Leader>= :wincmd =<CR> -nnoremap <Leader>r :wincmd R<CR> - -" remove highlights - -nnoremap <Leader><Leader>R<CR> :so ~/.config/nvim/init.vim - -" testing -nnoremap <Leader>t :call TestFile()<CR> -nnoremap <Leader><Leader>t :call TestPkg()<CR> - -" debugging -noremap <Leader><Leader>d :Termdebug<CR> -nnoremap <Leader><Leader>b :Break<CR> -nnoremap <Leader><Leader><S-b> :Clear<CR> diff --git a/.config/nvim/lua/function.lua b/.config/nvim/lua/function.lua new file mode 100644 index 0000000..d0327fd --- /dev/null +++ b/.config/nvim/lua/function.lua @@ -0,0 +1,33 @@ +-------------------------------------------------------------------------- +-- tmux / nvim pane unification + +function navigate_nvim(direction) + vim.cmd('wincmd ' .. direction) +end + +function navigate_l_nvim() navigate_nvim('h') end +function navigate_r_nvim() navigate_nvim('l') end +function navigate_u_nvim() navigate_nvim('k') end +function navigate_d_nvim() navigate_nvim('j') end + +tmux_map = { ['h'] = 'L', ['j'] = 'D', ['k'] = 'U', ['l'] = 'R' } + +function navigate_tmux(direction) + local socket = vim.fn.split(vim.env.TMUX, ',')[1] + + local winnr = vim.fn.winnr() + navigate_nvim(direction) + local notmove = (winnr == vim.fn.winnr()) + + if notmove then + vim.fn.system("tmux -S " .. socket .. " select-pane -" .. tmux_map[direction]) + end +end + +function navigate_l_tmux() navigate_tmux('h') end +function navigate_r_tmux() navigate_tmux('l') end +function navigate_u_tmux() navigate_tmux('k') end +function navigate_d_tmux() navigate_tmux('j') end + +-------------------------------------------------------------------------- +-- autoformatting diff --git a/.config/nvim/lua/keybind.lua b/.config/nvim/lua/keybind.lua new file mode 100644 index 0000000..d97074d --- /dev/null +++ b/.config/nvim/lua/keybind.lua @@ -0,0 +1,52 @@ +vim.g.mapleader = ' ' +vim.g.maplocalleader = '\\' + +-------------------------------------------------------------------------- +-- normal + +vim.api.nvim_set_keymap("n", "Q", "q", {}) +vim.api.nvim_set_keymap("n", "Y", "y$", { noremap = true }) + +if vim.env.TMUX ~= nil then + vim.api.nvim_set_keymap("n", "<C-h>", ":lua navigate_l_tmux() <CR>", { noremap = true, silent = true }) + vim.api.nvim_set_keymap("n", "<C-l>", ":lua navigate_r_tmux() <CR>", { noremap = true, silent = true }) + vim.api.nvim_set_keymap("n", "<C-k>", ":lua navigate_u_tmux() <CR>", { noremap = true, silent = true }) + vim.api.nvim_set_keymap("n", "<C-j>", ":lua navigate_d_tmux() <CR>", { noremap = true, silent = true }) +else + vim.api.nvim_set_keymap("n", "<C-h>", ":lua navigate_l_nvim() <CR>", { noremap = true, silent = true }) + vim.api.nvim_set_keymap("n", "<C-l>", ":lua navigate_r_nvim() <CR>", { noremap = true, silent = true }) + vim.api.nvim_set_keymap("n", "<C-k>", ":lua navigate_u_nvim() <CR>", { noremap = true, silent = true }) + vim.api.nvim_set_keymap("n", "<C-j>", ":lua navigate_d_nvim() <CR>", { noremap = true, silent = true }) +end + +vim.api.nvim_set_keymap("n", "<Leader>f", ":Files<CR>", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", "<Leader>b", ":Buffers<CR>", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", "<Leader>l", ":Lines<CR>", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", "<Leader>w", ":BLines<CR>", { noremap = true, silent = true }) + +vim.api.nvim_set_keymap("n", "<Leader>|", ":wincmd |<CR>", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", "<Leader>=", ":wincmd =<CR>", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", "<Leader>r", ":wincmd R<CR>", { noremap = true, silent = true }) + +vim.api.nvim_set_keymap("n", "<Leader><Leader>d", ":Termdebug<CR>", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", "<Leader><Leader>b", ":Break<CR>", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", "<Leader><Leader><S-b>", ":Clear<CR>", { noremap = true, silent = true }) + +-------------------------------------------------------------------------- +-- insert + +vim.api.nvim_set_keymap("i", "<C-D>", "·", { noremap = true }) + +-------------------------------------------------------------------------- +-- visual + +vim.api.nvim_set_keymap("x", "<C-h>", "<C-w>h", { noremap = true }) +vim.api.nvim_set_keymap("x", "<C-j>", "<C-w>j", { noremap = true }) +vim.api.nvim_set_keymap("x", "<C-k>", "<C-w>k", { noremap = true }) +vim.api.nvim_set_keymap("x", "<C-l>", "<C-w>l", { noremap = true }) + +-------------------------------------------------------------------------- +-- keybind + +vim.api.nvim_set_keymap("c", "<C-a>", "<Home>", { noremap = true }) +vim.api.nvim_set_keymap("c", "<C-e>", "<End>", { noremap = true }) diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua new file mode 100644 index 0000000..98caa7f --- /dev/null +++ b/.config/nvim/lua/lsp.lua @@ -0,0 +1,39 @@ +local lsp = require('lspconfig') +local git = require('neogit') + +local setup = function(client, buffer) + local function set_keymap(...) vim.api.nvim_buf_set_keymap(buffer, ...) end + local function set_option(...) vim.api.nvim_buf_set_option(buffer, ...) end + + set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') + + local opts = { noremap=true, silent=true } + + set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts) + set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts) + set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts) + set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts) + set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) + set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) + set_keymap('n', '[c', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts) + set_keymap('n', ']c', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts) + set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts) +end + +local servers = { 'clangd', 'tsserver' } +for _, s in ipairs(servers) do + lsp[s].setup { + on_attach=setup, + flags = { + debounce_text_changes = 150, + } + } +end + +vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( + vim.lsp.diagnostic.on_publish_diagnostics, { + virtual_text = false + } +) + +git.setup({}) diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua new file mode 100644 index 0000000..2d77b7a --- /dev/null +++ b/.config/nvim/lua/settings.lua @@ -0,0 +1,150 @@ +-------------------------------------------------------------------------- +-- vanilla settings + +local home = vim.env.HOME +local opt = vim.opt +local tmp = home .. '/.vim/tmp' + +opt.autoindent = true -- maintain indent of current line +opt.backspace = 'indent,start,eol' -- allow unrestricted backspacing in insert mode +opt.backup = false -- don't make backups before writing +opt.backupcopy = 'yes' -- overwrite files to update, instead of renaming + rewriting +opt.backupdir = tmp .. '/backup//' -- keep backup files out of the way (ie. if 'backup' is ever set) +opt.backupdir = opt.backupdir + '.' -- fallback +opt.backupskip = opt.backupskip + '*.re,*.rei' -- prevent bsb's watch mode from getting confused (if 'backup' is ever set) +opt.belloff = 'all' -- never ring the bell for any reason +opt.cursorline = true -- highlight current line +opt.diffopt = opt.diffopt + 'foldcolumn:0' -- don't show fold column in diff view +opt.directory = tmp .. '/swap//' -- keep swap files out of the way +opt.directory = opt.directory + '.' -- fallback +opt.emoji = false -- don't assume all emoji are double width +opt.expandtab = true -- always use spaces instead of tabs +opt.fillchars = { + diff = '∙', -- BULLET OPERATOR (U+2219, UTF-8: E2 88 99) + eob = ' ', -- NO-BREAK SPACE (U+00A0, UTF-8: C2 A0) to suppress ~ at EndOfBuffer + fold = '·', -- MIDDLE DOT (U+00B7, UTF-8: C2 B7) + vert = '┃', -- BOX DRAWINGS HEAVY VERTICAL (U+2503, UTF-8: E2 94 83) +} +opt.foldlevelstart = 99 -- start unfolded +opt.foldmethod = 'indent' -- not as cool as syntax, but faster +opt.formatoptions = opt.formatoptions + 'j' -- remove comment leader when joining comment lines +opt.formatoptions = opt.formatoptions + 'n' -- smart auto-indenting inside numbered lists +opt.guifont = 'consolas' +opt.hidden = true -- allows you to hide buffers with unsaved changes without being prompted +opt.inccommand = 'split' -- live preview of :s results +opt.incsearch = true -- live preview of search hits +opt.joinspaces = false -- don't autoinsert two spaces after '.', '?', '!' for join command +opt.laststatus = 2 -- always show status line +opt.lazyredraw = true -- don't bother updating screen during macro playback +opt.linebreak = true -- wrap long lines at characters in 'breakat' +opt.list = true -- show whitespace +opt.listchars = { + nbsp = '⦸', -- CIRCLED REVERSE SOLIDUS (U+29B8, UTF-8: E2 A6 B8) + extends = '»', -- RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB, UTF-8: C2 BB) + precedes = '«', -- LEFT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00AB, UTF-8: C2 AB) + tab = '▷⋯', -- WHITE RIGHT-POINTING TRIANGLE (U+25B7, UTF-8: E2 96 B7) + MIDLINE HORIZONTAL ELLIPSIS (U+22EF, UTF-8: E2 8B AF) + trail = '•', -- BULLET (U+2022, UTF-8: E2 80 A2) +} + +if vi then + opt.loadplugins = false +end + +opt.modelines = 5 -- scan this many lines looking for modeline +opt.number = true -- show line numbers in gutter +opt.pumblend = 10 -- pseudo-transparency for popup-menu +opt.relativenumber = true -- show relative numbers in gutter +opt.ruler = true -- show row and column of cursor +opt.scrolloff = 3 -- start scrolling 3 lines before edge of viewport + +if root then + opt.shada = '' -- Don't create root-owned files. + opt.shadafile = 'NONE' +else + -- Defaults: + -- Neovim: !,'100,<50,s10,h + -- + -- - ! save/restore global variables (only all-uppercase variables) + -- - '100 save/restore marks from last 100 files + -- - <50 save/restore 50 lines from each register + -- - s10 max item size 10KB + -- - h do not save/restore 'hlsearch' setting + -- + -- Our overrides: + -- - '0 store marks for 0 files + -- - <0 don't save registers + -- - f0 don't store file marks + -- - n: store in ~/.config/nvim/ + -- + opt.shada = "'0,<0,f0,n~/.vim/tmp/shada" +end + +opt.shiftround = false -- don't always indent by multiple of shiftwidth +opt.shiftwidth = 4 -- spaces per tab (when shifting) +opt.shortmess = opt.shortmess + 'A' -- ignore annoying swapfile messages +opt.shortmess = opt.shortmess + 'I' -- no splash screen +opt.shortmess = opt.shortmess + 'O' -- file-read message overwrites previous +opt.shortmess = opt.shortmess + 'T' -- truncate non-file messages in middle +opt.shortmess = opt.shortmess + 'W' -- don't echo "[w]"/"[written]" when writing +opt.shortmess = opt.shortmess + 'a' -- use abbreviations in messages eg. `[RO]` instead of `[readonly]` +opt.shortmess = opt.shortmess + 'c' -- completion messages +opt.shortmess = opt.shortmess + 'o' -- overwrite file-written messages +opt.shortmess = opt.shortmess + 't' -- truncate file messages at start +opt.showbreak = '↳ ' -- DOWNWARDS ARROW WITH TIP RIGHTWARDS (U+21B3, UTF-8: E2 86 B3) +opt.showcmd = false -- don't show extra info at end of command line +opt.sidescroll = 0 -- sidescroll in jumps because terminals are slow +opt.sidescrolloff = 3 -- same as scrolloff, but for columns +opt.smartindent = true -- auto-indent new line +opt.smarttab = true -- <tab>/<BS> indent/dedent in leading whitespace + +if not vi then + opt.softtabstop = -1 -- use 'shiftwidth' for tab/bs at end of line +end + +opt.spellcapcheck = '' -- don't check for capital letters at start of sentence +opt.splitbelow = true -- open horizontal splits below current window +opt.splitright = true -- open vertical splits to the right of the current window +opt.suffixes = opt.suffixes - '.h' -- don't sort header files at lower priority +opt.swapfile = false -- don't create swap files +opt.switchbuf = 'usetab' -- try to reuse windows/tabs when switching buffers +opt.synmaxcol = 200 -- don't bother syntax highlighting long lines +opt.tabstop = 4 -- spaces per tab +opt.termguicolors = true -- use guifg/guibg instead of ctermfg/ctermbg in terminal +opt.textwidth = 0 -- automatically hard wrap at 0 columns + +if root then + opt.undofile = false -- don't create root-owned files +else + opt.undodir = tmp .. '/undo//' -- keep undo files out of the way + opt.undodir = opt.undodir + '.' -- fallback + opt.undofile = true -- actually use undo files +end + +opt.updatetime = 2000 -- CursorHold interval +opt.updatecount = 0 -- update swapfiles every 80 typed chars +opt.viewdir = tmp .. '/view' -- where to store files for :mkview +opt.viewoptions = 'cursor,folds' -- save/restore just these (with `:{mk,load}view`) +opt.virtualedit = 'block' -- allow cursor to move where there is no text in visual block mode +opt.visualbell = true -- stop annoying beeping for non-error errors +opt.whichwrap = 'b,h,l,s,<,>,[,],~' -- allow <BS>/h/l/<Left>/<Right>/<Space>, ~ to cross line boundaries +opt.wildcharm = 26 -- ('<C-z>') substitute for 'wildchar' (<Tab>) in macros +opt.wildignore = opt.wildignore + '*.o,*.rej,*.so' -- patterns to ignore during file-navigation +opt.wildmenu = true -- show options as list when switching buffers etc +opt.wildmode = 'longest:full,full' -- shell-like autocomplete to unambiguous portion +opt.winblend = 10 -- psuedo-transparency for floating windows +opt.wrap = false -- no automatic line wraps +opt.wrapmargin = 0 -- no line wrapping +opt.writebackup = false -- don't keep backups after writing + +-------------------------------------------------------------------------- +-- plugin settings + +-- gdb debug +vim.g.termdebug_wide = 1 + +-- latex +vim.g.tex_flavor = "latex" + +-- git gutter +vim.g.gitgutter_grep = "" +vim.g.gitgutter_set_sign_backgrounds = 1 diff --git a/.config/nvim/lua/theme.lua b/.config/nvim/lua/theme.lua new file mode 100644 index 0000000..83e9c0a --- /dev/null +++ b/.config/nvim/lua/theme.lua @@ -0,0 +1,170 @@ +vim.cmd("hi clear") + +local theme = { + [22] = '#006F00', [23] = '#007173', [24] = '#007299', [25] = '#0074BE', + [30] = '#009799', [31] = '#0099BD', [38] = '#00BDDF', [52] = '#730B00', + [58] = '#727100', [59] = '#727272', [65] = '#719872', [66] = '#719899', + [67] = '#7299BC', [68] = '#719CDF', [73] = '#6FBCBD', [74] = '#70BDDF', + [88] = '#9B1300', [89] = '#9B1D72', [94] = '#9A7200', [95] = '#9A7372', + [96] = '#9A7599', [101] = '#999872', [103] = '#999ABD', [108] = '#98BC99', + [109] = '#98BCBD', [110] = '#98BEDE', [116] = '#97DDDF', [125] = '#BF2172', + [131] = '#BE7572', [137] = '#BE9873', [143] = '#BDBB72', [144] = '#BDBC98', + [145] = '#BDBDBD', [151] = '#BCDDBD', [152] = '#BCDEDE', [153] = '#BCE0FF', + [161] = '#E12672', [168] = '#E17899', [173] = '#E19972', [174] = '#E09B99', + [179] = '#DFBC72', [181] = '#E0BEBC', [184] = '#DEDC00', [186] = '#DEDD99', + [187] = '#DFDEBD', [189] = '#DFDFFF', [216] = '#FFBD98', [217] = '#FFBFBD', + [218] = '#FFC0DE', [220] = '#FFDD00', [222] = '#FFDE99', [224] = '#FFDFDF', + [230] = '#FFFFDF', [231] = '#FFFFFF', [232] = '#060606', [233] = '#171717', + [234] = '#252525', [235] = '#333233', [236] = '#3F3F3F', [237] = '#4B4B4B', + [238] = '#565656', [239] = '#616161', [240] = '#6B6B6B', [241] = '#757575', + [249] = '#BFBFBF', [250] = '#C8C8C8', [251] = '#D1D0D1', [252] = '#D9D9D9', + [253] = '#E1E1E1', [254] = '#E9E9E9', [255] = '#F1F1F1', + + ['nil'] = "", + ['none'] = 'NONE', +} + +function highlight(group, color) + local style = color.style and "gui=" .. color.style or "gui=NONE" + local fg = color.fg and "guifg=" .. color.fg or "guifg=NONE" + local bg = color.bg and "guibg=" .. color.bg or "guibg=NONE" + local sp = color.sp and "guisp=" .. color.sp or "" + + local hl = "highlight " .. group .. " " .. style .. " " .. fg .. " " .. bg .. " " .. sp + + vim.cmd(hl) + + if color.link then vim.cmd("highlight! link " .. group .. " " .. color.link) end +end + +local editor = { + Normal = {}, + EndOfBuffer = {}, + SignColumn = {}, + NormalFloat = { fg = theme[252], bg = theme[237] }, + + Special = { fg = theme[216] }, + SpecialKey = { fg = theme[59] }, + NonText = { fg = theme[239] }, + VertSplit = { fg = theme[239] }, + + LineNr = { fg = theme[101] }, + CursorLineNr = { fg = theme[131] }, + CursorLine = { bg = theme[236] }, + + Search = { fg = theme[252], bg = theme[24] }, + IncSearch = { fg = theme[220], bg = theme[238] }, + + StatusLine = { fg = theme[95], bg = theme[187], style='reverse,bold' }, + StatusLineNC = { fg = theme[239], bg = theme[187], style='reverse,bold' }, + StatusLineTerm = { fg = theme[95], bg = theme[187], style='reverse,bold' }, + StatusLineTermNC = { fg = theme[239], bg = theme[187], style='reverse,bold' }, + + TabLineFill = { fg = theme[239] }, + TabLineSel = { fg = theme[187], bg = theme[23] }, + TabLine = { fg = theme[249], bg = theme[241] }, + WildMenu = { fg = theme[95], bg = theme[185] }, + + Title = { fg = theme[181] }, + Question = { fg = theme[179] }, + Conceal = { fg = theme[254], bg = theme[236] }, + Ignore = { fg = theme[240], bg = theme[237] }, + + Visual = { bg = theme[23] }, + VisualNOS = { bg = theme[23] }, + + Folded = { fg = theme[101], bg = theme[238] }, + FoldColumn = { fg = theme[144], bg = theme[94] }, + + Pmenu = { fg = theme[238], bg = theme[224] }, + PmenuSel = { fg = theme[252], bg = theme[89] }, + PmenuSbar = { bg = theme[65] }, + PmenuThumb = { bg = theme[23] }, + + SpellBad = { fg = theme[168], style = 'italic,undercurl' }, + SpellCap = { fg = theme[110], style = 'italic,undercurl' }, + SpellLocal = { fg = theme[153], style = 'italic,undercurl' }, + SpellRare = { fg = theme[218], style = 'italic,undercurl' }, + + DiffAdd = { bg = theme[22] }, + DiffDelete = { bg = theme[95] }, + DiffChange = { bg = theme[235] }, + DiffText = { bg = theme[52] }, +} + +for group, colors in pairs(editor) do highlight(group, colors) end + +local syntax = { + Number = { fg = theme[222] }, + Float = { fg = theme[222] }, + Boolean = { fg = theme[103] }, + Constant = { fg = theme[73] }, + Character = { fg = theme[174] }, + String = { fg = theme[109] }, + Identifier = { fg = theme[217] }, + Delimiter = { fg = theme[137] }, + StringDelimiter = { fg = theme[137] }, + + Type = { fg = theme[179], style='bold' }, + Keyword = { fg = theme[168] }, + Operator = { fg = theme[186] }, + Structure = { fg = theme[116] }, + + Statement = { fg = theme[108] }, + Conditional = { fg = theme[110] }, + Repeat = { fg = theme[68], }, + Function = { fg = theme[187] }, + + PreProc = { fg = theme[143] }, + Comment = { fg = theme[65], style='italic' }, + Todo = { fg = theme[161], bg = theme[235], style='bold' }, + + Define = { fg = theme[173] }, + Macro = { fg = theme[173] }, + Include = { fg = theme[173] }, + PreCondit = { fg = theme[173] }, + + Exception = { fg = theme[161] }, + Underlined = { fg = theme[181] }, + Error = { fg = theme[252], bg = theme[52] }, + ErrorMsg = { fg = theme[252], bg = theme[52] }, +} + +for group, colors in pairs(syntax) do highlight(group, colors) end + +-- TODO: don't hardcode these +vim.g.terminal_color_0 = "#4E4E4D" +vim.g.terminal_color_1 = "#D68787" +vim.g.terminal_color_2 = "#5F865F" +vim.g.terminal_color_3 = "#D8AF5F" +vim.g.terminal_color_4 = "#85ADD4" +vim.g.terminal_color_5 = "#D7AFAF" +vim.g.terminal_color_6 = "#87AFAF" +vim.g.terminal_color_7 = "#D0D0D0" +vim.g.terminal_color_8 = "#626262" +vim.g.terminal_color_9 = "#D75F87" +vim.g.terminal_color_10 = "#87AF87" +vim.g.terminal_color_11 = "#FFD787" +vim.g.terminal_color_12 = "#ADD4FB" +vim.g.terminal_color_13 = "#FFAFAF" +vim.g.terminal_color_14 = "#87D7D7" +vim.g.terminal_color_15 = "#E4E4E4" + +vim.g.fzf_colors = { + ["fg"] = {'fg', 'NormalFloat'}, + ["bg"] = {'bg', 'NormalFloat'}, + ["fg+"] = {'bg', 'StatusLine'}, +} + +vim.o.pumblend = 20 + +-- dark-fg = 252, dark-bg = 237 +local plugins = { + -- vim-gitgutter + GitGutterAdd = { fg = theme[108], bg = theme[238] }, + GitGutterChange = { fg = theme[68], bg = theme[238] }, + GitGutterDelete = { fg = theme[161], bg = theme[238] }, + GitGutterChangeDelete = { fg = theme[168], bg = theme[238] }, +} + +for group, colors in pairs(plugins) do highlight(group, colors) end diff --git a/.config/nvim/macros.vim b/.config/nvim/macros.vim deleted file mode 100644 index 016a067..0000000 --- a/.config/nvim/macros.vim +++ /dev/null @@ -1,86 +0,0 @@ -""""""""""""""""""""""""""""""""""""""""""""" -" GENERAL - -" TERMINAL HOTKEYS -:tnoremap <Esc> <C-\><C-n> - -" Start interactive EasyAlign in visual mode (e.g. vipga) -xmap ga <Plug>(EasyAlign) - -" Start interactive EasyAlign for a motion/text object (e.g. gaip) -nmap ga <Plug>(EasyAlign) - -" Tmux integration. -if empty($TMUX) - nmap <silent> <c-k> :wincmd k<CR> - nmap <silent> <c-j> :wincmd j<CR> - nmap <silent> <c-h> :wincmd h<CR> - nmap <silent> <c-l> :wincmd l<CR> -else - let g:tmux_is_last_pane = 0 - au WinEnter * let g:tmux_is_last_pane = 0 - " Like `wincmd` but also change tmux panes instead of vim windows when needed. - function! TmuxWinCmd(direction) - let nr = winnr() - let tmux_last_pane = (a:direction == 'p' && g:tmux_is_last_pane) - if !tmux_last_pane - " try to switch windows within vim - exec 'wincmd ' . a:direction - endif - " Forward the switch panes command to tmux if: - " a) we're toggling between the last tmux pane; - " b) we tried switching windows in vim but it didn't have effect. - if tmux_last_pane || nr == winnr() - let cmd = 'tmux select-pane -' . tr(a:direction, 'phjkl', 'lLDUR') - exec 'silent !'.cmd - redraw! " because `exec` fucked up the screen. why is this needed?? arrghh - let g:tmux_is_last_pane = 1 - else - let g:tmux_is_last_pane = 0 - endif - endfunction - - " Ctrl + arrows to jump between windows. - " Can also jump to adjacent tmux panes. - nmap <silent> <c-k> :call TmuxWinCmd('k')<cr> - nmap <silent> <c-j> :call TmuxWinCmd('j')<cr> - nmap <silent> <c-h> :call TmuxWinCmd('h')<cr> - nmap <silent> <c-l> :call TmuxWinCmd('l')<cr> - -endif - -" pipe buffer to stdin and capture stdout to a new window -function! FilterToNewWindow() - let TempFile = tempname() - let SaveModified = &modified - exe 'w ' . TempFile - exe '!chmod +x ' . TempFile - let &modified = SaveModified - exe ':e ' . TempFile - exe '%! ' . @% - exe 'w!' -endfunction - -" bash execute contents of current buffer and filter it to a new window -command! FW call FilterToNewWindow() - -""""""""""""""""""""""""""""""""""""""""""""" -" CODING SPECFIC - -" golang -command GoProfCPU execute "!go tool pprof --web $GOPATH/bin/%:r cpu.pprof" -command GoProfMEM execute "!go tool pprof --web $GOPATH/bin/%:r mem.pprof" - -" testing -function TestPkg() - silent !clear - execute "!runtest " . substitute(expand('%:p:h'), "/home/nolln/root/sys/", "", "") -endfunction - -function TestFile() - silent !clear - execute "!runtest " . substitute(expand('%:p:r'), "/home/nolln/root/sys/", "", "") -endfunction - -" C files -autocmd BufNewfile,BufRead *.h set ft=c diff --git a/.config/nvim/normalmode.vim b/.config/nvim/normalmode.vim deleted file mode 100644 index b7b4f8c..0000000 --- a/.config/nvim/normalmode.vim +++ /dev/null @@ -1,21 +0,0 @@ -"""""""""""""""""""""""""""""" -" Normal mode remappings -"""""""""""""""""""""""""""""" - -" Toggle fold at current level -"noremap <Tab> za - -" Repeat the last macro with enter key instead of @@ -" noremap <expr> <CR> empty(&buftype) ? '@@' : '<CR>' - -" Avoid unintentional switches to Ex mode -nmap Q q - -" Consistent syntax -noremap Y y$ - -"""""" SPLIT NAVIGATION IN MACROS - -" Store relative line number jumps in the jump list if > 5 -" noremap <expr> k (v:count > 5 ? "m'" . v:count : '') . 'k' -" noremap <expr> j (v:count > 5 ? "m'" . v:count : '') . 'j' diff --git a/.config/nvim/pack/vendor/install b/.config/nvim/pack/vendor/install new file mode 100755 index 0000000..9bcc676 --- /dev/null +++ b/.config/nvim/pack/vendor/install @@ -0,0 +1,46 @@ +#!/usr/bin/python + +import os, subprocess + +def noop(url): + print(f"> skipping {url}...") + +def package(url): + return url.split("/")[1] + +def github(url): + return subprocess.Popen(["git", "clone", f"https://github.com/{url}.git", f"opt/{package(url)}"]) + +hosts = {"github": github} + +def host(name): + key = name[1:-1].strip() + if key in hosts: + return hosts[key] + return noop + +if __name__ == "__main__": + clone = noop + if not os.path.isdir("opt"): + os.mkdir("opt") + + procs = [] + with open("packages") as io: + for url in io: + url = url.strip("\n") + # TODO: better comment removal + if len(url) == 0 or url.startswith("#"): + continue + + if url.startswith("[") and url.endswith("]"): + clone = host(url) + + else: + if os.path.isdir(f"opt/{package(url)}"): + print(f"> {package(url)} installed") + continue + + procs.append(clone(url)) + + for p in procs: + p.wait() diff --git a/.config/nvim/pack/vendor/packages b/.config/nvim/pack/vendor/packages new file mode 100644 index 0000000..72e8ddd --- /dev/null +++ b/.config/nvim/pack/vendor/packages @@ -0,0 +1,27 @@ +[ github ] + +neovim/nvim-lspconfig + +nvim-neorg/neorg +nvim-lua/plenary.nvim +nvim-treesitter/nvim-treesitter + +TimUntersberger/neogit + +junegunn/fzf.vim + +tpope/vim-surround +tpope/vim-repeat +tpope/vim-vinegar +tpope/vim-commentary + +simeji/winresizer +adelarsq/vim-matchit +airblade/vim-gitgutter + +lervag/vimtex +plasticboy/vim-markdown +fatih/vim-go +JuliaEditorSupport/julia-vim +leafgarland/typescript-vim +peitalin/vim-jsx-typescript diff --git a/.config/nvim/pack/vendor/update b/.config/nvim/pack/vendor/update new file mode 100755 index 0000000..5dabe5c --- /dev/null +++ b/.config/nvim/pack/vendor/update @@ -0,0 +1,17 @@ +#!/usr/bin/python + +import os +import subprocess + +from glob import glob + +if __name__ == "__main__": + cwd = os.getcwd() + procs = [] + for repo in glob("opt/*/"): + os.chdir(repo) + procs.append(subprocess.Popen(["git", "pull"])) + os.chdir(cwd) + + for p in procs: + p.wait() diff --git a/.config/nvim/plugins.vim b/.config/nvim/plugins.vim deleted file mode 100644 index 57400f1..0000000 --- a/.config/nvim/plugins.vim +++ /dev/null @@ -1,73 +0,0 @@ -"""""""""""""""""""""""""""""""""""""" -" Generic coding plugins -"""""""""""""""""""""""""""""""""""""" -lua << - local lsp = require 'nvim_lsp' - local dig = require 'diagnostic' - - local function on_attach() - dig.on_attach() - end - - lsp.clangd.setup{on_attach=on_attach} - lsp.pyls.setup{on_attach=on_attach} -. - -nnoremap <silent> gd <cmd>lua vim.lsp.buf.declaration()<CR> -nnoremap <silent> gD <cmd>lua vim.lsp.buf.definition()<CR> -nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR> -nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR> -nnoremap <silent> K <cmd>lua vim.lsp.buf.hover()<CR> -nnoremap <silent> g0 <cmd>lua vim.lsp.buf.document_symbol()<CR> - -nnoremap <silent> ]c :NextDiagnosticCycle<CR> -nnoremap <silent> [c :PrevDiagnostic<CR> - -let g:deoplete#enable_at_startup = 1 -let g:diagnostic_insert_delay = 1 - -" gdb debugging -let g:termdebug_wide = 1 - -" Latex configuration -let g:tex_flavor="latex" -let g:vimtex_view_general_viewer="zathura" - -" Show git gutter -let g:gitgutter_grep='' -let g:gitgutter_set_sign_backgrounds = 1 - -" Quick-scope configuration. -let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] - -" Golang support -let g:go_gocode_propose_builtins = 1 -let g:go_highlight_build_constraints = 1 -let g:go_highlight_extra_types = 1 -let g:go_highlight_fields = 1 -let g:go_highlight_functions = 1 -let g:go_highlight_methods = 1 -let g:go_highlight_operators = 1 -let g:go_highlight_structs = 1 -let g:go_highlight_types = 1 -let g:go_fmt_experimental = 1 - -" Python support -let g:pymode_python = 'python3' -let g:python_highlight_all = 1 - -" Clang support -autocmd FileType c,cpp setlocal commentstring=//\ %s - -" Markdown support -let g:vim_markdown_preview_pandoc=1 -let g:vim_markdown_math=1 - -" prettier -" when running at every change you may want to disable quickfix -let g:prettier#autoformat = 0 - -augroup fmt - autocmd! - autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html undojoin | Neoformat prettier -augroup END diff --git a/.config/nvim/settings.vim b/.config/nvim/settings.vim deleted file mode 100644 index 0f13e6d..0000000 --- a/.config/nvim/settings.vim +++ /dev/null @@ -1,161 +0,0 @@ -"""""""""""""""""""""""""""""""""""""" -" Vanilla Vim Settings -"""""""""""""""""""""""""""""""""""""" -" Fonts -set guifont=Inconsolata - -" Show linenumbers -set ruler -set number relativenumber - -" Search properties -set incsearch -set hlsearch - -" Set Proper Tabs -set tabstop=4 -set softtabstop=4 -set shiftwidth=4 -set smarttab -set expandtab - -" Set text display properties. -set smartindent -set wrap -set linebreak -set nolist - -set textwidth=0 -set wrapmargin=0 - -" Lazy drawing for fast scrolling -set ttyfast -set lazyredraw - -" Highlight current line -set cursorline - -" Splits behave properly -set noea -set noequalalways - -" Manually configure some colors -set laststatus=1 - -" Allows to hide buffers without changes being saved -set hidden - -" Some server have issues with backup files, see #649 -set nobackup -set nowritebackup - -" Better display for messages -set cmdheight=2 - -" Smaller updatetime for CursorHold & CursorHoldI -set updatetime=300 - -" don't give |ins-completion-menu| messages. -set shortmess+=c - -" always show signcolumns -set signcolumn=yes - -" · to not be tokenized -set iskeyword+=· - -let g:python_host_proj = "~/pyenv/bin/python" - -" Nasm -let g:asmsyntax = 'nasm' - -if has('windows') - set splitbelow " open horizontal splits below current window -endif - -if has('vertsplit') - set splitright " open vertical splits to the right of the current window -endif - -if exists('$SUDO_USER') - set nobackup " don't create root-owned files - set nowritebackup " don't create root-owned files -else - set backupdir=~/local/.vim/tmp/backup - set backupdir+=~/.vim/tmp/backup " keep backup files out of the way - set backupdir+=. -endif - -if exists('$SUDO_USER') - set noswapfile " don't create root-owned files -else - set directory=~/local/.vim/tmp/swap// - set directory+=~/.vim/tmp/swap// " keep swap files out of the way - set directory+=. -endif - -if has('persistent_undo') - if exists('$SUDO_USER') - set noundofile " don't create root-owned files - else - set undodir=~/local/.vim/tmp/undo - set undodir+=~/.vim/tmp/undo " keep undo files out of the way - set undodir+=. - set undofile " actually use undo files - endif -endif - -if has('folding') - if has('windows') - set fillchars=vert:│ " BOX DRAWINGS HEAVY VERTICAL (U+2503, UTF-8: E2 94 83) - set fillchars+=fold:· " MIDDLE DOT (U+00B7, UTF-8: C2 B7) - endif - - set foldmethod=syntax " not as cool as syntax, but faster - set foldlevelstart=99 " start unfolded - -endif - -if has('viminfo') - if exists('$SUDO_USER') - set viminfo= " don't create root-owned files - else - if isdirectory('~/local/.vim/tmp') - set viminfo+=n~/local/.vim/tmp/viminfo - else - set viminfo+=n~/.vim/tmp/viminfo " override ~/.viminfo default - endif - - if !empty(glob('~/.vim/tmp/viminfo')) - if !filereadable(expand('~/.vim/tmp/viminfo')) - echoerr 'warning: ~/.vim/tmp/viminfo exists but is not readable' - endif - endif - endif -endif - -if has('mksession') - if isdirectory('~/local/.vim/tmp') - set viewdir=~/local/.vim/tmp/view - else - set viewdir=~/.vim/tmp/view " override ~/.vim/view default - endif - set viewoptions=cursor,folds " save/restore just these (with `:{mk,load}view`) -endif - -if has('virtualedit') - set virtualedit=block " allow cursor to move where there is no text in visual block mode -endif - -set visualbell t_vb= " stop annoying beeping for non-error errors -set whichwrap=b,h,l,s,<,>,[,],~ " allow <BS>/h/l/<Left>/<Right>/<Space>, ~ to cross line boundaries -set wildcharm=<C-z> " substitute for 'wildchar' (<Tab>) in macros - -if has('wildignore') - set wildignore+=*.o,*.rej " patterns to ignore during file-navigation -endif -if has('wildmenu') - set wildmenu " show options as list when switching buffers etc -endif - -set wildmode=longest:full,full " shell-like autocomplete to unambiguous portion diff --git a/.config/nvim/visualmode.vim b/.config/nvim/visualmode.vim deleted file mode 100644 index 9a91f9f..0000000 --- a/.config/nvim/visualmode.vim +++ /dev/null @@ -1,4 +0,0 @@ -xnoremap <C-h> <C-w>h -xnoremap <C-j> <C-w>j -xnoremap <C-k> <C-w>k -xnoremap <C-l> <C-w>l diff --git a/.config/offlineimap/config b/.config/offlineimap/config index 402b490..737a7a4 100644 --- a/.config/offlineimap/config +++ b/.config/offlineimap/config @@ -1,6 +1,6 @@ [general] ui = ttyui -accounts = main, work, gmail +accounts = main, kitp, gmail pythonfile = ~/.config/offlineimap/func.py [Account main] @@ -20,24 +20,6 @@ remotepasseval = get_pass("~/.config/password/fastmail.gpg") maxconnections = 3 sslcacertfile = /etc/ssl/certs/ca-certificates.crt -[Account work] -localrepository = work-local -remoterepository = work-remote - -[Repository work-local] -type = Maildir -localfolders = ~/mail/work - -[Repository work-remote] -type = IMAP -remotehost = mail.unibas.ch -remoteport = 993 -remoteuser = nicholas.noll@unibas.ch -remotepasseval = get_pass("~/.config/password/workmail.gpg") -maxconnections = 3 -sslcacertfile = /etc/ssl/certs/ca-certificates.crt -readonly = False - [Account gmail] localrepository = gmail-local remoterepository = gmail-remote @@ -53,3 +35,19 @@ remotepasseval = get_pass("~/.config/password/gmail.gpg") folderfilter = lambda folder: folder in ['INBOX', '[Gmail]/Drafts', '[Gmail]/Sent Mail', '[Gmail]/Store', '[Gmail]/Trash'] maxconnections = 3 sslcacertfile = /etc/ssl/certs/ca-certificates.crt + +[Account kitp] +localrepository = kitp-local +remoterepository = kitp-remote + +[Repository kitp-local] +type = GmailMaildir +localfolders = ~/mail/kitp + +[Repository kitp-remote] +type = Gmail +remoteuser = nnoll@ucsb.edu +remotepasseval = get_pass("~/.config/password/ucsb.gpg") +folderfilter = lambda folder: folder in ['INBOX', '[Gmail]/Drafts', '[Gmail]/Sent Mail', '_Archive', '[Gmail]/Trash'] +maxconnections = 3 +sslcacertfile = /etc/ssl/certs/ca-certificates.crt diff --git a/.config/offlineimap/func.pyc b/.config/offlineimap/func.pyc Binary files differdeleted file mode 100644 index 797a22c..0000000 --- a/.config/offlineimap/func.pyc +++ /dev/null diff --git a/.config/qutebrowser/bookmarks/urls b/.config/qutebrowser/bookmarks/urls index 385d21a..e69de29 100644 --- a/.config/qutebrowser/bookmarks/urls +++ b/.config/qutebrowser/bookmarks/urls @@ -1,5 +0,0 @@ -https://stackoverflow.com/questions/1083172/how-to-mmap-the-stack-for-the-clone-system-call-on-linux multithreading - How to mmap the stack for the clone() system call on linux? - Stack Overflow -http://www.sandpile.org/x86/gpr.htm sandpile.org -- x86 architecture -- general purpose registers -https://github.com/danistefanovic/build-your-own-x danistefanovic/build-your-own-x: 🤓 Build your own (insert technology here) -https://chryswoods.com/vector_c++/immintrin.html chryswoods.com | Part 2: AVX Intrinsics -https://superuser.com/questions/227991/where-to-upload-pgp-public-key-are-keyservers-still-surviving Where to upload PGP public key? Are KeyServers still surviving? - Super User diff --git a/.config/qutebrowser/config.py b/.config/qutebrowser/config.py index 1f4ee49..666fd77 100644 --- a/.config/qutebrowser/config.py +++ b/.config/qutebrowser/config.py @@ -1,3 +1,8 @@ +from operator import methodcaller +from qutebrowser.api import interceptor, message + +config.load_autoconfig(False) + # ------------------------------------------------------------------------ # colors @@ -109,6 +114,8 @@ c.colors.tabs.selected.odd.fg = nord['nord5'] # fonts font = "14pt consolas" +# ------------------------------------------------------------------------ +# fonts c.fonts.statusbar = font c.fonts.prompts = font @@ -128,6 +135,35 @@ c.downloads.location.directory = "~/pulls" c.spellcheck.languages = ["en-US"] c.content.pdfjs = True +c.content.blocking.method = "adblock" + +c.completion.height = "33%" +c.completion.open_categories = ["quickmarks", "history"] + +# ------------------------------------------------------------------------ +# aliases + +c.aliases = {'q': 'quit', 'w': 'session-save', 'wq': 'quit --save'} + +# ------------------------------------------------------------------------ +# keybinds + +config.bind(',c', 'spawn -d chromium {url}') +config.bind(',js', 'config-cycle content.javascript.enabled') + +# ------------------------------------------------------------------------ +# search engines + +c.url.searchengines['w'] = 'https://en.wikipedia.org/w/index.php?search={}&title=Special%3ASearch&fulltext=1&ns0=1' +c.url.searchengines['g'] = 'https://www.google.com/search?q={}' +c.url.searchengines['sx'] = 'https://searx.info/?q={}&categories=general&language=en-US' +c.url.searchengines['sc'] = 'https://scholar.google.com/scholar?hl=en-US&as_sdt=0%2C5&q={}&btnG=' +c.url.searchengines['os'] = 'https://wiki.archlinux.org/index.php?title=Special%3ASearch&search={}&go=Go' +c.url.searchengines['am'] = 'https://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords={}' +c.url.searchengines['py'] = 'https://docs.python.org/3/library/{}.html' + +# ------------------------------------------------------------------------ +# security c.completion.height = "33%" c.completion.open_categories = ["quickmarks", "history"] @@ -183,3 +219,26 @@ js_whitelist = [ for site in js_whitelist: with config.pattern(site) as p: p.content.javascript.enabled = True + +# ------------------------------------------------------------------------ +# redirections + +redirection = { + "www.reddit.com": methodcaller('setHost', 'old.reddit.com'), + "www.twitter.com": methodcaller('setHost', 'mobile.twitter.com'), +} + +def redirect(request): + if request.resource_type != interceptor.ResourceType.main_frame or request.request_url.scheme() in {"data", "blob"}: + return + + url = request.request_url + new = redirection.get(url.host()) + if new is not None and new(url) is not False: + message.info("redirecting to " + url.toString()) + try: + request.redirect(url) + except: + pass + +interceptor.register(redirect) diff --git a/.config/qutebrowser/quickmarks b/.config/qutebrowser/quickmarks index 58942ae..0b743b8 100644 --- a/.config/qutebrowser/quickmarks +++ b/.config/qutebrowser/quickmarks @@ -1,8 +1,5 @@ hn https://news.ycombinator.com/ -git https://git.sr.ht/ +git https://git.nbnoll.xyz blas http://www.netlib.org/blas/ intel https://software.intel.com/sites/landingpage/IntrinsicsGuide/#techs=MMX,SSE,SSE2,SSE3,SSSE3,SSE4_1,SSE4_2,AVX,AVX2&text=xorpd&expand=6141,6144 c http://www.quut.com/c/ANSI-C-grammar-y-2011.html -edo https://viewsourcecode.org/snaptoken/kilo/03.rawInputAndOutput.html -quanta https://www.quantamagazine.org/ -ttf https://formats.kaitai.io/ttf/ttf.svg diff --git a/.config/tmux/config b/.config/tmux/config index f4cd9e0..65d63f0 100644 --- a/.config/tmux/config +++ b/.config/tmux/config @@ -49,6 +49,10 @@ bind-key f resize-pane -Z bind-key [ copy-mode bind-key ] paste-buffer +bind-key -T copy-mode-vi v send-keys -X begin-selection +bind-key -T copy-mode-vi y send-keys -X copy-selection +bind-key -T copy-mode-vi r send-keys -X rectangle-toggle + # URL view bind-key u capture-pane \;\ save-buffer /tmp/tmux-buffer \;\ @@ -2227,7 +2227,7 @@ set breakpoint pending on python Dashboard.start() -dashboard source +# dashboard source # File variables --------------------------------------------------------------- |