From 78cefbb297b8b3b368e8ada7847b6aff759ed66d Mon Sep 17 00:00:00 2001 From: siduck76 Date: Sat, 13 Mar 2021 06:53:02 +0530 Subject: [PATCH] clean up --- init.lua | 53 +++---- lua/bufferline/lua.lua | 91 ++++++------ lua/gitsigns/lua.lua | 54 ++++---- lua/lsp_config/lua.lua | 27 ++-- lua/mappings/lua.lua | 13 +- lua/nvim-compe/lua.lua | 67 +++++---- lua/nvim-lspconfig/lua.lua | 48 +++---- lua/nvimTree/lua.lua | 132 +++++++++--------- lua/pluginsList/lua.lua | 51 +++---- lua/statusline/lua.lua | 275 +++++++++++++++++++------------------ lua/telescope-nvim/lua.lua | 135 +++++++++--------- lua/treesitter/lua.lua | 22 +-- lua/utils/lua.lua | 41 +++--- lua/web-devicons/lua.lua | 119 ++++++++-------- 14 files changed, 576 insertions(+), 552 deletions(-) diff --git a/init.lua b/init.lua index 0a0c26a..3767251 100644 --- a/init.lua +++ b/init.lua @@ -1,37 +1,38 @@ -- load plugins -require('pluginsList.lua') -require('web-devicons.lua') +require("pluginsList.lua") +require("web-devicons.lua") -require('utils.lua') -require('nvimTree.lua') -require('bufferline.lua') -require('statusline.lua') -require('telescope-nvim.lua') +require("utils.lua") +require("nvimTree.lua") +require("bufferline.lua") +require("statusline.lua") +require("telescope-nvim.lua") -- lsp -require('nvim-lspconfig.lua') -require('nvim-compe.lua') -require('coc.lua') +require("nvim-lspconfig.lua") +require("nvim-compe.lua") +require("coc.lua") -require('gitsigns.lua') +require("gitsigns.lua") -require'colorizer'.setup() +require "colorizer".setup() local cmd = vim.cmd local g = vim.g local indent = 2 -cmd 'colorscheme base16-onedark' -cmd 'syntax enable' -cmd 'syntax on' +cmd "colorscheme base16-onedark" +cmd "syntax enable" +cmd "syntax on" g.auto_save = 1 -g.mapleader = ' ' -require('treesitter.lua') -require('mappings.lua') +g.mapleader = " " --- highlights +require("treesitter.lua") +require("mappings.lua") + +-- highlights cmd("hi LineNr guibg=NONE") cmd("hi SignColumn guibg=NONE") cmd("hi VertSplit guibg=NONE") @@ -44,14 +45,16 @@ cmd("highlight TelescopeBorder guifg=#3e4451") cmd("highlight TelescopePromptBorder guifg=#3e4451") cmd("highlight TelescopeResultsBorder guifg=#3e4451") cmd("highlight TelescopePreviewBorder guifg=#525865") -cmd("highlight PmenuSel guibg=#BBE67E") +cmd("highlight PmenuSel guibg=#98c379") --- tree folder name , icon color +-- tree folder name , icon color cmd("highlight NvimTreeFolderIcon guifg = #61afef") cmd("highlight NvimTreeFolderName guifg = #61afef") -require('nvim-autopairs').setup() +require("nvim-autopairs").setup() -require('lspkind').init({ - File = ' ', -}) +require("lspkind").init( + { + File = " " + } +) diff --git a/lua/bufferline/lua.lua b/lua/bufferline/lua.lua index 3765b4e..6f42f00 100644 --- a/lua/bufferline/lua.lua +++ b/lua/bufferline/lua.lua @@ -1,54 +1,53 @@ -vim.o.termguicolors = true +vim.o.termguicolors = true -require'bufferline'.setup{ - options = { - buffer_close_icon= '', - modified_icon = '●', - close_icon = '', - left_trunc_marker = '', - right_trunc_marker = '', - max_name_length = 14, - max_prefix_length = 13, - tab_size = 18, - enforce_regular_tabs = true , - view = "multiwindow" , - show_buffer_close_icons = true , - separator_style = "thin" +require "bufferline".setup { + options = { + buffer_close_icon = "", + modified_icon = "●", + close_icon = "", + left_trunc_marker = "", + right_trunc_marker = "", + max_name_length = 14, + max_prefix_length = 13, + tab_size = 18, + enforce_regular_tabs = true, + view = "multiwindow", + show_buffer_close_icons = true, + separator_style = "thin" }, - - highlights = { + highlights = { background = { - guifg = comment_fg, - guibg = '#282c34' - }, - fill = { - guifg = comment_fg, - guibg = '#282c34' - }, + guifg = comment_fg, + guibg = "#282c34" + }, + fill = { + guifg = comment_fg, + guibg = "#282c34" + }, buffer_selected = { - guifg = normal_fg, - guibg = '#3A3E44', - gui = "bold" - }, - separator_visible = { - guifg = '#282c34' , - guibg = '#282c34' + guifg = normal_fg, + guibg = "#3A3E44", + gui = "bold" + }, + separator_visible = { + guifg = "#282c34", + guibg = "#282c34" }, separator_selected = { - guifg = '#282c34' , - guibg = '#282c34' - }, - separator = { - guifg = '#282c34' , - guibg = '#282c34' - }, - indicator_selected = { - guifg = '#282c34' , - guibg = '#282c34' - }, + guifg = "#282c34", + guibg = "#282c34" + }, + separator = { + guifg = "#282c34", + guibg = "#282c34" + }, + indicator_selected = { + guifg = "#282c34", + guibg = "#282c34" + }, modified_selected = { - guifg = string_fg, - guibg = '#3A3E44' - } - }; + guifg = string_fg, + guibg = "#3A3E44" + } + } } diff --git a/lua/gitsigns/lua.lua b/lua/gitsigns/lua.lua index 3dbd424..1fa4325 100644 --- a/lua/gitsigns/lua.lua +++ b/lua/gitsigns/lua.lua @@ -1,29 +1,27 @@ -require('gitsigns').setup { - signs = { - add = {hl = 'DiffAdd' , text = '▌', numhl='GitSignsAddNr'}, - change = {hl = 'DiffChange', text = '▌', numhl='GitSignsChangeNr'}, - delete = {hl = 'DiffDelete', text = '_', numhl='GitSignsDeleteNr'}, - topdelete = {hl = 'DiffDelete', text = '‾', numhl='GitSignsDeleteNr'}, - changedelete = {hl = 'DiffChange', text = '~', numhl='GitSignsChangeNr'}, - }, - numhl = false, - keymaps = { - -- Default keymap options - noremap = true, - buffer = true, - - ['n ]c'] = { expr = true, "&diff ? ']c' : 'lua require\"gitsigns\".next_hunk()'"}, - ['n [c'] = { expr = true, "&diff ? '[c' : 'lua require\"gitsigns\".prev_hunk()'"}, - - ['n hs'] = 'lua require"gitsigns".stage_hunk()', - ['n hu'] = 'lua require"gitsigns".undo_stage_hunk()', - ['n hr'] = 'lua require"gitsigns".reset_hunk()', - ['n hp'] = 'lua require"gitsigns".preview_hunk()', - ['n hb'] = 'lua require"gitsigns".blame_line()', - }, - watch_index = { - interval = 100 - }, - sign_priority = 5, - status_formatter = nil, -- Use default +require("gitsigns").setup { + signs = { + add = {hl = "DiffAdd", text = "▌", numhl = "GitSignsAddNr"}, + change = {hl = "DiffChange", text = "▌", numhl = "GitSignsChangeNr"}, + delete = {hl = "DiffDelete", text = "_", numhl = "GitSignsDeleteNr"}, + topdelete = {hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr"}, + changedelete = {hl = "DiffChange", text = "~", numhl = "GitSignsChangeNr"} + }, + numhl = false, + keymaps = { + -- Default keymap options + noremap = true, + buffer = true, + ["n ]c"] = {expr = true, '&diff ? \']c\' : \'lua require"gitsigns".next_hunk()\''}, + ["n [c"] = {expr = true, '&diff ? \'[c\' : \'lua require"gitsigns".prev_hunk()\''}, + ["n hs"] = 'lua require"gitsigns".stage_hunk()', + ["n hu"] = 'lua require"gitsigns".undo_stage_hunk()', + ["n hr"] = 'lua require"gitsigns".reset_hunk()', + ["n hp"] = 'lua require"gitsigns".preview_hunk()', + ["n hb"] = 'lua require"gitsigns".blame_line()' + }, + watch_index = { + interval = 100 + }, + sign_priority = 5, + status_formatter = nil -- Use default } diff --git a/lua/lsp_config/lua.lua b/lua/lsp_config/lua.lua index 47350ba..7d52eb9 100644 --- a/lua/lsp_config/lua.lua +++ b/lua/lsp_config/lua.lua @@ -5,19 +5,18 @@ vim.cmd [[ packadd completion-nvim ]] local html_snippet_capabilities = vim.lsp.protocol.make_client_capabilities() html_snippet_capabilities.textDocument.completion.completionItem.snippetSupport = true -require'lspconfig'.html.setup { - on_attach = lsp_on_attach, - capabilities = html_snippet_capabilities, - cmd = { "html-languageserver", "--stdio" }; - filetypes = { "html" }; - init_opitons = { - configurationSection = { "html", "css", "javascript" }; - embeddedLanguages = { - css = true, - javascript = true, - }; - }; +require "lspconfig".html.setup { + on_attach = lsp_on_attach, + capabilities = html_snippet_capabilities, + cmd = {"html-languageserver", "--stdio"}, + filetypes = {"html"}, + init_opitons = { + configurationSection = {"html", "css", "javascript"}, + embeddedLanguages = { + css = true, + javascript = true + } + } } -vim.g.completion_enable_snippet = 'UltiSnips' - +vim.g.completion_enable_snippet = "UltiSnips" diff --git a/lua/mappings/lua.lua b/lua/mappings/lua.lua index aad904f..5caa8cd 100644 --- a/lua/mappings/lua.lua +++ b/lua/mappings/lua.lua @@ -1,9 +1,10 @@ local function map(mode, lhs, rhs, opts) - local options = {noremap = true} - if opts then options = vim.tbl_extend('force', options, opts) end - vim.api.nvim_set_keymap(mode, lhs, rhs, options) + local options = {noremap = true} + if opts then + options = vim.tbl_extend("force", options, opts) + end + vim.api.nvim_set_keymap(mode, lhs, rhs, options) end --- keybind list -map('', 'c', '"+y') - +-- keybind list +map("", "c", '"+y') diff --git a/lua/nvim-compe/lua.lua b/lua/nvim-compe/lua.lua index 575fe22..a2320b1 100644 --- a/lua/nvim-compe/lua.lua +++ b/lua/nvim-compe/lua.lua @@ -3,45 +3,44 @@ vim.cmd [[packadd nvim-compe]] vim.o.completeopt = "menuone,noselect" -require'compe'.setup { - enabled = true; - autocomplete = true; - debug = false; - min_length = 1; - preselect = 'enable'; - throttle_time = 80; - source_timeout = 200; - incomplete_delay = 400; - max_abbr_width = 100; - max_kind_width = 100; - max_menu_width = 100; - documentation = false; - - source = { - path = true; - buffer = true; - calc = true; - vsnip = true; - nvim_lsp = true; - nvim_lua = true; - spell = true; - tags = true; - snippets_nvim = true; - treesitter = true; - }; +require "compe".setup { + enabled = true, + autocomplete = true, + debug = false, + min_length = 1, + preselect = "enable", + throttle_time = 80, + source_timeout = 200, + incomplete_delay = 400, + max_abbr_width = 100, + max_kind_width = 100, + max_menu_width = 100, + documentation = false, + source = { + path = true, + buffer = true, + calc = true, + vsnip = true, + nvim_lsp = true, + nvim_lua = true, + spell = true, + tags = true, + snippets_nvim = true, + treesitter = true + } } local t = function(str) - return vim.api.nvim_replace_termcodes(str, true, true, true) + return vim.api.nvim_replace_termcodes(str, true, true, true) end _G.s_tab_complete = function() - if vim.fn.pumvisible() == 1 then - return t "" - elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then - return t "(vsnip-jump-prev)" - else - return t "" - end + if vim.fn.pumvisible() == 1 then + return t "" + elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then + return t "(vsnip-jump-prev)" + else + return t "" + end end vim.api.nvim_set_keymap("s", "", "v:lua.tab_complete()", {expr = true}) diff --git a/lua/nvim-lspconfig/lua.lua b/lua/nvim-lspconfig/lua.lua index 7d5a6f8..2a2ec79 100644 --- a/lua/nvim-lspconfig/lua.lua +++ b/lua/nvim-lspconfig/lua.lua @@ -2,31 +2,33 @@ vim.cmd [[packadd nvim-lspconfig]] vim.cmd [[packadd nvim-compe]] local function map(mode, lhs, rhs, opts) - local options = {noremap = true} - if opts then options = vim.tbl_extend('force', options, opts) end - vim.api.nvim_set_keymap(mode, lhs, rhs, options) + local options = {noremap = true} + if opts then + options = vim.tbl_extend("force", options, opts) + end + vim.api.nvim_set_keymap(mode, lhs, rhs, options) end -local opts = { noremap=true, silent=true } +local opts = {noremap = true, silent = true} - -- Mappings. - map('n', 'gd', 'lua vim.lsp.buf.definition()', opts) - map('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) - map('n', 'gr', 'lua vim.lsp.buf.references()', opts) +-- Mappings. +map("n", "gd", "lua vim.lsp.buf.definition()", opts) +map("n", "gD", "lua vim.lsp.buf.declaration()", opts) +map("n", "gr", "lua vim.lsp.buf.references()", opts) - map('n', 'K', 'lua vim.lsp.buf.hover()', opts) - map('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) - map('n', '', 'lua vim.lsp.buf.signature_help()', opts) - map('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) - map('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) - map('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) - map('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) - map('n', 'rn', 'lua vim.lsp.buf.rename()', opts) - map('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) - map('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) - map('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) - map('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', opts) +map("n", "K", "lua vim.lsp.buf.hover()", opts) +map("n", "gi", "lua vim.lsp.buf.implementation()", opts) +map("n", "", "lua vim.lsp.buf.signature_help()", opts) +map("n", "wa", "lua vim.lsp.buf.add_workspace_folder()", opts) +map("n", "wr", "lua vim.lsp.buf.remove_workspace_folder()", opts) +map("n", "wl", "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))", opts) +map("n", "D", "lua vim.lsp.buf.type_definition()", opts) +map("n", "rn", "lua vim.lsp.buf.rename()", opts) +map("n", "e", "lua vim.lsp.diagnostic.show_line_diagnostics()", opts) +map("n", "[d", "lua vim.lsp.diagnostic.goto_prev()", opts) +map("n", "]d", "lua vim.lsp.diagnostic.goto_next()", opts) +map("n", "q", "lua vim.lsp.diagnostic.set_loclist()", opts) -require'lspconfig'.tsserver.setup{} -require'lspconfig'.cssls.setup{} -require'lspconfig'.html.setup{} +require "lspconfig".tsserver.setup {} +require "lspconfig".cssls.setup {} +require "lspconfig".html.setup {} diff --git a/lua/nvimTree/lua.lua b/lua/nvimTree/lua.lua index 6e6310b..4ad9b2e 100644 --- a/lua/nvimTree/lua.lua +++ b/lua/nvimTree/lua.lua @@ -1,80 +1,84 @@ vim.cmd [[packadd nvim-tree.lua]] -vim.o.termguicolors = true +vim.o.termguicolors = true -vim.g.nvim_tree_side = 'left' -vim.g.nvim_tree_width = 24 -vim.g.nvim_tree_ignore = { '.git', 'node_modules', '.cache' } -vim.g.nvim_tree_auto_open = 0 -vim.g.nvim_tree_auto_close = 0 -vim.g.nvim_tree_quit_on_open = 0 -vim.g.nvim_tree_follow = 1 -vim.g.nvim_tree_indent_markers = 1 -vim.g.nvim_tree_hide_dotfiles = 1 +vim.g.nvim_tree_side = "left" +vim.g.nvim_tree_width = 24 +vim.g.nvim_tree_ignore = {".git", "node_modules", ".cache"} +vim.g.nvim_tree_auto_open = 0 +vim.g.nvim_tree_auto_close = 0 +vim.g.nvim_tree_quit_on_open = 0 +vim.g.nvim_tree_follow = 1 +vim.g.nvim_tree_indent_markers = 1 +vim.g.nvim_tree_hide_dotfiles = 1 vim.g.nvim_tree_git_hl = 1 -vim.g.nvim_tree_root_folder_modifier = ':~' +vim.g.nvim_tree_root_folder_modifier = ":~" vim.g.nvim_tree_tab_open = 1 -vim.g.nvim_tree_allow_resize = 1 +vim.g.nvim_tree_allow_resize = 1 vim.g.nvim_tree_show_icons = { - git = 1, - folders = 1, - files = 1, - } - + git = 1, + folders = 1, + files = 1 +} + vim.g.nvim_tree_icons = { - default = ' ', - symlink = ' ', + default = " ", + symlink = " ", + git = { + unstaged = "✗", + staged = "✓", + unmerged = "", + renamed = "➜", + untracked = "★" + }, + folder = { + default = "", + open = "", + symlink = "" + } +} - git = { - unstaged = "✗", - staged = "✓", - unmerged = "", - renamed = "➜", - untracked = "★" - }, - folder = { - default = "", - open = "", - symlink = "", - } - } - -local get_lua_cb = function (cb_name) - return string.format(":lua require'nvim-tree'.on_keypress('%s')", cb_name) +local get_lua_cb = function(cb_name) + return string.format(":lua require'nvim-tree'.on_keypress('%s')", cb_name) end -- Mappings for nvimtree -vim.api.nvim_set_keymap('n', '', ':NvimTreeToggle', { - noremap = true, - silent = true - }) +vim.api.nvim_set_keymap( + "n", + "", + ":NvimTreeToggle", + { + noremap = true, + silent = true + } +) vim.g.nvim_tree_bindings = { - [""] = get_lua_cb("edit"), - ["o"] = get_lua_cb("edit"), - ["<2-LeftMouse>"] = get_lua_cb("edit"), - ["<2-RightMouse>"] = get_lua_cb("cd"), - [""] = get_lua_cb("cd"), - [""] = get_lua_cb("vsplit"), - [""] = get_lua_cb("split"), - [""] = get_lua_cb("tabnew"), - [""] = get_lua_cb("close_node"), - [""] = get_lua_cb("close_node"), - [""] = get_lua_cb("preview"), - ["I"] = get_lua_cb("toggle_ignored"), - ["H"] = get_lua_cb("toggle_dotfiles"), - ["R"] = get_lua_cb("refresh"), - ["a"] = get_lua_cb("create"), - ["d"] = get_lua_cb("remove"), - ["r"] = get_lua_cb("rename"), - [""] = get_lua_cb("full_rename"), - ["x"] = get_lua_cb("cut"), - ["c"] = get_lua_cb("copy"), - ["p"] = get_lua_cb("paste"), - ["[c"] = get_lua_cb("prev_git_item"), - ["]c"] = get_lua_cb("next_git_item"), - ["-"] = get_lua_cb("dir_up"), - ["q"] = get_lua_cb("close"), + [""] = get_lua_cb("edit"), + ["o"] = get_lua_cb("edit"), + ["<2-LeftMouse>"] = get_lua_cb("edit"), + ["<2-RightMouse>"] = get_lua_cb("cd"), + [""] = get_lua_cb("cd"), + [""] = get_lua_cb("vsplit"), + [""] = get_lua_cb("split"), + [""] = get_lua_cb("tabnew"), + [""] = get_lua_cb("close_node"), + [""] = get_lua_cb("close_node"), + [""] = get_lua_cb("preview"), + ["I"] = get_lua_cb("toggle_ignored"), + ["H"] = get_lua_cb("toggle_dotfiles"), + ["R"] = get_lua_cb("refresh"), + ["a"] = get_lua_cb("create"), + ["d"] = get_lua_cb("remove"), + ["r"] = get_lua_cb("rename"), + [""] = get_lua_cb("full_rename"), + ["x"] = get_lua_cb("cut"), + ["c"] = get_lua_cb("copy"), + ["p"] = get_lua_cb("paste"), + ["[c"] = get_lua_cb("prev_git_item"), + ["]c"] = get_lua_cb("next_git_item"), + ["-"] = get_lua_cb("dir_up"), + ["q"] = get_lua_cb("close") } diff --git a/lua/pluginsList/lua.lua b/lua/pluginsList/lua.lua index 22451f0..0deb588 100644 --- a/lua/pluginsList/lua.lua +++ b/lua/pluginsList/lua.lua @@ -1,27 +1,30 @@ -- check if packer is installed (~/local/share/nvim/site/pack) local packer_exists = pcall(vim.cmd, [[packadd packer.nvim]]) -return require('packer').startup(function() - use {'wbthomason/packer.nvim', opt = true} - use { 'kyazdani42/nvim-web-devicons'} - use { 'kyazdani42/nvim-tree.lua'} - use { 'nvim-lua/plenary.nvim'} - use { 'lewis6991/gitsigns.nvim'} - use { 'glepnir/galaxyline.nvim'} - use { 'akinsho/nvim-bufferline.lua'} - use { '907th/vim-auto-save'} - use { 'nvim-treesitter/nvim-treesitter'} - use { 'chriskempson/base16-vim'} - use { 'norcalli/nvim-colorizer.lua'} - use { 'ryanoasis/vim-devicons'} - use { 'sbdchd/neoformat'} - use { 'neovim/nvim-lspconfig'} - use { 'hrsh7th/nvim-compe'} - use { 'windwp/nvim-autopairs'} - use { 'alvan/vim-closetag'} - use { 'tweekmonster/startuptime.vim'} - use {'onsails/lspkind-nvim'} - use { 'nvim-telescope/telescope.nvim'} - use {'nvim-telescope/telescope-media-files.nvim'} - use {'nvim-lua/popup.nvim'} -end) +return require("packer").startup( + function() + use {"wbthomason/packer.nvim", opt = true} + use {"kyazdani42/nvim-web-devicons"} + use {"kyazdani42/nvim-tree.lua"} + use {"nvim-lua/plenary.nvim"} + use {"lewis6991/gitsigns.nvim"} + use {"glepnir/galaxyline.nvim"} + use {"akinsho/nvim-bufferline.lua"} + use {"907th/vim-auto-save"} + use {"nvim-treesitter/nvim-treesitter"} + use {"chriskempson/base16-vim"} + use {"norcalli/nvim-colorizer.lua"} + -- use { 'Yggdroot/indentLine'} + use {"ryanoasis/vim-devicons"} + use {"sbdchd/neoformat"} + use {"neovim/nvim-lspconfig"} + use {"hrsh7th/nvim-compe"} + use {"windwp/nvim-autopairs"} + use {"alvan/vim-closetag"} + use {"tweekmonster/startuptime.vim"} + use {"onsails/lspkind-nvim"} + use {"nvim-telescope/telescope.nvim"} + use {"nvim-telescope/telescope-media-files.nvim"} + use {"nvim-lua/popup.nvim"} + end +) diff --git a/lua/statusline/lua.lua b/lua/statusline/lua.lua index 57ba005..fe0aff8 100644 --- a/lua/statusline/lua.lua +++ b/lua/statusline/lua.lua @@ -1,191 +1,204 @@ -local gl = require('galaxyline') +local gl = require("galaxyline") local gls = gl.section -gl.short_line_list = {'LuaTree','vista','dbui'} +gl.short_line_list = {"LuaTree", "vista", "dbui"} local colors = { - bg = '#282c34', - line_bg = '#282c34', - fg = '#D8DEE9', - fg_green = '#65a380', - yellow = '#A3BE8C', - cyan = '#22262C', - darkblue = '#61afef', - green = '#BBE67E', - orange = '#FF8800', - purple = '#252930', - magenta = '#c678dd', - blue = '#22262C'; - red = '#DF8890', - lightbg = '#3C4048', - nord = '#81A1C1', - greenYel = '#EBCB8B' + bg = "#282c34", + line_bg = "#282c34", + fg = "#D8DEE9", + fg_green = "#65a380", + yellow = "#A3BE8C", + cyan = "#22262C", + darkblue = "#61afef", + green = "#BBE67E", + orange = "#FF8800", + purple = "#252930", + magenta = "#c678dd", + blue = "#22262C", + red = "#DF8890", + lightbg = "#3C4048", + nord = "#81A1C1", + greenYel = "#EBCB8B" } gls.left[1] = { - leftRounded = { - provider = function() return '' end, - highlight = { colors.nord, colors.bg } - }, + leftRounded = { + provider = function() + return "" + end, + highlight = {colors.nord, colors.bg} + } } gls.left[2] = { - ViMode = { - provider = function() - return '  ' - end, - highlight = {colors.bg,colors.nord}, - separator = ' ', - separator_highlight = {colors.lightbg,colors.lightbg}, - }, + ViMode = { + provider = function() + return "  " + end, + highlight = {colors.bg, colors.nord}, + separator = " ", + separator_highlight = {colors.lightbg, colors.lightbg} + } } -gls.left[3] ={ - FileIcon = { - provider = 'FileIcon', - condition = buffer_not_empty, - highlight = {require('galaxyline.provider_fileinfo').get_file_icon_color,colors.lightbg}, - }, +gls.left[3] = { + FileIcon = { + provider = "FileIcon", + condition = buffer_not_empty, + highlight = {require("galaxyline.provider_fileinfo").get_file_icon_color, colors.lightbg} + } } gls.left[4] = { - FileName = { - provider = {'FileName','FileSize'}, - condition = buffer_not_empty, - highlight = {colors.fg,colors.lightbg} - } + FileName = { + provider = {"FileName", "FileSize"}, + condition = buffer_not_empty, + highlight = {colors.fg, colors.lightbg} + } } gls.left[5] = { - teech = { - provider = function() return '' end, - separator = ' ', - highlight = { colors.lightbg, colors.bg } - }, + teech = { + provider = function() + return "" + end, + separator = " ", + highlight = {colors.lightbg, colors.bg} + } } local checkwidth = function() - local squeeze_width = vim.fn.winwidth(0) / 2 - if squeeze_width > 40 then - return true - end - return false + local squeeze_width = vim.fn.winwidth(0) / 2 + if squeeze_width > 40 then + return true + end + return false end gls.left[6] = { - DiffAdd = { - provider = 'DiffAdd', - condition = checkwidth, - icon = '  ', - highlight = {colors.greenYel,colors.line_bg}, - } + DiffAdd = { + provider = "DiffAdd", + condition = checkwidth, + icon = "  ", + highlight = {colors.greenYel, colors.line_bg} + } } gls.left[7] = { - DiffModified = { - provider = 'DiffModified', - condition = checkwidth, - icon = ' ', - highlight = {colors.orange,colors.line_bg}, - } + DiffModified = { + provider = "DiffModified", + condition = checkwidth, + icon = " ", + highlight = {colors.orange, colors.line_bg} + } } gls.left[8] = { - DiffRemove = { - provider = 'DiffRemove', - condition = checkwidth, - icon = ' ', - highlight = {colors.red,colors.line_bg}, - } + DiffRemove = { + provider = "DiffRemove", + condition = checkwidth, + icon = " ", + highlight = {colors.red, colors.line_bg} + } } gls.left[9] = { - LeftEnd = { - provider = function() return ' ' end, - separator = ' ', - separator_highlight = {colors.line_bg,colors.line_bg}, - highlight = {colors.line_bg,colors.line_bg} - } + LeftEnd = { + provider = function() + return " " + end, + separator = " ", + separator_highlight = {colors.line_bg, colors.line_bg}, + highlight = {colors.line_bg, colors.line_bg} + } } gls.left[10] = { - DiagnosticError = { - provider = 'DiagnosticError', - icon = '  ', - highlight = {colors.red,colors.bg} - } + DiagnosticError = { + provider = "DiagnosticError", + icon = "  ", + highlight = {colors.red, colors.bg} + } } gls.left[11] = { - Space = { - provider = function () return ' ' end, - highlight = {colors.line_bg,colors.line_bg} - } + Space = { + provider = function() + return " " + end, + highlight = {colors.line_bg, colors.line_bg} + } } gls.left[12] = { - DiagnosticWarn = { - provider = 'DiagnosticWarn', - icon = '  ', - highlight = {colors.blue,colors.bg}, - } + DiagnosticWarn = { + provider = "DiagnosticWarn", + icon = "  ", + highlight = {colors.blue, colors.bg} + } } gls.right[1] = { - GitIcon = { - provider = function() return '  ' end, - condition = require('galaxyline.provider_vcs').check_git_workspace, - highlight = {colors.green,colors.line_bg}, - } + GitIcon = { + provider = function() + return "  " + end, + condition = require("galaxyline.provider_vcs").check_git_workspace, + highlight = {colors.green, colors.line_bg} + } } gls.right[2] = { - GitBranch = { - provider = 'GitBranch', - condition = require('galaxyline.provider_vcs').check_git_workspace, - highlight = {colors.green,colors.line_bg}, - } + GitBranch = { + provider = "GitBranch", + condition = require("galaxyline.provider_vcs").check_git_workspace, + highlight = {colors.green, colors.line_bg} + } } gls.right[3] = { - right_LeftRounded = { - provider = function() return '' end, - separator = ' ', - separator_highlight = {colors.bg,colors.bg}, - highlight = { colors.red, colors.bg } - }, + right_LeftRounded = { + provider = function() + return "" + end, + separator = " ", + separator_highlight = {colors.bg, colors.bg}, + highlight = {colors.red, colors.bg} + } } gls.right[4] = { - SiMode = { - provider = function() - local alias = { - n = 'NORMAL', - i = 'INSERT', - c = 'COMMAND', - V = 'VISUAL', - [''] = 'VISUAL', - v = 'VISUAL', - R = 'REPLACE', - } - return alias[vim.fn.mode()] - end, - highlight = { colors.bg, colors.red }, - }, + SiMode = { + provider = function() + local alias = { + n = "NORMAL", + i = "INSERT", + c = "COMMAND", + V = "VISUAL", + [""] = "VISUAL", + v = "VISUAL", + R = "REPLACE" + } + return alias[vim.fn.mode()] + end, + highlight = {colors.bg, colors.red} + } } - gls.right[5] = { - PerCent = { - provider = 'LinePercent', - separator = ' ', - separator_highlight = {colors.red,colors.red}, - highlight = {colors.bg,colors.fg}, - } + PerCent = { + provider = "LinePercent", + separator = " ", + separator_highlight = {colors.red, colors.red}, + highlight = {colors.bg, colors.fg} + } } gls.right[6] = { - rightRounded = { - provider = function() return '' end, - highlight = { colors.fg, colors.bg } - }, + rightRounded = { + provider = function() + return "" + end, + highlight = {colors.fg, colors.bg} + } } diff --git a/lua/telescope-nvim/lua.lua b/lua/telescope-nvim/lua.lua index 0ff9136..d001c5f 100644 --- a/lua/telescope-nvim/lua.lua +++ b/lua/telescope-nvim/lua.lua @@ -1,72 +1,73 @@ -require('telescope').setup{ - - defaults = { - vimgrep_arguments = { - 'rg', - '--color=never', - '--no-heading', - '--with-filename', - '--line-number', - '--column', - '--smart-case' +require("telescope").setup { + defaults = { + vimgrep_arguments = { + "rg", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--smart-case" + }, + prompt_position = "bottom", + prompt_prefix = "> ", + selection_caret = "> ", + entry_prefix = " ", + initial_mode = "insert", + selection_strategy = "reset", + sorting_strategy = "descending", + layout_strategy = "horizontal", + layout_defaults = { + horizontal = { + mirror = false, + preview_width = 0.5 + }, + vertical = { + mirror = false + } + }, + file_sorter = require "telescope.sorters".get_fuzzy_file, + file_ignore_patterns = {}, + generic_sorter = require "telescope.sorters".get_generic_fuzzy_sorter, + shorten_path = true, + winblend = 0, + width = 0.75, + preview_cutoff = 120, + results_height = 1, + results_width = 0.8, + border = {}, + borderchars = {"─", "│", "─", "│", "╭", "╮", "╯", "╰"}, + color_devicons = true, + use_less = true, + set_env = {["COLORTERM"] = "truecolor"}, -- default = nil, + file_previewer = require "telescope.previewers".vim_buffer_cat.new, + grep_previewer = require "telescope.previewers".vim_buffer_vimgrep.new, + qflist_previewer = require "telescope.previewers".vim_buffer_qflist.new, + -- Developer configurations: Not meant for general override + buffer_previewer_maker = require "telescope.previewers".buffer_previewer_maker }, - prompt_position = "bottom", - prompt_prefix = "> ", - selection_caret = "> ", - entry_prefix = " ", - initial_mode = "insert", - selection_strategy = "reset", - sorting_strategy = "descending", - layout_strategy = "horizontal", - layout_defaults = { - horizontal = { - mirror = false, - preview_width = 0.5, - }, - vertical = { - mirror = false, - }, - }, - file_sorter = require'telescope.sorters'.get_fuzzy_file, - file_ignore_patterns = {}, - generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter, - shorten_path = true, - winblend = 0, - width = 0.75, - preview_cutoff = 120, - results_height = 1, - results_width = 0.8, - border = {}, - borderchars = { '─', '│', '─', '│', '╭', '╮', '╯', '╰' }, - color_devicons = true, - use_less = true, - set_env = { ['COLORTERM'] = 'truecolor' }, -- default = nil, - file_previewer = require'telescope.previewers'.vim_buffer_cat.new, - grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new, - qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new, - - -- Developer configurations: Not meant for general override - buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker - }, - - extensions = { - media_files = { - filetypes = {"png", "webp", "jpg", "jpeg"}, - find_cmd = "rg" -- find command (defaults to `fd`) + extensions = { + media_files = { + filetypes = {"png", "webp", "jpg", "jpeg"}, + find_cmd = "rg" -- find command (defaults to `fd`) + } } - } +} - } +require("telescope").load_extension("media_files") -require('telescope').load_extension('media_files') +local opt = {noremap = true, silent = true} -local opt = { noremap = true, silent = true } - -vim.g.mapleader = ' ' -vim.api.nvim_set_keymap('n', 'ff', [[lua require('telescope.builtin').find_files()]], opt) -vim.api.nvim_set_keymap('n', 'fp', [[lua require('telescope').extensions.media_files.media_files()]], opt) -vim.api.nvim_set_keymap('n', 'fb', [[lua require('telescope.builtin').buffers()]], opt) -vim.api.nvim_set_keymap('n', 'fh', [[lua require('telescope.builtin').help_tags()]], opt) -vim.api.nvim_set_keymap('n', 'fo', [[lua require('telescope.builtin').oldfiles()]], opt) -vim.api.nvim_set_keymap('n', 'fm', [[ Neoformat]] , opt) -vim.api.nvim_set_keymap('n', '', [[ %y+]] , opt) +vim.g.mapleader = " " +vim.api.nvim_set_keymap("n", "ff", [[lua require('telescope.builtin').find_files()]], opt) +vim.api.nvim_set_keymap( + "n", + "fp", + [[lua require('telescope').extensions.media_files.media_files()]], + opt +) +vim.api.nvim_set_keymap("n", "fb", [[lua require('telescope.builtin').buffers()]], opt) +vim.api.nvim_set_keymap("n", "fh", [[lua require('telescope.builtin').help_tags()]], opt) +vim.api.nvim_set_keymap("n", "fo", [[lua require('telescope.builtin').oldfiles()]], opt) +vim.api.nvim_set_keymap("n", "fm", [[ Neoformat]], opt) +vim.api.nvim_set_keymap("n", "", [[ %y+]], opt) diff --git a/lua/treesitter/lua.lua b/lua/treesitter/lua.lua index c88478d..1608a44 100644 --- a/lua/treesitter/lua.lua +++ b/lua/treesitter/lua.lua @@ -1,13 +1,17 @@ local ts_config = require("nvim-treesitter.configs") ts_config.setup { - ensure_installed = { - "javascript","html","css","bash","cpp","rust","lua" - }, - - highlight = { - enable = true, - use_languagetree = true, - }, + ensure_installed = { + "javascript", + "html", + "css", + "bash", + "cpp", + "rust", + "lua" + }, + highlight = { + enable = true, + use_languagetree = true + } } - diff --git a/lua/utils/lua.lua b/lua/utils/lua.lua index d36b260..75db6fd 100644 --- a/lua/utils/lua.lua +++ b/lua/utils/lua.lua @@ -1,36 +1,37 @@ -local scopes = { o = vim.o, b = vim.bo, w = vim.wo} +local scopes = {o = vim.o, b = vim.bo, w = vim.wo} local function opt(scope, key, value) - scopes[scope][key] = value - if scope ~= 'o' then scopes['o'][key] = value end + scopes[scope][key] = value + if scope ~= "o" then + scopes["o"][key] = value + end end -opt('o', 'hidden', true) -opt('o', 'ignorecase', true) -opt('o', 'splitbelow', true) -opt('o', 'splitright', true) -opt('o', 'termguicolors', true) -opt('w', 'number', true) -opt('o', 'numberwidth' , 2) +opt("o", "hidden", true) +opt("o", "ignorecase", true) +opt("o", "splitbelow", true) +opt("o", "splitright", true) +opt("o", "termguicolors", true) +opt("w", "number", true) +opt("o", "numberwidth", 2) -opt('o' ,'mouse' , "a") - -opt('w', 'signcolumn' , "yes") -opt('o' , 'cmdheight' , 1) -opt('o' , 'updatetime' , 250) -opt('o' , 'clipboard' , 'unnamedplus') +opt("o", "mouse", "a") +opt("w", "signcolumn", "yes") +opt("o", "cmdheight", 1) +opt("o", "updatetime", 250) +opt("o", "clipboard", "unnamedplus") local M = {} function M.is_buffer_empty() - -- Check whether the current buffer is empty - return vim.fn.empty(vim.fn.expand('%:t')) == 1 + -- Check whether the current buffer is empty + return vim.fn.empty(vim.fn.expand("%:t")) == 1 end function M.has_width_gt(cols) - -- Check if the windows width is greater than a given number of columns - return vim.fn.winwidth(0) / 2 > cols + -- Check if the windows width is greater than a given number of columns + return vim.fn.winwidth(0) / 2 > cols end return M diff --git a/lua/web-devicons/lua.lua b/lua/web-devicons/lua.lua index 41b20ea..be968a6 100644 --- a/lua/web-devicons/lua.lua +++ b/lua/web-devicons/lua.lua @@ -1,64 +1,61 @@ vim.cmd [[packadd nvim-web-devicons]] -require'nvim-web-devicons'.setup { - - override = { - html = { - icon = "", - color = "#DE8C92", - name = "html" - }, - css = { - icon = "", - color = "#61afef", - name = "css" - }, - js = { - icon = "", - color = "#EBCB8B", - name = "js" - }, - png = { - icon = " ", - color = "#BD77DC", - name = "png" - }, - jpg = { - icon = " ", - color = "#BD77DC", - name = "jpg" - }, - jpeg = { - icon = " ", - color = "#BD77DC", - name = "jpeg" - }, - mp3 = { - icon = "", - color = "#C8CCD4", - name = "mp3" - }, - mp4 = { - icon = "", - color = "#C8CCD4", - name = "mp4" - }, - out = { - icon = "", - color = "#C8CCD4", - name = "out" - }, - toml = { - icon = "", - color = "#61afef", - name = "toml" - }, - - lock = { - icon = "", - color = "#DE6B74", - name = "lock" - } - }; - +require "nvim-web-devicons".setup { + override = { + html = { + icon = "", + color = "#DE8C92", + name = "html" + }, + css = { + icon = "", + color = "#61afef", + name = "css" + }, + js = { + icon = "", + color = "#EBCB8B", + name = "js" + }, + png = { + icon = " ", + color = "#BD77DC", + name = "png" + }, + jpg = { + icon = " ", + color = "#BD77DC", + name = "jpg" + }, + jpeg = { + icon = " ", + color = "#BD77DC", + name = "jpeg" + }, + mp3 = { + icon = "", + color = "#C8CCD4", + name = "mp3" + }, + mp4 = { + icon = "", + color = "#C8CCD4", + name = "mp4" + }, + out = { + icon = "", + color = "#C8CCD4", + name = "out" + }, + toml = { + icon = "", + color = "#61afef", + name = "toml" + }, + lock = { + icon = "", + color = "#DE6B74", + name = "lock" + } + } }