Skip to content

Instantly share code, notes, and snippets.

@maka-io
Last active July 5, 2022 17:07
Show Gist options
  • Save maka-io/861462c928b1a0bcdeea8dcb5f75ffed to your computer and use it in GitHub Desktop.
Save maka-io/861462c928b1a0bcdeea8dcb5f75ffed to your computer and use it in GitHub Desktop.
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'puremourning/vimspector'
Plugin 'rustushki/JavaImp.vim'
let g:JavaImpDataDir = $HOME . "/vim/JavaImp"
let g:JavaImpPaths = $HOME . "/.m2/repository," . $HOME . "/Development/Surety/agency-visit-api/src/main/java"
exe "set dict=" . g:JavaImpDataDir . "/JavaImp.txt"
set complete-=k
set complete+=k
" Make transparent
if has("gui_running")
set transparency=15
endif
" Remove trailing whitespace
autocmd BufWritePre * :%s/\s\+$//e
" Start NERDTree when Vim starts with a directory argument.
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') |
\ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] | endif
" Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" Set the color
colorscheme desert
" TODO: this may not be in the correct place. It is intended to allow overriding <Leader>.
" source ~/.vimrc.before if it exists.
if filereadable(expand("~/.vimrc.before"))
source ~/.vimrc.before
endif
" ================ General Config ====================
set number "Line numbers are good
set backspace=indent,eol,start "Allow backspace in insert mode
set history=1000 "Store lots of :cmdline history
set showcmd "Show incomplete cmds down the bottom
set showmode "Show current mode down the bottom
set gcr=a:blinkon0 "Disable cursor blink
set visualbell "No sounds
set autoread "Reload files changed outside vim
set spell spelllang=en_us "Turns on spell check"
set mouse=a
set encoding=UTF-8
" This makes vim act like all other editors, buffers can
" exist in the background without being in a window.
" http://items.sjbach.com/319/configuring-vim-right
set hidden
"turn on syntax highlighting
syntax on
" Change leader to a comma because the backslash is too far away
" That means all \x commands turn into ,x
" The mapleader has to be set before vundle starts loading all
" the plugins.
let mapleader="\<space>"
" =============== Vundle Initialization ===============
" This loads all the plugins specified in ~/.vim/vundles.vim
" Use Vundle plugin to manage all other plugins
if filereadable(expand("~/.vim/vundles.vim"))
source ~/.vim/vundles.vim
endif
au BufNewFile,BufRead *.vundle set filetype=vim
" ================ Turn Off Swap Files ==============
set noswapfile
set nobackup
set nowb
" ================ Persistent Undo ==================
" Keep undo history across sessions, by storing in file.
" Only works all the time.
if has('persistent_undo') && isdirectory(expand('~').'/.vim/backups')
silent !mkdir ~/.vim/backups > /dev/null 2>&1
set undodir=~/.vim/backups
set undofile
endif
" ================ Indentation ======================
set autoindent
set smartindent
set smarttab
set shiftwidth=2
set softtabstop=2
set tabstop=2
set expandtab
" Auto indent pasted text
nnoremap p p=`]<C-o>
nnoremap P P=`]<C-o>
filetype plugin on
filetype indent on
" Display tabs and trailing spaces visually
set list listchars=tab:\ \ ,trail:·
set nowrap "Don't wrap lines
set linebreak "Wrap lines at convenient points
" ================ Folds ============================
set foldmethod=indent "fold based on indent
set foldnestmax=3 "deepest fold is 3 levels
set nofoldenable "dont fold by default
" ================ Completion =======================
set wildmode=list:longest
set wildmenu "enable ctrl-n and ctrl-p to scroll thru matches
set wildignore=*.o,*.obj,*~ "stuff to ignore when tab completing
set wildignore+=*vim/backups*
set wildignore+=*sass-cache*
set wildignore+=*DS_Store*
set wildignore+=vendor/rails/**
set wildignore+=vendor/cache/**
set wildignore+=*.gem
set wildignore+=log/**
set wildignore+=*.png,*.jpg,*.gif
" ================ Scrolling ========================
set scrolloff=2 "Start scrolling when we're 8 lines away from margins
set sidescrolloff=2
set sidescroll=1
" ================ Search ===========================
set incsearch " Find the next match as we type the search
set hlsearch " Highlight searches by default
set ignorecase " Ignore case when searching...
set smartcase " ...unless we type a capital
" ================ Custom Settings ========================
execute pathogen#infect()
let g:javascript_plugin_jsdoc = 1
let g:javascript_plugin_flow = 1
" autocmd VimEnter * NERDTree
let g:vimspector_enable_mappings = 'HUMAN'
noremap <Leader>db :call vimspector#Launch()<CR>
noremap <Leader>sdb :call vimspector#Stop()<CR>
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'maka-io/vim-lsp-settings'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
call plug#end()
let g:coc_global_extensions = ['coc-tsserver']
" Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup
" Give more space for displaying messages.
set cmdheight=2
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=1000
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
if has("nvim-0.5.0") || has("patch-8.1.1564")
" Recently vim can merge signcolumn and number column into one
set signcolumn=number
else
set signcolumn=yes
endif
" Use K to show documentation in preview window.
nnoremap <silent> K :call <SID>show_documentation()<CR>
hi default CocErrorSign ctermfg=Green guifg=#00ff00 guibg=NONE
hi default link CocErrorFloat CocErrorSign
" au User call lsp#register_server({
" \ 'name': 'eclipse-jdt-ls',
" \ 'cmd': {server_info->[
" \ 'java',
" \ '-Declipse.application=org.eclipse.jdt.ls.core.id1',
" \ '-Dosgi.bundles.defaultStartLevel=4',
" \ '-Declipse.product=org.eclipse.jdt.ls.core.product',
" \ '-Dlog.level=ALL',
" \ '-noverify',
" \ '-Xmx1G',
" \ '-jar',
" \ expand('~/.local/bin/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar'),
" \ '-configuration',
" \ expand('~/.config'),
" \ '-data',
" \ getcwd()
" \ ]},
" \ 'allowlist': ['java'],
" \ })
let g:lsp_settings = {
\ 'eclipse-jdt-ls': {
\ 'initializationOptions': {
\ 'bundles': [
\ '/Users/mjc/.m2/repository/com/microsoft/java/com.microsoft.java.debug.plugin/0.34.0/com.microsoft.java.debug.plugin-0.34.0.jar'
\ ]
\ }
\ }
\ }
"call lsp#send_request('eclipse-jdt-ls', {'method': 'workspace/executeCommand', 'params': {'command': 'vscode.java.startDebugSession'}, 'on_notification': function('lsp#utils#error')})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment