changed everything to spaces over tabs.

This commit is contained in:
Gabe Venberg 2024-02-22 16:10:47 -06:00
parent ffefa0fffd
commit 4c63486b4b
24 changed files with 1190 additions and 1190 deletions

View file

@ -1,9 +1,9 @@
"TODO: port to LUA!
function! Minimal_foldtext()
let lines_count = v:foldend - v:foldstart + 1
let lines_count_text = '+' . v:folddashes . '| ' . printf("%10S" , lines_count) . ' lines |'
let line_level_text = '| ' . printf("%8S" , 'level ' . v:foldlevel) . ' |'
let fold_text_end = line_level_text . repeat('-',8)
let fold_text_length = strlen(lines_count_text . fold_text_end) + &foldcolumn
return lines_count_text . repeat('-' , winwidth(0) - fold_text_length - 4) . fold_text_end
let lines_count = v:foldend - v:foldstart + 1
let lines_count_text = '+' . v:folddashes . '| ' . printf("%10S" , lines_count) . ' lines |'
let line_level_text = '| ' . printf("%8S" , 'level ' . v:foldlevel) . ' |'
let fold_text_end = line_level_text . repeat('-',8)
let fold_text_length = strlen(lines_count_text . fold_text_end) + &foldcolumn
return lines_count_text . repeat('-' , winwidth(0) - fold_text_length - 4) . fold_text_end
endfunction

View file

