Switch to Lua for nvim config

This commit is contained in:
Alex Yatskov 2022-10-21 17:55:56 -07:00
parent e6924cde6f
commit 5b61e22c6c
35 changed files with 246 additions and 415 deletions

24
.gitmodules vendored
View File

@ -43,12 +43,6 @@
[submodule ".vim/bundle/vim-signify"] [submodule ".vim/bundle/vim-signify"]
path = pack/plugins/start/vim-signify path = pack/plugins/start/vim-signify
url = https://github.com/mhinz/vim-signify.git url = https://github.com/mhinz/vim-signify.git
[submodule ".vim/bundle/fzf"]
path = pack/plugins/opt/fzf
url = https://github.com/junegunn/fzf
[submodule ".vim/bundle/fzf.vim"]
path = pack/plugins/opt/fzf.vim
url = https://github.com/junegunn/fzf.vim.git
[submodule ".vim/bundle/tcomment_vim"] [submodule ".vim/bundle/tcomment_vim"]
path = pack/plugins/start/tcomment_vim path = pack/plugins/start/tcomment_vim
url = https://github.com/tomtom/tcomment_vim url = https://github.com/tomtom/tcomment_vim
@ -65,19 +59,19 @@
path = pack/plugins/start/vim-polyglot path = pack/plugins/start/vim-polyglot
url = https://github.com/sheerun/vim-polyglot url = https://github.com/sheerun/vim-polyglot
[submodule "pack/plugins/opt/cmp-nvim-lsp"] [submodule "pack/plugins/opt/cmp-nvim-lsp"]
path = pack/plugins/opt/cmp-nvim-lsp path = pack/plugins/start/cmp-nvim-lsp
url = https://github.com/hrsh7th/cmp-nvim-lsp.git url = https://github.com/hrsh7th/cmp-nvim-lsp.git
[submodule "pack/plugins/opt/nvim-lspconfig"] [submodule "pack/plugins/opt/nvim-lspconfig"]
path = pack/plugins/opt/nvim-lspconfig path = pack/plugins/start/nvim-lspconfig
url = https://github.com/neovim/nvim-lspconfig.git url = https://github.com/neovim/nvim-lspconfig.git
[submodule "pack/plugins/opt/nvim-cmp"] [submodule "pack/plugins/opt/nvim-cmp"]
path = pack/plugins/opt/nvim-cmp path = pack/plugins/start/nvim-cmp
url = https://github.com/hrsh7th/nvim-cmp.git url = https://github.com/hrsh7th/nvim-cmp.git
[submodule "pack/plugins/opt/cmp-vsnip"] [submodule "pack/plugins/opt/cmp-vsnip"]
path = pack/plugins/opt/cmp-vsnip path = pack/plugins/start/cmp-vsnip
url = https://github.com/hrsh7th/cmp-vsnip url = https://github.com/hrsh7th/cmp-vsnip
[submodule "pack/plugins/opt/vim-vsnip"] [submodule "pack/plugins/opt/vim-vsnip"]
path = pack/plugins/opt/vim-vsnip path = pack/plugins/start/vim-vsnip
url = https://github.com/hrsh7th/vim-vsnip url = https://github.com/hrsh7th/vim-vsnip
[submodule "pack/plugins/start/suda.vim"] [submodule "pack/plugins/start/suda.vim"]
path = pack/plugins/start/suda.vim path = pack/plugins/start/suda.vim
@ -86,5 +80,11 @@
path = pack/plugins/start/plenary.nvim path = pack/plugins/start/plenary.nvim
url = https://github.com/nvim-lua/plenary.nvim.git url = https://github.com/nvim-lua/plenary.nvim.git
[submodule "pack/plugins/opt/hflip.nvim"] [submodule "pack/plugins/opt/hflip.nvim"]
path = pack/plugins/opt/hflip.nvim path = pack/plugins/start/hflip.nvim
url = https://github.com/FooSoft/hflip.nvim.git url = https://github.com/FooSoft/hflip.nvim.git
[submodule "pack/plugins/opt/telescope.nvim"]
path = pack/plugins/start/telescope.nvim
url = https://github.com/nvim-telescope/telescope.nvim.git
[submodule "pack/plugins/opt/telescope-fzf-native.nvim"]
path = pack/plugins/start/telescope-fzf-native.nvim
url = https://github.com/nvim-telescope/telescope-fzf-native.nvim.git

