summaryrefslogtreecommitdiff
path: root/.vimrc
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2023-04-02 16:59:59 +0200
committerMarc Vertes <mvertes@free.fr>2023-04-02 16:59:59 +0200
commitf18d246634a9e47e9e3155996a77c17a170cf47a (patch)
treef1ec091062f741c20d2387ce3261435f6c637ce7 /.vimrc
parenta4c13e982eec402ac7b7ec2c6211dcd2b8c1c7c1 (diff)
update on termux
Diffstat (limited to '.vimrc')
-rw-r--r--.vimrc98
1 files changed, 77 insertions, 21 deletions
diff --git a/.vimrc b/.vimrc
index 1e9f8a1..c0007b0 100644
--- a/.vimrc
+++ b/.vimrc
@@ -1,16 +1,35 @@
+" General vim defaults
" set background=
-" set t_te= t_ti= laststatus=2
set t_te= t_ti= ls=1 ruler
-
+set ai ts=4 sw=4 noet
+set nohlsearch
+set nois
syntax off
filetype on
filetype plugin on
filetype plugin indent on
let mapleader = ","
-set rtp+=/opt/homebrew/opt/fzf
+" Save all files at the same place
+set backupdir=~/.vim/backup//
+set directory=~/.vim/backup//
+set undodir=~/.vim/backup//
+set undofile
+set backup
+
+" Experiment: make the current dir be the same as edited file
+set autochdir
+
+"set rtp+=/opt/homebrew/opt/fzf
let g:fzf_preview = 'cat {}'
+set grepprg=rg\ --vimgrep\ --smart-case\ --hidden\ --follow
+
+nnoremap \ :Rg<CR>
+nnoremap <C-T> :Files<cr>
+nnoremap <Leader>b :Buffers<cr>
+nnoremap <Leader>s :Blines<cr>
+
" vimki plugin
autocmd filetype vimki syntax on
autocmd filetype vimki set autowrite
@@ -18,14 +37,17 @@ autocmd filetype vimki set autowrite
autocmd filetype vimki nmap <leader>z :FZF ~/Wiki<CR>
" vim-go plugin
-let g:go_def_mode = "gopls"
-let g:go_info_mode = "gopls"
-let g:go_list_type = "quickfix"
-" let g:go_fmt_command = "goimports"
-let g:go_fmt_command = "gopls"
-let g:go_gopls_gofumpt = 1
+"let g:go_def_mode = "gopls"
+"let g:go_info_mode = "gopls"
+"let g:go_list_type = "quickfix"
+"let g:go_fmt_command = "gopls"
+"let g:go_gopls_gofumpt = 1
+
+let g:go_gopls_enabled = 0
+let g:go_def_mode = "godef"
+let g:go_fmt_command = "goimports"
let g:go_metalinter_command = "golangci-lint"
-autocmd FileType go syntax on
+"autocmd FileType go syntax on
autocmd FileType go nmap <leader>b <Plug>(go-build)
autocmd FileType go nmap <leader>i <Plug>(go-info)
autocmd FileType go nmap <leader>r <Plug>(go-run)
@@ -35,21 +57,15 @@ autocmd FileType go nmap <leader>v <Plug>(go-referrers)
autocmd FileType go nmap <leader>n :cnext<CR>
autocmd FileType go nmap <leader>p :cprevious<CR>
autocmd FileType go nmap <leader>a :cclose<CR>
-autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4
+" autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4
let g:netrw_browsex_viewer = "open"
let g:netrw_gx = "<cWORD>"
let g:netrw_banner = 0
-autocmd filetype javascript,html,json,yaml set ts=2 sts=2 sw=2 et
+" python and yaml formatting:
+autocmd filetype python,yaml set ts=2 sts=2 sw=2 et
-" :set wm=2 linebreak
-" :set term=ansi
-":set modeline
-":set modelines=5
-set autoindent
-"set breakindent
-" :set ts=2 sw=2 sts=2 et
:set wrap
:set linebreak
:set nolist
@@ -76,6 +92,46 @@ hi SpellBad cterm=underline
hi SpellBad gui=undercurl
noremap <leader>n :bn<cr>
-noremap <leader><leader> :bd<cr>
-noremap <leader>o :!open <cWORD>&<cr><cr>
+"noremap <leader><leader> :bd<cr>
+noremap <leader>o :!xdg-open <cWORD>&<cr><cr>
noremap <C-g> :tag <c-r><c-w><cr>
+noremap <C-p> :Files<cr>
+
+""""""""""""" My cscope/vim key mappings
+ "
+ " The following maps all invoke one of the following cscope search types:
+ "
+ " 's' symbol: find all references to the token under cursor
+ " 'g' global: find global definition(s) of the token under cursor
+ " 'c' calls: find all calls to the function name under cursor
+ " 't' text: find all instances of the text under cursor
+ " 'e' egrep: egrep search for the word under cursor
+ " 'f' file: open the filename under cursor
+ " 'i' includes: find files that include the filename under cursor
+ " 'd' called: find functions that function under cursor calls
+
+noremap <leader>s :cs find s <C-R>=expand("<cword>")<CR><CR><tab>
+noremap <leader>g :cs find g <C-R>=expand("<cword>")<CR><CR><tab>
+noremap <leader>c :cs find c <C-R>=expand("<cword>")<CR><CR><tab>
+noremap <leader>t :cs find t <C-R>=expand("<cword>")<CR><CR><tab>
+noremap <leader>e :cs find e <C-R>=expand("<cword>")<CR><CR><tab>
+noremap <leader>i :cs find i <C-R>=expand("<cfile>")<CR><CR><tab>
+noremap <leader>f :cs find f <C-R>=expand("<cfile>")<CR><CR><tab>
+noremap <leader>d :cs find d <C-R>=expand("<cword>")<CR><CR><tab>
+
+
+function! CloseOnLast()
+ let cnt = 0
+ for i in range(0, bufnr("$"))
+ if buflisted(i)
+ let cnt += 1
+ endif
+ endfor
+ if cnt <= 1
+ q
+ else
+ bd
+ endif
+endfunction
+
+noremap <leader><leader> :call CloseOnLast()<cr>