227 lines
5.6 KiB
VimL
227 lines
5.6 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:pyxversion = 'python3'
|
||
|
||
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")
|
||
set undofile
|
||
set undodir=$HOME/.undodir
|
||
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 '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'
|
||
|
||
" 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 'vim-airline/vim-airline'
|
||
Plug 'vim-airline/vim-airline-themes'
|
||
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
|
||
|
||
" Builtin LSP
|
||
lua << EOF
|
||
local nvim_lsp = require'nvim_lsp'
|
||
nvim_lsp.ocamlls.setup{}
|
||
nvim_lsp.pyls.setup{
|
||
settings = {
|
||
pyls = {
|
||
configurationSources = { "pyls-black", flake8 }
|
||
}
|
||
}
|
||
}
|
||
nvim_lsp.rust_analyzer.setup{}
|
||
nvim_lsp.solargraph.setup{}
|
||
nvim_lsp.yamlls.setup{}
|
||
EOF
|
||
|
||
set background=dark
|
||
colorscheme corvine
|
||
|
||
"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 = [['(', ')'], ['[', ']'], ['{', '}']]
|
||
|
||
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,
|
||
smart_rename = "<Leader>r", -- mapping to rename reference under cursor
|
||
},
|
||
navigation = {
|
||
enable = true,
|
||
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'}
|
||
}
|
||
EOF
|
||
endif
|