diff --git a/config/nvim/init.lua b/config/nvim/init.lua index a4ff848..e25a197 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -24,6 +24,7 @@ vim.o.splitright = true -- Open vertical splits to the right vim.o.splitbelow = true -- Open horizontal splits below vim.o.timeoutlen = 300 -- Time (ms) to wait for a mapped sequence to complete vim.o.autocomplete = true +vim.o.showmode = false vim.opt.clipboard = "unnamedplus" vim.o.completeopt = 'menuone,noselect' vim.o.undodir = os.getenv("HOME") .. "/.cache/nvim/undodir" diff --git a/config/nvim/lua/autocmds/init.lua b/config/nvim/lua/autocmds/init.lua index f3a00e3..547af2f 100644 --- a/config/nvim/lua/autocmds/init.lua +++ b/config/nvim/lua/autocmds/init.lua @@ -6,7 +6,6 @@ vim.api.nvim_create_autocmd('FileType', { pattern = '*', callback = function() pcall(vim.treesitter.start) - vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" end, }) @@ -56,9 +55,9 @@ vim.api.nvim_create_autocmd('LspAttach', { -- Enable completion if the server supports it if client:supports_method('textDocument/completion') then - vim.lsp.completion.enable(true, client.id, ev.buf, { - autotrigger = true, -- false = manual trigger only - }) + vim.lsp.completion.enable(true, client.id, ev.buf, { + autotrigger = true, -- false = manual trigger only + }) end end, }) @@ -87,37 +86,37 @@ vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost" }, { -- Format: whole file or visual selection via :Fc local function smart_format() - local mode = vim.fn.mode() - local in_visual = mode == "v" or mode == "V" or mode == "\22" + local mode = vim.fn.mode() + local in_visual = mode == "v" or mode == "V" or mode == "\22" - local clients = vim.lsp.get_clients({ bufnr = 0 }) - local has_formatter = false - for _, client in ipairs(clients) do - if client.supports_method("textDocument/formatting") then - has_formatter = true - break + local clients = vim.lsp.get_clients({ bufnr = 0 }) + local has_formatter = false + for _, client in ipairs(clients) do + if client.supports_method("textDocument/formatting") then + has_formatter = true + break + end end - end - if in_visual then - if has_formatter then - vim.lsp.buf.format({ - range = { - start = vim.api.nvim_buf_get_mark(0, "<"), - ["end"] = vim.api.nvim_buf_get_mark(0, ">"), - }, - }) + if in_visual then + if has_formatter then + vim.lsp.buf.format({ + range = { + start = vim.api.nvim_buf_get_mark(0, "<"), + ["end"] = vim.api.nvim_buf_get_mark(0, ">"), + }, + }) + else + vim.cmd("normal! gv=") + end else - vim.cmd("normal! gv=") + if has_formatter then + vim.lsp.buf.format({ async = false }) + else + local view = vim.fn.winsaveview() + vim.cmd("normal! gg=G") + vim.fn.winrestview(view) + end end - else - if has_formatter then - vim.lsp.buf.format({ async = false }) - else - local view = vim.fn.winsaveview() - vim.cmd("normal! gg=G") - vim.fn.winrestview(view) - end - end end vim.api.nvim_create_user_command("FF", smart_format, { range = true }) diff --git a/config/nvim/lua/plugins/init.lua b/config/nvim/lua/plugins/init.lua index 95e3907..80ef13c 100644 --- a/config/nvim/lua/plugins/init.lua +++ b/config/nvim/lua/plugins/init.lua @@ -4,10 +4,37 @@ vim.pack.add({ { src = "https://github.com/romus204/tree-sitter-manager.nvim" }, { src = "https://github.com/rebelot/kanagawa.nvim" }, { src = "https://github.com/tribela/transparent.nvim" }, + { src = "https://github.com/nvim-lualine/lualine.nvim" } }) + vim.cmd(":colorscheme kanagawa") require("tree-sitter-manager").setup({}) +local theme = require('lualine.themes.kanagawa') + +for _, mode in pairs(theme) do + if mode.b then mode.b.bg = '#16161D' end + if mode.c then mode.c.bg = '#16161D' end + if mode.x then mode.x.bg = '#16161D' end + if mode.y then mode.y.bg = '#16161D' end + if mode.z then mode.z.bg = '#16161D' end +end + +require('lualine').setup({ + options = { + theme = theme, + component_separators = '', + section_separators = '', + }, + sections = { + lualine_a = {'mode'}, + lualine_b = {}, + lualine_c = {'filename'}, + lualine_x = {'diagnostics'}, + lualine_y = {}, + lualine_z = {'lsp_status', 'location'}, + }, +}) require("fzf-lua").setup() map("n", "f", ":lua FzfLua.files()")