diff options
| -rw-r--r-- | init.lua | 1 | ||||
| -rw-r--r-- | lua/user/cmp.lua | 6 | ||||
| -rw-r--r-- | lua/user/colorscheme.lua | 10 | ||||
| -rw-r--r-- | lua/user/keymaps.lua | 1 | ||||
| -rw-r--r-- | lua/user/lsp/lsp-installer.lua | 25 | ||||
| -rw-r--r-- | lua/user/lsp/null-ls.lua | 2 | ||||
| -rw-r--r-- | lua/user/lsp/settings/awk_ls.lua | 10 | ||||
| -rw-r--r-- | lua/user/lsp/settings/bashls.lua | 11 | ||||
| -rw-r--r-- | lua/user/lsp/settings/clangd.lua | 10 | ||||
| -rw-r--r-- | lua/user/lsp/settings/cmake.lua | 12 | ||||
| -rw-r--r-- | lua/user/lsp/settings/html.lua | 18 | ||||
| -rw-r--r-- | lua/user/lua.lua | 79 | ||||
| -rw-r--r-- | lua/user/nvim-tree.lua | 59 | ||||
| -rw-r--r-- | lua/user/options.lua | 3 | ||||
| -rw-r--r-- | lua/user/plugins.lua | 10 | ||||
| -rw-r--r-- | lua/user/treesitter.lua | 2 |
16 files changed, 206 insertions, 53 deletions
@@ -7,6 +7,7 @@ require "user.lsp" require "user.telescope" require "user.treesitter" require "user.autopairs" +require "user.lua" require "user.comment" require "user.gitsigns" require "user.nvim-tree" diff --git a/lua/user/cmp.lua b/lua/user/cmp.lua index 0ba1fc7..2966f5f 100644 --- a/lua/user/cmp.lua +++ b/lua/user/cmp.lua @@ -121,8 +121,10 @@ cmp.setup { behavior = cmp.ConfirmBehavior.Replace, select = false, }, - documentation = { - border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, + window = { + documentation = { + border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, + } }, experimental = { ghost_text = false, diff --git a/lua/user/colorscheme.lua b/lua/user/colorscheme.lua index 4ccd3ff..5e3ec3c 100644 --- a/lua/user/colorscheme.lua +++ b/lua/user/colorscheme.lua @@ -1,12 +1,4 @@ -vim.cmd [[ -try - colorscheme darkplus -catch /^Vim\%((\a\+)\)\=:E185/ - colorscheme default - set background=dark -endtry -]] -local colorscheme = "default" +local colorscheme = "tokyodark" local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) if not status_ok then diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index 49087c7..d6db5cd 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -62,6 +62,7 @@ keymap("t", "<C-h>", "<C-\\><C-N><C-w>h", term_opts) keymap("t", "<C-j>", "<C-\\><C-N><C-w>j", term_opts) keymap("t", "<C-k>", "<C-\\><C-N><C-w>k", term_opts) keymap("t", "<C-l>", "<C-\\><C-N><C-w>l", term_opts) +>>>>>>> vgg -- Nvimtree keymap("n", "<leader>e", ":NvimTreeToggle<cr>", opts) diff --git a/lua/user/lsp/lsp-installer.lua b/lua/user/lsp/lsp-installer.lua index f539050..ac8f40c 100644 --- a/lua/user/lsp/lsp-installer.lua +++ b/lua/user/lsp/lsp-installer.lua @@ -26,6 +26,31 @@ lsp_installer.on_server_ready(function(server) opts = vim.tbl_deep_extend("force", pyright_opts, opts) end + if server.name == "awk_ls" then + local awk_opts = require("user.lsp.settings.awk_ls") + opts = vim.tbl_deep_extend("force", awk_opts, opts) + end + + if server.name == "bashls" then + local bash_opts = require("user.lsp.settings.bashls") + opts = vim.tbl_deep_extend("force", bash_opts, opts) + end + + if server.name == "clangd" then + local clangd_opts = require("user.lsp.settings.clangd") + opts = vim.tbl_deep_extend("force", clangd_opts, opts) + end + + if server.name == "cmake" then + local cmake_opts = require("user.lsp.settings.cmake") + opts = vim.tbl_deep_extend("force", cmake_opts, opts) + end + + if server.name == "html" then + local html_opts = require("user.lsp.settings.html") + opts = vim.tbl_deep_extend("force", html_opts, opts) + end + -- This setup() function is exactly the same as lspconfig's setup function. -- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md server:setup(opts) diff --git a/lua/user/lsp/null-ls.lua b/lua/user/lsp/null-ls.lua index b261418..cb02d76 100644 --- a/lua/user/lsp/null-ls.lua +++ b/lua/user/lsp/null-ls.lua @@ -1,6 +1,4 @@ local null_ls_status_ok, null_ls = pcall(require, "null-ls") -if not null_ls_status_ok then - return -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting local formatting = null_ls.builtins.formatting diff --git a/lua/user/lsp/settings/awk_ls.lua b/lua/user/lsp/settings/awk_ls.lua new file mode 100644 index 0000000..9d4a2da --- /dev/null +++ b/lua/user/lsp/settings/awk_ls.lua @@ -0,0 +1,10 @@ +return { + settings = { + + awk = { + filetypes = { 'awk' }, + single_file_support = true, + } + } +} + diff --git a/lua/user/lsp/settings/bashls.lua b/lua/user/lsp/settings/bashls.lua new file mode 100644 index 0000000..72f8409 --- /dev/null +++ b/lua/user/lsp/settings/bashls.lua @@ -0,0 +1,11 @@ +return { + settings = { + + bash = { + cmd_env = {GLOB_PATTERN = "*@(.sh|.inc|.bash|.command)" }, + filetypes = { 'sh' }, + single_file_support = true, + } + } +} + diff --git a/lua/user/lsp/settings/clangd.lua b/lua/user/lsp/settings/clangd.lua new file mode 100644 index 0000000..55798a1 --- /dev/null +++ b/lua/user/lsp/settings/clangd.lua @@ -0,0 +1,10 @@ +return { + settings = { + + clangd = { + filetypes = { "c","cpp" }, + single_file_support = true, + } + } +} + diff --git a/lua/user/lsp/settings/cmake.lua b/lua/user/lsp/settings/cmake.lua new file mode 100644 index 0000000..c81df8a --- /dev/null +++ b/lua/user/lsp/settings/cmake.lua @@ -0,0 +1,12 @@ +return { + settings = { + + cmake = { + whitelist = {"cmake" }, + initialization_Options = { + buildDirectory = {"build"}, + }, + } + } +} + diff --git a/lua/user/lsp/settings/html.lua b/lua/user/lsp/settings/html.lua new file mode 100644 index 0000000..fb161a9 --- /dev/null +++ b/lua/user/lsp/settings/html.lua @@ -0,0 +1,18 @@ +return { + settings = { + + html = { + filetypes = { 'html' }, + init_options = { + configurationSection = {"html", "css", "javascript" }, + embeddedLanguages = { + css = true, + javascript = true, + }, + provideFormatter = true + }, + single_file_support = true, + } + } +} + diff --git a/lua/user/lua.lua b/lua/user/lua.lua new file mode 100644 index 0000000..c97c178 --- /dev/null +++ b/lua/user/lua.lua @@ -0,0 +1,79 @@ +local fmt = string.format + +-- Iterator that splits a string o a given delimiter +local function split(str, delim) + delim = delim or "%s" + return string.gmatch(str, fmt('[^%s]+', delim)) +end + +-- Find the proper directory separator depending +-- on lua installation or OS. +local function dir_separator() + -- Look at package.config for directory separator string (it's the first line) + if package.config then + return string.match(package.config, '^[^\n]') + elseif vim.fn.has('win32') == 1 then + return '\\' + else + return '/' + end +end + +-- Search for lua traditional include paths. +-- This mimics how require internally works. +local function include_paths(fname, ext) + ext = ext or "lua" + local sep = dir_separator() + local paths = string.gsub(package.path, '%?', fname) + for path in split(paths, "%;") do + if vim.fn.filereadable(path) == 1 then + return path + end + end +end + +-- Search for nvim lua include paths +local function include_rtpaths(fname, ext) + ext = ext or "lua" + local sep = dir_separator() + local rtpaths = vim.api.nvim_list_runtime_paths() + local modfile, initfile = fmt('%s.%s', fname, ext), fmt('init.%s', ext) + for _, path in ipairs(rtpaths) do + -- Look on runtime path for 'lua/*.lua' files + local path1 = table.concat({path, ext, modfile}, sep) + if vim.fn.filereadable(path1) == 1 then + return path1 + end + -- Look on runtime path for 'lua/*/init.lua' files + local path2 = table.concat({path, ext, fname, initfile}, sep) + if vim.fn.filereadable(path2) == 1 then + return path2 + end + end +end + +-- Global function that searches the path for the required file +function find_required_path(module) + -- Look at package.config for directory separator string (it's the first line) + local sep = string.match(package.config, '^[^\n]') + -- Properly change '.' to separator (probably '/' on *nix and '\' on Windows) + local fname = vim.fn.substitute(module, "\\.", sep, "g") + local f + ---- First search for lua modules + f = include_paths(fname, 'lua') + if f then return f end + -- This part is just for nvim modules + f = include_rtpaths(fname, 'lua') + if f then return f end + ---- Now search for Fennel modules + f = include_paths(fname, 'fnl') + if f then return f end + -- This part is just for nvim modules + f = include_rtpaths(fname, 'fnl') + if f then return f end +end + + +-- Set options to open require with gf +vim.opt_local.include = [=[\v<((do|load)file|require)\s*\(?['"]\zs[^'"]+\ze['"]]=] +vim.opt_local.includeexpr = "v:lua.find_required_path(v:fname)"
\ No newline at end of file diff --git a/lua/user/nvim-tree.lua b/lua/user/nvim-tree.lua index c64c5e1..e88a027 100644 --- a/lua/user/nvim-tree.lua +++ b/lua/user/nvim-tree.lua @@ -1,25 +1,5 @@ -- 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 @@ -42,7 +22,6 @@ nvim_tree.setup { "dashboard", "alpha", }, - auto_close = true, open_on_tab = false, hijack_cursor = false, update_cwd = true, @@ -50,6 +29,30 @@ nvim_tree.setup { enable = true, auto_open = true, }, + renderer = { + icons = { + glyphs = { + default = "", + symlink = "", + git = { + unstaged = "", + staged = "S", + unmerged = "", + renamed = "➜", + deleted = "", + untracked = "U", + ignored = "◌", + }, + folder = { + default = "", + open = "", + empty = "", + empty_open = "", + symlink = "", + }, + }, + }, + }, diagnostics = { enable = true, icons = { @@ -94,22 +97,8 @@ nvim_tree.setup { number = false, relativenumber = false, }, -<<<<<<< HEAD trash = { cmd = "trash", require_confirm = true, }, -======= ->>>>>>> vgg - 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/lua/user/options.lua b/lua/user/options.lua index cf23784..52e63ab 100644 --- a/lua/user/options.lua +++ b/lua/user/options.lua @@ -20,7 +20,8 @@ local options = { timeoutlen = 1000, -- time to wait for a mapped sequence to complete (in milliseconds) undofile = true, -- enable persistent undo updatetime = 300, -- faster completion (4000ms default) - writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited + writebackup = false, -- if a file is being edited by another program (or was written to + -- file while editing with another program), it is not allowed to be edited expandtab = true, -- convert tabs to spaces shiftwidth = 2, -- the number of spaces inserted for each indentation tabstop = 2, -- insert 2 spaces for a tab diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index eced55c..7f2cb92 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -46,8 +46,6 @@ return packer.startup(function(use) use "nvim-lua/plenary.nvim" -- Useful lua functions used ny lots of plugins use "windwp/nvim-autopairs" -- Autopairs, integrates with both cmp and treesitter use "numToStr/Comment.nvim" -- Easily comment stuff - use "kyazdani42/nvim-web-devicons" - use "kyazdani42/nvim-tree.lua" use "akinsho/bufferline.nvim" use "moll/vim-bbye" use "nvim-lualine/lualine.nvim" @@ -55,13 +53,19 @@ return packer.startup(function(use) use "ahmedkhalf/project.nvim" use "lewis6991/impatient.nvim" use "lukas-reineke/indent-blankline.nvim" + use 'goolord/alpha-nvim' + use "antoinemadec/FixCursorHold.nvim" -- This is needed to fix lsp doc highlight + use 'kyazdani42/nvim-web-devicons' + use 'kyazdani42/nvim-tree.lua' use "goolord/alpha-nvim" use "antoinemadec/FixCursorHold.nvim" -- This is needed to fix lsp doc highlight use "folke/which-key.nvim" -- Colorschemes - -- use "lunarvim/colorschemes" -- A bunch of colorschemes you can try out + use "lunarvim/colorschemes" -- A bunch of colorschemes you can try out use "lunarvim/darkplus.nvim" + use 'tiagovla/tokyodark.nvim' + -- cmp plugins use "hrsh7th/nvim-cmp" -- The completion plugin diff --git a/lua/user/treesitter.lua b/lua/user/treesitter.lua index db78f70..47ae33a 100644 --- a/lua/user/treesitter.lua +++ b/lua/user/treesitter.lua @@ -14,7 +14,7 @@ local configs = require("nvim-treesitter.configs") configs.setup { - ensure_installed = "maintained", + ensure_installed = {"python","lua","json"}, sync_install = false, ignore_install = { "" }, -- List of parsers to ignore installing autopairs = { |
