From d59a26f882017a62b4119a7649ca3d4b43f65725 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Thu, 25 Feb 2021 15:17:37 +0100 Subject: Added vint and flake8 to lint vim and qutebrowser conf, Added shellcheck to zsh files, Fixing all linting errors --- .travis.yml | 15 +++++++++++ config/qutebrowser/config.py | 24 ++++++++--------- config/redshift/redshift.conf | 2 ++ config/vim/pluggins.vim | 7 +++-- config/vim/vimrc | 62 ++++++++++++++++++++++--------------------- config/x11/.xinitrc | 26 ++++++++++++++++++ config/x11/xinitrc | 26 ------------------ config/zsh/.zshrc | 31 ++++++++++------------ config/zsh/aliases.zsh | 12 +++------ config/zsh/zprofile | 21 ++++++++------- test | 21 ++++++++++++--- 11 files changed, 136 insertions(+), 111 deletions(-) create mode 100755 config/x11/.xinitrc delete mode 100755 config/x11/xinitrc diff --git a/.travis.yml b/.travis.yml index 3aee491..50fcd8c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,19 @@ language: shell +os: linux +dist: focal + +addons: + apt: + packages: + - python3 + - python3-pip + +install: + - pip3 install -U pip + - pip3 install setuptools + - pip3 install vim-vint + - pip3 install flake8 + script: - ./test 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('', '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{}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:call PutHeaderBoilerPlate() " put semicolon at the end of line nnoremap ; mqA;`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 m :make all " }}} +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 cout istd::cout << << std::endl;2Fcout istd::cout << << std::endl;2F