diff options
Diffstat (limited to 'lua/user')
-rw-r--r-- | lua/user/alpha.lua | 65 | ||||
-rw-r--r-- | lua/user/bufferline.lua | 136 | ||||
-rw-r--r-- | lua/user/cmp.lua | 6 | ||||
-rw-r--r-- | lua/user/commentstring.lua | 23 | ||||
-rw-r--r-- | lua/user/config.lua | 36 | ||||
-rw-r--r-- | lua/user/impatient.lua | 6 | ||||
-rw-r--r-- | lua/user/keymaps.lua | 21 | ||||
-rw-r--r-- | lua/user/lsp/handlers.lua | 3 | ||||
-rw-r--r-- | lua/user/neoscroll.lua | 31 | ||||
-rw-r--r-- | lua/user/options.lua | 22 | ||||
-rw-r--r-- | lua/user/plugins.lua | 27 | ||||
-rw-r--r-- | lua/user/project.lua | 20 | ||||
-rw-r--r-- | lua/user/session-manager.lua | 9 | ||||
-rw-r--r-- | lua/user/telescope.lua | 13 | ||||
-rw-r--r-- | lua/user/treesitter.lua | 4 |
15 files changed, 379 insertions, 43 deletions
diff --git a/lua/user/alpha.lua b/lua/user/alpha.lua new file mode 100644 index 0000000..d6894c9 --- /dev/null +++ b/lua/user/alpha.lua @@ -0,0 +1,65 @@ +local status_ok, alpha = pcall(require, "alpha") +if not status_ok then + return +end + +local button = require('alpha.themes.dashboard').button + +local header = { + type = "text", + val = { + [[ ____ ___ ]], + [[ /\ _`\ /\_ \ __ ]], + [[ \ \ \L\_\_ __ __ ___ ___ __ \//\ \ __ __ /\_\ ___ ___ ]], + [[ \ \ _\/\`'__\/'__`\ /' __` __`\ /'__`\ \ \ \ _______/\ \/\ \\/\ \ /' __` __`\ ]], + [[ \ \ \/\ \ \//\ \L\.\_/\ \/\ \/\ \/\ \L\.\_ \_\ \_/\______\ \ \_/ |\ \ \/\ \/\ \/\ \ ]], + [[ \ \_\ \ \_\\ \__/.\_\ \_\ \_\ \_\ \__/.\_\/\____\/______/\ \___/ \ \_\ \_\ \_\ \_\]], + [[ \/_/ \/_/ \/__/\/_/\/_/\/_/\/_/\/__/\/_/\/____/ \/__/ \/_/\/_/\/_/\/_/]], + }, + opts = { + position = "center", + hl = "Type", + -- wrap = "overflow"; + }, +} + +local buttons = { + type = "group", + val = { + button("e", " New file", "<cmd>ene <CR>"), + button("SPC f", " Find file"), + button("SPC h", " Recently opened files"), + button("SPC g", " Find word"), + button("SPC s l", " Open last session"), + }, + opts = { + spacing = 1, + }, +} + +local footer = { + type = "text", + val = "framal.xyz", + opts = { + position = "center", + hl = "Number", + }, +} + + +local config = { + layout = { + { type = "padding", val = 2 }, + header, + { type = "padding", val = 2 }, + buttons, + footer, + }, + opts = { + margin = 5, + }, +} + +alpha.setup ( + config +) diff --git a/lua/user/bufferline.lua b/lua/user/bufferline.lua new file mode 100644 index 0000000..65f037c --- /dev/null +++ b/lua/user/bufferline.lua @@ -0,0 +1,136 @@ +local status_ok, bufferline = pcall(require, "bufferline") +if not status_ok then + return +end + +bufferline.setup { + options = { + -- mode = "buffers", + numbers = "none", + close_command = "Bdelete! %d", + left_mouse_command = "buffer %d", + indicator_icon = "▎", + buffer_close_icon = "", + -- buffer_close_icon = '', + modified_icon = "●", + close_icon = "", + -- close_icon = '', + left_trunc_marker = "", + right_trunc_marker = "", + + max_name_length = 30, + max_prefix_length = 30, -- prefix used when a buffer is de-duplicated + tab_size = 25, + diagnostics = "nvim_lsp", + diagnostics_update_in_insert = false, + offsets = { + { + filetype = "nerdtree", + text = "Files", + highlight = "Directory", + text_align = "center" + } + }, + show_buffer_items = true, + show_buffer_close_icons = false, + show_close_icon = false, -- wtf, why use mouse??? + show_tab_indicators = true, + persist_buffer_sort = true, + separator_style = "thin", + 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" }, + -- }, + -- }, +} diff --git a/lua/user/cmp.lua b/lua/user/cmp.lua index 960eb13..b52f421 100644 --- a/lua/user/cmp.lua +++ b/lua/user/cmp.lua @@ -113,8 +113,10 @@ cmp.setup({ behavior = cmp.ConfirmBehavior.Replace, select = false, }, - documentation = { - border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, + window = { + documentation = { + border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, + }, }, experimental = { -- ghost_text = true, diff --git a/lua/user/commentstring.lua b/lua/user/commentstring.lua new file mode 100644 index 0000000..fa1ebc8 --- /dev/null +++ b/lua/user/commentstring.lua @@ -0,0 +1,23 @@ +local status_ok, commentstring = pcall(require, "Comment") +if not status_ok then + return +end + +commentstring.setup { + pre_hook = function(ctx) + local U = require "Comment.utils" + + local location = nil + if ctx.ctype == U.ctype.block then + location = require("ts_context_commentstring.utils").get_cursor_location() + elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then + location = require("ts_context_commentstring.utils").get_visual_start_location() + end + + return require("ts_context_commentstring.internal").calculate_commentstring { + key = ctx.ctype == U.ctype.line and "__default" or "__multiline", + location = location, + } + end, +} + diff --git a/lua/user/config.lua b/lua/user/config.lua index 4f6b233..3d7ef8f 100644 --- a/lua/user/config.lua +++ b/lua/user/config.lua @@ -1,26 +1,14 @@ -vim.cmd [[colorscheme gruvbox]] +-- vim.cmd [[let $NVIM_TUI_ENABLE_TRUE_COLOR=1]] +-- vim.cmd [[let g:gruvbox_italic=1]] --- local Plug = require 'vimplug' +vim.opt.termguicolors = true +vim.o.background = "dark" -- or "light" for light mode +vim.cmd([[colorscheme gruvbox]]) --- Plug.begin('~/.config/share/nvim/plugged') --- --- Plug 'https://github.com/vim-airline/vim-airline' --- Plug 'https://github.com/rafi/awesome-vim-colorschemes' --- Plug 'https://github.com/preservim/nerdtree' --- Plug 'https://github.com/neovim/nvim-lspconfig' --- Plug 'https://github.com/williamboman/nvim-lsp-installer' --- Plug 'https://github.com/hrsh7th/nvim-cmp' --- Plug 'https://github.com/hrsh7th/cmp-nvim-lsp' --- Plug 'https://github.com/hrsh7th/cmp-buffer' --- Plug 'https://github.com/hrsh7th/cmp-path' --- Plug 'https://github.com/hrsh7th/cmp-cmdline' --- Plug 'https://github.com/hrsh7th/nvim-cmp' --- Plug 'https://github.com/L3MON4D3/LuaSnip' --- Plug 'https://github.com/rafamadriz/friendly-snippets' --- Plug 'https://github.com/saadparwaiz1/cmp_luasnip' --- Plug 'https://github.com/nvim-lua/popup.nvim' --- Plug 'https://github.com/nvim-lua/plenary.nvim' --- --- Plug.ends() --- --- vim.cmd [[colorscheme gruvbox]] +vim.cmd [[autocmd BufWinLeave *.* mkview]] +vim.cmd [[autocmd BufWinLeave *.* silent loadview]] +vim.cmd [[autocmd VimEnter *.* AlphaReady]] + +vim.cmd [[highlight Normal ctermbg=none]] +vim.cmd [[highlight NonText ctermbg=none]] +vim.cmd [[highlight clear SignColumn]] diff --git a/lua/user/impatient.lua b/lua/user/impatient.lua new file mode 100644 index 0000000..84419e0 --- /dev/null +++ b/lua/user/impatient.lua @@ -0,0 +1,6 @@ +local status_ok, impatient = pcall(require, "impatient") +if not status_ok then + return +end + +impatient.enable_profile() diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index 3c5fc5b..3c9df9c 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -1,6 +1,6 @@ local opts = { noremap = true, silent = true } -local term_opts = { silent = true } +-- local term_opts = { silent = true } local keymap = vim.api.nvim_set_keymap @@ -10,22 +10,20 @@ keymap("n", "<C-j>", "<C-w>j", opts) keymap("n", "<C-k>", "<C-w>k", opts) keymap("n", "<C-l>", "<C-w>l", opts) - -- Remap space as leader key keymap("n", "<Space>", "<Nop>", opts) vim.g.mapleader = " " vim.g.maplocalleader = " " - -- NERDTree keybindings keymap("n", "<C-n>", ":NERDTree<CR>", opts) keymap("n", "<C-t>", ":NERDTreeToggle<CR>", opts) -- Resizing windows (like i3) -keymap("n", "<C-Up>", ":resize -2<CR>", opts) -keymap("n", "<C-Down>", ":resize +2<CR>", opts) -keymap("n", "<C-Left>", ":vertical resize -2<CR>", opts) -keymap("n", "<C-Right>", ":vertical resize +2<CR>", opts) +keymap("n", "<C-S-Up>", ":resize -2<CR>", opts) +keymap("n", "<C-S-Down>", ":resize +2<CR>", opts) +keymap("n", "<C-S-Left>", ":vertical resize -2<CR>", opts) +keymap("n", "<C-S-Right>", ":vertical resize +2<CR>", opts) -- Moving between buffers keymap("n", "<S-l>", ":bnext<CR>", opts) @@ -47,4 +45,11 @@ keymap("v", "p", '"_dP', opts) -- Telescope -- keymap("n", "<leader>f", "<cmd>lua require 'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({previewer = false}))<CR>", opts) keymap("n", "<leader>f", "<cmd>Telescope find_files<CR>", opts) --- keymap("n", "<C-t>", "<cmd>Telescope live_grep<CR>", opts) +keymap("n", "<leader>g", "<cmd>Telescope live_grep<CR>", opts) +keymap("n", "<leader>m", "<cmd>Telescope media_files<CR>", opts) +keymap("n", "<leader>r", "<cmd>Telescope lsp_references<CR>", opts) +keymap("n", "<leader>h", "<cmd>Telescope oldfiles<CR>", opts) + +-- Session Manager +keymap("n", "<leader>sl", "<cmd>SessionManager load_last_session<CR>", opts) +keymap("n", "<leader>ss", "<cmd>SessionManager save_current_session<CR>", opts) diff --git a/lua/user/lsp/handlers.lua b/lua/user/lsp/handlers.lua index f5ab1ed..6cb5f7c 100644 --- a/lua/user/lsp/handlers.lua +++ b/lua/user/lsp/handlers.lua @@ -46,8 +46,7 @@ local function lsp_keymaps(bufnr) set_keymap("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts) set_keymap("n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts) set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts) - set_keymap("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts) - set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts) + set_keymap("n", "<C-S-K>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts) set_keymap("n", "[d", '<cmd>lua vim.diagnostic.goto_prev({border = "rounded"})<CR>', opts) set_keymap("n", "gl", '<cmd>lua vim.diagnostic.open_float({border = "rounded"})<CR>', opts) set_keymap("n", "]d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts) diff --git a/lua/user/neoscroll.lua b/lua/user/neoscroll.lua new file mode 100644 index 0000000..9ff4038 --- /dev/null +++ b/lua/user/neoscroll.lua @@ -0,0 +1,31 @@ +local status_ok, neoscroll = pcall(require, 'neoscroll') +if not status_ok then + return +end + +neoscroll.setup({ + easing_function = "quadratic" +}) + +local status_ok, config = pcall(require, 'neoscroll.config') +if not status_ok then + return +end + +local t = {} +-- Syntax: t[keys] = {function, {function arguments}} +-- Use the "sine" easing function +t['<C-u>'] = {'scroll', {'-vim.wo.scroll', 'true', '350', [['sine']]}} +t['<C-d>'] = {'scroll', { 'vim.wo.scroll', 'true', '350', [['sine']]}} +-- Use the "circular" easing function +t['<C-b>'] = {'scroll', {'-vim.api.nvim_win_get_height(0)', 'true', '500', [['circular']]}} +t['<C-f>'] = {'scroll', { 'vim.api.nvim_win_get_height(0)', 'true', '500', [['circular']]}} +-- Pass "nil" to disable the easing animation (constant scrolling speed) +t['<C-y>'] = {'scroll', {'-0.10', 'false', '100', nil}} +t['<C-e>'] = {'scroll', { '0.10', 'false', '100', nil}} +-- When no easing function is provided the default easing function (in this case "quadratic") will be used +t['zt'] = {'zt', {'300'}} +t['zz'] = {'zz', {'300'}} +t['zb'] = {'zb', {'300'}} + +config.set_mappings() diff --git a/lua/user/options.lua b/lua/user/options.lua index 293aa31..2b2b4f7 100644 --- a/lua/user/options.lua +++ b/lua/user/options.lua @@ -4,11 +4,25 @@ local options = { shiftwidth = 2, scrolloff = 5, number = true, - relativenumber = true, + relativenumber = true, wrap = false, cursorline = true, numberwidth = 4, undofile = true, + colorcolumn = { 80 }, + encoding = "UTF-8", + signcolumn = "yes", + updatetime = 300, + splitright = true, + splitbelow = true, + smartcase = true, + mouse = "a", + fileencoding = "utf-8", +} + +local gopts = { + NERDTreeDirArrowCollapsible = "", + NERDTreeDirArrowExpandable = "", } @@ -16,4 +30,8 @@ for k, v in pairs(options) do vim.opt[k] = v end -vim.cmd [[set matchpairs+=<:>]] +for k, v in pairs(gopts) do + vim.g[k] = v +end + +vim.cmd [[set matchpairs+=<:>]] diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index f07da22..9b26c51 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -41,8 +41,12 @@ return packer.startup(function(use) use "nvim-lua/plenary.nvim" use "vim-airline/vim-airline" - use "rafi/awesome-vim-colorschemes" + use "vim-airline/vim-airline-themes" + -- use "itchyny/lightline.vim" use "preservim/nerdtree" + use "tiagofumo/vim-nerdtree-syntax-highlight" + use "kyazdani42/nvim-web-devicons" + use "ryanoasis/vim-devicons" use 'hrsh7th/nvim-cmp' use 'hrsh7th/cmp-nvim-lsp' @@ -60,11 +64,32 @@ return packer.startup(function(use) use 'nvim-telescope/telescope.nvim' use 'nvim-telescope/telescope-media-files.nvim' + use "nvim-telescope/telescope-ui-select.nvim" use { 'nvim-treesitter/nvim-treesitter', run = ":TSUpdate", } + + use 'cxw42/editorconfig-vim' + use 'morhetz/gruvbox' + -- use "ellisonleao/gruvbox.nvim" + + use 'rhlobo/vim-super-retab' + use "ahmedkhalf/project.nvim" + + use 'lewis6991/impatient.nvim' + use 'karb94/neoscroll.nvim' + + use 'JoosepAlviste/nvim-ts-context-commentstring' + use "numToStr/Comment.nvim" + + use "moll/vim-bbye" + use "akinsho/bufferline.nvim" + + use "goolord/alpha-nvim" + use "Shatur/neovim-session-manager" + if PACKER_BOOTSTRAP then require("packer").sync() end diff --git a/lua/user/project.lua b/lua/user/project.lua new file mode 100644 index 0000000..efb60b2 --- /dev/null +++ b/lua/user/project.lua @@ -0,0 +1,20 @@ +local status_ok, project = pcall(require, "project_nvim") +if not status_ok then + return +end + +project.setup({ + detection_methods= { 'pattern' }, + patterns = { '.git' }, + show_hidden = false, + silent_chdir = true, + manual_mode = false, + datapath = vim.fn.stdpath("data"), +}) + +local status_ok, telescope = pcall(require, "telescope") +if not status_ok then + return +end + +telescope.load_extension('projects') diff --git a/lua/user/session-manager.lua b/lua/user/session-manager.lua new file mode 100644 index 0000000..7d615e4 --- /dev/null +++ b/lua/user/session-manager.lua @@ -0,0 +1,9 @@ +local status_ok, session_manager = pcall(require, "session_manager") +if not status_ok then + return +end + +local Path = require('plenary.path') +session_manager.setup({ + sessions_dir = Path:new(vim.fn.stdpath('data'), '.sessions'), +}) diff --git a/lua/user/telescope.lua b/lua/user/telescope.lua index d27069b..d2c449a 100644 --- a/lua/user/telescope.lua +++ b/lua/user/telescope.lua @@ -4,18 +4,23 @@ if not status_ok then return end - telescope.load_extension('media_files') +telescope.load_extension('ui-select') local actions = require "telescope.actions" telescope.setup { defaults = { - prompt_prefix = " ", + prompt_prefix = " ", selection_caret = " ", - path_display = { "smart" }, - mappings = { + extensions = { + ["ui-select"] = { + require("telescope.themes").get_dropdown {} + } + }, + + mappings = { i = { ["<C-n>"] = actions.cycle_history_next, ["<C-p>"] = actions.cycle_history_prev, diff --git a/lua/user/treesitter.lua b/lua/user/treesitter.lua index 4935b8f..62a1197 100644 --- a/lua/user/treesitter.lua +++ b/lua/user/treesitter.lua @@ -13,4 +13,8 @@ configs.setup { additional_vim_regex_highlighting = true, }, indent = { enable = true, disable = { "yaml" } }, + context_commentstring = { + enable = true, + enable_autocmd = false, + } } |