Last active
March 8, 2021 17:21
-
-
Save cjgratacos/5ee75b44a4c3606c584bf3b9ec7d954a to your computer and use it in GitHub Desktop.
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 !exists('g:vscode') | |
set nocompatible | |
let mapleader = "\<Space>" | |
lua require('plugins') | |
lua require('themes') | |
lua require('servers') | |
lua require('debugger') | |
lua require('mappings') | |
augroup highlight_yank | |
autocmd! | |
autocmd TextYankPost * silent! lua require'vim.highlight'.on_yank() | |
augroup end | |
augroup jdtls_lsp | |
autocmd! | |
autocmd FileType java lua require'jdtls_setup'.setup() | |
augroup end | |
" lua vim.lsp.set_log_level("debug") | |
if has('nvim') || has('termguicolors') | |
set termguicolors | |
endif | |
if !has('gui_running') | |
set t_Co=256 | |
endif | |
let g:edge_style = 'aura' | |
colorscheme edge | |
""""""""""""""""""""""""""""""""""""""' | |
""""""""""""""""""""""""""""""""""""""' | |
"" GUI Configs | |
""""""""""""""""""""""""""""""""""""""' | |
""""""""""""""""""""""""""""""""""""""' | |
set guioptions-=T " Remove toolbar | |
set vb t_vb= " No more beeps | |
set backspace=2 " Backspace over newlines | |
set nofoldenable | |
set ttyfast | |
" https://github.com/vi/vim/issues/1735#issuecomment-383353563 | |
set lazyredraw | |
set synmaxcol=500 | |
set laststatus=2 | |
set diffopt+=iwhite " No whitespace in vimdiff | |
" Make diffing better: https://vimways.org/2018/the-power-of-diff/ | |
set diffopt+=algorithm:patience | |
set diffopt+=indent-heuristic | |
set showcmd " Show (partial) command in status line. | |
set mouse=a " Enable mouse usage (all modes) in terminals | |
set shortmess+=c " don't give |ins-completion-menu| messages. | |
" Show those damn hidden characters | |
" Verbose: set listchars=nbsp:¬,eol:¶,extends:»,precedes:«,trail:• | |
set listchars=nbsp:¬,extends:»,precedes:«,trail:• | |
set number | |
set relativenumber | |
syntax on | |
" Cursor Setup | |
set cursorline | |
set cmdheight=2 | |
set updatetime=50 | |
filetype plugin indent on | |
set autoindent | |
set timeoutlen=300 " http://stackoverflow.com/questions/2158516/delay-before-o-opens-a-new-line | |
set encoding=utf-8 | |
set scrolloff=5 | |
set noshowmode | |
set hidden | |
set nowrap | |
set nojoinspaces | |
" Always draw sign column. Prevent buffer moving when adding/deleting sign. | |
set signcolumn=yes | |
" Sane splits | |
set splitright | |
set splitbelow | |
" Permanent undo | |
set undodir=~/.vimdid | |
set undofile | |
" Use wide spaces instead of tabs | |
set shiftwidth=4 softtabstop=4 tabstop=4 expandtab | |
" Wrapping options | |
set formatoptions=tc " wrap text and comments using textwidth | |
set formatoptions+=r " continue comments when pressing ENTER in I mode | |
set formatoptions+=q " enable formatting of comments with gq | |
set formatoptions+=n " detect lists for formatting | |
set formatoptions+=b " auto-wrap in insert mode, and do not wrap old long lines | |
" Proper search | |
set incsearch | |
set ignorecase | |
set smartcase | |
set gdefault | |
" Search results centered please | |
nnoremap <silent> n nzz | |
nnoremap <silent> N Nzz | |
nnoremap <silent> * *zz | |
nnoremap <silent> # #zz | |
nnoremap <silent> g* g*zz | |
" Very magic by default | |
nnoremap ? ?\v | |
nnoremap / /\v | |
cnoremap %s/ %sm/ | |
" ============================================================================= | |
" # Keyboard shortcuts | |
" ============================================================================= | |
" ; as : | |
nnoremap . ; | |
nnoremap ; : | |
" Ctrl+c and Ctrl+j as Esc | |
" Ctrl-j is a little awkward unfortunately: | |
" https://github.com/neovim/neovim/issues/5916 | |
" So we also map Ctrl+k | |
inoremap <C-j> <Esc> | |
nnoremap <C-k> <Esc> | |
inoremap <C-k> <Esc> | |
vnoremap <C-k> <Esc> | |
snoremap <C-k> <Esc> | |
xnoremap <C-k> <Esc> | |
cnoremap <C-k> <Esc> | |
onoremap <C-k> <Esc> | |
lnoremap <C-k> <Esc> | |
tnoremap <C-k> <Esc> | |
nnoremap <C-c> <Esc> | |
inoremap <C-c> <Esc> | |
vnoremap <C-c> <Esc> | |
snoremap <C-c> <Esc> | |
xnoremap <C-c> <Esc> | |
cnoremap <C-c> <Esc> | |
onoremap <C-c> <Esc> | |
lnoremap <C-c> <Esc> | |
tnoremap <C-c> <Esc> | |
" Neat X clipboard integration | |
" ,p will paste clipboard into buffer | |
" ,c will copy entire buffer into clipboard | |
noremap <leader>p :read !xsel --clipboard --output<cr> | |
noremap <leader>y :w !xsel -ib<cr><cr> | |
" Open new file adjacent to current file | |
nnoremap <leader>e :e <C-R>=expand("%:p:h") . "/" <CR> | |
" No arrow keys --- force yourself to use the home row | |
nnoremap <up> <nop> | |
nnoremap <down> <nop> | |
inoremap <up> <nop> | |
inoremap <down> <nop> | |
inoremap <left> <nop> | |
inoremap <right> <nop> | |
" Left and right can switch buffers | |
nnoremap <left> :bp<CR> | |
nnoremap <right> :bn<CR> | |
" Move by line | |
nnoremap j gj | |
nnoremap k gk | |
" Git fugitive | |
nnoremap <leader>gs :Git<CR> | |
" Quick-save | |
nmap <leader>w :w<CR> | |
map H ^ | |
map L $ | |
nnoremap Q <nop> | |
nnoremap <silent><leader>b :lua require'telescope.builtin'.buffers{}<CR> | |
nnoremap <silent><leader><leader> :lua require'telescope.builtin'.buffers{}<CR> | |
nnoremap <silent><leader>f :lua require'telescope.builtin'.git_files{}<CR> | |
nnoremap <silent><leader>s :lua require'telescope.builtin'.current_buffer_fuzzy_find{}<CR> | |
nnoremap <silent><leader>m :lua require'telescope.builtin'.marks{}<CR> | |
nnoremap <silent><leader>r :lua require'telescope.builtin'.live_grep{}<CR> | |
nnoremap <silent><leader>gc :lua require'telescope.builtin'.git_commits{}<CR> | |
" NvimTreeOpen and NvimTreeClose are also available if you need them | |
nnoremap <silent><leader>tt :NvimTreeToggle<CR> | |
nnoremap <silent><leader>tr :NvimTreeRefresh<CR> | |
nnoremap <silent><leader>tn :NvimTreeFindFile<CR> | |
nnoremap <silent><leader>tf :Lspsaga open_floaterm<CR> | |
nnoremap <silent><leader>tc :Lspsaga close_floaterm<CR> | |
nnoremap <silent><leader>ac :only<CR> | |
nnoremap <leader>, :set invlist<CR> | |
nnoremap <silent>Q :bd!<CR> | |
nnoremap <silent><leader>q :q<CR> | |
" I can type :help on my own, thanks. | |
map <F1> <Esc> | |
imap <F1> <Esc> | |
nnoremap <leader>h <C-W>h | |
nnoremap <leader>j <C-W>j | |
nnoremap <leader>k <C-W>k | |
nnoremap <leader>l <C-W>l | |
" Prevent accidental writes to buffers that shouldn't be edited | |
autocmd BufRead *.orig set readonly | |
autocmd BufRead *.pacnew set readonly | |
" Leave paste mode when leaving insert mode | |
autocmd InsertLeave * set nopaste | |
" Jump to last edit position on opening file | |
if has("autocmd") | |
" https://stackoverflow.com/questions/31449496/vim-ignore-specifc-file-in-autocommand | |
au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif | |
endif | |
"""""""""""""""""""""""""""""""""""" | |
"""""""""""""""""""""""""""""""""""" | |
"" Sneak | |
"""""""""""""""""""""""""""""""""""" | |
"""""""""""""""""""""""""""""""""""" | |
let g:sneak#label = 1 | |
" case insensitive sneak | |
let g:sneak#use_ic_scs = 1 | |
" immediately move to the next instance of search, if you move the cursor sneak is back to default behavior | |
let g:sneak#s_next = 1 | |
" remap so I can use , and ; with f and t | |
"""""""""""""""""""""""""""""""""""" | |
" Trigger a highlight in the appropriate direction when pressing these keys: | |
let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] | |
highlight QuickScopePrimary guifg='#00C7DF' gui=underline ctermfg=155 cterm=underline | |
highlight QuickScopeSecondary guifg='#afff5f' gui=underline ctermfg=81 cterm=underline | |
let g:qs_max_chars=150 | |
"""""""""""""""""""""""""""""""""""" | |
"""""""""""""""""""""""""""""""""""" | |
"" Dirvish | |
"""""""""""""""""""""""""""""""""""" | |
"""""""""""""""""""""""""""""""""""" | |
let g:loaded_netrwPlugin = 1 | |
command! -nargs=? -complete=dir Explore Dirvish <args> | |
command! -nargs=? -complete=dir Sexplore belowright split | silent Dirvish <args> | |
command! -nargs=? -complete=dir Vexplore leftabove vsplit | silent Dirvish <args> | |
let g:dirvish_mode = ':sort ,^.*[\/], | silent keeppatterns g@\v/\.[^\/]+/?$@d _' | |
endif |
Author
cjgratacos
commented
Mar 8, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment