Update .vimrc
This commit is contained in:
parent
6a057856a6
commit
5be5497230
1 changed files with 106 additions and 118 deletions
224
vim/.vimrc
224
vim/.vimrc
|
@ -1,118 +1,106 @@
|
||||||
"Not compatible with vi, which causes problems
|
local set = vim.opt
|
||||||
set nocompatible
|
local cmd = vim.api.nvim_command
|
||||||
"Get filetype
|
local au = vim.api.nvim_create_autocmd
|
||||||
filetype on
|
local plug = vim.fn['plug#']
|
||||||
filetype plugin on
|
vim.call('plug#begin', '~/.config/nvim/plugged')
|
||||||
filetype indent on
|
plug('https://gitlab.com/rawleyIfowler/melange')
|
||||||
filetype plugin indent on
|
plug('ap/vim-css-color')
|
||||||
"Plugins in ~/.vim/plugged
|
plug('ap/vim-buftabline')
|
||||||
call plug#begin()
|
plug('dag/vim-fish')
|
||||||
Plug 'jiangmiao/auto-pairs'
|
plug('clojure-vim/clojure.vim', {['for'] = 'clojure'})
|
||||||
Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
|
plug('scrooloose/nerdtree', { on = 'NERDTreeToggle'})
|
||||||
Plug 'arzg/vim-swift', { 'for': 'swift' }
|
plug('fatih/vim-go', { ['for'] = 'go' })
|
||||||
Plug 'tyru/open-browser.vim'
|
plug('tree-sitter/tree-sitter')
|
||||||
Plug 'junegunn/vim-easy-align'
|
plug('tpope/vim-surround')
|
||||||
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
plug('tpope/vim-fireplace', {['for'] = 'clojure'})
|
||||||
Plug 'junegunn/fzf.vim'
|
plug('neovim/nvim-lsp')
|
||||||
Plug 'preservim/NERDTree', { 'on': 'NERDTreeToggle' }
|
plug('neovim/nvim-lspconfig')
|
||||||
Plug 'itchyny/lightline.vim'
|
plug('junegunn/goyo.vim', {['for'] = 'markdown'})
|
||||||
Plug 'tpope/vim-surround'
|
plug('junegunn/fzf', {['dir'] = '~/.fzf', ['do'] = './install --all'})
|
||||||
Plug 'prabirshrestha/async.vim'
|
plug('junegunn/fzf.vim')
|
||||||
Plug 'prabirshrestha/asyncomplete.vim'
|
plug('jiangmiao/auto-pairs')
|
||||||
Plug 'prabirshrestha/asyncomplete-lsp.vim'
|
plug('guns/vim-clojure-highlight', {['for'] = 'clojure'})
|
||||||
Plug 'prabirshrestha/vim-lsp'
|
plug('guns/vim-clojure-static', {['for'] = 'clojure'})
|
||||||
Plug 'prabirshrestha/asyncomplete-gocode.vim', { 'for': 'go' }
|
plug('luochen1990/rainbow', {['for'] = 'clojure'})
|
||||||
Plug 'keremc/asyncomplete-clang.vim', { 'for': ['c', 'cpp', 'h', 'hpp'] }
|
plug('docunext/closetag.vim')
|
||||||
Plug 'mattn/vim-lsp-settings'
|
plug('norcalli/nvim_utils')
|
||||||
Plug 'prabirshrestha/asyncomplete-lsp.vim'
|
plug('hrsh7th/nvim-cmp')
|
||||||
Plug 'https://github.com/KabbAmine/yowish.vim'
|
plug('hrsh7th/cmp-buffer')
|
||||||
Plug 'https://github.com/ap/vim-css-color'
|
plug('hrsh7th/cmp-nvim-lsp')
|
||||||
Plug 'digitaltoad/vim-pug', { 'for': 'pug' }
|
plug('l3mon4d3/luasnip')
|
||||||
Plug 'ap/vim-buftabline'
|
vim.call('plug#end')
|
||||||
Plug 'dracula/vim'
|
pcall(require, 'nvim_utils')
|
||||||
Plug 'fatih/vim-go', { 'for': 'go' }
|
local cmp = require('cmp')
|
||||||
Plug 'frazrepo/vim-rainbow'
|
-- Basic editor configurations
|
||||||
Plug 'clojure-vim/clojure.vim', { 'for': 'clojure' }
|
set.tabstop = 4
|
||||||
Plug 'clojure-vim/async-clj-omni', { 'for': 'clojure' }
|
set.shiftwidth = 4
|
||||||
Plug 'vim-scripts/VimClojure', { 'for': 'clojure' }
|
set.expandtab = true
|
||||||
call plug#end()
|
set.number = true
|
||||||
"Dracula > All
|
set.termguicolors = true
|
||||||
colorscheme dracula
|
set.autoindent = true
|
||||||
syntax on
|
set.autowrite = true
|
||||||
set ai
|
set.ai = true
|
||||||
set number
|
set.wildignore = {'*/cache/*', '*/tmp*'}
|
||||||
set ts=4
|
-- Keybindings
|
||||||
set sw=4
|
function map(mode, lhs, rhs, opts)
|
||||||
set background=dark
|
options = {}
|
||||||
set nowrap
|
if opts then
|
||||||
set hidden
|
options = vim.tbl_extend("force", options, opts)
|
||||||
set showcmd
|
end
|
||||||
set wildmenu
|
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||||
set hlsearch
|
end
|
||||||
set confirm
|
---- Cycling through buffers
|
||||||
set expandtab
|
map('n', '<C-h>', ':bprev<cr>', { noremap = true })
|
||||||
"Buffer hopping
|
map('n', '<C-l>', ':bnext<cr>', { noremap = true })
|
||||||
nmap <C-h> :bp<cr>
|
---- NERDTree
|
||||||
nmap <C-l> :bn<cr>
|
map('n', '<S-w>', ':NERDTreeToggle<cr>', { noremap = true })
|
||||||
nmap <C-q> :Bclose<cr>
|
map('n', '<S-q>', ':NERDTreeClose<cr>', { noremap = true })
|
||||||
"Ripgrep with fzf
|
---- Ripgrep
|
||||||
nmap <C-f> :Rg<cr>
|
map('n', '<C-f>', ':Rg<cr>')
|
||||||
"Nerd tree
|
---- Auto-complete
|
||||||
nmap <S-w> :NERDTreeToggle<cr>
|
cmp.setup({
|
||||||
"For writing blog posts
|
snippet = {
|
||||||
autocmd BufNewFile,BufRead *.html,*.txt,*.blog set spell
|
expand = function(a)
|
||||||
autocmd BufNewFile,BufRead *.html,*.txt,*.blog set wrap
|
-- Enable the lua snips engine
|
||||||
"Asyncomplete configurations
|
require('luasnip').lsp_expand(a.body)
|
||||||
inoremap <expr> <cr> pumvisible() ? asyncomplete#close_popup() . "\<cr>" : "\<cr>"
|
end
|
||||||
imap <c-space> <Plug>(asyncomplete_force_refresh)
|
},
|
||||||
function! s:check_back_space() abort
|
|
||||||
let col=col('.') - 1
|
mapping = cmp.mapping.preset.insert({
|
||||||
return !col || getline('.')[col - 1] =~ '\s'
|
['<Tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c' }),
|
||||||
endfunction
|
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||||
inoremap <silent><expr> <TAB>
|
['<C-Space>'] = cmp.mapping.complete()
|
||||||
\ pumvisible() ? "\<C-n>" :
|
}),
|
||||||
\ <SID>check_back_space() ? "\<TAB>" :
|
|
||||||
\ asyncomplete#force_refresh()
|
sources = {
|
||||||
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
-- Get completions from these sources
|
||||||
autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
|
{ name = 'buffer' },
|
||||||
"AUTO COMPLETES"
|
{ name = 'nvim_lsp' },
|
||||||
au User asyncomplete_setup call asyncomplete#register_source({
|
{ name = 'luasnip' }
|
||||||
\ 'name': 'async_clj_omni',
|
}
|
||||||
\ 'whitelist': ['clojure'],
|
})
|
||||||
\ 'completor': function('async_clj_omni#sources#complete'),
|
local cmp_capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
\ })
|
-- Colors
|
||||||
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#gocode#get_source_options({
|
vim.cmd('syntax enable')
|
||||||
\ 'name': 'gocode',
|
vim.cmd('colorscheme melange')
|
||||||
\ 'allowlist': ['go'],
|
vim.o.background = 'dark'
|
||||||
\ 'completor': function('asyncomplete#sources#gocode#completor'),
|
-- Clojure/Common Lisp specific configurations
|
||||||
\ 'config': {
|
-- Clojure and Common Lisp style is 2 space indent
|
||||||
\ 'gocode_path': expand('~/go/bin/gocode')
|
-- https://guide.clojure.style
|
||||||
\ },
|
vim.cmd([[
|
||||||
\ }))
|
filetype on
|
||||||
au User asyncomplete_setup call asyncomplete#register_source(
|
filetype plugin on
|
||||||
\ asyncomplete#sources#clang#get_source_options({
|
filetype plugin indent on
|
||||||
\ 'config': {
|
autocmd Filetype clojure,clj,lisp,lsp,cl,l let g:rainbow_active=1
|
||||||
\ 'clang_path': '/usr/bin/clang',
|
]])
|
||||||
\ 'clang_args': {
|
require('lspconfig')['clojure_lsp'].setup{ capabilities = cmp_capabilities }
|
||||||
\ 'cpp': ['-std=c++11']
|
-- Go specific configurations
|
||||||
\ }
|
require('lspconfig')['gopls'].setup{ capabilities = cmp_capabilities }
|
||||||
\ }
|
-- C/C++ specific configurations
|
||||||
\}))
|
require('lspconfig')['clangd'].setup{ capabilities = cmp_capabilities }
|
||||||
""Load only on Lisp, Clojure, or Emacs Lisp files for rainbow parens
|
-- TypeScript specific configurations
|
||||||
au FileType clojure,lisp,lsp,cl,l,el,elc,eln call rainbow#load()
|
require('lspconfig')['tsserver'].setup{ capabilities = cmp_capabilities }
|
||||||
"Toggle on rainbow parens by default if the following file type is detected
|
-- 2 Tab space standard languages
|
||||||
let fts=['clojure', 'lisp', 'lsp', 'cl', 'el', 'eln', 'l', 'elc']
|
vim.cmd([[
|
||||||
if index(fts, &filetype) != -1
|
autocmd Filetype clojure,clj,lisp,lsp,cl,l,javascript,js,typescript,ts setlocal tabstop=2 shiftwidth=2
|
||||||
"Clojure style standards like 2 space indents check it out:
|
]])
|
||||||
"https://guide.clojure.style
|
|
||||||
set ts=2
|
|
||||||
set sw=2
|
|
||||||
:RainbowToggle
|
|
||||||
endif
|
|
||||||
"Configure clojure fuzzy indents and alignments
|
|
||||||
let g:clojure_fuzzy_indent=1
|
|
||||||
let g:clojure_align_subforms=1
|
|
||||||
"Fix weird background color issues with dracula color scheme
|
|
||||||
if &term =~ '256color'
|
|
||||||
set t_ut=
|
|
||||||
endif
|
|
||||||
|
|
Loading…
Reference in a new issue