This commit is contained in:
Fabian Becker 2022-07-28 18:11:27 +02:00
parent 57f32cb47a
commit cc3e659086
6 changed files with 71 additions and 26 deletions

View File

@ -33,15 +33,6 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
}
)
local saga = require 'lspsaga'
saga.init_lsp_saga({
-- symbols in winbar
symbol_in_winbar = true,
winbar_file_format = function()
return vim.fn.expand("%=%m %f")
end,
})
-- symbols for autocomplete
vim.lsp.protocol.CompletionItemKind = {
"  (Text) ",

View File

@ -0,0 +1,58 @@
local saga = require 'lspsaga'
saga.init_lsp_saga({
-- symbols in winbar
symbol_in_winbar = {
enable = true,
click_support = true,
show_file = true,
in_custom = true,
},
})
local function get_file_name(include_path)
local file_name = require('lspsaga.symbolwinbar').get_file_name()
if vim.fn.bufname '%' == '' then return '' end
if include_path == false then return file_name end
-- Else if include path: ./lsp/saga.lua -> lsp > saga.lua
local sep = vim.loop.os_uname().sysname == 'Windows' and '\\' or '/'
local path_list = vim.split(string.gsub(vim.fn.expand '%:~:.:h', '%%', ''), sep)
local file_path = ''
for _, cur in ipairs(path_list) do
file_path = (cur == '.' or cur == '~') and '' or
file_path .. cur .. ' ' .. '%#LspSagaWinbarSep#>%*' .. ' %*'
end
return file_path .. file_name
end
local function config_winbar()
local exclude = {
['teminal'] = true,
['toggleterm'] = true,
['prompt'] = true,
['NvimTree'] = true,
['help'] = true,
} -- Ignore float windows and exclude filetype
if vim.api.nvim_win_get_config(0).zindex or exclude[vim.bo.filetype] then
vim.wo.winbar = ''
else
local ok, lspsaga = pcall(require, 'lspsaga.symbolwinbar')
local sym
if ok then sym = lspsaga.get_symbol_node() end
local win_val = ''
win_val = get_file_name(true) -- set to true to include path
if sym ~= nil then win_val = win_val .. sym end
vim.wo.winbar = win_val
end
end
local events = { 'BufEnter', 'BufWinEnter', 'CursorMoved' }
vim.api.nvim_create_autocmd(events, {
pattern = '*',
callback = function() config_winbar() end,
})
vim.api.nvim_create_autocmd('User', {
pattern = 'LspsagaUpdateSymbol',
callback = function() config_winbar() end,
})

View File

@ -1,24 +1,25 @@
local Remap = require("halfdan.keymap")
local nnoremap = Remap.nnoremap
local builtin = require("telescope.builtin")
nnoremap("<leader>ps", function()
require('telescope.builtin').grep_string({ search = vim.fn.input("Grep For > ")})
builtin.grep_string({ search = vim.fn.input("Grep For > ")})
end)
nnoremap("<C-p>", function()
require('telescope.builtin').git_files()
builtin.git_files()
end)
nnoremap("<Leader>pf", function()
require('telescope.builtin').find_files()
builtin.find_files()
end)
nnoremap("<leader>pw", function()
require('telescope.builtin').grep_string { search = vim.fn.expand("<cword>") }
builtin.grep_string { search = vim.fn.expand("<cword>") }
end)
nnoremap("<leader>pb", function()
require('telescope.builtin').buffers()
builtin.buffers()
end)
nnoremap("<leader>vh", function()
require('telescope.builtin').help_tags()
builtin.help_tags()
end)
-- Telescope

View File

@ -117,12 +117,8 @@ return require("packer").startup(
use {'rust-lang/rust.vim'}
use {'simrat39/rust-tools.nvim'}
-- Debugger support via dap
use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} }
use {'JuliaEditorSupport/julia-vim', opt=true}
vim.g.latex_to_unicode_auto = 1
-- use {'JuliaEditorSupport/julia-vim', opt=true}
-- vim.g.latex_to_unicode_auto = 1
-- themes & colorschemes
use {'arcticicestudio/nord-vim'}

View File

@ -25,7 +25,7 @@ vim.bo.smartindent = true -- Makes indenting smart
vim.wo.number = true -- set numbered lines
vim.wo.relativenumber = true -- set relative number
vim.wo.cursorline = true -- Enable highlighting of the current line
vim.o.showtabline = 2 -- Always show tabs
vim.o.showtabline = 1 -- Always show tabs
vim.o.showmode = false -- We don't need to see things like -- INSERT -- anymore
vim.o.backup = false -- This is recommended by coc
vim.o.writebackup = false -- This is recommended by coc
@ -34,11 +34,10 @@ vim.o.updatetime = 300 -- Faster completion
vim.o.timeoutlen = 500 -- By default timeoutlen is 1000 ms
vim.o.clipboard = "unnamedplus" -- Copy paste between vim and everything else
vim.o.laststatus = 3 -- Set global status bar
vim.opt.showtabline = 0 -- Disable tabline
-- vim.opt.winbar = "%=%m %f" -- Show winbar with modified flag and filename right adjusted
vim.opt.winbar = "%=%m %f" -- Show winbar with modified flag and filename right adjusted
-- Enable telescope theme
vim.g.gruvbox_baby_telescope_theme = 1
vim.g.gruvbox_baby_background_color = "dark"
vim.g.gruvbox_baby_background_color = "light"
vim.g.mapleader = ' '

View File

@ -1,5 +1,5 @@
require('nvim-treesitter.configs').setup({
ensure_installed = { "python", "go", "julia", "elixir", "rust", "gomod", "json", "lua", "ruby", "yaml" },
ensure_installed = { "python", "go", "elixir", "rust", "gomod", "json", "lua", "ruby", "yaml" },
ignore_install = { "haskell" },
highlight = {
enable = true