From bb31dbfd4e788f0efcbb0e6ab8264a12116aa672 Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 7 Mar 2020 23:40:57 +0100 Subject: xmonad brightness handling --- .vimrc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to '.vimrc') diff --git a/.vimrc b/.vimrc index 9d7059e..7a329af 100644 --- a/.vimrc +++ b/.vimrc @@ -106,26 +106,27 @@ nnoremap l :ls " file manipulation with leader nnoremap w :w nnoremap x :x - " open vimrc in split nnoremap rc :vsplit $MYVIMRC " source vimrc nnoremap src :source $MYVIMRC - " file toggle nnoremap z zi - " create c function body from prototype nnoremap gcf A{} - " put semicolon at the end of line nnoremap ; mqA;`q +" grep +" nnoremap gw :silent grep -R .:copen +" nnoremap gW :silent execute "grep! -R " . shellescape(expand("")) . " .":copen +" nnoremap gn :cnext +" nnoremap gp :cprevious + + " remove trailing white space on save autocmd BufWritePre * %s/\s\+$//e - " initialise buf for fold toggle autocmd BufReadPre * :normal zMzi - " real tab in c file for school projects autocmd Filetype c setlocal noexpandtab -- cgit From a07ae4a5994380a1a5f40823ce40ac8fd4e6644a Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 9 Mar 2020 12:37:02 +0100 Subject: Added vimrc fold marker --- .vimrc | 94 +++++++++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 67 insertions(+), 27 deletions(-) (limited to '.vimrc') diff --git a/.vimrc b/.vimrc index 7a329af..ec90935 100644 --- a/.vimrc +++ b/.vimrc @@ -2,10 +2,15 @@ " vimrc " """""""""" -" load pluggins +" load pluggins {{{ source $HOME/dotfiles/.pluggins.vim +" }}} -" common +""""""""""" +" options " +""""""""""" + +" common {{{ let mapleader = ' ' " set leader key to space let maplocalleader = '-' " set file local leader key to backslash set nocompatible " not compatible with vi @@ -21,61 +26,77 @@ set scrolloff=2 " line padding when scrolling set textwidth=89 " when line wrap occurs set encoding=utf-8 " utf-8 encoding filetype plugin indent on " allow to add specific rules for certain type of file +" }}} -" browse list with tab +" browse list with tab {{{ set wildmode=longest,list,full set wildmenu " tab to cycle through completion options set path+=** " recursive :find +"}}} -" intuitif split opening +" intuitif split opening {{{ set splitbelow set splitright set fcs+=vert:\ " no split separator +" }}} -" tab +" tab {{{ set expandtab " tab to space set tabstop=4 " tab size set shiftwidth=4 set smarttab set autoindent set smartindent +" }}} -" file search +" file search {{{ set ignorecase " case insensitive set smartcase set hlsearch " match highlight set incsearch +" }}} -" status +" status {{{ set laststatus=2 " always a statusline (all window) set showcmd " show current partial command in the bottom right set noshowmode " dont show current mode (i.e --INSERT--) +" }}} -" fold +" fold {{{ set foldmethod=indent " create fold based on the text indent +" }}} -" ctrlp pluggin +" ctrlp pluggin {{{ " directory to ignore when searching in file tree set wildignore=*/tmp/*,*.o,*.so,*.swp,*.zip,*/node_modules/*,*/vendor/*,.bundle/*,bin/*,.git/* " ctrlp ignore all stuff in the .gitignore let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard'] +" }}} + +""""""""""""""" +" colorscheme " +""""""""""""""" -" colorscheme +" one {{{ let g:onedark_terminal_italics=1 colorscheme onedark let g:lightline = {} let g:lightline.colorscheme = 'one' " lightline theme to onedark +" }}} + """""""""""" " mappings " """""""""""" -" split navigation +" split navigation {{{ nnoremap nnoremap nnoremap nnoremap +" }}} +" common {{{ " 'Y' yank to the end of the line noremap Y y$ " solves annoying delay went exiting insert mode @@ -98,35 +119,54 @@ nnoremap ) 10j " tag nagigation nnoremap ] nnoremap t -" buffer navigation +" }}} + +" buffer navigation {{{ nnoremap n :bn nnoremap p :bp nnoremap :b# nnoremap l :ls -" file manipulation with leader -nnoremap w :w -nnoremap x :x -" open vimrc in split +" }}} + +" vimrc {{{ nnoremap rc :vsplit $MYVIMRC -" source vimrc nnoremap src :source $MYVIMRC -" file toggle -nnoremap z zi +" }}} + +" c {{{ " create c function body from prototype nnoremap gcf A{} " put semicolon at the end of line nnoremap ; mqA;`q - -" grep -" nnoremap gw :silent grep -R .:copen -" nnoremap gW :silent execute "grep! -R " . shellescape(expand("")) . " .":copen -" nnoremap gn :cnext -" nnoremap gp :cprevious - - +" quickfix window toggle +" }}} + +" quickfix window toggle {{{ +nnoremap q :call QuickfixToggle() +let g:quickfix_is_open = 0 +if !exists('*QuickfixToggle') + function QuickfixToggle() + if g:quickfix_is_open + cclose + let g:quickfix_is_open = 0 + else + copen + let g:quickfix_is_open = 1 + endif + endfunction +endif +" }}} + +" hook {{{ " remove trailing white space on save autocmd BufWritePre * %s/\s\+$//e " initialise buf for fold toggle autocmd BufReadPre * :normal zMzi +" }}} + +" filetype {{{ " real tab in c file for school projects autocmd Filetype c setlocal noexpandtab +" vim fold method to marker +autocmd Filetype vim setlocal foldmethod=marker +" }}} -- cgit From ebb061bc953b647bc2944e4f203f2d3fd30d181d Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 13 Mar 2020 18:17:19 +0100 Subject: xmonad fullscreen without borders --- .vimrc | 2 ++ 1 file changed, 2 insertions(+) (limited to '.vimrc') diff --git a/.vimrc b/.vimrc index ec90935..cc4fdad 100644 --- a/.vimrc +++ b/.vimrc @@ -94,6 +94,7 @@ nnoremap nnoremap nnoremap nnoremap +nnoremap s= = " }}} " common {{{ @@ -166,6 +167,7 @@ autocmd BufReadPre * :normal zMzi " filetype {{{ " real tab in c file for school projects +autocmd BufReadPre,BufNewFile *.h,*.c set filetype=c autocmd Filetype c setlocal noexpandtab " vim fold method to marker autocmd Filetype vim setlocal foldmethod=marker -- cgit From 66c963bb41213bc09dac88b201ba67ba4d0835ad Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 28 Mar 2020 22:25:24 +0100 Subject: Added vim pluggin: quick-scope --- .vimrc | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to '.vimrc') diff --git a/.vimrc b/.vimrc index cc4fdad..684528c 100644 --- a/.vimrc +++ b/.vimrc @@ -66,13 +66,6 @@ set noshowmode " dont show current mode (i.e --INSERT--) set foldmethod=indent " create fold based on the text indent " }}} -" ctrlp pluggin {{{ -" directory to ignore when searching in file tree -set wildignore=*/tmp/*,*.o,*.so,*.swp,*.zip,*/node_modules/*,*/vendor/*,.bundle/*,bin/*,.git/* -" ctrlp ignore all stuff in the .gitignore -let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard'] -" }}} - """"""""""""""" " colorscheme " """"""""""""""" @@ -172,3 +165,18 @@ autocmd Filetype c setlocal noexpandtab " vim fold method to marker autocmd Filetype vim setlocal foldmethod=marker " }}} + +"""""""""""" +" pluggins " +"""""""""""" + +" ctrlp {{{ +" directory to ignore when searching in file tree +set wildignore=*/tmp/*,*.o,*.so,*.swp,*.zip,*/node_modules/*,*/vendor/*,.bundle/*,bin/*,.git/* +" ctrlp ignore all stuff in the .gitignore +let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard'] +" }}} + +" quick-scope {{{ +let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] +" }}} -- cgit From f7bd76cf8f012781a18bf6b3d50bd2a9ef7dac30 Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 30 Mar 2020 20:53:59 +0200 Subject: Add vim doxygen/norm comment style --- .vimrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to '.vimrc') diff --git a/.vimrc b/.vimrc index 684528c..3416740 100644 --- a/.vimrc +++ b/.vimrc @@ -132,7 +132,9 @@ nnoremap src :source $MYVIMRC nnoremap gcf A{} " put semicolon at the end of line nnoremap ; mqA;`q -" quickfix window toggle +" doxygen format comments +autocmd Filetype c setlocal comments=s:/**,m:**,e:*/,s:/*,m:**,e:*/ +autocmd Filetype h setlocal comments=s:/**,m:**,e:*/,s:/*,m:**,e:*/ " }}} " quickfix window toggle {{{ -- cgit From 6cb4a877a2e9a59c3c17d477333840e5ae13ed82 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 31 Mar 2020 11:31:22 +0200 Subject: Removed .bashrc default junk --- .vimrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '.vimrc') diff --git a/.vimrc b/.vimrc index 3416740..1fc69f0 100644 --- a/.vimrc +++ b/.vimrc @@ -74,7 +74,7 @@ set foldmethod=indent " create fold based on the text indent let g:onedark_terminal_italics=1 colorscheme onedark let g:lightline = {} -let g:lightline.colorscheme = 'one' " lightline theme to onedark +let g:lightline.colorscheme = 'jellybeans' " lightline theme to onedark " }}} @@ -134,7 +134,7 @@ nnoremap gcf A{} nnoremap ; mqA;`q " doxygen format comments autocmd Filetype c setlocal comments=s:/**,m:**,e:*/,s:/*,m:**,e:*/ -autocmd Filetype h setlocal comments=s:/**,m:**,e:*/,s:/*,m:**,e:*/ +autocmd Filetype cpp setlocal comments=s:/**,m:**,e:*/,s:/*,m:**,e:*/ " }}} " quickfix window toggle {{{ -- cgit From 5828534933ffd5ca23c6e47b7c12a4a2637e01f0 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 14 Apr 2020 13:06:17 +0200 Subject: Added vim functions to help with boilerplate in c++ files --- .vimrc | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 5 deletions(-) (limited to '.vimrc') diff --git a/.vimrc b/.vimrc index 1fc69f0..a8d3bf4 100644 --- a/.vimrc +++ b/.vimrc @@ -20,11 +20,13 @@ set numberwidth=1 " line numbers gutter autowidth set cursorline " highlight current line set noshowmatch " dont jump to pair bracket set autoread " reload files when changes happen outside vim +set autowrite " auto write buf on certain events set hidden " keep change in buffer when quitting window set noswapfile " disable swap files set scrolloff=2 " line padding when scrolling set textwidth=89 " when line wrap occurs set encoding=utf-8 " utf-8 encoding +set formatoptions-=t " do not auto break line > 89 character filetype plugin indent on " allow to add specific rules for certain type of file " }}} @@ -37,7 +39,7 @@ set path+=** " recursive :find " intuitif split opening {{{ set splitbelow set splitright -set fcs+=vert:\ " no split separator +set fcs+=vert:│ " split separator " }}} " tab {{{ @@ -64,6 +66,7 @@ set noshowmode " dont show current mode (i.e --INSERT--) " fold {{{ set foldmethod=indent " create fold based on the text indent +set nofoldenable " not folded by default " }}} """"""""""""""" @@ -73,6 +76,14 @@ set foldmethod=indent " create fold based on the text indent " one {{{ let g:onedark_terminal_italics=1 colorscheme onedark +" }}} +" dracula {{{ +let g:dracula_bold = 1 +let g:dracula_italic = 1 +let g:dracula_colorterm = 0 +" colorscheme dracula +" }}} +" lightline {{{ let g:lightline = {} let g:lightline.colorscheme = 'jellybeans' " lightline theme to onedark " }}} @@ -87,6 +98,10 @@ nnoremap nnoremap nnoremap nnoremap +" nnoremap +" nnoremap +" nnoremap +" nnoremap nnoremap s= = " }}} @@ -129,7 +144,29 @@ nnoremap src :source $MYVIMRC " c {{{ " create c function body from prototype -nnoremap gcf A{} +nnoremap gcf A{}j + +" initialise a school header file +function PutHeaderBoilerPlate() + 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") +endfunction +nnoremap gch :Stdheader:call PutHeaderBoilerPlate() + +function PutCoplienForm(name) + let l:default_constructor = a:name . "();\n" + let l:copy_constructor = a:name . "(" . a:name . " const& other);\n" + let l:copy_operator = "void operator=(" . a:name . " const& 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{" +endfunction +command! PutCoplienFormFile call PutCoplienForm(split(expand('%:t'), '\.')[0]) + " put semicolon at the end of line nnoremap ; mqA;`q " doxygen format comments @@ -138,7 +175,9 @@ autocmd Filetype cpp setlocal comments=s:/**,m:**,e:*/,s:/*,m:**,e:*/ " }}} " quickfix window toggle {{{ -nnoremap q :call QuickfixToggle() +nnoremap qt :call QuickfixToggle() +nnoremap qn :cnext +nnoremap qp :cprevious let g:quickfix_is_open = 0 if !exists('*QuickfixToggle') function QuickfixToggle() @@ -153,11 +192,13 @@ if !exists('*QuickfixToggle') endif " }}} +" make {{{ +nnoremap m :make all +" }}} + " hook {{{ " remove trailing white space on save autocmd BufWritePre * %s/\s\+$//e -" initialise buf for fold toggle -autocmd BufReadPre * :normal zMzi " }}} " filetype {{{ @@ -177,8 +218,16 @@ autocmd Filetype vim setlocal foldmethod=marker set wildignore=*/tmp/*,*.o,*.so,*.swp,*.zip,*/node_modules/*,*/vendor/*,.bundle/*,bin/*,.git/* " ctrlp ignore all stuff in the .gitignore let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard'] +let g:ctrlp_working_path_mode = 'rw' " }}} " quick-scope {{{ let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] " }}} + +" man-plugin {{{ +runtime! ftplugin/man.vim +let g:ft_man_open_mode = 'vert' " open in a vertical split +let g:ft_man_no_sect_fallback = 2 " if page specified fallback to page 2 (syscall pages) +" autocmd Filetype man unmap q: hmmmm?? +" }}} -- cgit From 36c19a33127316bea52d46130d53035a328eb1c5 Mon Sep 17 00:00:00 2001 From: Charles Date: Sun, 26 Apr 2020 08:33:18 +0200 Subject: Change colorscheme to solarized and switched to st --- .vimrc | 51 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 18 deletions(-) (limited to '.vimrc') diff --git a/.vimrc b/.vimrc index a8d3bf4..dc57121 100644 --- a/.vimrc +++ b/.vimrc @@ -15,7 +15,7 @@ let mapleader = ' ' " set leader key to space let maplocalleader = '-' " set file local leader key to backslash set nocompatible " not compatible with vi set number " line number -set relativenumber " line number relative to cursor +" set relativenumber " line number relative to cursor set numberwidth=1 " line numbers gutter autowidth set cursorline " highlight current line set noshowmatch " dont jump to pair bracket @@ -74,18 +74,26 @@ set nofoldenable " not folded by default """"""""""""""" " one {{{ -let g:onedark_terminal_italics=1 -colorscheme onedark +" let g:onedark_terminal_italics=1 +" colorscheme onedark " }}} " dracula {{{ -let g:dracula_bold = 1 -let g:dracula_italic = 1 -let g:dracula_colorterm = 0 +" let g:dracula_bold = 1 +" let g:dracula_italic = 1 +" let g:dracula_colorterm = 0 " colorscheme dracula " }}} +" solarized {{{ +set t_Co=16 +let g:solarized_termcolors=16 +let g:solarized_visibility='low' " visibility of invisible chars with set list +set background=dark +colorscheme solarized +" }}} " lightline {{{ let g:lightline = {} -let g:lightline.colorscheme = 'jellybeans' " lightline theme to onedark +let g:lightline.colorscheme = 'solarized' " lightline theme to solarized +" let g:lightline.colorscheme = 'jellybeans' " lightline theme to onedark " }}} @@ -144,7 +152,7 @@ nnoremap src :source $MYVIMRC " c {{{ " create c function body from prototype -nnoremap gcf A{}j +nnoremap gcf A{}j " initialise a school header file function PutHeaderBoilerPlate() @@ -156,22 +164,27 @@ function PutHeaderBoilerPlate() endfunction nnoremap gch :Stdheader:call PutHeaderBoilerPlate() -function PutCoplienForm(name) +" 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 . "(" . a:name . " const& other);\n" - let l:copy_operator = "void operator=(" . a:name . " const& other);\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{" endfunction -command! PutCoplienFormFile call PutCoplienForm(split(expand('%:t'), '\.')[0]) - -" 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:*/ +" Put Coplien Form boilerplate according to filename +command! PutCoplienFormFile call PutCoplienFormFunc(split(expand('%:t'), '\.')[0]) +command! -nargs=1 PutCoplienForm call PutCoplienFormFunc("") " }}} " quickfix window toggle {{{ @@ -205,6 +218,8 @@ autocmd BufWritePre * %s/\s\+$//e " real tab in c file for school projects autocmd BufReadPre,BufNewFile *.h,*.c set filetype=c autocmd Filetype c setlocal noexpandtab +" std::cout << ... << std::endl; shortcut +autocmd Filetype cpp nnoremap cout istd::cout << << std::endl;2F