This commit is contained in:
Jan Eitzinger 2024-02-16 14:20:24 +01:00
parent 674ea2016f
commit 13c23dfa1c
7 changed files with 1 additions and 537 deletions

View File

@ -1,26 +0,0 @@
vim.g.tex_flavor = "latex"
vim.opt_local.conceallevel = 2
-- vim.opt_local.spell = true
vim.opt_local.wrap = true
require("nvim-surround").buffer_setup({
surrounds = {
['"'] = {
add = { "``", "''" },
find = "``.-''",
delete = "^(``)().-('')()$",
},
["$"] = {
add = { "\\(", "\\)" },
find = "\\%(.-\\%)",
delete = "^(\\%()().-(\\%))()$",
change = {
target = "^\\(%()().-(\\%))()$",
replacement = function()
return { { "[", "\t" }, { "", "\\]" } }
end,
},
},
},
})

View File

@ -1,85 +0,0 @@
local ok, cmp = pcall(require, 'cmp')
if not ok then
return
end
require('luasnip.loaders.from_vscode').lazy_load()
local luasnip = require('luasnip')
local lspkind = require('lspkind')
local select_opts = {behavior = cmp.SelectBehavior.Select}
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end
},
sources = {
{name = 'path'},
{name = 'nvim_lsp', keyword_length = 1},
{name = 'buffer', keyword_length = 3},
{name = 'luasnip', keyword_length = 2},
},
window = {
documentation = cmp.config.window.bordered()
},
formatting = {
format = lspkind.cmp_format({
mode = 'symbol_text', -- show only symbol annotations
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
})
},
mapping = {
['<Up>'] = cmp.mapping.select_prev_item(select_opts),
['<Down>'] = cmp.mapping.select_next_item(select_opts),
['<C-p>'] = cmp.mapping.select_prev_item(select_opts),
['<C-n>'] = cmp.mapping.select_next_item(select_opts),
['<C-u>'] = cmp.mapping.scroll_docs(-4),
['<C-d>'] = cmp.mapping.scroll_docs(4),
['<C-e>'] = cmp.mapping.abort(),
['<C-y>'] = cmp.mapping.confirm({select = true}),
['<CR>'] = cmp.mapping.confirm({select = false}),
['<C-f>'] = cmp.mapping(function(fallback)
if luasnip.jumpable(1) then
luasnip.jump(1)
else
fallback()
end
end, {'i', 's'}),
['<C-b>'] = cmp.mapping(function(fallback)
if luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, {'i', 's'}),
['<Tab>'] = cmp.mapping(function(fallback)
local col = vim.fn.col('.') - 1
if cmp.visible() then
cmp.select_next_item(select_opts)
elseif col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
fallback()
else
cmp.complete()
end
end, {'i', 's'}),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item(select_opts)
else
fallback()
end
end, {'i', 's'}),
},
})

View File

@ -1,220 +0,0 @@
local ok, lsp = pcall(require, 'lspconfig')
if not ok then
return
end
{{- if ne .chezmoi.os "openbsd" }}
-- See :help mason-settings
require('mason').setup({
ui = { border = 'rounded' }
})
-- See :help mason-lspconfig-settings
require('mason-lspconfig').setup({
ensure_installed = {
'clangd',
'gopls',
'ltex',
'marksman',
'svelte',
'tsserver',
'eslint',
'html',
'cssls',
'lua_ls'
}
})
{{- end }}
local lsp_defaults = lsp.util.default_config
lsp_defaults.capabilities = vim.tbl_deep_extend(
'force',
lsp_defaults.capabilities,
require('cmp_nvim_lsp').default_capabilities()
)
local sign = function(opts)
-- See :help sign_define()
vim.fn.sign_define(opts.name, {
texthl = opts.name,
text = opts.text,
numhl = ''
})
end
sign({ name = 'DiagnosticSignError', text = '✘' })
sign({ name = 'DiagnosticSignWarn', text = '▲' })
sign({ name = 'DiagnosticSignHint', text = '⚑' })
sign({ name = 'DiagnosticSignInfo', text = '' })
vim.diagnostic.config({
virtual_text = false,
severity_sort = true,
float = {
border = 'rounded',
source = 'always',
header = '',
prefix = '',
},
})
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
vim.lsp.handlers.hover,
{ border = 'rounded' }
)
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
vim.lsp.handlers.signature_help,
{ border = 'rounded' }
)
vim.lsp.handlers["workspace/diagnostic/refresh"] = function(_, _, ctx)
local ns = vim.lsp.diagnostic.get_namespace(ctx.client_id)
pcall(vim.diagnostic.reset, ns)
return true
end
vim.api.nvim_create_autocmd('BufWritePre', {
pattern = '*.go',
callback = function()
vim.lsp.buf.code_action({ context = { only = { 'source.organizeImports' } }, apply = true })
end
})
require("lsp-format").setup {
html = {
exclude = { "html" }
},
svelte = {
exclude = { "svelte" }
}
}
{{- if ne .chezmoi.os "openbsd" }}
local group = vim.api.nvim_create_augroup('lsp_cmds', { clear = true })
vim.api.nvim_create_autocmd('LspAttach', {
group = group,
desc = 'LSP actions',
callback = function(args)
local bufmap = function(mode, lhs, rhs)
local opts = { buffer = true }
vim.keymap.set(mode, lhs, rhs, opts)
end
local client = vim.lsp.get_client_by_id(args.data.client_id)
require("lsp-format").on_attach(client)
bufmap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>')
bufmap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>')
bufmap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>')
bufmap('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>')
bufmap('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>')
bufmap('n', 'gA', '<cmd>Telescope diagnostics<cr>')
bufmap('n', 'gr', '<cmd>Telescope lsp_references<cr>')
bufmap('n', 'gi', '<cmd>Telescope lsp_implementations<cr>')
bufmap('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>')
bufmap('n', '<F3>', '<cmd>lua vim.lsp.buf.format({async = true})<cr>')
bufmap('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>')
bufmap('x', '<F4>', '<cmd>lua vim.lsp.buf.range_code_action()<cr>')
bufmap('n', 'gl', '<cmd>lua vim.diagnostic.open_float()<cr>')
bufmap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<cr>')
bufmap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<cr>')
end
})
require('mason-lspconfig').setup_handlers({
function(server)
lsp[server].setup({})
end,
['tsserver'] = function()
lsp.tsserver.setup({
settings = {
completions = {
completeFunctionCalls = true
}
}
})
end,
['lua_ls'] = function()
lsp.lua_ls.setup({
settings = {
Lua = {
diagnostics = {
globals = { 'vim' }
},
}
}
})
end,
['gopls'] = function()
lsp.gopls.setup({
settings = {
gopls = {
analyses = {
unusedparams = true,
unusedvariable = true,
shadow = true
},
staticcheck = true,
},
}
})
end,
})
{{- else }}
local on_attach = function(client)
local bufmap = function(mode, lhs, rhs)
local opts = {buffer = true}
vim.keymap.set(mode, lhs, rhs, opts)
end
require("lsp-format").on_attach(client)
bufmap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>')
bufmap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>')
bufmap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>')
bufmap('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>')
bufmap('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>')
bufmap('n', 'gA', '<cmd>Telescope diagnostics<cr>')
bufmap('n', 'gr', '<cmd>Telescope lsp_references<cr>')
bufmap('n', 'gi', '<cmd>Telescope lsp_implementations<cr>')
bufmap('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>')
bufmap('n', '<F3>', '<cmd>lua vim.lsp.buf.format({async = true})<cr>')
bufmap('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>')
bufmap('x', '<F4>', '<cmd>lua vim.lsp.buf.range_code_action()<cr>')
bufmap('n', 'gl', '<cmd>lua vim.diagnostic.open_float()<cr>')
bufmap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<cr>')
bufmap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<cr>')
end
lsp.gopls.setup {
settings = {
gopls = {
analyses = {
unusedparams = true,
unusedvariable = true,
shadow = true
},
staticcheck = true,
},
},
on_attach = on_attach
}
lsp.clangd.setup { on_attach = on_attach }
lsp.ltex.setup {
on_attach = on_attach,
filetypes = { "latex", "tex", "bib", "mkd", "gitcommit", "text" },
}
lsp.svelte.setup { on_attach = on_attach }
lsp.tsserver.setup { on_attach = on_attach }
lsp.lua_ls.setup {
settings = {
Lua = {
diagnostics = {
globals = { 'vim' }
},
}
},
on_attach = on_attach
}
{{- end }}

View File

@ -1,76 +0,0 @@
local ok, telekasten = pcall(require, 'telekasten')
local home = vim.fn.expand("~/doc/zettelkasten")
telekasten.setup {
home = home,
take_over_my_home = true,
auto_set_filetype = true,
dailies = home .. '/' .. 'daily',
weeklies = home .. '/' .. 'weekly',
templates = home .. '/' .. 'templates',
image_subdir = "img",
extension = ".md",
new_note_filename = "uuid-title",
uuid_type = "%Y%m%d%H%M",
uuid_sep = "-",
follow_creates_nonexisting = true,
dailies_create_nonexisting = true,
weeklies_create_nonexisting = true,
journal_auto_open = false,
-- template for new notes (new_note, follow_link)
-- set to `nil` or do not specify if you do not want a template
template_new_note = home .. '/' .. 'templates/new_note.md',
-- template for newly created daily notes (goto_today)
-- set to `nil` or do not specify if you do not want a template
template_new_daily = home .. '/' .. 'templates/daily.md',
-- template for newly created weekly notes (goto_thisweek)
-- set to `nil` or do not specify if you do not want a template
template_new_weekly= home .. '/' .. 'templates/weekly.md',
-- image link style
-- wiki: ![[image name]]
-- markdown: ![](image_subdir/xxxxx.png)
image_link_style = "wiki",
-- default sort option: 'filename', 'modified'
sort = "filename",
-- integrate with calendar-vim
plug_into_calendar = true,
calendar_opts = {
weeknm = 4,
calendar_monday = 1,
calendar_mark = 'left-fit',
},
close_after_yanking = false,
insert_after_inserting = true,
tag_notation = "#tag",
command_palette_theme = "dropdown",
show_tags_theme = "ivy",
subdirs_in_links = true,
template_handling = "smart",
new_note_location = "smart",
rename_update_links = true,
follow_url_fallback = nil,
}
local map = vim.keymap.set
map('n',"<leader>zf", "<cmd>Telekasten find_notes<cr>")
map('n',"<leader>zd", "<cmd>Telekasten find_daily_notes<cr>")
map('n',"<leader>zg", "<cmd>Telekasten search_notes<cr>")
map('n',"<leader>zz", "<cmd>Telekasten follow_link<cr>")
map('n',"<leader>zn", "<cmd>Telekasten new_note<cr>")
map('n',"<leader>zr", "<cmd>Telekasten rename_note<cr>")
map('n',"<leader>zc", "<cmd>Telekasten show_calendar<cr>")
map('n',"<leader>#", "<cmd>Telekasten show_tags<cr>")
map('n',"<leader>z", "<cmd>Telekasten panel<cr>")
vim.api.nvim_set_hl(0, "tklink", { fg = "#689d6a", bg = "" })
vim.api.nvim_set_hl(0, "tkBrackets", { fg = "gray", bg = "gray" })

View File

@ -1,34 +0,0 @@
local ok, telescope = pcall(require, 'telescope')
if not ok then
return
end
telescope.setup {
defaults = {
prompt_prefix = ' ',
selection_caret = ' ',
layout_config = { horizontal = { preview_width = 0.5 } },
file_ignore_patterns = { 'node_modules/.*' },
},
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
}
}
}
telescope.load_extension('fzf')
telescope.load_extension('file_browser')
local map = vim.keymap.set
map('n', "<C-n>", "<cmd>Telescope file_browser<cr>")
map('n', "<C-t>", "<cmd>Telescope current_buffer_tags<cr>")
map('n', "<leader>e", "<cmd>Telescope find_files<cr>")
map('n', "<leader>f", "<cmd>Telescope live_grep<cr>")
map('n', "<leader>b", "<cmd>Telescope buffers<cr>")
map('n', "<leader>h", "<cmd>Telescope help_tags<cr>")
map('n', "z=", "<cmd>Telescope spell_suggest<cr>")

View File

@ -1,94 +0,0 @@
local ok, treesitter = pcall(require, 'nvim-treesitter.configs')
if not ok then
return
end
treesitter.setup {
incremental_selection = {
enable = true,
keymaps = {
-- mappings for incremental selection (visual mappings)
init_selection = "gnn", -- maps in normal mode to init the node/scope selection
node_incremental = "grn", -- increment to the upper named parent
scope_incremental = "grc", -- increment to the upper scope (as defined in locals.scm)
node_decremental = "grm" -- decrement to the previous node
}
},
textobjects = {
-- syntax-aware textobjects
enable = true,
lsp_interop = {
enable = true,
peek_definition_code = {
["DF"] = "@function.outer",
}
},
keymaps = {
["iL"] = {
-- you can define your own textobjects directly here
go = "(function_definition) @function",
},
-- or you use the queries from supported languages with textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["aC"] = "@class.outer",
["iC"] = "@class.inner",
["ac"] = "@conditional.outer",
["ic"] = "@conditional.inner",
["ae"] = "@block.outer",
["ie"] = "@block.inner",
["al"] = "@loop.outer",
["il"] = "@loop.inner",
["is"] = "@statement.inner",
["as"] = "@statement.outer",
["ad"] = "@comment.outer",
["am"] = "@call.outer",
["im"] = "@call.inner"
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]]"] = "@function.outer",
["]c"] = { query = "@class.outer", desc = "Next class start" },
--
-- You can use regex matching and/or pass a list in a "query" key to group multiple queires.
["]o"] = "@loop.*",
-- ["]o"] = { query = { "@loop.inner", "@loop.outer" } }
--
-- You can pass a query group to use query from `queries/<lang>/<query_group>.scm file in your runtime path.
-- Below example nvim-treesitter's `locals.scm` and `folds.scm`. They also provide highlights.scm and indent.scm.
["]s"] = { query = "@scope", query_group = "locals", desc = "Next scope" },
["]z"] = { query = "@fold", query_group = "folds", desc = "Next fold" },
},
goto_next_end = {
["]["] = "@function.outer",
["]C"] = "@class.outer",
},
goto_previous_start = {
["[["] = "@function.outer",
["[c"] = "@class.outer",
},
goto_previous_end = {
["[]"] = "@function.outer",
["[C"] = "@class.outer",
}
}
},
ensure_installed = {
'javascript',
'typescript',
'css',
'json',
'c',
'lua',
'go'
},
sync_install = false,
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
}

View File

@ -68,9 +68,8 @@ set -g @catppuccin_status_right_separator_inverse "no"
set -g @catppuccin_status_fill "icon"
set -g @catppuccin_status_connect_separator "no"
set -g @catppuccin_directory_text "#{pane_current_path}"
set -g @catppuccin_host_text "#{host_short}"
set -g @catppuccin_directory_icon " "
set -g @catppuccin_host_text "#{host_short}"
set -g @catppuccin_user_icon " "
set -g @catppuccin_host_icon " "
set -g @catppuccin_date_time_icon " "