require("nvim.comment")
require("nvim.nvim-tree")
require("nvim.bufferline")
-require("nvim.null-ls")
+require("nvim.lsp.null-ls")
require("nvim.leap")
require("nvim.colorizer")
+require("nvim.lualine")
+require("nvim.toggleterm")
enforce_regular_tabs = true,
always_show_bufferline = true,
},
+ 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" },
+ },
+ },
})
--- /dev/null
+local null_ls_status_ok, null_ls = pcall(require, "null-ls")
+if not null_ls_status_ok then
+ return
+end
+
+local formatting = null_ls.builtins.formatting
+local diagnostics = null_ls.builtins.diagnostics
+
+null_ls.setup({
+ debug = false,
+ sources = {
+ formatting.black,
+ formatting.stylua,
+ diagnostics.flake8,
+ },
+})
+
+local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
+null_ls.setup({
+ -- you can reuse a shared lspconfig on_attach callback here
+ on_attach = function(client, bufnr)
+ if client.supports_method("textDocument/formatting") then
+ vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
+ vim.api.nvim_create_autocmd("BufWritePre", {
+ group = augroup,
+ buffer = bufnr,
+ callback = function()
+ -- on 0.8, you should use vim.lsp.buf.format({ bufnr = bufnr }) instead
+ vim.lsp.buf.formatting_sync()
+ end,
+ })
+ end
+ end,
+})
--- /dev/null
+local status_ok, lualine = pcall(require, "lualine")
+if not status_ok then
+ return
+end
+
+local hide_in_width = function()
+ return vim.fn.winwidth(0) > 80
+end
+
+local diagnostics = {
+ "diagnostics",
+ sources = { "nvim_diagnostic" },
+ sections = { "error", "warn" },
+ symbols = { error = " ", warn = " " },
+ colored = false,
+ update_in_insert = false,
+ always_visible = true,
+}
+
+local diff = {
+ "diff",
+ colored = false,
+ symbols = { added = " ", modified = " ", removed = " " }, -- changes diff symbols
+ cond = hide_in_width,
+}
+
+local mode = {
+ "mode",
+ fmt = function(str)
+ return "-- " .. str .. " --"
+ end,
+}
+
+local filetype = {
+ "filetype",
+ icons_enabled = false,
+ icon = nil,
+}
+
+local branch = {
+ "branch",
+ icons_enabled = true,
+ icon = "",
+}
+
+local location = {
+ "location",
+ padding = 0,
+}
+
+-- cool function for progress
+local progress = function()
+ local current_line = vim.fn.line(".")
+ local total_lines = vim.fn.line("$")
+ local chars = { "__", "▁▁", "▂▂", "▃▃", "▄▄", "▅▅", "▆▆", "▇▇", "██" }
+ local line_ratio = current_line / total_lines
+ local index = math.ceil(line_ratio * #chars)
+ return chars[index]
+end
+
+local spaces = function()
+ return "spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth")
+end
+
+lualine.setup({
+ options = {
+ icons_enabled = true,
+ theme = "auto",
+ component_separators = { left = "", right = "" },
+ section_separators = { left = "", right = "" },
+ disabled_filetypes = { "dashboard", "NvimTree", "Outline" },
+ always_divide_middle = true,
+ },
+ sections = {
+ lualine_a = { branch, diagnostics },
+ lualine_b = { mode },
+ lualine_c = {},
+ -- lualine_x = { "encoding", "fileformat", "filetype" },
+ lualine_x = { diff, spaces, "encoding", filetype },
+ lualine_y = { location },
+ lualine_z = { progress },
+ },
+ inactive_sections = {
+ lualine_a = {},
+ lualine_b = {},
+ lualine_c = { "filename" },
+ lualine_x = { "location" },
+ lualine_y = {},
+ lualine_z = {},
+ },
+ tabline = {},
+ extensions = {},
+})
+++ /dev/null
-local null_ls_status_ok, null_ls = pcall(require, "null-ls")
-if not null_ls_status_ok then
- return
-end
-
-local formatting = null_ls.builtins.formatting
-local diagnostics = null_ls.builtins.diagnostics
-
-null_ls.setup({
- debug = false,
- sources = {
- formatting.black,
- formatting.stylua,
- diagnostics.flake8,
- },
-})
undofile = true,
updatetime = 300,
writebackup = false,
- expandtab = false,
+ expandtab = true,
shiftwidth = 4,
tabstop = 4,
number = true,
for k, v in pairs(options) do
vim.opt[k] = v
end
+
+vim.cmd([[
+ augroup Markdown
+ autocmd!
+ autocmd FileType markdown set wrap
+ augroup END
+]])
+
+vim.cmd([[
+ augroup Format
+ autocmd!
+ autocmd BufWritePre *.html :normal mZgg=G`Z:delmarks Z
+ augroup END
+]])
+
+vim.cmd([[
+ augroup FormatOnSave
+ autocmd!
+ autocmd BufWritePre * :Format
+ augroup END
+]])
"kyazdani42/nvim-web-devicons",
} })
+ -- Lualine
+ use({
+ "nvim-lualine/lualine.nvim",
+ requires = { "kyazdani42/nvim-web-devicons", opt = true },
+ })
+
-- For quick movement between a file
use("ggandor/leap.nvim")
-- Shows hex colours
use("norcalli/nvim-colorizer.lua")
+ -- Toggle Terminal
+ use("akinsho/toggleterm.nvim")
+
-- NON LUA PLUGINS
use("moll/vim-bbye")
--- /dev/null
+local status_ok, toggleterm = pcall(require, "toggleterm")
+if not status_ok then
+ return
+end
+
+toggleterm.setup({
+ size = 20,
+ open_mapping = [[<F1>]],
+ hide_numbers = true,
+ shade_filetypes = {},
+ shade_terminals = true,
+ shading_factor = 2,
+ start_in_insert = true,
+ insert_mappings = true,
+ persist_size = true,
+ direction = "float",
+ close_on_exit = true,
+ shell = vim.o.shell,
+ float_opts = {
+ border = "curved",
+ winblend = 0,
+ highlights = {
+ border = "Normal",
+ background = "Normal",
+ },
+ },
+})
+
+function _G.set_terminal_keymaps()
+ local opts = { noremap = true }
+ vim.api.nvim_buf_set_keymap(0, "t", "<esc>", [[<F1><C-n>]], opts)
+ vim.api.nvim_buf_set_keymap(0, "t", "jk", [[<F1><C-n>]], opts)
+ vim.api.nvim_buf_set_keymap(0, "t", "<C-h>", [[<F1><C-n><C-W>h]], opts)
+ vim.api.nvim_buf_set_keymap(0, "t", "<C-j>", [[<F1><C-n><C-W>j]], opts)
+ vim.api.nvim_buf_set_keymap(0, "t", "<C-k>", [[<F1><C-n><C-W>k]], opts)
+ vim.api.nvim_buf_set_keymap(0, "t", "<C-l>", [[<F1><C-n><C-W>l]], opts)
+end
+
+vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()")