1
ftplugin/c.lua Normal file
View File

@ -0,0 +1 @@
vim.diagnostic.disable()

View File

@ -1,8 +0,0 @@
" vim-fswitch
noremap gfs :HFlip<Cr>
if has('nvim')
lua << EOF
vim.diagnostic.disable()
EOF
endif

1
ftplugin/cpp.lua Normal file
View File

@ -0,0 +1 @@
vim.diagnostic.disable()

View File

@ -1,8 +0,0 @@
" vim-fswitch
noremap gfs :HFlip<Cr>
if has('nvim')
lua << EOF
vim.diagnostic.disable()
EOF
endif

12
ftplugin/go.lua Normal file
View File

@ -0,0 +1,12 @@
vim.opt.expandtab = false
vim.keymap.set('n', '<leader><f5>', '<cmd>GoDebugStart<cr>')
vim.keymap.set('n', '<leader><f9>', '<cmd>GoDebugBreakpoint<cr>')
vim.keymap.set('n', '<leader>b', '<cmd>plug>(go-build)')
vim.keymap.set('n', '<leader>c', '<cmd>plug>(go-coverage)')
vim.keymap.set('n', '<leader>r', '<cmd>plug>(go-run)')
vim.keymap.set('n', '<leader>t', '<cmd>plug>(go-test)')
vim.keymap.set('n', '<s-f11>', '<cmd>GoDebugStepOut<cr>')
vim.keymap.set('n', '<s-f5>', '<cmd>GoDebugStop<cr>')
vim.b.argwrap_tail_comma = 1

View File

@ -1,14 +0,0 @@
setlocal noexpandtab
" vim-argwrap
let b:argwrap_tail_comma = 1
" vim-go
nmap <leader><f5> :GoDebugStart<cr>
nmap <leader><f9> :GoDebugBreakpoint<cr>
nmap <leader>b <plug>(go-build)
nmap <leader>c <plug>(go-coverage)
nmap <leader>r <plug>(go-run)
nmap <leader>t <plug>(go-test)
nmap <s-f11> :GoDebugStepOut<cr>
nmap <s-f5> :GoDebugStop<cr>

1
ftplugin/html.lua Normal file
View File

@ -0,0 +1 @@
vim.opt.spell = true

View File

@ -1 +0,0 @@
setlocal spell

3
ftplugin/markdown.lua Normal file
View File

@ -0,0 +1,3 @@
vim.opt.colorcolumn = { 120 }
vim.opt.spell = true
vim.opt.textwidth = 120

View File

@ -1,3 +0,0 @@
setlocal colorcolumn=120
setlocal textwidth=120
setlocal spell

2
ftplugin/yaml.lua Normal file
View File

@ -0,0 +1,2 @@
vim.opt.shiftwidth = 2
vim.opt.tabstop = 2

View File

@ -1,2 +0,0 @@
setlocal shiftwidth=2
setlocal tabstop=2

View File

@ -1,8 +0,0 @@
GuiPopupmenu 0
GuiTabline 0
if has('unix')
GuiFont Terminus:h12
else
GuiFont! Lucida\ Console:h10
endif

View File

@ -1,15 +0,0 @@
set columns=128
set lines=32
set guioptions-=L
set guioptions-=R
set guioptions-=T
set guioptions-=l
set guioptions-=m
set guioptions-=r
if has('unix')
set guifont=Source\ Code\ Pro\ Regular\ 10
else
set guifont=Lucida_Console:h10
endif

198
init.lua Normal file
View File

@ -0,0 +1,198 @@
vim.cmd.colorscheme('solarized8')
vim.g.mapleader = ' '
vim.opt.autowrite = true
vim.opt.backup = false
vim.opt.completeopt = 'menuone,noselect'
vim.opt.expandtab = true
vim.opt.fileformats = 'unix,dos,mac'
vim.opt.foldenable = false
vim.opt.guicursor = 'n:blinkon0'
vim.opt.ignorecase = true
vim.opt.langremap = false
vim.opt.linebreak = true
vim.opt.modeline = false
vim.opt.modelines = 0
vim.opt.number = true
vim.opt.shiftround = true
vim.opt.shiftwidth = 4
vim.opt.smartcase = true
vim.opt.swapfile = false
vim.opt.tabstop = 4
vim.opt.termguicolors = true
vim.opt.updatetime = 300
vim.opt.wrap = false
vim.opt.writebackup = false
-- gui
vim.api.nvim_create_autocmd(
'UIEnter', {
callback = function()
if vim.v.event.chan == 1 then
require('ginit')
end
end,
once = true,
}
)
-- general
vim.keymap.set('i', '<c-c>', '<esc>')
vim.keymap.set('n', '<bs>', '<cmd>bd<cr>')
vim.keymap.set('n', '<c-c><c-c>', '<cmd>nohlsearch<cr>')
vim.keymap.set('n', '<leader><leader>', '<cmd>b#<cr>')
vim.keymap.set('n', '<leader>w', '<cmd>w<cr>')
vim.keymap.set('n', '<leader>x', '<cmd>x<cr>')
vim.keymap.set('n', 'j', 'gj')
vim.keymap.set('n', 'k', 'gk')
-- clipboard
vim.keymap.set({ 'n', 'v' }, '<leader>P', '"+P')
vim.keymap.set({ 'n', 'v' }, '<leader>Y', '"+y$')
vim.keymap.set({ 'n', 'v' }, '<leader>d', '"+d')
vim.keymap.set({ 'n', 'v' }, '<leader>d', '"+dd')
vim.keymap.set({ 'n', 'v' }, '<leader>p', '"+p')
vim.keymap.set({ 'n', 'v' }, '<leader>y', '"+y')
vim.keymap.set({ 'n', 'v' }, '<leader>yy', '"+yy')
-- splits
vim.keymap.set('n', '<a-=>', '<c-w><c-=>')
vim.keymap.set('n', '<a-h>', '<c-w><')
vim.keymap.set('n', '<a-j>', '<c-w>+')
vim.keymap.set('n', '<a-k>', '<c-w>-')
vim.keymap.set('n', '<a-l>', '<c-w>>')
vim.keymap.set('n', '<c-h>', '<c-w>h')
vim.keymap.set('n', '<c-j>', '<c-w>j')
vim.keymap.set('n', '<c-k>', '<c-w>k')
vim.keymap.set('n', '<c-l>', '<c-w>l')
-- cmp-nvim-lsp, nvim-lspconfig
local nvim_lspconfig = require('lspconfig')
if nvim_lspconfig then
local capabilities = vim.lsp.protocol.make_client_capabilities()
local cmp_nvim_lsp = require('cmp_nvim_lsp')
if cmp_nvim_lsp then
capabilities = cmp_nvim_lsp.update_capabilities(capabilities, { snippetSupport = false })
end
nvim_lspconfig.clangd.setup({ capabilities = capabilities })
nvim_lspconfig.gopls.setup({ capabilities = capabilities })
nvim_lspconfig.jedi_language_server.setup({ capabilities = capabilities })
nvim_lspconfig.rust_analyzer.setup({ capabilities = capabilities })
nvim_lspconfig.tsserver.setup({ capabilities = capabilities })
nvim_lspconfig.vimls.setup({ capabilities = capabilities })
nvim_lspconfig.sumneko_lua.setup({
settings = {
Lua = {
diagnostics = { globals = { 'vim' } },
runtime = { version = 'LuaJIT' },
telemetry = { enable = false },
workspace = { library = vim.api.nvim_get_runtime_file('', true) },
},
},
})
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition)
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action)
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
vim.keymap.set('n', '<space>f', function() vim.lsp.buf.format({ async = true }) end)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename)
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder)
vim.keymap.set('n', '<space>wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end)
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder)
vim.keymap.set('n', 'K', vim.lsp.buf.hover)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation)
vim.keymap.set('n', 'gr', vim.lsp.buf.references)
vim.opt.omnifunc = 'v:lua.vim.lsp.omnifunc'
end
-- nvim-cmp
local nvim_cmp = require('cmp')
if nvim_cmp then
nvim_cmp.setup({
mapping = {
['<c-d>'] = nvim_cmp.mapping.scroll_docs(-4),
['<c-f>'] = nvim_cmp.mapping.scroll_docs(4),
['<c-n>'] = nvim_cmp.mapping.select_next_item(),
['<c-p>'] = nvim_cmp.mapping.select_prev_item(),
['<tab>'] = nvim_cmp.mapping.confirm({ select = true }),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
},
snippet = {
expand = function(args) vim.fn['vsnip#anonymous'](args.body) end,
},
})
end
-- telescope.nvim
local telescope = require('telescope')
if telescope then
local telescope_builtin = require('telescope.builtin')
if telescope_builtin then
vim.keymap.set('n', '<space>fb', telescope_builtin.buffers, {})
vim.keymap.set('n', '<space>fg', telescope_builtin.git_files, {})
vim.keymap.set('n', '<space>fh', telescope_builtin.oldfiles, {})
vim.keymap.set('n', '<space>fr', telescope_builtin.reloader, {})
vim.keymap.set('n', '<space>fs', telescope_builtin.spell_suggest, {})
end
local telescope_actions = require('telescope.actions')
telescope.setup {
defaults = {
mappings = {
i = {
['<c-j>'] = telescope_actions.move_selection_next,
['<c-k>'] = telescope_actions.move_selection_previous,
['<esc>'] = telescope_actions.close,
},
},
}
}
end
-- vim-airline
vim.g['airline#extensions#tabline#enabled'] = 1
vim.g['airline_symbols_ascii'] = 1
-- vim-argwrap
vim.keymap.set('n', '<leader>a', '<cmd>ArgWrap<cr>')
-- vim-better-whitespace
vim.api.nvim_set_hl(0, 'ExtraWhitespace', { bg = '#6c71c4' })
-- vim-dirvish
vim.g.dirvish_mode = ':sort ,^.*[\\/],'
-- vim-easy-align
vim.g.easy_align_ignore_groups = {}
vim.keymap.set('n', 'ga', '<plug>(EasyAlign)')
vim.keymap.set('v', '<cr>', '<plug>(EasyAlign)')
-- vim-go
vim.g.go_diagnostics_enabled = 0
vim.g.go_imports_autosave = 0
vim.g.go_metalinter_enabled = {}
vim.g.go_null_module_warning = 0
vim.g.go_version_warning = 0
-- vim-interestingwords
vim.g.interestingWordsGUIColors = { '#8ccbea', '#a4e57e', '#ffdb72', '#ff7272', '#ffb3ff', '#9999ff' }
vim.g.interestingWordsTermColors = { '154', '121', '211', '137', '214', '222' }
-- vim-polyglot
vim.g.rustfmt_autosave = 1
-- hflip.nvim
vim.keymap.set('n', 'gfs', '<cmd>HFlip<cr>')

