From 7c56115cc9a31519f0e1921b5d45d85862b9619d Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Sat, 10 Sep 2022 12:04:50 +0200 Subject: [PATCH] nvim: add lualine --- .config/nvim/lua/plugins.lua | 475 +++++++++++++++------------ .config/nvim/lua/plugins/lualine.lua | 15 + .config/nvim/lua/settings.lua | 14 +- 3 files changed, 280 insertions(+), 224 deletions(-) create mode 100644 .config/nvim/lua/plugins/lualine.lua diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 77eab82..1b6178f 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -1,187 +1,211 @@ -return require('packer').startup(function() - use 'hashivim/vim-terraform' - use 'pierreglaser/folding-nvim' - use 'tjdevries/colorbuddy.vim' - use 'wbthomason/packer.nvim' - use 'ray-x/lsp_signature.nvim' - use 'jose-elias-alvarez/nvim-lsp-ts-utils' - use 'rafamadriz/friendly-snippets' - use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} } - use {'ray-x/guihua.lua', run = 'cd lua/fzy && make'} - use 'jjo/vim-cue' - use("ckipp01/stylua-nvim") +return require("packer").startup(function() + use("hashivim/vim-terraform") + use("pierreglaser/folding-nvim") + use("tjdevries/colorbuddy.vim") + use("wbthomason/packer.nvim") + use("ray-x/lsp_signature.nvim") + use("jose-elias-alvarez/nvim-lsp-ts-utils") + use("rafamadriz/friendly-snippets") + use({ "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } }) + use({ "ray-x/guihua.lua", run = "cd lua/fzy && make" }) + use("jjo/vim-cue") + use("ckipp01/stylua-nvim") - use { - 'theHamsta/nvim-dap-virtual-text', - config = function() - require("nvim-dap-virtual-text").setup { - commented = true, - } - end - } + use({ + "theHamsta/nvim-dap-virtual-text", + config = function() + require("nvim-dap-virtual-text").setup({ + commented = true, + }) + end, + }) - use({ - "jose-elias-alvarez/null-ls.nvim", - requires = { "nvim-lua/plenary.nvim" }, - config = function() - require("plugins/null-ls") - end, - }) + use({ + "jose-elias-alvarez/null-ls.nvim", + requires = { "nvim-lua/plenary.nvim" }, + config = function() + require("plugins/null-ls") + end, + }) - use { - 'b3nj5m1n/kommentary', - config = function() - require('kommentary.config').use_extended_mappings() - vim.api.nvim_set_keymap("n", "", "kommentary_line_default", {}) -- C-/ - vim.api.nvim_set_keymap("v", "", "kommentary_visual_default", {}) -- C-/ + use({ + "b3nj5m1n/kommentary", + config = function() + require("kommentary.config").use_extended_mappings() + vim.api.nvim_set_keymap("n", "", "kommentary_line_default", {}) -- C-/ + vim.api.nvim_set_keymap("v", "", "kommentary_visual_default", {}) -- C-/ - require('kommentary.config').configure_language("default", { - prefer_single_line_comments = true, - }) - end - } + require("kommentary.config").configure_language("default", { + prefer_single_line_comments = true, + }) + end, + }) - use { - 'L3MON4D3/LuaSnip', - config = function() - require("luasnip/loaders/from_vscode").lazy_load() - end - } + use({ + "L3MON4D3/LuaSnip", + config = function() + require("luasnip/loaders/from_vscode").lazy_load() + 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 { - '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, - } + use({ + "lewis6991/gitsigns.nvim", + requires = { + "nvim-lua/plenary.nvim", + }, + config = function() + require("gitsigns").setup({ + numhl = true, + signs = { + add = { hl = "GitSignsAdd", text = "▌", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, + change = { + hl = "GitSignsChange", + 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 { - 'lewis6991/gitsigns.nvim', - requires = { - 'nvim-lua/plenary.nvim' - }, - config = function() - require('gitsigns').setup { - numhl = true, - signs = { - add = {hl = 'GitSignsAdd' , text = '▌', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, - change = {hl = 'GitSignsChange', 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({ + "lukas-reineke/indent-blankline.nvim", + branch = "master", + config = function() + -- vim.wo.colorcolumn = "100" + vim.g.indent_blankline_char = "│" + vim.g.indent_blankline_space_char = "⬝" + vim.g.indent_blankline_space_char_highlight_list = { "IndentSpace" } + -- vim.g.indent_blankline_char_list = {'|', '¦', '┆', '┊'} + vim.g.indent_blankline_buftype_exclude = { "help", "terminal" } + vim.g.indent_blankline_filetype_exclude = { "text", "markdown" } + -- vim.g.indent_blankline_show_end_of_line = true + vim.g.indent_blankline_show_first_indent_level = true + vim.g.indent_blankline_show_trailing_blankline_indent = true + vim.g.indent_blankline_char_highlight_list = + { "Indent1", "Indent2", "Indent3", "Indent4", "Indent5", "Indent6" } + end, + }) - use { - "lukas-reineke/indent-blankline.nvim", - branch = "master", - config = function() - -- vim.wo.colorcolumn = "100" - vim.g.indent_blankline_char = "│" - vim.g.indent_blankline_space_char = "⬝" - vim.g.indent_blankline_space_char_highlight_list = { 'IndentSpace' } - -- vim.g.indent_blankline_char_list = {'|', '¦', '┆', '┊'} - vim.g.indent_blankline_buftype_exclude = {"help", "terminal"} - vim.g.indent_blankline_filetype_exclude = {"text", "markdown"} - -- vim.g.indent_blankline_show_end_of_line = true - vim.g.indent_blankline_show_first_indent_level = true - vim.g.indent_blankline_show_trailing_blankline_indent = true - vim.g.indent_blankline_char_highlight_list = { 'Indent1', 'Indent2', 'Indent3', 'Indent4', 'Indent5', 'Indent6'} - end - } + use({ + "neovim/nvim-lspconfig", + config = function() + require("dln.lsp-config") + local map = require("dln.utils").map + map("n", "K", "lua vim.lsp.buf.hover()") + map("i", "", "lua vim.lsp.buf.signature_help()") + map("n", "1gd", "lua vim.lsp.buf.type_definition()") + map("n", "gf", "lua vim.lsp.buf.formatting()") + map("n", "rn", "lua vim.lsp.buf.rename()") + map("n", "[d", "lua vim.lsp.diagnostic.goto_prev()") + map("n", "]d", "lua vim.lsp.diagnostic.goto_next()") + map("n", "gwa", "lua vim.lsp.buf.add_workspace_folder()") + map("n", "gwr", "lua vim.lsp.buf.add_workspace_folder()") + map("n", "gwl", "lua vim.lsp.buf.add_workspace_folder()") + end, + }) - use { - 'neovim/nvim-lspconfig', - config = function() - require('dln.lsp-config') - local map = require('dln.utils').map - map('n', 'K', 'lua vim.lsp.buf.hover()') - map('i', '', 'lua vim.lsp.buf.signature_help()') - map('n', '1gd', 'lua vim.lsp.buf.type_definition()') - map('n', 'gf', 'lua vim.lsp.buf.formatting()') - map('n', 'rn', 'lua vim.lsp.buf.rename()') - map('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()') - map('n', ']d', 'lua vim.lsp.diagnostic.goto_next()') - map('n', 'gwa', 'lua vim.lsp.buf.add_workspace_folder()') - map('n', 'gwr', 'lua vim.lsp.buf.add_workspace_folder()') - map('n', 'gwl', 'lua vim.lsp.buf.add_workspace_folder()') - end - } + use({ + "nvim-telescope/telescope.nvim", + requires = { + "nvim-lua/popup.nvim", + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope-fzy-native.nvim", + "nvim-telescope/telescope-github.nvim", + "nvim-telescope/telescope-dap.nvim", + }, + config = function() + require("dln.telescope") + local map = require("dln.utils").map + map("n", "b", 'lua require("telescope.builtin").buffers()') + map("n", "f", 'lua require("telescope.builtin").oldfiles()') + map("n", "", 'lua require("telescope.builtin").oldfiles()') + map("n", "e", 'lua require("telescope.builtin").git_files()') + map("n", "g", 'lua require("telescope.builtin").git_status()') + map("n", "a", 'lua require("telescope.builtin").lsp_code_actions()') + map("n", "m", 'lua require("telescope.builtin").marks()') + map("n", "s", 'lua require("telescope.builtin").lsp_document_symbols()') + map("n", "t", 'lua require("telescope.builtin").treesitter()') + map("n", "/", 'lua require("telescope.builtin").live_grep()') + map("n", ".", 'lua require("telescope.builtin").file_browser()') + map("n", "p", 'lua require("telescope.builtin").registers()') + map("n", "gr", 'lua require("telescope.builtin").lsp_references()') + map("n", "gd", 'lua require("telescope.builtin").lsp_definitions()') + map("n", "g/", 'lua require("telescope.builtin").lsp_document_symbols()') + map("n", "g?", 'lua require("telescope.builtin").lsp_workspace_symbols()') + map("n", "ge", 'lua require("telescope.builtin").lsp_document_diagnostics()') + map("n", "Db", 'lua require("telescope").extensions.dap.list_breakpoints()') + map("n", "Dcc", 'lua require("telescope").extensions.dap.commands()') + map("n", "Df", 'lua require("telescope").extensions.dap.frames()') + map("n", "Dv", 'lua require("telescope").extensions.dap.variables()') + end, + }) - use { - 'nvim-telescope/telescope.nvim', - requires = { - 'nvim-lua/popup.nvim', - 'nvim-lua/plenary.nvim', - 'nvim-telescope/telescope-fzy-native.nvim', - 'nvim-telescope/telescope-github.nvim', - 'nvim-telescope/telescope-dap.nvim' - }, - config = function() - require('dln.telescope') - local map = require('dln.utils').map - map('n', 'b', 'lua require("telescope.builtin").buffers()') - map('n', 'f', 'lua require("telescope.builtin").oldfiles()') - map('n', '', 'lua require("telescope.builtin").oldfiles()') - map('n', 'e', 'lua require("telescope.builtin").git_files()') - map('n', 'g', 'lua require("telescope.builtin").git_status()') - map('n', 'a', 'lua require("telescope.builtin").lsp_code_actions()') - map('n', 'm', 'lua require("telescope.builtin").marks()') - map('n', 's', 'lua require("telescope.builtin").lsp_document_symbols()') - map('n', 't', 'lua require("telescope.builtin").treesitter()') - map('n', '/', 'lua require("telescope.builtin").live_grep()') - map('n', '.', 'lua require("telescope.builtin").file_browser()') - map('n', 'p', 'lua require("telescope.builtin").registers()') - map('n', 'gr', 'lua require("telescope.builtin").lsp_references()') - map('n', 'gd', 'lua require("telescope.builtin").lsp_definitions()') - map('n', 'g/', 'lua require("telescope.builtin").lsp_document_symbols()') - map('n', 'g?', 'lua require("telescope.builtin").lsp_workspace_symbols()') - map('n', 'ge', 'lua require("telescope.builtin").lsp_document_diagnostics()') - map('n', 'Db', 'lua require("telescope").extensions.dap.list_breakpoints()') - map('n', 'Dcc', 'lua require("telescope").extensions.dap.commands()') - map('n', 'Df', 'lua require("telescope").extensions.dap.frames()') - map('n', 'Dv', 'lua require("telescope").extensions.dap.variables()') - end - } + -- treesitter + use({ + "nvim-treesitter/nvim-treesitter", + requires = { + "nvim-treesitter/playground", + "nvim-treesitter/nvim-treesitter-textobjects", + "windwp/nvim-ts-autotag", + }, + run = ":TSUpdate", + config = function() + require("plugins/treesitter") + end, + }) - -- treesitter - use { - "nvim-treesitter/nvim-treesitter", - requires = { - "nvim-treesitter/playground", - "nvim-treesitter/nvim-treesitter-textobjects", - "windwp/nvim-ts-autotag" - }, - run = ":TSUpdate", - config = function() require("plugins/treesitter") end, - } + 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 c :lua require('go.comment').gen()") + vim.cmd("autocmd BufWritePre *.go :silent! lua require('go.format').gofmt()") + vim.cmd("autocmd BufWritePre (InsertLeave?) lua vim.lsp.buf.formatting_sync(nil,500)") + end, + }) - 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 c :lua require('go.comment').gen()") - vim.cmd("autocmd BufWritePre *.go :silent! lua require('go.format').gofmt()") - vim.cmd('autocmd BufWritePre (InsertLeave?) lua vim.lsp.buf.formatting_sync(nil,500)') - end - } - - use({ + use({ "nvim-treesitter/nvim-treesitter-context", requires = { "nvim-treesitter/nvim-treesitter", @@ -191,58 +215,73 @@ return require('packer').startup(function() end, }) - use { - "onsails/lspkind-nvim", - config = function() - require('lspkind').init({ - }) - end - } + use({ + "onsails/lspkind-nvim", + config = function() + require("lspkind").init({}) + end, + }) - -- marks - use { - "chentoast/marks.nvim", - config = function() require("plugins/marks") end, - } + -- marks + use({ + "chentoast/marks.nvim", + config = function() + require("plugins/marks") + end, + }) - -- dap - use { - 'mfussenegger/nvim-dap', - config = function() require("plugins/dap") end, - } + -- dap + use({ + "mfussenegger/nvim-dap", + config = function() + require("plugins/dap") + end, + }) - -- go - use { - "leoluz/nvim-dap-go", - config = function() require("plugins/nvim-dap-go") end, - } + -- go + use({ + "leoluz/nvim-dap-go", + config = function() + require("plugins/nvim-dap-go") + end, + }) - -- lsp_lines - use { - "https://git.sr.ht/~whynothugo/lsp_lines.nvim", - config = function() - require("lsp_lines").setup() - vim.diagnostic.config({ - virtual_text = false, - }) - end - } + -- lualine + use({ + "nvim-lualine/lualine.nvim", + requires = { "kyazdani42/nvim-web-devicons", opt = true }, + config = function() + require("plugins/lualine") + end, + }) - -- zenbones - use { - "mcchrish/zenbones.nvim", - requires = { - "rktjmp/lush.nvim", - }, - config = function() require("plugins/zenbones") end, - } + -- lsp_lines + use({ + "https://git.sr.ht/~whynothugo/lsp_lines.nvim", + config = function() + require("lsp_lines").setup() + vim.diagnostic.config({ + virtual_text = false, + }) + end, + }) - -- copilot - use({ - "github/copilot.vim", - config = function() - require("plugins/copilot") - end, - }) + -- zenbones + use({ + "mcchrish/zenbones.nvim", + requires = { + "rktjmp/lush.nvim", + }, + config = function() + require("plugins/zenbones") + end, + }) + -- copilot + use({ + "github/copilot.vim", + config = function() + require("plugins/copilot") + end, + }) end) diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..4ee51ee --- /dev/null +++ b/.config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,15 @@ +local lualine = require("lualine") +lualine.setup({ + options = { + globalstatus = true, + }, + sections = { + lualine_c = { + { + "filename", + path = 1, + file_status = true, + }, + }, + }, +}) diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua index 11394bb..40982bf 100644 --- a/.config/nvim/lua/settings.lua +++ b/.config/nvim/lua/settings.lua @@ -14,6 +14,8 @@ vim.o.backupdir = "/home/dln/.local/share/nvim/backup/" vim.o.backup = true vim.g.netrw_dirhistmax = 0 vim.o.clipboard = "unnamedplus" +vim.g.do_filetype_lua = 1 +vim.g.did_load_filetypes = 0 --- Indent vim.o.autoindent = true @@ -46,18 +48,18 @@ vim.o.completeopt = "menuone,noinsert,noselect" --- Appearance vim.o.background = "light" -vim.o.scrolloff = 5 +vim.o.scrolloff = 7 vim.o.showmode = false vim.o.sidescrolloff = 5 vim.o.termguicolors = true vim.wo.cursorline = true vim.wo.number = true vim.wo.signcolumn = "yes" -vim.o.laststatus = 0 -vim.o.statusline = "═" -vim.o.fillchars = "stl:═,stlnc:═" -vim.o.title = true -vim.o.titlestring = "%F%m %r %y" +vim.o.laststatus = 3 +-- vim.o.statusline = "═" +vim.o.fillchars = "stl: ,stlnc: " +-- vim.o.title = true +-- vim.o.titlestring = "%F%m %r %y" vim.wo.foldmethod = "expr" vim.wo.foldexpr = "nvim_treesitter#foldexpr()"