diff --git a/.vimrc b/.vimrc index 20c526c..6412d2b 100644 --- a/.vimrc +++ b/.vimrc @@ -1,14 +1,14 @@ set nocompatible " use vim defaults -set scrolloff=0 " keep n lines when scrolling +set scrolloff=4 " keep n lines when scrolling set ai " set auto-indenting on for programming, autoindent set showcmd " display incomplete commands -" set nobackup " do not keep a backup file +set nobackup " do not keep a backup file set number " show line numbers set ruler " show the current row and column -set hlsearch " highlight searches hls -set incsearch " do incremental searching is +set hlsearch " highlight searches +set incsearch " do incremental searching set showmatch " jump to matches when entering regexp set ignorecase " ic ignore case when searching @@ -27,33 +27,19 @@ filetype indent on " load indent file for specific file type set t_RV= " http://bugs.debian.org/608242, http://groups.google.com/group/vim_dev/browse_thread/thread/9770ea844cec3282 +set t_ti= t_te= + set rnu "relativenumber " colorscheme default -set showmode " smd - -set backup -set backupdir=~/backupdir -" set patchmode=.orig - -"set nowrapscan " stop search at the end of the file nows ws -set wrapscan -" just change ts when there is other size tab like JS is 2, py is 4 " -" Number of visual spaces per TAB +" just change ts when there is other size tab like JS is 2, py is 4 set tabstop=4 " set ts=4 -" Number of spaces indented when reindent operations (>> and <<) are used -" if 0 that tabstop value set shiftwidth=0 -" Number of spaces in TAB when editing set softtabstop=-1 -" Convert TABs to spaces set expandtab " set et, set noet -" Enable intelligent tabbing and spacing for indentation and alignment -set smarttab - set hidden set ls=2 "laststatus set autoread @@ -71,10 +57,6 @@ set wop="pum,tagfile" "wildoptions nnoremap Y y$ -nnoremap !b !!bash -nnoremap !t :.terminal ++noclose ++curwin -xnoremap != "tygvs=t -nnoremap != "tcc=t " like neovim PA " not needed since vim 9 it is the default xnoremap P a gv"_dPa @@ -84,20 +66,20 @@ nnoremap n nzz nnoremap N Nzz nnoremap zz nnoremap zz - if ! has('win32')| set guifont=Fira\ Code\ 14 | endif if has('win32')| set guifont=Fira_code:h14:cANSI:qDRAFT | endif set guiligatures=!\"#$%&()*+-./:<=>?@[]^_{\|~>< set guioptions= -" set guioptions-=m -" set guioptions-=T -" set guioptions-=r set renderoptions=type:directx set encoding=utf-8 set colorcolumn=80,120 -" neovim remap +nnoremap Q gq +nnoremap QQ gqgq +vnoremap Q gq + +" neovim remap test nnoremap nohlsearchdiffupdatenormal! inoremap u inoremap u @@ -121,7 +103,9 @@ xnoremap p "+p nnoremap Tex nnoremap Tex -let g:netrw_fastbrowse=2 +let g:netrw_fastbrowse=2 " not reload and alternative file (C-^) is netrw (like :Rex) +" let g:netrw_fastbrowse=0 " reload the list and alternative file (C-^) is last text buffer + " nnoremap :Explore:Rexplore nnoremap Explore @@ -135,22 +119,10 @@ nnoremap j lnextzz nnoremap k lprevzz nnoremap ss :%s/\<\>//gI xnoremap ss "ty:%s/t/t/gI - -let searchgrep = ':lvimgrep! '''' ./*/**\|lopen10h' -nnoremap / @=searchgrep -nnoremap sd @=searchgrep - - -let xsearchgrep = '"ty:lvimgrep! ''t'' ./*/**\|lopen10h' -xnoremap / @=xsearchgrep -xnoremap sd @=xsearchgrep - -let searchgrepprojet = ':lgrep ''''\| lopen8hi' -nnoremap sp @=searchgrepprojet - -let xsearchgrepprojet = '"ty:lgrep ''t''\| lopen8hi' -xnoremap sp @=xsearchgrepprojet - +nnoremap / :lvimgrep! "\<\>" ./*/**\|lopen +xnoremap / "ty:lvimgrep! 't' ./*/**\|lopen +nnoremap sp :lvimgrep! "\<\>" ./*/**\|lopen +xnoremap sp "ty:lvimgrep! 't' ./*/**\|lopen " nnoremap p :n %/**/** " nnoremap p :n ./**/** " nnoremap q:ie **/* @@ -178,7 +150,7 @@ nnoremap b[ :bp nnoremap bl :blast nnoremap bS :wa nnoremap bs :w -if ! has('win32') | nnoremap bu :w! !sudo tee % | endif +if ! has('win32') | nnoremap bu :w !sudo tee % | endif nnoremap qq :qa nnoremap qQ :qa! @@ -192,12 +164,13 @@ nnoremap tr :set readonly! nnoremap tw :set wrap! nnoremap n :tabnew nnoremap n :tabnew -nnoremap v :tabedit % -nnoremap v :tabedit % -nnoremap s :tabedit % -nnoremap s :tabedit % -nnoremap :tabedit % -nnoremap :tabedit % +let duplicatenewtab = 'vT' +nnoremap v @=duplicatenewtab +nnoremap v @=duplicatenewtab +nnoremap s @=duplicatenewtab +nnoremap s @=duplicatenewtab +nnoremap @=duplicatenewtab +nnoremap @=duplicatenewtab nnoremap of tabnew nnoremap d :tabclose nnoremap d :tabclose @@ -240,17 +213,11 @@ nnoremap cx :copen nnoremap op :Lexplore nnoremap gcc :!git commit -let gitcheckout = ':terminal -:resize -git branch -l -git checkout ' -nnoremap gb @=gitcheckout -" nnoremap gb q:gg"_dG:r!git branch -a:resizeo!git checkout +nnoremap gb q:gg"_dG:r!git branch -a:resizeo!git checkout " nnoremap gb :!git branch -a && bashgit t checkout checkout nnoremap gB :!git blame '%' " nnoremap gg :!clear&&git status nnoremap ggg :!clear&&git status --show-stash&&git add --interactive -" nnoremap ggg :!clear&&git status --show-stash&&git commit --interactive nnoremap ggp :!git push nnoremap gp :!git push nnoremap ggF :!git pull @@ -270,8 +237,6 @@ xnoremap iF "%p let insertFileName = 'm''o%vT/"ty"_dd"tp' nnoremap if @=insertFileName xnoremap if o%a"tyT/"_ddgv"tp -nnoremap id i=strftime("%Y%m%d%H%M%S") - nnoremap hrr :!reset xnoremap hrr :!reset @@ -368,12 +333,26 @@ function! NetrwMapping() noremap X :cd % \| !explorer . endfunction -let g:netrw_browsex_viewer= "xdg-open" +" let g:netrw_browsex_viewer= "xdg-open" +if has('win32') || has('win64') + let g:netrw_browsex_viewer= "open" +endif " end remap netrw " map " set shell=C:\Program\ Files\Git\bin\bash +" Check if running on Windows + +if has('win32') || has('win64') + " Use Bash for :ter and :! commands on Windows + set shell=\"C:\\Program\ Files\\Git\\bin\\bash.exe\" + set shellcmdflag=-c + set shellquote= + set shellxquote=\" +endif +" gvim -c ter -c on + let g:netrw_keepdir = 1 " 1 is the default keep current let g:netrw_localcopydircmd = 'cp -r' @@ -387,6 +366,8 @@ let g:netrw_banner = 0 " set omnifunc=syntaxcomplete#Complete " the default si : set complete=.,w,b,u,t,i +" :h E535 +" set complete=.,w,b,u,i set complete=. set noswapfile set nowrap @@ -436,7 +417,7 @@ command Diff exec ":!git diff '%'" command DiffMaster exec ":!git diff HEAD..master '%'" command DiffMain exec ":!git diff HEAD..main '%'" -set efm=%m "errorformat +"set efm=%m "errorformat " setlocal efm=Date:%m,P%m,F%m,N%m,%f:%l | autocmd Filetype css setlocal tabstop=4 | setlocal et autocmd Filetype python setlocal tabstop=4 | setlocal et @@ -452,6 +433,7 @@ autocmd Filetype pug setlocal tabstop=2 | setlocal et autocmd Filetype json setlocal tabstop=2 | setlocal et autocmd Filetype sh setlocal tabstop=4 | setlocal et | nnoremap K K autocmd Filetype arduino setlocal tabstop=2 | setlocal et +autocmd Filetype c setlocal tabstop=4 | setlocal et " autocmd Filetype markdown setlocal spell | setlocal spelllang=fr @@ -470,16 +452,4 @@ let printPython = "yiwoprint('0: ', 0)" let consolelog = 'yiwoconsole.log(''"'', ");' - -" try | Rex | catch /^Vim\%((\a\+)\)\=:E492:/ | E | endtry -" try | Rex | catch /.*/ | E | endtry - -set gp=git\ grep\ -n - -" let g:ale_set_loclist = 0 -" let g:ale_set_quickfix = 0 -" set omnifunc=ale#completion#OmniFunc -" nnoremap gh :ALEHover -" xnoremap gh :ALEHover - - +set omnifunc=lsp#complete