diff --git a/.config/vim/writer/vimrc b/.config/vim/writer/vimrc index e26024e5..044f2ebc 100644 --- a/.config/vim/writer/vimrc +++ b/.config/vim/writer/vimrc @@ -10,7 +10,7 @@ call plug#begin(root . 'plugged') Plug 'jamessan/vim-gnupg', { 'commit': 'f9b608f' } Plug 'junegunn/goyo.vim' Plug 'junegunn/limelight.vim' - +Plug 'girishji/vimcomplete' call plug#end() set nobackup "no backup files @@ -60,7 +60,6 @@ map map -command Date :r! date "+\%Y-\%m-\%d \%H:\%M" :nnoremap ns i## :Date diff --git a/.vim/basic-config.vim b/.vim/basic-config.vim deleted file mode 100644 index cbc58c44..00000000 --- a/.vim/basic-config.vim +++ /dev/null @@ -1,48 +0,0 @@ -" https://stackoverflow.com/questions/743150/how-to-prevent-vim-from-creating-and-leaving-temporary-files -set nobackup "no backup files -set nowritebackup "only in case you don't want a backup file while editing -set noswapfile "no swap files -" https://stackoverflow.com/questions/2816719/clear-the-viminfo-file -set viminfo= "no ~/.viminfo file - -" Essential: use proper encryption by default -" https://dgl.cx/2014/10/vim-blowfish -:setlocal cm=blowfish2 - -" Line Numbers -set number -" turn hybrid line numbers on -set number relativenumber - -" Highlight current line -set cursorline - -" hlsearch word Taken from http://nvie.com/posts/how-i-boosted-my-vim/ -set autoindent " always set autoindenting on -set copyindent " copy the previous indentation on autoindenting -set showmatch " set show matching parenthesis -set ignorecase " ignore case when searching -set smartcase " ignore case if search pattern is all lowercase, - " case-sensitive otherwise -set hlsearch " highlight search terms -set incsearch " show search matches as you type - - -set encoding=utf-8 " Use UTF-8 everywhere. -set termencoding=utf-8 - - -set wrap -set linebreak -syntax enable - -set nocompatible -filetype plugin on - - - - -command! -bang -nargs=* GGrep - \ call fzf#vim#grep( - \ 'git grep --line-number -- '.shellescape(), 0, - \ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), 0) diff --git a/.vim/fzf.vim b/.vim/fzf.vim deleted file mode 100644 index 0044aef1..00000000 --- a/.vim/fzf.vim +++ /dev/null @@ -1,5 +0,0 @@ -nnoremap :Files! -let g:fzf_action = { - \ 'ctrl-t': 'tab split', - \ 'ctrl-i': 'split', - \ 'ctrl-v': 'vsplit' } diff --git a/.vim/keys.vim b/.vim/keys.vim deleted file mode 100644 index 497be97d..00000000 --- a/.vim/keys.vim +++ /dev/null @@ -1,18 +0,0 @@ -" https://vi.stackexchange.com/questions/2162/why-doesnt-the-backspace-key-work-in-insert-mode#answer-2163 -set backspace=indent,eol,start - -let mapleader="," -nnoremap b :call gitblame#echo() - - - -" Map C-Y C-N to Control Space -" https://vi.stackexchange.com/questions/21457/how-to-remap-autocomplete-on-controln-to-controlspace#answer-21469 -inoremap - -map -map - - -map :GFiles -map :GGrep diff --git a/.vim/commands.vim b/.vim/plugin/command-date.vim similarity index 56% rename from .vim/commands.vim rename to .vim/plugin/command-date.vim index 7449dd75..7d928cf1 100644 --- a/.vim/commands.vim +++ b/.vim/plugin/command-date.vim @@ -1,7 +1,3 @@ -" Open current editor file externally -nnoremap gO :!open '%:p' - - function Date() :r! date "+\%Y-\%m-\%d \%H:\%M" endfunction diff --git a/.vim/plugin/commands.vim b/.vim/plugin/command-deletethis.vim similarity index 100% rename from .vim/plugin/commands.vim rename to .vim/plugin/command-deletethis.vim diff --git a/.vim/plugin/command-openexternally.vim b/.vim/plugin/command-openexternally.vim new file mode 100644 index 00000000..80f62e4a --- /dev/null +++ b/.vim/plugin/command-openexternally.vim @@ -0,0 +1,3 @@ +" Open current editor file externally +nnoremap gO :!open '%:p' + diff --git a/.vim/plugin/keys-fzf-awesomeness.vim b/.vim/plugin/keys-fzf-awesomeness.vim new file mode 100644 index 00000000..26d32556 --- /dev/null +++ b/.vim/plugin/keys-fzf-awesomeness.vim @@ -0,0 +1,12 @@ +command! -bang -nargs=* GGrep + \ call fzf#vim#grep( + \ 'git grep --line-number -- '.shellescape(), 0, + \ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), 0) + +let g:fzf_action = { + \ 'ctrl-t': 'tab split', + \ 'ctrl-i': 'split', + \ 'ctrl-v': 'vsplit' } + +map :GFiles +map :GGrep diff --git a/.vim/plugin/keys-leader.vim b/.vim/plugin/keys-leader.vim new file mode 100644 index 00000000..338bdd30 --- /dev/null +++ b/.vim/plugin/keys-leader.vim @@ -0,0 +1,4 @@ +let mapleader="," + +nnoremap b :call gitblame#echo() + diff --git a/.vim/plugin/keys-make-backspace-great-again.vim b/.vim/plugin/keys-make-backspace-great-again.vim new file mode 100644 index 00000000..a9bd9da4 --- /dev/null +++ b/.vim/plugin/keys-make-backspace-great-again.vim @@ -0,0 +1,3 @@ +" https://vi.stackexchange.com/questions/2162/why-doesnt-the-backspace-key-work-in-insert-mode#answer-2163 +set backspace=indent,eol,start + diff --git a/.vim/plugin/keys-paragraph-jumping.vim b/.vim/plugin/keys-paragraph-jumping.vim new file mode 100644 index 00000000..81a3354a --- /dev/null +++ b/.vim/plugin/keys-paragraph-jumping.vim @@ -0,0 +1,3 @@ +map +map + diff --git a/.vim/plugin/special-files.vim b/.vim/plugin/special-files.vim index 37db1d3a..25804aa8 100644 --- a/.vim/plugin/special-files.vim +++ b/.vim/plugin/special-files.vim @@ -14,3 +14,9 @@ autocmd BufWritePre ~/.config/stew/Stewfile :%sort autocmd BufWritePre ~/.config/newsboat/killfile :%sort autocmd BufWritePre ~/.config/newsboat/highlights :%sort autocmd BufWritePre ~/.config/newsboat/highlights :%sort + +autocmd BufRead,BufNewFile reflections setfiletype reflections +autocmd BufRead,BufNewFile urls,config setfiletype conf.tabsep + +autocmd BufRead compose*.yml source ~/.vim/files/docker-compose.vim + diff --git a/.vim/theme.vim b/.vim/plugin/theme.vim similarity index 87% rename from .vim/theme.vim rename to .vim/plugin/theme.vim index ad32e6cf..06203766 100644 --- a/.vim/theme.vim +++ b/.vim/plugin/theme.vim @@ -1,8 +1,3 @@ -let g:gruvbox_transparent_bg = 1 -let g:gruvbox_contrast_light = "hard" -colorscheme gruvbox - - hi CursorLine term=bold cterm=bold guibg=Grey40 hi Folded ctermbg=NONE guibg=NONE diff --git a/.vim/plugin/vimcompletion.vim b/.vim/plugin/vimcompletion.vim new file mode 100644 index 00000000..32892cde --- /dev/null +++ b/.vim/plugin/vimcompletion.vim @@ -0,0 +1,23 @@ +vim9script + +var options = { + completor: { + alwaysOn: true, + shuffleEqualPriority: true, + postfixHighlight: true + }, + buffer: { enable: true, priority: 10, urlComplete: true, envComplete: true }, + abbrev: { enable: true, priority: 10 }, + omnifunc: { enable: false, priority: 8, filetypes: ['python', 'javascript'] }, + ngram: { + enable: true, + priority: 10, + bigram: false, + filetypes: ['text', 'help', 'markdown'], + filetypesComments: ['c', 'cpp', 'python', 'java'], + }, +} +g:vimcomplete_tab_enable = 1 +g:vimcomplete_cr_enable = 0 + +autocmd VimEnter * g:VimCompleteOptionsSet(options) diff --git a/.vim/plugins.vim b/.vim/plugins.vim index 0d7d5d5f..f42b2237 100644 --- a/.vim/plugins.vim +++ b/.vim/plugins.vim @@ -28,4 +28,5 @@ Plug 'stsewd/gx-extended.vim' Plug 'tpope/vim-fugitive' Plug 'vimwiki/vimwiki' Plug 'zivyangll/git-blame.vim' +Plug 'girishji/vimcomplete' call plug#end() diff --git a/.vim/vimrc b/.vim/vimrc index 1a490a3c..11150427 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -1,4 +1,45 @@ -source ~/.vim/basic-config.vim +" https://stackoverflow.com/questions/743150/how-to-prevent-vim-from-creating-and-leaving-temporary-files +set nobackup "no backup files +set nowritebackup "only in case you don't want a backup file while editing +set noswapfile "no swap files +" https://stackoverflow.com/questions/2816719/clear-the-viminfo-file +set viminfo= "no ~/.viminfo file + +" Essential: use proper encryption by default +" https://dgl.cx/2014/10/vim-blowfish +:setlocal cm=blowfish2 + +" Line Numbers +set number +" turn hybrid line numbers on +set number relativenumber + +" Highlight current line +set cursorline + +" hlsearch word Taken from http://nvie.com/posts/how-i-boosted-my-vim/ +set autoindent " always set autoindenting on +set copyindent " copy the previous indentation on autoindenting +set showmatch " set show matching parenthesis +set ignorecase " ignore case when searching +set smartcase " ignore case if search pattern is all lowercase, + " case-sensitive otherwise +set hlsearch " highlight search terms +set incsearch " show search matches as you type + + +set encoding=utf-8 " Use UTF-8 everywhere. +set termencoding=utf-8 + + +set wrap +set linebreak +syntax enable + +set nocompatible +filetype plugin on + + " Neocomplete let g:neocomplete#enable_at_startup = 1 @@ -6,20 +47,13 @@ let g:neocomplete#enable_smart_case = 1 source ~/.vim/plugins.vim -au BufRead,BufNewFile reflections setfiletype reflections -au BufRead,BufNewFile urls,config setfiletype conf.tabsep - let g:indentLine_char = '' source ~/.vim/ale.vim -source ~/.vim/fzf.vim source ~/.vim/folds.vim source ~/.vim/vimwiki.vim -source ~/.vim/commands.vim - -autocmd BufRead docker-compose*.yml source ~/.vim/files/docker-compose.vim let g:netrw_liststyle = 3 @@ -29,5 +63,7 @@ set maxmempattern=5000 source ~/.vim/auto-dark.vim -source ~/.vim/theme.vim -source ~/.vim/keys.vim + +let g:gruvbox_transparent_bg = 1 +let g:gruvbox_contrast_light = "hard" +colorscheme gruvbox