Last active
January 12, 2021 18:05
-
-
Save pocco81/ff59a716c4cbfa44a95daef4d817e9b8 to your computer and use it in GitHub Desktop.
this is my old .vimrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if $COLORTERM == 'gnome-terminal' | |
set t_Co=256 | |
endif | |
set shell=bash | |
map <C-z> u | |
set nocompatible " be iMproved, required | |
filetype on " required | |
" Helps force plug-ins to load correctly when it is turned back on below. | |
"filetype off | |
" Avoid annoying noise after skipping a line | |
set noerrorbells | |
" Turn on syntax highlighting. | |
syntax on | |
" For plug-ins to load correctly. | |
filetype plugin indent on | |
set clipboard=unnamedplus | |
" Turn off modelines | |
set modelines=0 | |
" Automatically wrap text that extends beyond the screen length. | |
set nowrap | |
" Vim's auto indentation feature does not work properly with text copied from outside of Vim. Press the <F2> key to toggle paste mode on/off. | |
nnoremap <F2> :set invpaste paste?<CR> | |
imap <F2> <C-O>:set invpaste paste?<CR> | |
set pastetoggle=<F2> | |
" Uncomment below to set the max textwidth. Use a value corresponding to the width of your screen. | |
" set textwidth=79 | |
set formatoptions=tcqrn1 | |
set tabstop=4 | |
set shiftwidth=4 | |
set softtabstop=4 | |
set expandtab | |
set noshiftround | |
set smartindent | |
set mouse=a | |
set noswapfile | |
" Display 5 lines above/below the cursor when scrolling with a mouse. | |
set scrolloff=5 | |
" Fixes common backspace problems | |
set backspace=indent,eol,start | |
" Speed up scrolling in Vim | |
set ttyfast | |
" Status bar | |
set laststatus=2 | |
" Display options | |
set showmode | |
set showcmd | |
" Highlight matching pairs of brackets. Use the '%' character to jump between them. | |
set matchpairs+=<:> | |
" Display different types of white spaces. | |
set list | |
set listchars=tab:›\ ,trail:•,extends:#,nbsp:. | |
" Show line numbers | |
set number | |
" Set status line display | |
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ [BUFFER=%n]\ %{strftime('%c')} | |
" Encoding | |
set encoding=utf-8 | |
set fileencoding=utf-8 | |
"set encoding=latin1 | |
" Highlight matching search patterns | |
set hlsearch | |
" Enable incremental search | |
set incsearch | |
" Include matching uppercase words with lowercase search term | |
set ignorecase | |
" Include only uppercase words with uppercase search term | |
set smartcase | |
" Store info from no more than 100 files at a time, 9999 lines of text, 100kb of data. Useful for copying large amounts of data between files. | |
set viminfo='100,<9999,s100 | |
" Map the <Space> key to toggle a selected fold opened/closed. | |
nnoremap <silent> <Space> @=(foldlevel('.')?'za':"\<Space>")<CR> | |
vnoremap <Space> zf | |
" Automatically save and load folds | |
autocmd BufWinLeave *.* mkview | |
autocmd BufWinEnter *.* silent loadview" | |
" Pluggins | |
call plug#begin('~/.vim/plugged') | |
Plug 'gruvbox-community/gruvbox' | |
Plug 'mbbill/undotree' | |
Plug 'tpope/vim-fugitive' | |
Plug 'vim-utils/vim-man' | |
Plug 'mbbill/undotree' | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'scrooloose/nerdtree' | |
Plug 'Xuyuanp/nerdtree-git-plugin' | |
Plug 'tiagofumo/vim-nerdtree-syntax-highlight' | |
Plug 'euclidianAce/BetterLua.vim' | |
Plug 'nvim-treesitter/highlight.lua' | |
"Plug 'nvim-treesitter/nvim-treesitter' | |
Plug 'ctrlpvim/ctrlp.vim' " fuzzy find files | |
Plug 'scrooloose/nerdcommenter' | |
Plug 'majutsushi/tagbar' | |
Plug 'ryanoasis/vim-devicons' | |
Plug 'cskeeters/javadoc.vim' | |
Plug 'junegunn/goyo.vim' | |
Plug 'junegunn/limelight.vim' | |
Plug 'vim-airline/vim-airline' | |
Plug 'Dinduks/vim-java-get-set' | |
Plug 'Yggdroot/indentLine' | |
Plug 'tpope/vim-commentary' | |
"Plug 'psliwka/vim-smoothie' | |
Plug 'yuttie/comfortable-motion.vim' | |
Plug 'preservim/nerdcommenter' | |
Plug 'sheerun/vim-polyglot' | |
"Plug 'nathanaelkane/vim-indent-guides' | |
"Plug 'dense-analysis/ale' | |
"Plug 'junegunn/vim-javacomplete2', {'for': 'java'} " Load only for java files | |
"Plug 'justinmk/vim-sneak' | |
" Plug 'unblevable/quick-scope' | |
call plug#end() " note: open javadoc.vim using ',j'. more info: https://github.com/cskeeters/javadoc.vim | |
"------------" | |
inoremap <C-w> <C-\><C-o>dB | |
inoremap <C-BS> <C-\><C-o>db | |
noremap! <C-BS> <C-w> | |
noremap! <C-h> <C-w> | |
"---------------" | |
" | |
" nnoremap <C-V> p | |
" inoremap <C-V> <C-O>P | |
" vnoremap <C-V> p | |
" vnoremap <C-C> y | |
" vnoremap <C-X> x | |
"fan modes: | |
" + 2 = silent | |
" + 0 = balance | |
" + 1 = turbo | |
" nnoremap <silent> <C-d> :call comfortable_motion#flick(100)<CR> | |
" nnoremap <silent> <C-u> :call comfortable_motion#flick(-100)<CR> | |
" nnoremap <silent> <C-f> :call comfortable_motion#flick(200)<CR> | |
" nnoremap <silent> <C-b> :call comfortable_motion#flick(-200)<CR> | |
" noremap <silent> <ScrollWheelDown> :call comfortable_motion#flick(45)<CR> | |
" noremap <silent> <ScrollWheelUp> :call comfortable_motion#flick(-45)<CR> | |
let g:comfortable_motion_friction = 950.0 | |
let g:comfortable_motion_air_drag = 1.0 | |
" vim-airline config | |
" having something like: "2gt is just the same as pressing 2gt :) | |
"vmap <C-c> "+yi | |
"vmap <C-x> "+c | |
"vmap <C-v> c<ESC>"+p | |
"imap <C-v> <ESC>"+pa | |
"map :ibgs :InsertBothGetterSetter<CR> | |
"command Ibgs InsertBothGetterSetter<CR> | |
"https://superuser.com/questions/93492/how-to-add-a-command-in-vim-editor | |
"setters and getters in java | |
"the first two are the same | |
map <leader>sg :InsertBothGetterSetter<CR> | |
map <leader>gs :InsertBothGetterSetter<CR> | |
map <leader>se :InsertSetterOnly<CR> | |
map <leader>ge :InsertGetterOnly<CR> | |
"make code in vim more readable | |
set cursorline | |
"autocmd VimEnter * set cursorline . | |
let g:indentLine_defaultGroup = 'SpecialKey' | |
let g:indentLine_color_term = 239 | |
"let g:indentLine_char = 'c' | |
"let g:indentLine_setColors = 0 | |
"let g:indentLine_char_list = ['|', '¦', '┆', '┊'] | |
"let g:indentLine_char_list = ['¦', '┆'] | |
"let g:indent_guides_enable_on_vim_startup = 1 | |
"let g:indent_guides_guide_size = 1 | |
"java setters and gettters | |
"map jgs mawv/ <CR>"ty/ <CR>wvwh"ny/getters<CR>$a<CR><CR><Esc>xxapublic <Esc>"tpa<Esc>"npbiget<Esc>l~ea(){<CR><Tab>return <Esc>"npa;<CR>}<Esc>=<CR><Esc>/setters<CR>$a<CR><CR><Esc>xxapublic void <Esc>"npbiset<Esc>l~ea(<Esc>"tpa <Esc>"npa)<CR>{<CR><Tab>this.<Esc>"npa= <Esc>"npa;<CR>}<Esc>=<CR>`ak | |
" Go to tab by number | |
noremap <leader>1 1gt | |
noremap <leader>2 2gt | |
noremap <leader>3 3gt | |
noremap <leader>4 4gt | |
noremap <leader>5 5gt | |
noremap <leader>6 6gt | |
noremap <leader>7 7gt | |
noremap <leader>8 8gt | |
noremap <leader>9 9gt | |
noremap <leader>0 :tablast<cr> | |
"nmap <A>s :w<CR> | |
"imap <A>s <Esc>:w<CR>a | |
"map on insert mode Alt+s to pressing Esc, then typing :w and then Enter | |
"https://stackoverflow.com/questions/3446320/in-vim-how-to-map-save-to-ctrl-s | |
" Enable the list of buffers | |
"let g:airline#extensions#tabline#enabled = 1 | |
" Show just the filename | |
"let g:airline#extensions#tabline#fnamemod = ':t' | |
"this command os for turning vim airline off (kind of) note: put the " symbol | |
"at the end | |
"let g:airline_section_z = "%p%% : \ue0a1:%l/%L: Col:%c | |
" | |
colorscheme gruvbox | |
set background=dark | |
" Ctrl-b to open Tagbar | |
"map <S-Tab> :TagbarToggle<CR> "use this one for having tagbar open normally | |
map <S-Tab> :TagbarOpenAutoClose<CR> | |
"tagbar autoclose will close tagbar as soon as you press onter on x function | |
let g:tagbar_autofocus = 1 "move cursor to tagbar as soon as it's toggled | |
"refer to this two liks for more info: | |
"https://github.com/preservim/tagbar/blob/master/doc/tagbar.txt#L586 | |
"https://www.reddit.com/r/vim/comments/kk8jyw/how_to_automatically_switch_to_a_new_buffer_i/ | |
"limelight configs | |
" Default: 0.5 | |
let g:limelight_default_coefficient = 0.7 | |
let g:limelight_paragraph_span = 1 | |
" Color name (:help cterm-colors) or ANSI code | |
let g:limelight_conceal_ctermfg = 'gray' | |
let g:limelight_conceal_ctermfg = 240 | |
" Color name (:help gui-colors) or RGB color | |
let g:limelight_conceal_guifg = 'DarkGray' | |
let g:limelight_conceal_guifg = '#777777' | |
"note: :Limelight = turn on limelight | |
":Limelight! = turn off limelight | |
":Limelight!! = turn on/off | |
"mn: <leader> = \ | |
"mapping :Goyo to \gy | |
map <leader>gy :Goyo<CR> | |
map <leader>ll :Limelight!!<CR> | |
"turning text wrapping on | |
":set wrap | |
"turning text wrapping off | |
":set nowrap | |
map <leader>wr :set wrap<CR> | |
map <leader>nwr :set nowrap<CR> | |
"this is for toggling limelight as soon as goyo is toggled | |
"autocmd! User GoyoEnter Limelight | |
"autocmd! User GoyoLeave Limelight! | |
set shell=bash | |
let g:goyo_width = 120 | |
let g:goyo_height = 85 | |
let g:goyo_linenr = 0 | |
" Setup compilers for languages | |
let g:ale_linters = { | |
\ 'cs':['syntax', 'semantic', 'issues'], | |
\ 'python': ['pylint'], | |
\ 'java': ['javac'] | |
\ } | |
vmap <C-c> "+yi | |
vmap <C-x> "+c | |
vmap <C-v> c<ESC>"+p | |
imap <C-v> <ESC>"+pa | |
" Java completion | |
"autocmd FileType java setlocal omnifunc=javacomplete#Complete | |
" autocmd FileType java JCEnable fds | |
"autocmd FileType .java setlocal commentstring=#\ %s | |
"autocmd FileType lisp setl cms=;%s | |
"autocmd FileType kotlin set commentstring=//\ %s | |
autocmd FileType c,cpp,cs,java,kotlin setlocal commentstring=//%s | |
filetype plugin on | |
" NERDTree key mapping | |
map <F2> :NERDTreeToggle<CR> | |
map <Tab> :NERDTreeToggle<CR> | |
" move between vim tabs | |
map <PageUp> :tabn<CR> | |
map <PageDown> :tabp<CR> | |
map <S-PageDown> :tabr<CR> | |
map <S-PageUp> :tabl<CR> | |
"map <S-l> :tabs<CR> | |
"map <C-Tab> :tabn<CR> | |
"more info: https://superuser.com/questions/277787/vim-map-a-key-combination-while-in-insert-mode | |
"mn: replace <Esc> with <C-O> in case you want to end up in insert mode instead of normal | |
inoremap <PageUp> <Esc>:tabn<CR> | |
inoremap <PageDown> <Esc>:tabp<CR> | |
inoremap <S-PageDown> <Esc>:tabr<CR> | |
inoremap <S-PageUp> <Esc>:tabl<CR> | |
"inoremap <S-l> <Esc>:tabs<CR> | |
"inoremap <C-Tab> <Esc>:tabn<CR> | |
let g:coc_global_extensions = [ | |
\ 'coc-snippets', | |
\ 'coc-pairs', | |
\ 'coc-tsserver', | |
\ 'coc-eslint', | |
\ 'coc-prettier', | |
\ 'coc-json', | |
\ 'coc-clangd', | |
\ 'coc-css', | |
\ 'coc-cssmodules', | |
\ 'coc-emmet', | |
\ 'coc-highlight', | |
\ 'coc-git', | |
\ 'coc-gist', | |
\ 'coc-html', | |
\ 'coc-java', | |
\ 'coc-markdownlint', | |
\ 'coc-python', | |
\ 'coc-sh', | |
\ 'coc-lua', | |
\ 'coc-kotlin-dev', | |
\ 'coc-emoji-shortcodes', | |
\ 'coc-marketplace', | |
\ 'coc-lists', | |
\ 'coc-translator', | |
\ 'coc-spell-checker', | |
\ 'coc-tabnine', | |
\ ] | |
"prevent TextEdit from failing | |
set hidden | |
set cmdheight=1 | |
set updatetime=300 | |
" Add `:Format` command to format current buffer. | |
command! -nargs=0 Format :call CocAction('format') | |
" Add `:Fold` command to fold current buffer. | |
command! -nargs=? Fold :call CocAction('fold', <f-args>) | |
" Add `:OR` command for organize imports of the current buffer. | |
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') | |
" Add (Neo)Vim's native statusline support. | |
" NOTE: Please see `:h coc-status` for integrations with external plugins that | |
" provide custom statusline: lightline.vim, vim-airline. | |
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} | |
" moving to left, right, up & down | |
map <S-Left> <C-w>h | |
map <S-Down> <C-w>j | |
map <S-Up> <C-w>k | |
map <S-Right> <C-w>l | |
" map <C-S-Right> <C-w>l "as a matter of fact, this works! (Ctrl+Shift+Arrow) | |
" rearranging windows to left, right, down and up | |
map <C-S-Left> <C-w>H | |
map <C-S-Down> <C-w>J | |
map <C-S-Up> <C-w>K | |
map <C-S-Right> <C-w>L | |
"originals of the one above | |
"map <C-h> <C-w>h | |
"map <C-j> <C-w>j | |
"map <C-k> <C-w>k | |
"map <C-l> <C-w>l | |
" | |
au BufEnter *.java :highlight java_class cterm=bold,italic | |
au BufEnter *.java :match java_class /class/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment