dotfiles/nvimrc

599 lines
18 KiB
Plaintext
Raw Normal View History

2021-07-19 19:51:35 +00:00
" Prefer $HOME/.vim to $HOME/.config/nvim (for now):
2023-09-17 07:58:53 +00:00
" TODO: refactor file structure for nvim
set runtimepath^=~/.vim runtimepath+=~/.vim/after runtimepath+=~/.vim/lua
2021-06-22 04:24:37 +00:00
let &packpath = &runtimepath
set background=dark
syntax on
filetype plugin indent on
let mapleader=','
" netrw
let g:netrw_banner = 0
let g:netrw_liststyle = 1
let g:netrw_list_hide = '^\.'
let g:netrw_winsize=25
map <leader>n <esc>:Lexplore<cr>
" fix helptags for opt/ plugins
" https://vi.stackexchange.com/questions/17210/generating-help-tags-for-packages-that-are-loaded-by-vim-8s-package-management
command! -nargs=0 -bar Helptags
\ for p in glob('~/.vim/pack/git-plugins/opt/*', 1, 1)
\| exe 'packadd ' . fnamemodify(p, ':t')
\| endfor
\| helptags ALL
set shiftwidth=2
set shiftround
set tabstop=2
set expandtab
set smarttab
set splitbelow
set splitright
set encoding=utf-8
set hidden
set nowrap
set smartindent
set copyindent
set autoindent
set hlsearch
set showmatch
set wildmenu
set wildmode=list:full,full
set number
set norelativenumber
2021-06-22 04:24:37 +00:00
set ruler
set backspace=indent,eol,start
set ignorecase
set smartcase
set incsearch
set history=1000
set undolevels=1000
set title
set novisualbell
set noerrorbells
set nobackup
set noswapfile
set mouse=a
set mousemodel=popup_setpos
" https://github.com/tpope/vim-sensible/issues/78:
set lazyredraw
set timeoutlen=1000
set scrolloff=15
set dictionary=/usr/share/dict/words
" See :help thesaurus
set thesaurus=$HOME/Documents/thesaurus/thesaurus_pkg/thesaurus.txt
set shortmess+=I
set updatetime=250
set pastetoggle=<f2>
set pumheight=200
" Required for nvim-compe:
set complete-=i
set nrformats-=octal
set ttimeout
set ttimeoutlen=100
set formatoptions+=j
set autoread
" https://github.com/tpope/vim-sensible/issues/142:
set synmaxcol=500
" Enable 24-bit colours.
" https://github.com/alacritty/alacritty/issues/109#issuecomment-440353106
if exists('+termguicolors')
let &t_8f="\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b="\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
endif
" Colour scheme:
packadd! nord-vim " https://github.com/arcticicestudio/nord-vim.git
colorscheme nord
augroup vimrc
autocmd!
" Automatically load/save views on files.
" https://vi.stackexchange.com/posts/13874/revisions
autocmd BufWinLeave,BufLeave,BufWritePost,BufHidden,QuitPre ?* nested silent! mkview!
autocmd BufWinEnter ?* silent! loadview
" set cursor line highlight in insert mode.
autocmd InsertEnter * set cul
autocmd InsertLeavePre * set nocul
" use tabs in .gitconfig
autocmd BufEnter .gitconfig setlocal shiftwidth=2 tabstop=2 noexpandtab
" Quickfix window is always full-width.
" https://github.com/fatih/vim-go/issues/1757#issuecomment-565130503
autocmd FileType qf if (getwininfo(win_getid())[0].loclist != 1) | wincmd J | endif
" Remove trailing whitespace pre-save:
2022-01-27 16:24:09 +00:00
autocmd FileType go,ruby,markdown,rust,python,markdown,lua autocmd BufWritePre <buffer> silent! %s/\s\+$//e
2021-06-22 04:24:37 +00:00
augroup end
" Don't remember the current directory for a given file:
set viewoptions-=curdir
set viewoptions-=options
set sessionoptions-=options
" Key mappings:
nnoremap j gj
nnoremap k gk
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
imap <up> <nop>
imap <down> <nop>
imap <left> <nop>
imap <right> <nop>
nmap ]q :cn<cr>
nmap [q :cp<cr>
nnoremap <silent> <leader>w :up<cr>
2021-06-22 04:24:37 +00:00
nnoremap <silent> <leader>/ :nohlsearch<cr>
nnoremap <silent> <leader><space> :nohlsearch<cr>
" Select just-pasted text:
nnoremap <silent> <leader>0 `[v`]
" Select just-pasted text and re-indent:
nnoremap <silent> <leader>) `[v`]=
nnoremap <silent> <leader>1 :set relativenumber!<cr>
nnoremap <silent> <leader>! :windo set norelativenumber<cr>
nnoremap <leader>m :marks<cr>
nnoremap <leader>v :vsplit<cr>
nnoremap <leader>s :split<cr>
nnoremap <leader>rp "_dd<bar>P
nnoremap <leader>dq ggVG"_d:wq<cr>
2021-06-22 04:24:37 +00:00
" abbrevs
iabbrev esdebug debugger; // eslint-disable-line no-debugger
2022-06-10 17:08:01 +00:00
iabbrev bashstrict set -euo pipefail<cr>IFS=$'\n\t'<cr>
2023-09-17 17:43:16 +00:00
" include all lua
2023-09-17 07:58:53 +00:00
lua require("main")
2021-12-16 19:23:10 +00:00
" Function to eat trailing character when applying iabbrevs.
" https://stackoverflow.com/questions/11858927/preventing-trailing-whitespace-when-using-vim-abbreviations
2021-12-30 13:26:10 +00:00
func! Eatchar(pat)
2021-12-16 19:23:10 +00:00
let c = nr2char(getchar(0))
return (c =~ a:pat) ? '' : c
endfunc
2021-06-22 04:24:37 +00:00
" Git mappings
"
" Copy Git permalink to clipboard for either current line or range
function! CopyGitURLToLineOrRange() range
if a:firstline == a:lastline
execute ".GBrowse!"
else
execute a:firstline . "," . a:lastline . "GBrowse!"
endif
endfunction
function! OpenGitURLToLineOrRange() range
if a:firstline == a:lastline
execute ".GBrowse"
else
execute a:firstline . "," . a:lastline . "GBrowse"
endif
endfunction
2021-07-27 07:05:29 +00:00
nnoremap <leader>as :Git<cr>
2021-06-22 04:24:37 +00:00
nnoremap <leader>ab :Git blame<cr>
nnoremap <leader>ac :Commits<cr>
nnoremap <leader>ah :GitGutterLineHighlightsToggle<cr>
nnoremap <leader>aY :call CopyGitURLToLineOrRange()<cr>
vnoremap <leader>aY :call CopyGitURLToLineOrRange()<cr>
nnoremap <leader>ao :call OpenGitURLToLineOrRange()<cr>
nnoremap <leader>ap :execute 'silent !ghpr <c-r><c-f>' \| redraw!<cr>
" echo filename of current buffer:
nmap <leader>fe :echom expand("%:p")<cr>
" yank filename of current buffer:
function! CopyToDefaultRegister()
let @" = expand("%:p")
echom expand("%:p")
endfunction
nmap <leader>fy :call CopyToDefaultRegister()<cr>
" and into + register:
function! CopyToSystemClipboard()
let @* = expand("%:p")
let @+ = expand("%:p")
echom expand("%:p")
endfunction
nmap <leader>fY :call CopyToSystemClipboard()<cr>
" disable Ex mode
nnoremap Q <Nop>
function! ToggleQuickFix()
if empty(filter(getwininfo(), 'v:val.quickfix'))
copen
else
cclose
endif
endfunction
nmap <silent> <leader>q :call ToggleQuickFix()<cr>
nmap <silent> <leader>l :lclose<cr>
" vim-markdown configuration:
let g:vim_markdown_conceal = 1
" fzf configuration:
let g:fzf_action = {
2021-10-19 14:33:29 +00:00
\ 'ctrl-h': 'leftabove vsplit',
\ 'ctrl-j': 'rightbelow split',
\ 'ctrl-k': 'leftabove split',
\ 'ctrl-l': 'rightbelow vsplit',
\ 'ctrl-o': 'only | e',
\ 'ctrl-s': 'split',
\ 'ctrl-t': 'tab split',
\ 'ctrl-v': 'vsplit',
\ }
nmap <leader>t :GFiles<cr>
nmap <leader>T :Files<cr>
2021-06-22 04:24:37 +00:00
nmap <leader>b :Buffers<cr>
2021-12-16 22:44:18 +00:00
nmap <leader>rg :Rg<cr>
2021-06-22 04:24:37 +00:00
" Lightline configuration:
packadd! lightline.vim " https://github.com/itchyny/lightline.vim.git
set laststatus=2
function! LightlineLSPErrorText()
let l:count = luaeval("vim.diagnostic.get(0, [[Error]])")
2021-06-22 04:24:37 +00:00
if l:count == 0
return ''
endif
return l:count . 'E'
endfunction
function! LightlineLSPWarningText()
let l:count = luaeval("vim.diagnostic.get(0, [[Warning]])")
2021-06-22 04:24:37 +00:00
if l:count == 0
return ''
endif
return l:count . 'W'
endfunction
function! LightlineLSPInformationText()
let l:count = luaeval("vim.diagnostic.get(0, [[Information]])")
2021-06-22 04:24:37 +00:00
if l:count == 0
return ''
endif
return l:count . 'I'
endfunction
let g:lightline = {
\ 'colorscheme': 'seoul256',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'readonly', 'filename', 'modified' ],
\ [ 'gitbranch' ], ['lsperror', 'lspwarn', 'lspinfo' ] ],
\ 'right': [ ['lineinfo'], ['percent'], ['filetype'], ['gobuild'] ],
\ },
\ 'component_function': {
\ 'gobuild': 'go#statusline#Show',
\ 'gitbranch': 'FugitiveStatusline',
\ },
\ 'component_expand': {
\ 'lsperror': 'LightlineLSPErrorText',
\ 'lspwarn': 'LightlineLSPWarningText',
\ 'lspinfo': 'LightlineLSPInformationText',
\ },
\ 'component_type': {
\ 'lsperror': 'error',
\ 'lspwarn': 'warning',
\ },
\ 'mode_map': {
\ 'n' : 'N',
\ 'i' : 'I',
\ 'R' : 'R',
\ 'v' : 'V',
\ 'V' : 'V-LINE',
\ "\<C-v>": 'V-BLOCK',
\ 'c' : 'C',
\ 's' : 'S',
\ 'S' : 'S-LINE',
\ "\<C-s>": 'S-BLOCK',
\ 't': 'TERM',
\ },
\ }
" vim-gitgutter configuration
packadd! vim-gitgutter " https://github.com/airblade/vim-gitgutter.git
set signcolumn=yes
nmap ]h <Plug>(GitGutterNextHunk)
nmap [h <Plug>(GitGutterPrevHunk)
omap ih <Plug>(GitGutterTextObjectInnerPending)
omap ah <Plug>(GitGutterTextObjectOuterPending)
xmap ih <Plug>(GitGutterTextObjectInnerVisual)
xmap ah <Plug>(GitGutterTextObjectOuterVisual)
" vim-fugitive
packadd! vim-fugitive " https://github.com/tpope/vim-fugitive.git
" vim-go
" Doesn't work in after/ftplugin/go.vim:
let g:go_def_mapping_enabled = 0
packadd! vim-go " https://github.com/fatih/vim-go.git
" load internal plugins:
runtime macros/matchit.vim
" load other plugins:
packadd! rust.vim " https://github.com/rust-lang/rust.vim.git
packadd! tmux-complete.vim " https://github.com/wellle/tmux-complete.vim.git
packadd! vim-commentary " https://github.com/tpope/vim-commentary.git
2021-07-14 16:00:43 +00:00
packadd! vim-rails " https://github.com/tpope/vim-rails.git
2022-02-17 06:23:00 +00:00
packadd! vim-jsx-pretty " https://github.com/MaxMEllon/vim-jsx-pretty.git
2021-06-22 04:24:37 +00:00
" Requires both fzf.vim plugin to be manually installed:
" https://github.com/junegunn/fzf/blob/master/plugin/fzf.vim
" and also this separate plugin, which is loaded here:
packadd! fzf.vim " https://github.com/junegunn/fzf.vim.git
packadd! vim-surround " https://github.com/tpope/vim-surround.git
packadd! vim-rhubarb " https://github.com/tpope/vim-rhubarb.git
packadd! editorconfig-vim " https://github.com/editorconfig/editorconfig-vim.git
packadd! vim-wordmotion " https://github.com/chaoren/vim-wordmotion.git
" formatter.nvim: see lua/formatter.lua
" packadd! formatter.nvim " https://github.com/mhartington/formatter.nvim.git
2021-06-22 04:24:37 +00:00
" enable inline vim highlighting:
let g:vimsyn_embed= 'lPr'
" Treesitter: see lua/treesitter_config.lua
" packadd! nvim-treesitter " https://github.com/nvim-treesitter/nvim-treesitter.git
" packadd! nvim-treesitter-textobjects " https://github.com/nvim-treesitter/nvim-treesitter-textobjects.git
" packadd! nvim-treesitter-refactor " https://github.com/nvim-treesitter/nvim-treesitter-refactor.git
" packadd! nvim-treesitter-context " https://github.com/nvim-treesitter/nvim-treesitter-context.git
" packadd! playground " https://github.com/nvim-treesitter/playground.git
2022-08-25 02:50:22 +00:00
2023-09-17 20:50:50 +00:00
" copilot: see lua/copilot_config.lua
" packadd! copilot.lua " https://github.com/zbirenbaum/copilot.lua.git
2023-09-17 05:32:54 +00:00
2021-10-27 07:35:24 +00:00
" nvim-cmp:
packadd! nvim-cmp " https://github.com/hrsh7th/nvim-cmp.git
2023-09-17 05:32:54 +00:00
packadd! copilot-cmp " https://github.com/zbirenbaum/copilot-cmp.git
2021-10-27 07:35:24 +00:00
packadd! vim-vsnip " https://github.com/hrsh7th/vim-vsnip.git
packadd! cmp-vsnip " https://github.com/hrsh7th/cmp-vsnip.git
packadd! cmp-nvim-lsp " https://github.com/hrsh7th/cmp-nvim-lsp.git
packadd! cmp-buffer " https://github.com/hrsh7th/cmp-buffer.git
packadd! cmp-path " https://github.com/hrsh7th/cmp-path.git
packadd! cmp-calc " https://github.com/hrsh7th/cmp-calc
lua <<EOF
local cmp = require('cmp')
local cmp_buffer = require('cmp_buffer')
2021-10-27 07:35:24 +00:00
cmp.setup({
completion = {
completeopt = 'menu,menuone,noinsert',
},
2021-10-27 07:35:24 +00:00
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
2023-09-18 06:01:47 +00:00
mapping = cmp.mapping.preset.insert({
2021-10-27 07:35:24 +00:00
['<C-u>'] = cmp.mapping.scroll_docs(-4),
['<C-d>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
2023-09-18 06:01:47 +00:00
['C-y'] = cmp.mapping.confirm({ select = true, behaviour = cmp.ConfirmBehavior.Replace }),
2021-10-27 07:35:24 +00:00
['<CR>'] = cmp.mapping.confirm({ select = true, behaviour = cmp.ConfirmBehavior.Replace }),
2023-09-18 06:01:47 +00:00
}),
2021-10-27 07:35:24 +00:00
sources = cmp.config.sources({
2023-09-17 06:17:46 +00:00
{ name = 'copilot', keyword_length = 0 },
2023-09-18 06:01:47 +00:00
{ name = 'nvim_lsp', keyword_length = 3 },
{
name = 'buffer',
option = {
get_bufnrs = function()
return vim.api.nvim_list_bufs()
end
},
},
2021-10-27 07:35:24 +00:00
{ name = 'path' },
{ name = 'calc' },
}),
sorting = {
comparators = {
function(...) return cmp_buffer:compare_locality(...) end,
}
2021-12-30 13:26:10 +00:00
},
2022-02-14 17:08:31 +00:00
view = {
entries = 'native',
},
2021-12-30 13:26:10 +00:00
experimental = {
ghost_text = true,
},
2021-10-27 07:35:24 +00:00
})
EOF
2021-06-22 04:24:37 +00:00
" LSP
packadd! nvim-lspconfig " https://github.com/neovim/nvim-lspconfig.git
2022-06-02 15:25:43 +00:00
packadd! lsp_signature.nvim " https://github.com/ray-x/lsp_signature.nvim.git
2021-06-22 04:24:37 +00:00
packadd! fzf-lsp.nvim " https://github.com/gfanto/fzf-lsp.nvim.git
lua <<EOF
local nvim_lsp = require('lspconfig')
local on_attach = function(client, bufnr)
-- nvim does not expose autocmd via Lua API yet:
vim.api.nvim_exec([[autocmd User LspDiagnosticsChanged call lightline#update()]], false)
local opts = { noremap=true, silent=false }
2022-06-02 15:25:43 +00:00
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
2021-06-22 04:24:37 +00:00
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', '<Cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>gD', '<Cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>e', '<Cmd>lua vim.lsp.buf.rename()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>r', '<Cmd>lua vim.lsp.buf.references()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>i', '<Cmd>lua vim.lsp.buf.implementation()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>ca', '<Cmd>lua vim.lsp.buf.code_action()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>ci', '<Cmd>lua vim.lsp.buf.incoming_calls()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>co', '<Cmd>lua vim.lsp.buf.outgoing_calls()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']e', '<Cmd>lua vim.diagnostic.goto_next({severity="Error"})<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '[e', '<Cmd>lua vim.diagnostic.goto_prev({severity="Error"})<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']d', '<Cmd>lua vim.diagnostic.goto_next()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '[d', '<Cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'cd', '<Cmd>lua vim.diagnostic.hide(nil, 0)<CR>', opts)
2021-06-22 04:24:37 +00:00
-- fzf triggers:
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>fr', '<Cmd>References<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>fi', '<Cmd>Implementations<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>fs', '<Cmd>DocumentSymbols<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>fw', '<Cmd>WorkspaceSymbols<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>fc', '<Cmd>CodeActions<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>fci', '<Cmd>IncomingCalls<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>fco', '<Cmd>OutgoingCalls<CR>', opts)
2022-06-02 15:25:43 +00:00
require 'lsp_signature'.on_attach({
hint_enable = false,
})
2023-09-17 05:32:54 +00:00
require 'copilot_cmp'.setup();
2021-06-22 04:24:37 +00:00
end
-- Go
2023-01-11 06:27:22 +00:00
local capabilities = require('cmp_nvim_lsp').default_capabilities()
2021-06-22 04:24:37 +00:00
capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.completion.completionItem.resolveSupport = {
properties = {
'documentation',
'detail',
'additionalTextEdits',
}
}
nvim_lsp.gopls.setup{
settings = {
gopls = {
staticcheck = true,
2022-12-26 06:29:15 +00:00
-- Disalbing linksInHover may not be working as expected:
linksInHover = false,
usePlaceholders = true,
2021-06-22 04:24:37 +00:00
analyses = {
unusedparams = true,
shadow = true,
unusedwrite = true,
unusedresult = true,
nilness = true,
},
},
},
capabilities = capabilities,
on_attach = on_attach,
}
2021-09-04 21:14:09 +00:00
-- Rust
nvim_lsp.rust_analyzer.setup{
2023-02-28 16:18:17 +00:00
capabilities = capabilities,
2021-09-04 21:14:09 +00:00
on_attach = on_attach,
2022-12-13 21:18:34 +00:00
settings = {
["rust-analyzer"] = {
imports = {
granularity = {
group = "module",
},
prefix = "self",
},
cargo = {
buildScripts = {
enable = true,
},
},
procMacro = {
2023-02-28 16:18:17 +00:00
enable = false,
2022-12-13 21:18:34 +00:00
},
2023-02-28 16:18:17 +00:00
diagnostics = {
disabled = { "unresolved-proc-macro" },
}
2022-12-13 21:18:34 +00:00
}
}
2021-09-04 21:14:09 +00:00
}
2021-06-22 04:24:37 +00:00
-- Ruby
nvim_lsp.solargraph.setup{
on_attach = on_attach,
}
2021-10-08 12:30:42 +00:00
-- Typescript
-- https://jose-elias-alvarez.medium.com/configuring-neovims-lsp-client-for-typescript-development-5789d58ea9c
nvim_lsp.tsserver.setup{
on_attach = on_attach,
}
local filetypes = {
typescript = "eslint",
typescriptreact = "eslint",
}
-- diagnosticls
2021-10-08 12:30:42 +00:00
local linters = {
eslint = {
sourceName = "eslint",
-- fallback to global eslint if the local is not found?
-- https://github.com/creativenull/diagnosticls-configs-nvim/blob/e7d6f7e99f6b416d2aeee89314bc46fc36df7b22/lua/diagnosticls-configs/fs.lua#L20
command = "./node_modules/.bin/eslint",
rootPatterns = {".eslintrc", ".eslintrc.js"},
2021-10-08 12:30:42 +00:00
debounce = 100,
args = {"--stdin", "--stdin-filename", "%filepath", "--format", "json"},
parseJson = {
errorsRoot = "[0].messages",
line = "line",
column = "column",
endLine = "endLine",
endColumn = "endColumn",
message = "${message} [${ruleId}]",
security = "severity"
},
securities = {[1] = "error", [2] = "warning"}
}
}
nvim_lsp.diagnosticls.setup{
on_attach = on_attach,
filetypes = vim.tbl_keys(filetypes),
init_options = {
linters = linters,
filetypes = filetypes,
}
}
2021-06-22 04:24:37 +00:00
-- Lua
2023-02-28 16:18:28 +00:00
local lua_ls_root_path = os.getenv("HOME").."/dev/lua-language-server"
local lua_ls_binary = lua_ls_root_path.."/bin/lua-language-server"
2021-06-22 04:24:37 +00:00
local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")
2023-02-28 16:18:28 +00:00
nvim_lsp.lua_ls.setup {
cmd = {lua_ls_binary, "-E", lua_ls_root_path .. "/main.lua"};
2021-06-22 04:24:37 +00:00
settings = {
Lua = {
runtime = {
version = 'LuaJIT',
path = runtime_path,
},
diagnostics = {
globals = {'vim'},
},
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
},
telemetry = {
enable = false,
},
},
},
on_attach = on_attach,
}
EOF