diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index 8c14215..980c17d 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -5,4 +5,6 @@ require "user.colorscheme" require "user.cmp" require "user.lsp" require "user.telescope" - +require "user.treesitter" +require "user.nvim-tree" +require "user.bufferline" diff --git a/nvim/.config/nvim/lua/user/bufferline.lua b/nvim/.config/nvim/lua/user/bufferline.lua new file mode 100644 index 0000000..7d98cf0 --- /dev/null +++ b/nvim/.config/nvim/lua/user/bufferline.lua @@ -0,0 +1,167 @@ +local status_ok, bufferline = pcall(require, "bufferline") +if not status_ok then + return +end + +bufferline.setup { + options = { + numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string, + close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions" + right_mouse_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions" + left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions" + middle_mouse_command = nil, -- can be a string | function, see "Mouse actions" + -- NOTE: this plugin is designed with this icon in mind, + -- and so changing this is NOT recommended, this is intended + -- as an escape hatch for people who cannot bear it for whatever reason + indicator_icon = "▎", + buffer_close_icon = "", + -- buffer_close_icon = '', + modified_icon = "●", + close_icon = "", + -- close_icon = '', + left_trunc_marker = "", + right_trunc_marker = "", + --- name_formatter can be used to change the buffer's label in the bufferline. + --- Please note some names can/will break the + --- bufferline so use this at your discretion knowing that it has + --- some limitations that will *NOT* be fixed. + -- name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr" + -- -- remove extension from markdown files for example + -- if buf.name:match('%.md') then + -- return vim.fn.fnamemodify(buf.name, ':t:r') + -- end + -- end, + max_name_length = 30, + max_prefix_length = 30, -- prefix used when a buffer is de-duplicated + tab_size = 21, + diagnostics = false, -- | "nvim_lsp" | "coc", + diagnostics_update_in_insert = false, + -- diagnostics_indicator = function(count, level, diagnostics_dict, context) + -- return "("..count..")" + -- end, + -- NOTE: this will be called a lot so don't do any heavy processing here + -- custom_filter = function(buf_number) + -- -- filter out filetypes you don't want to see + -- if vim.bo[buf_number].filetype ~= "" then + -- return true + -- end + -- -- filter out by buffer name + -- if vim.fn.bufname(buf_number) ~= "" then + -- return true + -- end + -- -- filter out based on arbitrary rules + -- -- e.g. filter out vim wiki buffer from tabline in your work repo + -- if vim.fn.getcwd() == "" and vim.bo[buf_number].filetype ~= "wiki" then + -- return true + -- end + -- end, + offsets = { { filetype = "NvimTree", text = "", padding = 1 } }, + show_buffer_icons = true, + show_buffer_close_icons = true, + show_close_icon = true, + show_tab_indicators = true, + persist_buffer_sort = true, -- whether or not custom sorted buffers should persist + -- can also be a table containing 2 custom separators + -- [focused and unfocused]. eg: { '|', '|' } + separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' }, + enforce_regular_tabs = true, + always_show_bufferline = true, + -- sort_by = 'id' | 'extension' | 'relative_directory' | 'directory' | 'tabs' | function(buffer_a, buffer_b) + -- -- add custom logic + -- return buffer_a.modified > buffer_b.modified + -- end + }, + highlights = { + fill = { + guifg = { attribute = "fg", highlight = "#ff0000" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + background = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + + -- buffer_selected = { + -- guifg = {attribute='fg',highlight='#ff0000'}, + -- guibg = {attribute='bg',highlight='#0000ff'}, + -- gui = 'none' + -- }, + buffer_visible = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + + close_button = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + close_button_visible = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + -- close_button_selected = { + -- guifg = {attribute='fg',highlight='TabLineSel'}, + -- guibg ={attribute='bg',highlight='TabLineSel'} + -- }, + + tab_selected = { + guifg = { attribute = "fg", highlight = "Normal" }, + guibg = { attribute = "bg", highlight = "Normal" }, + }, + tab = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + tab_close = { + -- guifg = {attribute='fg',highlight='LspDiagnosticsDefaultError'}, + guifg = { attribute = "fg", highlight = "TabLineSel" }, + guibg = { attribute = "bg", highlight = "Normal" }, + }, + + duplicate_selected = { + guifg = { attribute = "fg", highlight = "TabLineSel" }, + guibg = { attribute = "bg", highlight = "TabLineSel" }, + gui = "italic", + }, + duplicate_visible = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + gui = "italic", + }, + duplicate = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + gui = "italic", + }, + + modified = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + modified_selected = { + guifg = { attribute = "fg", highlight = "Normal" }, + guibg = { attribute = "bg", highlight = "Normal" }, + }, + modified_visible = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + + separator = { + guifg = { attribute = "bg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + separator_selected = { + guifg = { attribute = "bg", highlight = "Normal" }, + guibg = { attribute = "bg", highlight = "Normal" }, + }, + -- separator_visible = { + -- guifg = {attribute='bg',highlight='TabLine'}, + -- guibg = {attribute='bg',highlight='TabLine'} + -- }, + indicator_selected = { + guifg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" }, + guibg = { attribute = "bg", highlight = "Normal" }, + }, + }, +} diff --git a/nvim/.config/nvim/lua/user/keymaps.lua b/nvim/.config/nvim/lua/user/keymaps.lua index 28718bb..8536b70 100644 --- a/nvim/.config/nvim/lua/user/keymaps.lua +++ b/nvim/.config/nvim/lua/user/keymaps.lua @@ -18,6 +18,13 @@ vim.g.maplocalleader = " " -- term_mode = "t", -- command_mode = "c", +-- Remap some language specific stuff -- +keymap("n", "ü", "{", opts) +keymap("n", "", "", opts) + +keymap("n", "+", "}", opts) +keymap("n", "", "", opts) + -- Normal -- -- Better window navigation keymap("n", "", "h", opts) @@ -25,7 +32,7 @@ keymap("n", "", "j", opts) keymap("n", "", "k", opts) keymap("n", "", "l", opts) -keymap("n", "e", ":Lex 30", opts) +keymap("n", "e", ":NvimTreeToggle", opts) -- Resize with arrows keymap("n", "", ":resize -2", opts) diff --git a/nvim/.config/nvim/lua/user/lsp/handlers.lua b/nvim/.config/nvim/lua/user/lsp/handlers.lua index fb8b7f8..9c445c9 100644 --- a/nvim/.config/nvim/lua/user/lsp/handlers.lua +++ b/nvim/.config/nvim/lua/user/lsp/handlers.lua @@ -71,15 +71,20 @@ local function lsp_keymaps(bufnr) vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "lua vim.lsp.buf.references()", opts) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "ca", "lua vim.lsp.buf.code_action()", opts) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "f", "lua vim.diagnostic.open_float()", opts) + + -- for german keyboard... + vim.api.nvim_buf_set_keymap(bufnr, "n", "Üd", 'lua vim.diagnostic.goto_prev({ border = "rounded" })', opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", 'lua vim.diagnostic.goto_prev({ border = "rounded" })', opts) vim.api.nvim_buf_set_keymap( bufnr, "n", "gl", - 'lua vim.lsp.diagnostic.show_line_diagnostics({ border = "rounded" })', + 'lua vim.diagnostic.open_float()', opts ) vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", 'lua vim.diagnostic.goto_next({ border = "rounded" })', opts) + -- for german keyboard ... + vim.api.nvim_buf_set_keymap(bufnr, "n", "*d", 'lua vim.diagnostic.goto_next({ border = "rounded" })', opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "q", "lua vim.diagnostic.setloclist()", opts) vim.cmd [[ command! Format execute 'lua vim.lsp.buf.formatting()' ]] end diff --git a/nvim/.config/nvim/lua/user/nvim-tree.lua b/nvim/.config/nvim/lua/user/nvim-tree.lua new file mode 100644 index 0000000..e80e04b --- /dev/null +++ b/nvim/.config/nvim/lua/user/nvim-tree.lua @@ -0,0 +1,100 @@ +-- following options are the default +-- each of these are documented in `:help nvim-tree.OPTION_NAME` +vim.g.nvim_tree_icons = { + default = "", + symlink = "", + git = { + unstaged = "", + staged = "S", + unmerged = "", + renamed = "➜", + deleted = "", + untracked = "U", + ignored = "◌", + }, + folder = { + default = "", + open = "", + empty = "", + empty_open = "", + symlink = "", + }, +} + +local status_ok, nvim_tree = pcall(require, "nvim-tree") +if not status_ok then + return +end + +local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config") +if not config_status_ok then + return +end + +local tree_cb = nvim_tree_config.nvim_tree_callback + +nvim_tree.setup { + disable_netrw = true, + hijack_netrw = true, + open_on_setup = false, + ignore_ft_on_setup = { + "startify", + "dashboard", + "alpha", + }, + auto_close = true, + open_on_tab = false, + hijack_cursor = false, + update_cwd = true, + update_to_buf_dir = { + enable = true, + auto_open = true, + }, + diagnostics = { + enable = true, + icons = { + hint = "", + info = "", + warning = "", + error = "", + }, + }, + update_focused_file = { + enable = true, + update_cwd = true, + ignore_list = {}, + }, + git = { + enable = true, + ignore = true, + timeout = 500, + }, + view = { + width = 30, + height = 30, + hide_root_folder = false, + side = "left", + auto_resize = true, + mappings = { + custom_only = false, + list = { + { key = { "l", "", "o" }, cb = tree_cb "edit" }, + { key = "h", cb = tree_cb "close_node" }, + { key = "v", cb = tree_cb "vsplit" }, + }, + }, + number = false, + relativenumber = false, + }, + quit_on_open = 0, + git_hl = 1, + disable_window_picker = 0, + root_folder_modifier = ":t", + show_icons = { + git = 1, + folders = 1, + files = 1, + folder_arrows = 1, + tree_width = 30, + }, +} diff --git a/nvim/.config/nvim/lua/user/options.lua b/nvim/.config/nvim/lua/user/options.lua index d62a396..037a5f1 100644 --- a/nvim/.config/nvim/lua/user/options.lua +++ b/nvim/.config/nvim/lua/user/options.lua @@ -1,7 +1,7 @@ local options = { backup = false, -- creates a backup file clipboard = "unnamedplus", -- allows neovim to access the system clipboard - cmdheight = 1, -- more space in the neovim command line for displaying messages + cmdheight = 2, -- more space in the neovim command line for displaying messages completeopt = { "menuone", "noselect" }, -- mostly just for cmp conceallevel = 0, -- so that `` is visible in markdown files fileencoding = "utf-8", -- the encoding written to a file @@ -9,7 +9,7 @@ local options = { ignorecase = true, -- ignore case in search patterns mouse = "a", -- allow the mouse to be used in neovim pumheight = 10, -- pop up menu height - showmode = false, -- we don't need to see things like -- INSERT -- anymore + showmode = true, -- we don't need to see things like -- INSERT -- anymore showtabline = 2, -- always show tabs smartcase = true, -- smart case smartindent = true, -- make indenting smarter again diff --git a/nvim/.config/nvim/lua/user/plugins.lua b/nvim/.config/nvim/lua/user/plugins.lua index a3f6711..32b5bfb 100644 --- a/nvim/.config/nvim/lua/user/plugins.lua +++ b/nvim/.config/nvim/lua/user/plugins.lua @@ -67,6 +67,26 @@ return packer.startup(function(use) use "nvim-telescope/telescope.nvim" use 'nvim-telescope/telescope-media-files.nvim' + -- Treesitter + use { + "nvim-treesitter/nvim-treesitter", + run = ":TSUpdate", + } + + -- nvim-tree + use { + 'kyazdani42/nvim-tree.lua', + requires = { + 'kyazdani42/nvim-web-devicons', -- optional, for file icon + }, + config = function() require'nvim-tree'.setup {} end + } + + -- Bufferline + use "akinsho/bufferline.nvim" + use "moll/vim-bbye" + + -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins if PACKER_BOOTSTRAP then diff --git a/nvim/.config/nvim/lua/user/treesitter.lua b/nvim/.config/nvim/lua/user/treesitter.lua new file mode 100644 index 0000000..8a89492 --- /dev/null +++ b/nvim/.config/nvim/lua/user/treesitter.lua @@ -0,0 +1,13 @@ +local configs = require("nvim-treesitter.configs") +configs.setup { + ensure_installed = "maintained", + sync_install = false, + ignore_install = { "" }, -- List of parsers to ignore installing + highlight = { + enable = true, -- false will disable the whole extension + disable = { "" }, -- list of language that will be disabled + additional_vim_regex_highlighting = true, + + }, + indent = { enable = true }, +} diff --git a/nvim/.config/nvim/plugin/packer_compiled.lua b/nvim/.config/nvim/plugin/packer_compiled.lua index 24c7d71..d026c68 100644 --- a/nvim/.config/nvim/plugin/packer_compiled.lua +++ b/nvim/.config/nvim/plugin/packer_compiled.lua @@ -74,6 +74,11 @@ _G.packer_plugins = { path = "/home/n0x/.local/share/nvim/site/pack/packer/start/LuaSnip", url = "https://github.com/L3MON4D3/LuaSnip" }, + ["bufferline.nvim"] = { + loaded = true, + path = "/home/n0x/.local/share/nvim/site/pack/packer/start/bufferline.nvim", + url = "https://github.com/akinsho/bufferline.nvim" + }, ["cmp-buffer"] = { loaded = true, path = "/home/n0x/.local/share/nvim/site/pack/packer/start/cmp-buffer", @@ -124,6 +129,22 @@ _G.packer_plugins = { path = "/home/n0x/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", url = "https://github.com/neovim/nvim-lspconfig" }, + ["nvim-tree.lua"] = { + config = { "\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14nvim-tree\frequire\0" }, + loaded = true, + path = "/home/n0x/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", + url = "https://github.com/kyazdani42/nvim-tree.lua" + }, + ["nvim-treesitter"] = { + loaded = true, + path = "/home/n0x/.local/share/nvim/site/pack/packer/start/nvim-treesitter", + url = "https://github.com/nvim-treesitter/nvim-treesitter" + }, + ["nvim-web-devicons"] = { + loaded = true, + path = "/home/n0x/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", + url = "https://github.com/kyazdani42/nvim-web-devicons" + }, ["packer.nvim"] = { loaded = true, path = "/home/n0x/.local/share/nvim/site/pack/packer/start/packer.nvim", @@ -148,14 +169,24 @@ _G.packer_plugins = { loaded = true, path = "/home/n0x/.local/share/nvim/site/pack/packer/start/telescope.nvim", url = "https://github.com/nvim-telescope/telescope.nvim" + }, + ["vim-bbye"] = { + loaded = true, + path = "/home/n0x/.local/share/nvim/site/pack/packer/start/vim-bbye", + url = "https://github.com/moll/vim-bbye" } } time([[Defining packer_plugins]], false) +-- Config for: nvim-tree.lua +time([[Config for nvim-tree.lua]], true) +try_loadstring("\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14nvim-tree\frequire\0", "config", "nvim-tree.lua") +time([[Config for nvim-tree.lua]], false) if should_profile then save_profiles() end end) if not no_errors then + error_msg = error_msg:gsub('"', '\\"') vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') end