aboutsummaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2021-02-25 15:17:37 +0100
committerCharles Cabergs <me@cacharle.xyz>2021-02-25 15:26:09 +0100
commitd59a26f882017a62b4119a7649ca3d4b43f65725 (patch)
tree3ec808804ef398651a9bcc9a021f16c5d30b7b88 /config
parentbb72eb10b6c7148ad3107c50a4232dea080d1468 (diff)
downloaddotfiles-d59a26f882017a62b4119a7649ca3d4b43f65725.tar.gz
dotfiles-d59a26f882017a62b4119a7649ca3d4b43f65725.tar.bz2
dotfiles-d59a26f882017a62b4119a7649ca3d4b43f65725.zip
Added vint and flake8 to lint vim and qutebrowser conf, Added shellcheck to zsh files, Fixing all linting errors
Diffstat (limited to 'config')
-rw-r--r--config/qutebrowser/config.py24
-rw-r--r--config/redshift/redshift.conf2
-rw-r--r--config/vim/pluggins.vim7
-rw-r--r--config/vim/vimrc62
-rwxr-xr-xconfig/x11/.xinitrc (renamed from config/x11/xinitrc)2
-rw-r--r--config/zsh/.zshrc31
-rw-r--r--config/zsh/aliases.zsh12
-rwxr-xr-xconfig/zsh/zprofile21
8 files changed, 78 insertions, 83 deletions
diff --git a/config/qutebrowser/config.py b/config/qutebrowser/config.py
index d449658..0fe74ba 100644
--- a/config/qutebrowser/config.py
+++ b/config/qutebrowser/config.py
@@ -2,20 +2,22 @@ import os
from qutebrowser.api import interceptor
+
config.load_autoconfig(True)
+
# Youtube ad blocking
def filter_yt(info: interceptor.Request):
url = info.request_url
if (
- url.host() == 'www.youtube.com'
- and url.path() == '/get_video_info'
- and '&adformat=' in url.query()
+ url.host() == 'www.youtube.com' and
+ url.path() == '/get_video_info' and
+ '&adformat=' in url.query()
):
info.block()
-interceptor.register(filter_yt)
+interceptor.register(filter_yt)
c.aliases = {
'q': 'close',
@@ -60,13 +62,12 @@ config.bind('K', 'tab-next', 'normal')
config.bind('<F12>', 'devtools', 'normal')
-c.colors.webpage.darkmode.enabled = True # Convert light themed sites to dark theme (very nice result)
-c.colors.webpage.bg = 'black' # Disabling white flash before page loading
+c.colors.webpage.darkmode.enabled = True # Convert light themed sites to dark theme
# c.content.proxy = 'socks://localhost:9050/' # tor
c.content.autoplay = False
c.content.notifications = False
-#c.content.cookies.accept = 'no-3rdparty'
+# c.content.cookies.accept = 'no-3rdparty'
c.auto_save.session = True
c.session.lazy_restore = True
@@ -137,10 +138,10 @@ c.colors.contextmenu.disabled.fg = base04
# Background color of the context menu. If set to null, the Qt default is used.
c.colors.contextmenu.menu.bg = base00
# Foreground color of the context menu. If set to null, the Qt default is used.
-c.colors.contextmenu.menu.fg = base05
+c.colors.contextmenu.menu.fg = base05
# Background color of the context menu’s selected item. If set to null, the Qt default is used.
c.colors.contextmenu.selected.bg = base02
-#Foreground color of the context menu’s selected item. If set to null, the Qt default is used.
+# Foreground color of the context menu’s selected item. If set to null, the Qt default is used.
c.colors.contextmenu.selected.fg = base05
# Background color for the download bar.
c.colors.downloads.bar.bg = base00
@@ -281,6 +282,5 @@ c.colors.tabs.selected.odd.bg = base02
c.colors.tabs.selected.even.fg = base05
# Background color of selected even tabs.
c.colors.tabs.selected.even.bg = base02
-# Background color for webpages if unset (or empty to use the theme's
-# color).
-# c.colors.webpage.bg = base00
+# Background color for webpages if unset (or empty to use the theme's color).
+c.colors.webpage.bg = base00
diff --git a/config/redshift/redshift.conf b/config/redshift/redshift.conf
index 1e540e3..b76d5f7 100644
--- a/config/redshift/redshift.conf
+++ b/config/redshift/redshift.conf
@@ -12,3 +12,5 @@ location-provider=manual
[manual]
lat=50.8008858
lon=4.2886091
+
+; vim:ft=dosini
diff --git a/config/vim/pluggins.vim b/config/vim/pluggins.vim
index 7091c5f..b7436f2 100644
--- a/config/vim/pluggins.vim
+++ b/config/vim/pluggins.vim
@@ -2,12 +2,12 @@
" vim pluggins "
""""""""""""""""
-call plug#begin("$XDG_DATA_HOME/vim/plugged")
+call plug#begin($XDG_DATA_HOME . '/vim/plugged')
Plug 'ctrlpvim/ctrlp.vim' " Ctrl-P similar to vsc
Plug 'tpope/vim-eunuch' " basic unix command in vim
Plug 'tomtom/tcomment_vim' " mininal commenter
Plug 'itchyny/lightline.vim' " minimal status bar
- Plug 'HappyTramp/vim-syntax-extra' " syntax highlight of C operators
+ Plug 'cacharle/vim-syntax-extra' " syntax highlight of C operators
Plug 'romainl/vim-cool' " disable highlight after search
Plug 'tpope/vim-fugitive' " git wrapper
Plug 'junegunn/vim-easy-align' " align
@@ -18,7 +18,6 @@ call plug#begin("$XDG_DATA_HOME/vim/plugged")
" Plug 'mhinz/vim-rfc' " RFC download/syntax/tags
Plug 'skammer/vim-css-color'
-
" markdown preview in browser
" Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']}
@@ -29,7 +28,7 @@ call plug#begin("$XDG_DATA_HOME/vim/plugged")
Plug 'nikvdp/ejs-syntax' " ejs
" s19 at home
- Plug 'HappyTramp/vim-42header' " 42 header
+ Plug 'cacharle/vim-42header' " 42 header
" themes
" Plug 'joshdick/onedark.vim' " onedark
diff --git a/config/vim/vimrc b/config/vim/vimrc
index 644032f..8082ea6 100644
--- a/config/vim/vimrc
+++ b/config/vim/vimrc
@@ -1,7 +1,3 @@
-""""""""""
-" vimrc "
-""""""""""
-
" xdg {{{
set runtimepath^=$XDG_CONFIG_HOME/vim
set runtimepath+=$XDG_DATA_HOME/vim
@@ -10,8 +6,8 @@ set runtimepath+=$XDG_CONFIG_HOME/vim/after
set packpath^=$XDG_DATA_HOME/vim,$XDG_CONFIG_HOME/vim
set packpath+=$XDG_CONFIG_HOME/vim/after,$XDG_DATA_HOME/vim/after
-let g:netrw_home = $XDG_DATA_HOME . "/vim"
-call mkdir($XDG_DATA_HOME."/vim/spell", 'p')
+let g:netrw_home = $XDG_DATA_HOME . '/vim'
+call mkdir($XDG_DATA_HOME . '/vim/spell', 'p')
set viewdir=$XDG_DATA_HOME/vim/view | call mkdir(&viewdir, 'p')
set backupdir=$XDG_CACHE_HOME/vim/backup | call mkdir(&backupdir, 'p')
@@ -24,6 +20,7 @@ source $XDG_CONFIG_HOME/vim/pluggins.vim " load pluggins
" common {{{
let mapleader = ' ' " set leader key to space
let maplocalleader = '-' " set file local leader key to backslash
+" vint: -ProhibitSetNoCompatible
set nocompatible " not compatible with vi
set number " line number
" set relativenumber " line number relative to cursor
@@ -38,6 +35,7 @@ set scrolloff=2 " line padding when scrolling
set textwidth=0 " when line wrap occurs
set wrapmargin=0 " disable auto line wrapping
set encoding=utf-8 " utf-8 encoding
+scriptencoding utf-8
set formatoptions-=t " do not auto break line > 89 character
filetype plugin indent on " allow to add specific rules for certain type of file
" set mouse=a " mouse scrolling (heretic)
@@ -52,7 +50,7 @@ set path+=** " recursive :find
" intuitif split opening {{{
set splitbelow
set splitright
-set fcs+=vert:│ " split separator
+set fillchars+=vert:│ " split separator
" }}}
" tab {{{
@@ -179,31 +177,28 @@ nnoremap gcf A<BS><CR>{<CR><CR>}<ESC>j
" initialise a school header file
function PutHeaderBoilerPlate()
- let l:filename = join(split(toupper(expand('%:t')), '\.'), "_")
+ let l:filename = join(split(toupper(expand('%:t')), '\.'), '_')
" echom l:filename
- call append(12, "#ifndef " . l:filename)
- call append(13, "# define " . l:filename)
- call append(15, "#endif")
+ call append(12, '#ifndef ' . l:filename)
+ call append(13, '# define ' . l:filename)
+ call append(15, '#endif')
endfunction
nnoremap gch :Stdheader<CR>:call PutHeaderBoilerPlate()<CR>
" put semicolon at the end of line
nnoremap <leader>; mqA;<ESC>`q
-" doxygen format comments
-autocmd Filetype c setlocal comments=s:/**,m:**,e:*/,s:/*,m:**,e:*/
-autocmd Filetype cpp setlocal comments=s:/**,m:**,e:*/,s:/*,m:**,e:*/
" }}}
" cpp {{{
" Put Coplien Form boilerplate class
function PutCoplienFormFunc(name)
- let l:default_constructor = a:name . "();\n"
- let l:copy_constructor = a:name . "(const " . a:name . "& other);\n"
- let l:copy_operator = a:name . "& operator=(const " . a:name . "& other);\n"
- let l:destructor = "~" . a:name . "();\n"
+ let l:default_constructor = a:name . '();\n'
+ let l:copy_constructor = a:name . '(const ' . a:name . '& other);\n'
+ let l:copy_operator = a:name . '& operator=(const ' . a:name . '& other);\n'
+ let l:destructor = '~' . a:name . '();\n'
- execute "normal iclass " . a:name . "\n{\npublic:\n" . l:default_constructor . l:copy_constructor . l:copy_operator . l:destructor . "\nprivate:\n};\n"
- execute "normal <2{"
+ execute 'normal iclass ' . a:name . '\n{\npublic:\n' . l:default_constructor . l:copy_constructor . l:copy_operator . l:destructor . '\nprivate:\n};\n'
+ execute 'normal <2{'
endfunction
" Put Coplien Form boilerplate according to filename
command! PutCoplienFormFile call PutCoplienFormFunc(split(expand('%:t'), '\.')[0])
@@ -244,25 +239,32 @@ command! CountScopeLines call CountScopeLines()
nnoremap <leader>m :make all <CR>
" }}}
+augroup vimrc
+ autocmd!
+augroup END
+
" hook {{{
" remove trailing white space on save
-autocmd BufWritePre * %s/\s\+$//e
+autocmd vimrc BufWritePre * %s/\s\+$//e
" dirty hack to disable this feature on markdown (autocmd! wouldn't work)
-autocmd BufReadPre *.md autocmd! BufWritePre
+autocmd vimrc BufReadPre *.md autocmd! BufWritePre
" }}}
" filetype {{{
" real tab in c file for school projects
let g:c_syntax_for_h = 1 " filetype=c in header files instead of filetype=cpp
-autocmd Filetype c setlocal noexpandtab
-" std::cout << ... << std::endl; shortcut
-autocmd Filetype cpp nnoremap <leader>cout istd::cout << << std::endl;<ESC>2F<hi
-" vim fold method to marker
-autocmd Filetype vim setlocal foldmethod=marker
-
-autocmd FileType haskell set formatprg=stylish-haskell
-autocmd FileType lisp,html,css,htmldjango setlocal shiftwidth=2
+augroup vimrc_files
+ autocmd!
+ " school c
+ autocmd Filetype c setlocal noexpandtab
+ autocmd Filetype c setlocal comments=s:/**,m:**,e:*/,s:/*,m:**,e:*/
+ " std::cout << ... << std::endl; shortcut
+ autocmd Filetype cpp nnoremap <leader>cout istd::cout << << std::endl;<ESC>2F<hi
+ autocmd Filetype vim setlocal foldmethod=marker " vim fold method to marker
+ autocmd FileType haskell set formatprg=stylish-haskell
+ autocmd FileType lisp,html,css,htmldjango setlocal shiftwidth=2
+augroup END
" }}}
""""""""""""
diff --git a/config/x11/xinitrc b/config/x11/.xinitrc
index 90d8515..e50cfa6 100755
--- a/config/x11/xinitrc
+++ b/config/x11/.xinitrc
@@ -3,7 +3,7 @@
# xinput disable 'ETPS/2 Elantech Touchpad' &
echo 'Starting redshift'
-redshift -c $XDG_CONFIG_HOME/redshift/redshift.conf &
+redshift &
echo 'Starting dunst'
dunst &
xset r rate 200 50
diff --git a/config/zsh/.zshrc b/config/zsh/.zshrc
index 372b828..0c69f31 100644
--- a/config/zsh/.zshrc
+++ b/config/zsh/.zshrc
@@ -1,24 +1,22 @@
-###############
-# zshrc #
-###############
-
+#!/bin/zsh
# load aliases
-source $XDG_CONFIG_HOME/zsh/aliases.zsh
+# shellcheck source=/dev/null
+. "$XDG_CONFIG_HOME/zsh/aliases.zsh"
# prompt
-case `tty` in
+case $(tty) in
/dev/tty[1-9])
# %~ path ('~' if $HOME)
# %B/%b start/stop bold
# %B/%b start/stop color
- NEWLINE=$'\n'
+ NEWLINE=$(printf '\n')
export PROMPT="${NEWLINE}%B%F{blue}%~%f${NEWLINE}%F{red}> %f%b"
;;
*)
# pure prompt
export FPATH="$FPATH:$XDG_DATA_HOME/zsh/pure"
- ZSH_THEME="pure"
+ export ZSH_THEME='pure'
autoload -U promptinit
promptinit
prompt pure
@@ -53,26 +51,25 @@ setopt list_rows_first # cycle through row first in menu
# setopt extendedglob
# executed when changing directory
-function chpwd() {
- content=$(ls | wc -l)
+chpwd() {
+ content="$(find . -maxdepth 1 | wc -l)"
([ "$content" -lt 20 ] && ls -l) ||
echo "$(pwd) contains $content entries"
[ "$(stat -c "%U" .)" = "$USER" ] && touch . # to sort by last cd
}
-# add command-not-found package suggestion
-#source /etc/zsh_command_not_found
-
-
+# shellcheck disable=SC2034,SC2039
fignore=(o hi) # ignore extensions in autocomplete
# pluggins
-source $XDG_DATA_HOME/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh # prompt syntax highlight
+# shellcheck source=/dev/null
+. "$XDG_DATA_HOME/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" # prompt syntax highlight
export YSU_MESSAGE_POSITION="after" # you-should-use message after command output
-source $XDG_DATA_HOME/zsh/zsh-you-should-use/you-should-use.plugin.zsh # alias reminder
+. "$XDG_DATA_HOME/zsh/zsh-you-should-use/you-should-use.plugin.zsh" # alias reminder
# set tab to 4 spaces
tabs 4
-export GPG_TTY=$(tty) # fixing gpg fatal error about tty
+GPG_TTY=$(tty) # fixing gpg fatal error about tty
+export GPG_TTY
diff --git a/config/zsh/aliases.zsh b/config/zsh/aliases.zsh
index 3d2cfa1..ff036f2 100644
--- a/config/zsh/aliases.zsh
+++ b/config/zsh/aliases.zsh
@@ -1,6 +1,4 @@
-###############
-# zsh aliases #
-###############
+#!/bin/zsh
# color
alias grep='grep --color=auto'
@@ -113,7 +111,7 @@ alias cagor='RUSTFLAGS="$RUSTFLAGS -A dead_code" cargo run'
# wifi
wificonnect() {
- nmcli device wifi connect $1 password $2
+ nmcli device wifi connect "$1" password "$2"
}
# alias mutt='neomutt'
@@ -126,12 +124,8 @@ alias qmvdest='qmv --format=do'
alias xclip='xclip -selection clipboard'
-pacman-url() {
+pacman_url() {
pacman -Si "$1" | grep URL | tr -s ' ' | cut -d ' ' -f 3
}
-grep-kill() {
- ps aux | grep "$1" | tr -s ' ' | cut -d ' ' -f 2 | xargs kill
-}
-
alias filter-valgrind="sed -e 's/==[0-9]*==/==/' -e 's/0x[0-9A-F]*//'"
diff --git a/config/zsh/zprofile b/config/zsh/zprofile
index 1713b9e..68a9b48 100755
--- a/config/zsh/zprofile
+++ b/config/zsh/zprofile
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/zsh
export PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:$HOME/.local/bin"
@@ -20,6 +20,7 @@ export XMONAD_DATA_HOME="$XDG_DATA_HOME"
export XMONAD_CACHE_HOME="$XDG_CACHE_HOME"
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc"
+# shellcheck disable=SC2016
export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC'
export IPYTHONDIR="$XDG_CONFIG_HOME/ipython"
export JUPYTER_CONFIG_DIR="$XDG_CONFIG_HOME/jupyter"
@@ -33,14 +34,15 @@ export LESSHISTFILE='-' # no ~/.lesshst
# runtime
export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority"
+# shellcheck disable=SC2155
# color in man (less pager)
-export LESS_TERMCAP_mb=$'\e[1;32m'
-export LESS_TERMCAP_md=$'\e[1;32m'
-export LESS_TERMCAP_me=$'\e[0m'
-export LESS_TERMCAP_se=$'\e[0m'
-export LESS_TERMCAP_so=$'\e[01;33m'
-export LESS_TERMCAP_ue=$'\e[0m'
-export LESS_TERMCAP_us=$'\e[1;4;31m'
+export LESS_TERMCAP_mb=$(printf '%b' '\e[1;32m')
+export LESS_TERMCAP_md=$(printf '%b' '\e[1;32m')
+export LESS_TERMCAP_me=$(printf '%b' '\e[0m')
+export LESS_TERMCAP_se=$(printf '%b' '\e[0m')
+export LESS_TERMCAP_so=$(printf '%b' '\e[01;33m')
+export LESS_TERMCAP_ue=$(printf '%b' '\e[0m')
+export LESS_TERMCAP_us=$(printf '%b' '\e[1;4;31m')
export LESS_TERMCAP_mr=$(tput rev)
export LESS_TERMCAP_mh=$(tput dim)
export LESS_TERMCAP_ZN=$(tput ssubm)
@@ -48,7 +50,6 @@ export LESS_TERMCAP_ZV=$(tput rsubm)
export LESS_TERMCAP_ZO=$(tput ssupm)
export LESS_TERMCAP_ZW=$(tput rsupm)
-
export MINIKUBE_IN_STYLE=false # disable cringe minikube emojies
# school env
@@ -57,4 +58,4 @@ export MINISHELL_TEST_PAGER=vim
export MINISHELL_TEST_FLAGS=-DMINISHELL_TEST
export WEBSERV_FLAGS=-DWEBSERV_CACHARLE
-[ "$(tty)" = '/dev/tty1' ] && exec startx
+[ "$(tty)" = '/dev/tty1' ] && HOME="$XDG_CONFIG_HOME/x11" exec startx