@ -1,67 +1,67 @@
local opts = {}
local on_attach = function()
local function set_keymap(...) vim.api.nvim_set_keymap(...) end
local function set_keymap(...) vim.api.nvim_set_keymap(...) end
local function set_option(...) vim.api.nvim_set_option(...) end
local function set_option(...) vim.api.nvim_set_option(...) end
-- Enable completion triggered by <c-x><c-o>
set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Enable completion triggered by <c-x><c-o>
set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
local function optsWithDesc(desc)
return { silent = true, desc = desc }
end
-- Mappings.
local function optsWithDesc(desc)
return { silent = true, desc = desc }
end
--setup leader-l prefix in whitch-key
local wk = require("which-key")
wk.register {
["<leader>l"]={
name="+lsp"
}
}
--setup leader-l prefix in whitch-key
local wk = require("which-key")
wk.register {
["<leader>l"]={
name="+lsp"
}
}
-- See `:help vim.lsp.*` for documentation on any of the below functions
set_keymap('', '<leader>lc', '<cmd>lua vim.lsp.buf.declaration()<CR>', optsWithDesc("jump to declaration"))
set_keymap('', '<leader>ld', '<cmd>lua vim.lsp.buf.definition()<CR>', optsWithDesc("jump to definition"))
set_keymap('', '<leader>lh', '<cmd>lua vim.lsp.buf.hover()<CR>', optsWithDesc("show lsp hover info"))
set_keymap('', '<leader>li', '<cmd>lua vim.lsp.buf.implementation()<CR>', optsWithDesc("show implementations"))
set_keymap('', '<leader>ls', '<cmd>lua vim.lsp.buf.signature_help()<CR>', optsWithDesc("show signature help"))
set_keymap('', '<leader>lwa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', optsWithDesc("add workspace folder"))
set_keymap('', '<leader>lwr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>',
optsWithDesc("remove workspace folder"))
set_keymap('', '<leader>lw', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>',
optsWithDesc("show workspace folders"))
set_keymap('', '<leader>lr', '<cmd>lua vim.lsp.buf.rename()<CR>', optsWithDesc("rename symbol"))
set_keymap('', '<leader>la', '<cmd>lua vim.lsp.buf.code_action()<CR>', optsWithDesc("lsp code action"))
set_keymap('', '<leader>le', '<cmd>lua vim.lsp.buf.references()<CR>', optsWithDesc("list references"))
set_keymap('', '<leader>lo', '<cmd>lua vim.diagnostic.open_float()<CR>',
optsWithDesc("show diagnostic in floating window"))
set_keymap('', '<leader>ln', '<cmd>lua vim.diagnostic.goto_next()<CR>', optsWithDesc("next lsp diagnostic"))
set_keymap('', '<leader>lp', '<cmd>lua vim.diagnostic.goto_prev()<CR>', optsWithDesc("prev lsp diagnostic"))
set_keymap('', '<leader>lm', '<cmd>lua vim.lsp.buf.format {async=true}<CR>', optsWithDesc("format buffer"))
set_keymap('', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', optsWithDesc("next lsp diagnostic"))
set_keymap('', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', optsWithDesc("prev lsp diagnostic"))
-- See `:help vim.lsp.*` for documentation on any of the below functions
set_keymap('', '<leader>lc', '<cmd>lua vim.lsp.buf.declaration()<CR>', optsWithDesc("jump to declaration"))
set_keymap('', '<leader>ld', '<cmd>lua vim.lsp.buf.definition()<CR>', optsWithDesc("jump to definition"))
set_keymap('', '<leader>lh', '<cmd>lua vim.lsp.buf.hover()<CR>', optsWithDesc("show lsp hover info"))
set_keymap('', '<leader>li', '<cmd>lua vim.lsp.buf.implementation()<CR>', optsWithDesc("show implementations"))
set_keymap('', '<leader>ls', '<cmd>lua vim.lsp.buf.signature_help()<CR>', optsWithDesc("show signature help"))
set_keymap('', '<leader>lwa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', optsWithDesc("add workspace folder"))
set_keymap('', '<leader>lwr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>',
optsWithDesc("remove workspace folder"))
set_keymap('', '<leader>lw', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>',
optsWithDesc("show workspace folders"))
set_keymap('', '<leader>lr', '<cmd>lua vim.lsp.buf.rename()<CR>', optsWithDesc("rename symbol"))
set_keymap('', '<leader>la', '<cmd>lua vim.lsp.buf.code_action()<CR>', optsWithDesc("lsp code action"))
set_keymap('', '<leader>le', '<cmd>lua vim.lsp.buf.references()<CR>', optsWithDesc("list references"))
set_keymap('', '<leader>lo', '<cmd>lua vim.diagnostic.open_float()<CR>',
optsWithDesc("show diagnostic in floating window"))
set_keymap('', '<leader>ln', '<cmd>lua vim.diagnostic.goto_next()<CR>', optsWithDesc("next lsp diagnostic"))
set_keymap('', '<leader>lp', '<cmd>lua vim.diagnostic.goto_prev()<CR>', optsWithDesc("prev lsp diagnostic"))
set_keymap('', '<leader>lm', '<cmd>lua vim.lsp.buf.format {async=true}<CR>', optsWithDesc("format buffer"))
set_keymap('', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', optsWithDesc("next lsp diagnostic"))
set_keymap('', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', optsWithDesc("prev lsp diagnostic"))
end
require("mason-lspconfig").setup_handlers({
function(server_name)
require("lspconfig")[server_name].setup {}
on_attach()
end,
["rust_analyzer"] = function()
require('rust-tools-setup')
on_attach()
end,
["lua_ls"] = function()
require('lspconfig').lua_ls.setup {
settings = {
Lua = {
diagnostics = {
globals = { "vim" }
}
}
}
}
on_attach()
end,
function(server_name)
require("lspconfig")[server_name].setup {}
on_attach()
end,
["rust_analyzer"] = function()
require('rust-tools-setup')
on_attach()
end,
["lua_ls"] = function()
require('lspconfig').lua_ls.setup {
settings = {
Lua = {
diagnostics = {
globals = { "vim" }
}
}
}
}
on_attach()
end,
})

View file

@ -8,63 +8,63 @@ vim.o.completeopt='menu,menuone,preview,noinsert,noselect'
-- nvim-cmp setup
local cmp = require 'cmp'
cmp.setup {
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
mapping = {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Insert,
select = false,
-- behavior = cmp.ConfirmBehavior.Replace,
-- select = false,
},
['<Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end,
['<S-Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end,
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'path' },
{ name = 'luasnip' },
{ name = 'nvim_lsp_signature_help' },
{ name = 'emoji' },
{ name = 'latex_symbols' },
-- { name = 'buffer' },
-- { name = 'digraphs' },
-- { name = 'dictionary' },
-- { name = 'spell' },
},
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
mapping = {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Insert,
select = false,
-- behavior = cmp.ConfirmBehavior.Replace,
-- select = false,
},
['<Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end,
['<S-Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end,
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'path' },
{ name = 'luasnip' },
{ name = 'nvim_lsp_signature_help' },
{ name = 'emoji' },
{ name = 'latex_symbols' },
-- { name = 'buffer' },
-- { name = 'digraphs' },
-- { name = 'dictionary' },
-- { name = 'spell' },
},
}
cmp.setup.cmdline('/', {
sources = cmp.config.sources({
{ name = 'nvim_lsp_document_symbol' },
{ name = 'treesitter' },
}, {
{ name = 'buffer' },
{ name = 'cmdline' },
})
sources = cmp.config.sources({
{ name = 'nvim_lsp_document_symbol' },
{ name = 'treesitter' },
}, {
{ name = 'buffer' },
{ name = 'cmdline' },
})
})

View file

@ -1,85 +1,85 @@
local opts = {
tools = {
autoSetHints = true,
RustHoverActions = true,
tools = {
autoSetHints = true,
RustHoverActions = true,
-- how to execute terminal commands
executor = require("rust-tools/executors").termopen,
inlay_hints = {
auto=true,
-- Only show inlay hints for the current line
only_current_line = false,
-- Event which triggers a refersh of the inlay hints.
only_current_line_autocmd = "CursorHold",
-- whether to show parameter hints with the inlay hints or not
show_parameter_hints = true,
-- whether to show variable name before type hints with the inlay hints or not
show_variable_name = true,
-- prefix for parameter hints
parameter_hints_prefix = "<- ",
-- prefix for all the other hints (type, chaining)
other_hints_prefix = "=> ",
-- whether to align to the lenght of the longest line in the file
max_len_align = false,
-- padding from the left if max_len_align is true
max_len_align_padding = 1,
-- whether to align to the extreme right or not
right_align = true,
-- padding from the right if right_align is true
right_align_padding = 1,
-- The color of the hints
highlight = "Comment",
},
hover_actions = {
-- the border that is used for the hover window
border = {
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
},
-- whether the hover action window gets automatically focused
auto_focus = false,
},
-- settings for showing the crate graph based on graphviz and the dot
-- command
crate_graph = {
-- Backend used for displaying the graph
backend = "x11",
-- where to store the output, nil for no output stored (relative
-- path from pwd)
output = nil,
-- true for all crates.io and external crates, false only the local
-- crates
full = true,
},
},
-- all the opts to send to nvim-lspconfig
server = {
-- standalone file support
-- setting it to false may improve startup time
standalone = true,
settings = {
-- rust-analyer options
["rust-analyzer"] = {
-- enable clippy on save
checkOnSave = {
command = "clippy"
},
}
}
},
-- debugging stuff
dap = {
adapter = {
type = "executable",
command = "lldb-vscode",
name = "rt_lldb",
},
},
-- how to execute terminal commands
executor = require("rust-tools/executors").termopen,
inlay_hints = {
auto=true,
-- Only show inlay hints for the current line
only_current_line = false,
-- Event which triggers a refersh of the inlay hints.
only_current_line_autocmd = "CursorHold",
-- whether to show parameter hints with the inlay hints or not
show_parameter_hints = true,
-- whether to show variable name before type hints with the inlay hints or not
show_variable_name = true,
-- prefix for parameter hints
parameter_hints_prefix = "<- ",
-- prefix for all the other hints (type, chaining)
other_hints_prefix = "=> ",
-- whether to align to the lenght of the longest line in the file
max_len_align = false,
-- padding from the left if max_len_align is true
max_len_align_padding = 1,
-- whether to align to the extreme right or not
right_align = true,
-- padding from the right if right_align is true
right_align_padding = 1,
-- The color of the hints
highlight = "Comment",
},
hover_actions = {
-- the border that is used for the hover window
border = {
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
},
-- whether the hover action window gets automatically focused
auto_focus = false,
},
-- settings for showing the crate graph based on graphviz and the dot
-- command
crate_graph = {
-- Backend used for displaying the graph
backend = "x11",
-- where to store the output, nil for no output stored (relative
-- path from pwd)
output = nil,
-- true for all crates.io and external crates, false only the local
-- crates
full = true,
},
},
-- all the opts to send to nvim-lspconfig
server = {
-- standalone file support
-- setting it to false may improve startup time
standalone = true,
settings = {
-- rust-analyer options
["rust-analyzer"] = {
-- enable clippy on save
checkOnSave = {
command = "clippy"
},
}
}
},
-- debugging stuff
dap = {
adapter = {
type = "executable",
command = "lldb-vscode",
name = "rt_lldb",
},
},
}
require('rust-tools').setup(opts)