View File

@ -1,4 +0,0 @@
runtime options.vim
runtime keymaps.vim
runtime plugins.vim
runtime util.vim

View File

@ -1,43 +0,0 @@
let mapleader = "\<space>"
" core
nnoremap <silent><leader><leader> :b#<cr>
nnoremap <silent><c-c><c-c> :nohlsearch<cr>
nnoremap <silent><leader>m :make<cr>
nnoremap <silent><leader>w :w<cr>
nnoremap <silent><leader>x :x<cr>
inoremap <C-c> <esc>
nnoremap Q <nop>
nnoremap Y y$
nnoremap <leader>Y "+y$
vnoremap <leader>y "+y
vnoremap <leader>d "+d
vnoremap <leader>p "+p
vnoremap <leader>P "+P
nnoremap <leader>y "+y
nnoremap <leader>d "+d
nnoremap <leader>p "+p
nnoremap <leader>P "+P
nnoremap <leader>yy "+yy
nnoremap <leader>d "+dd
nnoremap <silent><bs> :bd<cr>
nnoremap <silent><s-bs> :%bd <bar> e# <bar> bd#<cr>
nnoremap <a-k> <c-w>-
nnoremap <a-j> <c-w>+
nnoremap <a-h> <c-w><
nnoremap <a-l> <c-w>>
nnoremap <a-=> <c-w><c-=>
nnoremap <C-j> <C-W>j
nnoremap <C-k> <C-W>k
nnoremap <C-h> <C-W>h
nnoremap <C-l> <C-W>l
nnoremap j gj
nnoremap k gk
" util
nnoremap <leader>ig :Guid<cr>

View File

@ -1,4 +0,0 @@
@echo off
mklink "%USERPROFILE%\_vimrc" "%CD%\init.vim"
mklink "%USERPROFILE%\_gvimrc" "%CD%\gvim.vim"
mklink /J "%USERPROFILE%\vimfiles" "%CD%"

View File

@ -1,6 +0,0 @@
#!/bin/bash
ln -sf $PWD/init.vim ~/.vimrc
ln -sf $PWD/gvim.vim ~/.gvimrc
if [ ! -d ~/.vim ]; then
ln -s $PWD ~/.vim
fi

13
lua/ginit.lua Normal file
View File

@ -0,0 +1,13 @@
vim.cmd.GuiTabline(0)
vim.cmd.GuiPopupmenu(0)
local font
if vim.fn.has('unix') == 1 then
font = 'Terminus:h12'
elseif vim.fn.has('win32') == 1 then
font = 'Lucida Console:h8'
end
if font then
vim.cmd.Guifont({ args = { font }})
end

View File

@ -1,61 +0,0 @@
set nocompatible
set termguicolors
set t_Co=16
filetype indent plugin on
colorscheme solarized8
syntax enable
set autoindent
set autoread
set autowrite
set background=dark
set backspace=indent,eol,start
set belloff=all
set complete-=i
set encoding=utf-8
set expandtab
set fileformats=unix,dos,mac
set formatoptions=tcqj
set guicursor=n:blinkon0
set hidden
set history=10000
set hlsearch
set ignorecase
set incsearch
set laststatus=2
set linebreak
set modelines=0
set mousemodel=popup
set nobackup
set nofoldenable
set nofsync
set nolangremap
set nomodeline
set noswapfile
set nowrap
set nowritebackup
set nrformats=bin,hex
set number
set ruler
set ruler
set scrolloff=5
set shiftround
set shiftwidth=4
set shortmess+=I
set showcmd
set sidescroll=1
set smartcase
set smarttab
set tabpagemax=50
set tabstop=4
set ttimeout
set ttimeoutlen=50
set ttyfast
set updatetime=300
set wildignore+=*/tmp/*
set wildmenu
if &shell =~ 'bin/fish'
set shell=/bin/sh
endif

@ -1 +0,0 @@
Subproject commit f9d53303bb00225edb6e46ca1851e5cf1b55e623

@ -1 +0,0 @@
Subproject commit 9ceac718026fd39498d95ff04fa04d3e40c465d7

@ -1 +0,0 @@
Subproject commit caaab4c95ebb7d5243556d1f0c254302babdb657

@ -0,0 +1 @@
Subproject commit 7e6d996a9d4ce3ef414307e688afd6b02ab68640

@ -0,0 +1 @@
Subproject commit 65c0ee3d4bb9cb696e262bca1ea5e9af3938fc90

@ -0,0 +1 @@
Subproject commit f174a0367b4fc7cb17710d867e25ea792311c418

View File

@ -1,173 +0,0 @@
" cmp-nvim-lsp, nvim-cmp, nvim-lspconfig
if has('nvim')
packadd cmp-nvim-lsp
packadd cmp-vsnip
packadd nvim-cmp
packadd nvim-lspconfig
packadd vim-vsnip
packadd hflip.nvim
lua << EOF
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
-- Enable completion triggered by <c-x><c-o>
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
local opts = { noremap=true, silent=true }
-- See `:help vim.lsp.*` for documentation on any of the below functions
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
end
-- Add additional capabilities supported by nvim-cmp
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities, {snippetSupport = false})
-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
local nvim_lsp = require('lspconfig')
for _, lsp in ipairs({'clangd', 'gopls', 'jedi_language_server', 'rust_analyzer', 'tsserver', 'vimls'}) do
nvim_lsp[lsp].setup({
on_attach = on_attach,
capabilities = capabilities
})
end
nvim_lsp.sumneko_lua.setup {
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT',
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = {'vim'},
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file('', true),
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
},
},
},
}
-- nvim-cmp setup
local cmp = require('cmp')
cmp.setup {
mapping = {
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
['<Tab>'] = cmp.mapping.confirm({select = true}),
},
sources = {
{name = 'nvim_lsp'},
{name = 'vsnip'},
},
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
}
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
EOF
endif
" hflip.nvim
command! HFlipReload lua require'plenary.reload'.reload_module('hflip', false)
" fzf
if executable('fzf')
packadd fzf.vim
packadd fzf
let $FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -f -g "" 2> /dev/null'
let g:fzf_colors = {
\ 'bg': ['bg', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'border': ['fg', 'Ignore'],
\ 'fg': ['fg', 'Normal'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'header': ['fg', 'Comment'],
\ 'hl': ['fg', 'Comment'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'marker': ['fg', 'Keyword'],
\ 'pointer': ['fg', 'Exception'],
\ 'prompt': ['fg', 'Conditional'],
\ 'spinner': ['fg', 'Label'],
\ }
if has('windows')
let g:fzf_preview_window = ''
endif
nnoremap <silent><leader>fg :GFiles<cr>
nnoremap <silent><leader>ff :Files ~<cr>
nnoremap <silent><leader>fh :History<cr>
nnoremap <silent><leader>fc :BCommits<cr>
nnoremap <silent><leader>fb :Buffers<cr>
nnoremap <silent><leader>fl :Lines<cr>
endif
" vim-airline
let g:airline#extensions#tabline#enabled = 1
let g:airline_symbols_ascii = 1
" vim-argwrap
nnoremap <silent><leader>a :ArgWrap<cr>
" vim-better-whitespace
highlight ExtraWhitespace ctermbg=DarkMagenta guibg=#6c71c4
" vim-dirvish
let g:dirvish_mode = ':sort ,^.*[\/],'
" vim-easy-align
let g:easy_align_ignore_groups = []
nmap ga <plug>(EasyAlign)
vmap <cr> <plug>(EasyAlign)
" vim-go
let g:go_diagnostics_enabled = 0
let g:go_imports_autosave = 0
let g:go_metalinter_enabled = []
let g:go_null_module_warning = 0
let g:go_version_warning = 0
" vim-interestingwords
let g:interestingWordsGUIColors = ['#8ccbea', '#a4e57e', '#ffdb72', '#ff7272', '#ffb3ff', '#9999ff']
let g:interestingWordsTermColors = ['154', '121', '211', '137', '214', '222']
" vim-polyglot
let g:rustfmt_autosave = 1

View File

@ -1,50 +0,0 @@
auto BufRead,BufNewFile *.gohtml setfiletype html
function! s:unalign() range
for l:line in range(a:firstline, a:lastline)
let l:text = getline(l:line)
let l:subst = substitute(l:text, '\(\S\+\)\s\{2,}', '\1 ', 'g')
call setline(l:line, l:subst)
endfor
endfunction
command! -range UnAlign <line1>,<line2>call s:unalign()
function! s:guid()
if has('pythonx')
pythonx import uuid
let l:guid = pyxeval('str(uuid.uuid4())')
elseif has('windows')
let l:guid = system('powershell.exe -command "[guid]::NewGuid().ToString()"')[:-2]
endif
if exists('l:guid')
execute 'normal! i' . l:guid . "\<Esc>"
else
echoerr 'No GUID provider available'
endif
endfunction
command! Guid call s:guid()
if has('nvim')
lua << EOF
function _G.put(...)
local objects = {}
for i = 1, select('#', ...) do
local v = select(i, ...)
table.insert(objects, vim.inspect(v))
end
print(table.concat(objects, '\n'))
return ...
end
function _G.list_packages()
for key, value in pairs(package.loaded) do
print(key)
end
end
EOF
endif