262 lines
6.5 KiB
VimL
262 lines
6.5 KiB
VimL
if empty(glob('~/.config/nvim/autoload/plug.vim'))
|
||
silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
|
||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
||
endif
|
||
|
||
let g:loaded_python_provider = 0
|
||
let g:pyxversion = '3'
|
||
|
||
set number
|
||
set relativenumber
|
||
set tabstop=4
|
||
set shiftwidth=4
|
||
set smarttab
|
||
set expandtab
|
||
set hidden
|
||
set showtabline=1
|
||
set termguicolors
|
||
set ttyfast
|
||
set wildmenu
|
||
set title
|
||
set list
|
||
set listchars=tab:→\ ,eol:¬,trail:•,extends:❯,precedes:❮,space:‣
|
||
set showbreak=↪
|
||
set timeoutlen=500
|
||
set ignorecase
|
||
set smartcase
|
||
set splitbelow
|
||
set splitright
|
||
|
||
if has("nvim-0.5.0")
|
||
augroup LuaHighlight
|
||
autocmd!
|
||
autocmd TextYankPost * silent! lua require'vim.highlight'.on_yank()
|
||
augroup END
|
||
endif
|
||
|
||
let g:mapleader="\<SPACE>"
|
||
let g:maplocalleader=','
|
||
|
||
if has('nvim')
|
||
set inccommand=split
|
||
endif
|
||
|
||
if has("persistent_undo")
|
||
if !isdirectory($HOME . "/.undodir")
|
||
call mkdir($HOME . "/.undodir", "p", 0770)
|
||
endif
|
||
set undodir=~/.undodir/
|
||
set undofile
|
||
augroup undodir
|
||
autocmd!
|
||
autocmd BufWritePre /tmp/* setlocal noundofile
|
||
augroup END
|
||
endif
|
||
|
||
call plug#begin('~/.config/nvim/plugged')
|
||
" if has('python3') && has('timers')
|
||
" Plug 'AlphaMycelium/pathfinder.vim'
|
||
" else
|
||
" echoerr 'pathfinder.vim is not supported on this Vim installation'
|
||
" endif
|
||
Plug 'inkarkat/vim-ReplaceWithRegister'
|
||
|
||
Plug 'chriskempson/base16-vim'
|
||
|
||
Plug 'junegunn/vim-plug'
|
||
|
||
" Builtin LSP Stuff
|
||
Plug 'neovim/nvim-lsp'
|
||
|
||
" Lisp-In-Lua
|
||
Plug 'Olical/conjure'
|
||
Plug 'Olical/aniseed'
|
||
Plug 'bakpakin/fennel.vim'
|
||
|
||
" CtrlP
|
||
Plug 'ctrlpvim/ctrlp.vim'
|
||
|
||
" Wakatime
|
||
Plug 'wakatime/vim-wakatime'
|
||
|
||
" Dispatch
|
||
Plug 'tpope/vim-dispatch'
|
||
Plug 'radenling/vim-dispatch-neovim'
|
||
|
||
" Follow symlinks
|
||
Plug 'moll/vim-bbye'
|
||
Plug 'aymericbeaumet/vim-symlink'
|
||
|
||
" Editorconfig
|
||
Plug 'sgur/vim-editorconfig'
|
||
|
||
Plug 'terryma/vim-expand-region'
|
||
Plug 'junegunn/rainbow_parentheses.vim'
|
||
|
||
if !has("nvim-0.5.0")
|
||
Plug 'machakann/vim-highlightedyank'
|
||
endif
|
||
|
||
Plug 'nvim-treesitter/nvim-treesitter'
|
||
|
||
Plug 'datwaft/bubbly.nvim'
|
||
Plug 'morhetz/gruvbox'
|
||
Plug 'arzg/vim-corvine'
|
||
Plug 'tpope/vim-fugitive'
|
||
Plug 'mhinz/vim-signify'
|
||
Plug 'tpope/vim-commentary'
|
||
Plug 'mbbill/undotree'
|
||
Plug 'elmcast/elm-vim'
|
||
Plug 'liuchengxu/vim-which-key'
|
||
Plug 'airblade/vim-rooter'
|
||
|
||
"async.vim
|
||
Plug 'prabirshrestha/async.vim'
|
||
|
||
call plug#end()
|
||
|
||
" CtrlP mappings
|
||
let g:ctrlp_map = '<Leader>p'
|
||
let g:ctrlp_cmd = 'CtrlPMixed'
|
||
let g:ctrlp_user_command = 'rg --files %s'
|
||
|
||
set signcolumn=yes
|
||
|
||
lua << EOF
|
||
-- bubbly_statusline
|
||
vim.g.bubbly_palette = {
|
||
background = "#34343c",
|
||
foreground = "#c5cdd9",
|
||
black = "#3e4249",
|
||
red = "#ec5f67",
|
||
green = "#99c794",
|
||
yellow = "#fac863",
|
||
blue = "#6699cc",
|
||
purple = "#c594c5",
|
||
cyan = "#62b3b2",
|
||
white = "#ffffff",
|
||
lightgrey = "#a7adba",
|
||
darkgrey = "#65737e",
|
||
}
|
||
|
||
-- Builtin LSP
|
||
local lspconfig = require'lspconfig'
|
||
lspconfig.ocamlls.setup{}
|
||
lspconfig.rust_analyzer.setup{}
|
||
lspconfig.solargraph.setup{}
|
||
lspconfig.yamlls.setup{}
|
||
EOF
|
||
|
||
set background=dark
|
||
colorscheme base16-oceanicnext
|
||
|
||
"Airline settings
|
||
let g:airline#extensions#tabline#enabled = 1
|
||
let g:airline_powerline_fonts = 1
|
||
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
|
||
let g:airline_theme='base16_tomorrow'
|
||
|
||
nnoremap <leader>u :UndotreeToggle<cr>
|
||
nnoremap <leader>h <C-W><C-H>
|
||
nnoremap <leader>j <C-W><C-J>
|
||
nnoremap <leader>k <C-W><C-K>
|
||
nnoremap <leader>l <C-W><C-L>
|
||
nnoremap <leader>n :nohl<cr>
|
||
nnoremap <C-k> <C-u>
|
||
nnoremap <C-j> <C-d>
|
||
vnoremap <C-k> <C-u>
|
||
vnoremap <C-j> <C-d>
|
||
|
||
" Read and write to system clipboard
|
||
vnoremap <Leader>y "+y
|
||
vnoremap <Leader>d "+d
|
||
nnoremap <Leader>p "+p
|
||
nnoremap <Leader>P "+P
|
||
vnoremap <Leader>p "+p
|
||
vnoremap <Leader>P "+P
|
||
|
||
" Keep expanding regions with v in visual mode
|
||
vmap v <Plug>(expand_region_expand)
|
||
vmap <C-v> <Plug>(expand_region_shrink)
|
||
|
||
" which-key
|
||
let g:which_key_map = {}
|
||
autocmd! User vim-which-key call which_key#register('<Space>', 'g:which_key_map')
|
||
nnoremap <silent> <leader> :<c-u>WhichKey '<Space>'<CR>
|
||
nnoremap <silent> <localleader> :<c-u>WhichKey ','<CR>
|
||
|
||
"rainbow-parens
|
||
autocmd VimEnter * RainbowParentheses
|
||
let g:rainbow#blacklist = [248]
|
||
let g:rainbow#pairs = [['(', ')'], ['[', ']'], ['{', '}']]
|
||
|
||
" silicon remaps
|
||
if executable("silicon")
|
||
vnoremap <Leader>c :'<,'>w !silicon -c -l%:e<CR>
|
||
vnoremap <Leader><S-c> :<BS><BS><BS><BS><BS>exec(":'<,'>w !silicon -c -l" . &filetype)<CR>
|
||
endif
|
||
|
||
function! s:transformed_url(url)
|
||
let l:rv = a:url
|
||
let l:rv = system("echo " . l:rv . ' | sed "s|:|/|" | sed "s|git@|https://|"')
|
||
return l:rv
|
||
endfunction
|
||
|
||
function! GetGitUrl()
|
||
let url = trim(system("git remote get-url origin"))
|
||
let t_url = s:transformed_url(url)
|
||
let branch = system("git branch --show-current")
|
||
let file_name = expand('%')
|
||
let line_num = line(".")
|
||
let @+ = trim(t_url) . "/blob/" . trim(branch) . "/" . trim(file_name) . "#L" . trim(line_num)
|
||
endfunction
|
||
|
||
nnoremap <silent> <leader>c :call GetGitUrl()<CR>
|
||
nnoremap <silent> <leader>* :grep <cword><CR>:cw
|
||
|
||
set grepprg=rg\ -H\ --no-heading\ --vimgrep
|
||
set grepformat=%f:%l:%c:%m
|
||
|
||
if has("nvim-0.5.0")
|
||
lua << EOF
|
||
require 'nvim-treesitter.configs'.setup {
|
||
highlight = {
|
||
enable = true, -- false will disable the whole extension
|
||
},
|
||
incremental_selection = {
|
||
enable = true,
|
||
keymaps = { -- mappings for incremental selection (visual mappings)
|
||
init_selection = '<Leader>s', -- maps in normal mode to init the node/scope selection
|
||
node_incremental = "u", -- increment to the upper named parent
|
||
scope_incremental = "s", -- increment to the upper scope (as defined in locals.scm)
|
||
node_decremental = "d", -- decrement to the previous node
|
||
}
|
||
},
|
||
refactor = {
|
||
highlight_definitions = {
|
||
enable = true
|
||
},
|
||
smart_rename = {
|
||
enable = true,
|
||
keymaps = {
|
||
smart_rename = "<Leader>r", -- mapping to rename reference under cursor
|
||
}
|
||
},
|
||
navigation = {
|
||
enable = true,
|
||
keymaps = {
|
||
goto_definition = "<Leader>tg", -- mapping to go to definition of symbol under cursor
|
||
list_definitions = "<Leader>ta" -- mapping to list all definitions in current file
|
||
}
|
||
}
|
||
},
|
||
ensure_installed = {'python', 'yaml', 'rust', 'ocaml'}
|
||
}
|
||
EOF
|
||
endif
|
||
|
||
set foldmethod=expr
|
||
set foldexpr=nvim_treesitter#foldexpr()
|
||
|
||
" nnoremap <silent> <leader>tsr :w | e | TSBufEnable('highlight')<CR>
|