nvim: add lualine

This commit is contained in:
Daniel Lundin 2022-09-10 12:04:50 +02:00
parent a8aea29e83
commit 7c56115cc9
3 changed files with 280 additions and 224 deletions

View file

@ -1,187 +1,211 @@
return require('packer').startup(function() return require("packer").startup(function()
use 'hashivim/vim-terraform' use("hashivim/vim-terraform")
use 'pierreglaser/folding-nvim' use("pierreglaser/folding-nvim")
use 'tjdevries/colorbuddy.vim' use("tjdevries/colorbuddy.vim")
use 'wbthomason/packer.nvim' use("wbthomason/packer.nvim")
use 'ray-x/lsp_signature.nvim' use("ray-x/lsp_signature.nvim")
use 'jose-elias-alvarez/nvim-lsp-ts-utils' use("jose-elias-alvarez/nvim-lsp-ts-utils")
use 'rafamadriz/friendly-snippets' use("rafamadriz/friendly-snippets")
use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} } use({ "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } })
use {'ray-x/guihua.lua', run = 'cd lua/fzy && make'} use({ "ray-x/guihua.lua", run = "cd lua/fzy && make" })
use 'jjo/vim-cue' use("jjo/vim-cue")
use("ckipp01/stylua-nvim") use("ckipp01/stylua-nvim")
use { use({
'theHamsta/nvim-dap-virtual-text', "theHamsta/nvim-dap-virtual-text",
config = function() config = function()
require("nvim-dap-virtual-text").setup { require("nvim-dap-virtual-text").setup({
commented = true, commented = true,
} })
end end,
} })
use({ use({
"jose-elias-alvarez/null-ls.nvim", "jose-elias-alvarez/null-ls.nvim",
requires = { "nvim-lua/plenary.nvim" }, requires = { "nvim-lua/plenary.nvim" },
config = function() config = function()
require("plugins/null-ls") require("plugins/null-ls")
end, end,
}) })
use { use({
'b3nj5m1n/kommentary', "b3nj5m1n/kommentary",
config = function() config = function()
require('kommentary.config').use_extended_mappings() require("kommentary.config").use_extended_mappings()
vim.api.nvim_set_keymap("n", "", "<Plug>kommentary_line_default", {}) -- C-/ vim.api.nvim_set_keymap("n", "", "<Plug>kommentary_line_default", {}) -- C-/
vim.api.nvim_set_keymap("v", "", "<Plug>kommentary_visual_default", {}) -- C-/ vim.api.nvim_set_keymap("v", "", "<Plug>kommentary_visual_default", {}) -- C-/
require('kommentary.config').configure_language("default", { require("kommentary.config").configure_language("default", {
prefer_single_line_comments = true, prefer_single_line_comments = true,
}) })
end end,
} })
use { use({
'L3MON4D3/LuaSnip', "L3MON4D3/LuaSnip",
config = function() config = function()
require("luasnip/loaders/from_vscode").lazy_load() require("luasnip/loaders/from_vscode").lazy_load()
end end,
} })
-- cmp
use({
"hrsh7th/nvim-cmp",
requires = {
"andersevenrud/cmp-tmux",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
},
config = function()
require("plugins/nvim-cmp")
end,
})
-- cmp use({
use { "lewis6991/gitsigns.nvim",
'hrsh7th/nvim-cmp', requires = {
requires = { "nvim-lua/plenary.nvim",
'andersevenrud/cmp-tmux', },
'hrsh7th/cmp-nvim-lsp', config = function()
'hrsh7th/cmp-buffer', require("gitsigns").setup({
'hrsh7th/cmp-path', numhl = true,
'hrsh7th/cmp-cmdline', signs = {
'L3MON4D3/LuaSnip', add = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
'saadparwaiz1/cmp_luasnip', change = {
}, hl = "GitSignsChange",
config = function() require("plugins/nvim-cmp") end, text = "",
} numhl = "GitSignsChangeNr",
linehl = "GitSignsChangeLn",
},
delete = {
hl = "GitSignsDelete",
text = "",
numhl = "GitSignsDeleteNr",
linehl = "GitSignsDeleteLn",
},
topdelete = {
hl = "GitSignsDelete",
text = "",
numhl = "GitSignsDeleteNr",
linehl = "GitSignsDeleteLn",
},
changedelete = {
hl = "GitSignsChange",
text = "~",
numhl = "GitSignsChangeNr",
linehl = "GitSignsChangeLn",
},
},
})
end,
})
use { use({
'lewis6991/gitsigns.nvim', "lukas-reineke/indent-blankline.nvim",
requires = { branch = "master",
'nvim-lua/plenary.nvim' config = function()
}, -- vim.wo.colorcolumn = "100"
config = function() vim.g.indent_blankline_char = ""
require('gitsigns').setup { vim.g.indent_blankline_space_char = ""
numhl = true, vim.g.indent_blankline_space_char_highlight_list = { "IndentSpace" }
signs = { -- vim.g.indent_blankline_char_list = {'|', '¦', '┆', '┊'}
add = {hl = 'GitSignsAdd' , text = '', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, vim.g.indent_blankline_buftype_exclude = { "help", "terminal" }
change = {hl = 'GitSignsChange', text = '', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, vim.g.indent_blankline_filetype_exclude = { "text", "markdown" }
delete = {hl = 'GitSignsDelete', text = '', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, -- vim.g.indent_blankline_show_end_of_line = true
topdelete = {hl = 'GitSignsDelete', text = '', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, vim.g.indent_blankline_show_first_indent_level = true
changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, vim.g.indent_blankline_show_trailing_blankline_indent = true
}, vim.g.indent_blankline_char_highlight_list =
} { "Indent1", "Indent2", "Indent3", "Indent4", "Indent5", "Indent6" }
end end,
} })
use { use({
"lukas-reineke/indent-blankline.nvim", "neovim/nvim-lspconfig",
branch = "master", config = function()
config = function() require("dln.lsp-config")
-- vim.wo.colorcolumn = "100" local map = require("dln.utils").map
vim.g.indent_blankline_char = "" map("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>")
vim.g.indent_blankline_space_char = "" map("i", "<C-k>", "<Cmd>lua vim.lsp.buf.signature_help()<CR>")
vim.g.indent_blankline_space_char_highlight_list = { 'IndentSpace' } map("n", "1gd", "<Cmd>lua vim.lsp.buf.type_definition()<CR>")
-- vim.g.indent_blankline_char_list = {'|', '¦', '┆', '┊'} map("n", "gf", "<Cmd>lua vim.lsp.buf.formatting()<CR>")
vim.g.indent_blankline_buftype_exclude = {"help", "terminal"} map("n", "rn", "<Cmd>lua vim.lsp.buf.rename()<CR>")
vim.g.indent_blankline_filetype_exclude = {"text", "markdown"} map("n", "[d", "<Cmd>lua vim.lsp.diagnostic.goto_prev()<CR>")
-- vim.g.indent_blankline_show_end_of_line = true map("n", "]d", "<Cmd>lua vim.lsp.diagnostic.goto_next()<CR>")
vim.g.indent_blankline_show_first_indent_level = true map("n", "gwa", "<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
vim.g.indent_blankline_show_trailing_blankline_indent = true map("n", "gwr", "<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
vim.g.indent_blankline_char_highlight_list = { 'Indent1', 'Indent2', 'Indent3', 'Indent4', 'Indent5', 'Indent6'} map("n", "gwl", "<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
end end,
} })
use { use({
'neovim/nvim-lspconfig', "nvim-telescope/telescope.nvim",
config = function() requires = {
require('dln.lsp-config') "nvim-lua/popup.nvim",
local map = require('dln.utils').map "nvim-lua/plenary.nvim",
map('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>') "nvim-telescope/telescope-fzy-native.nvim",
map('i', '<C-k>', '<Cmd>lua vim.lsp.buf.signature_help()<CR>') "nvim-telescope/telescope-github.nvim",
map('n', '1gd', '<Cmd>lua vim.lsp.buf.type_definition()<CR>') "nvim-telescope/telescope-dap.nvim",
map('n', 'gf', '<Cmd>lua vim.lsp.buf.formatting()<CR>') },
map('n', 'rn', '<Cmd>lua vim.lsp.buf.rename()<CR>') config = function()
map('n', '[d', '<Cmd>lua vim.lsp.diagnostic.goto_prev()<CR>') require("dln.telescope")
map('n', ']d', '<Cmd>lua vim.lsp.diagnostic.goto_next()<CR>') local map = require("dln.utils").map
map('n', 'gwa', '<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>') map("n", "<leader>b", '<cmd>lua require("telescope.builtin").buffers()<CR>')
map('n', 'gwr', '<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>') map("n", "<leader>f", '<cmd>lua require("telescope.builtin").oldfiles()<CR>')
map('n', 'gwl', '<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>') map("n", "<space>", '<cmd>lua require("telescope.builtin").oldfiles()<CR>')
end map("n", "<leader>e", '<cmd>lua require("telescope.builtin").git_files()<CR>')
} map("n", "<leader>g", '<cmd>lua require("telescope.builtin").git_status()<CR>')
map("n", "<leader>a", '<cmd>lua require("telescope.builtin").lsp_code_actions()<CR>')
map("n", "<leader>m", '<cmd>lua require("telescope.builtin").marks()<CR>')
map("n", "<leader>s", '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>')
map("n", "<leader>t", '<cmd>lua require("telescope.builtin").treesitter()<CR>')
map("n", "<leader>/", '<cmd>lua require("telescope.builtin").live_grep()<CR>')
map("n", "<leader>.", '<cmd>lua require("telescope.builtin").file_browser()<CR>')
map("n", "<leader>p", '<cmd>lua require("telescope.builtin").registers()<CR>')
map("n", "gr", '<cmd>lua require("telescope.builtin").lsp_references()<CR>')
map("n", "gd", '<cmd>lua require("telescope.builtin").lsp_definitions()<CR>')
map("n", "g/", '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>')
map("n", "g?", '<cmd>lua require("telescope.builtin").lsp_workspace_symbols()<CR>')
map("n", "ge", '<cmd>lua require("telescope.builtin").lsp_document_diagnostics()<CR>')
map("n", "Db", '<cmd>lua require("telescope").extensions.dap.list_breakpoints()<CR>')
map("n", "Dcc", '<cmd>lua require("telescope").extensions.dap.commands()<CR>')
map("n", "Df", '<cmd>lua require("telescope").extensions.dap.frames()<CR>')
map("n", "Dv", '<cmd>lua require("telescope").extensions.dap.variables()<CR>')
end,
})
use { -- treesitter
'nvim-telescope/telescope.nvim', use({
requires = { "nvim-treesitter/nvim-treesitter",
'nvim-lua/popup.nvim', requires = {
'nvim-lua/plenary.nvim', "nvim-treesitter/playground",
'nvim-telescope/telescope-fzy-native.nvim', "nvim-treesitter/nvim-treesitter-textobjects",
'nvim-telescope/telescope-github.nvim', "windwp/nvim-ts-autotag",
'nvim-telescope/telescope-dap.nvim' },
}, run = ":TSUpdate",
config = function() config = function()
require('dln.telescope') require("plugins/treesitter")
local map = require('dln.utils').map end,
map('n', '<leader>b', '<cmd>lua require("telescope.builtin").buffers()<CR>') })
map('n', '<leader>f', '<cmd>lua require("telescope.builtin").oldfiles()<CR>')
map('n', '<space>', '<cmd>lua require("telescope.builtin").oldfiles()<CR>')
map('n', '<leader>e', '<cmd>lua require("telescope.builtin").git_files()<CR>')
map('n', '<leader>g', '<cmd>lua require("telescope.builtin").git_status()<CR>')
map('n', '<leader>a', '<cmd>lua require("telescope.builtin").lsp_code_actions()<CR>')
map('n', '<leader>m', '<cmd>lua require("telescope.builtin").marks()<CR>')
map('n', '<leader>s', '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>')
map('n', '<leader>t', '<cmd>lua require("telescope.builtin").treesitter()<CR>')
map('n', '<leader>/', '<cmd>lua require("telescope.builtin").live_grep()<CR>')
map('n', '<leader>.', '<cmd>lua require("telescope.builtin").file_browser()<CR>')
map('n', '<leader>p', '<cmd>lua require("telescope.builtin").registers()<CR>')
map('n', 'gr', '<cmd>lua require("telescope.builtin").lsp_references()<CR>')
map('n', 'gd', '<cmd>lua require("telescope.builtin").lsp_definitions()<CR>')
map('n', 'g/', '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>')
map('n', 'g?', '<cmd>lua require("telescope.builtin").lsp_workspace_symbols()<CR>')
map('n', 'ge', '<cmd>lua require("telescope.builtin").lsp_document_diagnostics()<CR>')
map('n', 'Db', '<cmd>lua require("telescope").extensions.dap.list_breakpoints()<CR>')
map('n', 'Dcc', '<cmd>lua require("telescope").extensions.dap.commands()<CR>')
map('n', 'Df', '<cmd>lua require("telescope").extensions.dap.frames()<CR>')
map('n', 'Dv', '<cmd>lua require("telescope").extensions.dap.variables()<CR>')
end
}
-- treesitter use({
use { "ray-x/go.nvim",
"nvim-treesitter/nvim-treesitter", config = function()
requires = { require("go").setup({
"nvim-treesitter/playground", comment_placeholder = "",
"nvim-treesitter/nvim-treesitter-textobjects", icons = { breakpoint = "🧘", currentpos = "🏃" },
"windwp/nvim-ts-autotag" dap_debug_gui = false,
}, })
run = ":TSUpdate", vim.cmd("autocmd FileType go nmap <Leader>c :lua require('go.comment').gen()<cr>")
config = function() require("plugins/treesitter") end, vim.cmd("autocmd BufWritePre *.go :silent! lua require('go.format').gofmt()")
} vim.cmd("autocmd BufWritePre (InsertLeave?) <buffer> lua vim.lsp.buf.formatting_sync(nil,500)")
end,
})
use { use({
"ray-x/go.nvim",
config = function()
require('go').setup({
comment_placeholder = '',
icons = {breakpoint = '🧘', currentpos = '🏃'},
dap_debug_gui = false
})
vim.cmd("autocmd FileType go nmap <Leader>c :lua require('go.comment').gen()<cr>")
vim.cmd("autocmd BufWritePre *.go :silent! lua require('go.format').gofmt()")
vim.cmd('autocmd BufWritePre (InsertLeave?) <buffer> lua vim.lsp.buf.formatting_sync(nil,500)')
end
}
use({
"nvim-treesitter/nvim-treesitter-context", "nvim-treesitter/nvim-treesitter-context",
requires = { requires = {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
@ -191,58 +215,73 @@ return require('packer').startup(function()
end, end,
}) })
use { use({
"onsails/lspkind-nvim", "onsails/lspkind-nvim",
config = function() config = function()
require('lspkind').init({ require("lspkind").init({})
}) end,
end })
}
-- marks -- marks
use { use({
"chentoast/marks.nvim", "chentoast/marks.nvim",
config = function() require("plugins/marks") end, config = function()
} require("plugins/marks")
end,
})
-- dap -- dap
use { use({
'mfussenegger/nvim-dap', "mfussenegger/nvim-dap",
config = function() require("plugins/dap") end, config = function()
} require("plugins/dap")
end,
})
-- go -- go
use { use({
"leoluz/nvim-dap-go", "leoluz/nvim-dap-go",
config = function() require("plugins/nvim-dap-go") end, config = function()
} require("plugins/nvim-dap-go")
end,
})
-- lsp_lines -- lualine
use { use({
"https://git.sr.ht/~whynothugo/lsp_lines.nvim", "nvim-lualine/lualine.nvim",
config = function() requires = { "kyazdani42/nvim-web-devicons", opt = true },
require("lsp_lines").setup() config = function()
vim.diagnostic.config({ require("plugins/lualine")
virtual_text = false, end,
}) })
end
}
-- zenbones -- lsp_lines
use { use({
"mcchrish/zenbones.nvim", "https://git.sr.ht/~whynothugo/lsp_lines.nvim",
requires = { config = function()
"rktjmp/lush.nvim", require("lsp_lines").setup()
}, vim.diagnostic.config({
config = function() require("plugins/zenbones") end, virtual_text = false,
} })
end,
})
-- copilot -- zenbones
use({ use({
"github/copilot.vim", "mcchrish/zenbones.nvim",
config = function() requires = {
require("plugins/copilot") "rktjmp/lush.nvim",
end, },
}) config = function()
require("plugins/zenbones")
end,
})
-- copilot
use({
"github/copilot.vim",
config = function()
require("plugins/copilot")
end,
})
end) end)

View file

@ -0,0 +1,15 @@
local lualine = require("lualine")
lualine.setup({
options = {
globalstatus = true,
},
sections = {
lualine_c = {
{
"filename",
path = 1,
file_status = true,
},
},
},
})

View file

@ -14,6 +14,8 @@ vim.o.backupdir = "/home/dln/.local/share/nvim/backup/"
vim.o.backup = true vim.o.backup = true
vim.g.netrw_dirhistmax = 0 vim.g.netrw_dirhistmax = 0
vim.o.clipboard = "unnamedplus" vim.o.clipboard = "unnamedplus"
vim.g.do_filetype_lua = 1
vim.g.did_load_filetypes = 0
--- Indent --- Indent
vim.o.autoindent = true vim.o.autoindent = true
@ -46,18 +48,18 @@ vim.o.completeopt = "menuone,noinsert,noselect"
--- Appearance --- Appearance
vim.o.background = "light" vim.o.background = "light"
vim.o.scrolloff = 5 vim.o.scrolloff = 7
vim.o.showmode = false vim.o.showmode = false
vim.o.sidescrolloff = 5 vim.o.sidescrolloff = 5
vim.o.termguicolors = true vim.o.termguicolors = true
vim.wo.cursorline = true vim.wo.cursorline = true
vim.wo.number = true vim.wo.number = true
vim.wo.signcolumn = "yes" vim.wo.signcolumn = "yes"
vim.o.laststatus = 0 vim.o.laststatus = 3
vim.o.statusline = "" -- vim.o.statusline = "═"
vim.o.fillchars = "stl:═,stlnc:═" vim.o.fillchars = "stl: ,stlnc: "
vim.o.title = true -- vim.o.title = true
vim.o.titlestring = "%F%m %r %y" -- vim.o.titlestring = "%F%m %r %y"
vim.wo.foldmethod = "expr" vim.wo.foldmethod = "expr"
vim.wo.foldexpr = "nvim_treesitter#foldexpr()" vim.wo.foldexpr = "nvim_treesitter#foldexpr()"