summaryrefslogtreecommitdiffstats
path: root/.config/nvim/after
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/after')
-rw-r--r--.config/nvim/after/plugin/asyncomplete.lua13
-rw-r--r--.config/nvim/after/plugin/floaterm.lua9
-rw-r--r--.config/nvim/after/plugin/lualine.lua349
-rw-r--r--.config/nvim/after/plugin/nerd-commenter.lua14
-rw-r--r--.config/nvim/after/plugin/org.lua4
-rw-r--r--.config/nvim/after/plugin/quickscope.lua7
-rw-r--r--.config/nvim/after/plugin/rainbow.lua23
-rw-r--r--.config/nvim/after/plugin/signify.lua1
-rw-r--r--.config/nvim/after/plugin/startify.lua29
-rw-r--r--.config/nvim/after/plugin/treesitter.lua34
-rw-r--r--.config/nvim/after/plugin/whichkey.lua56
11 files changed, 539 insertions, 0 deletions
diff --git a/.config/nvim/after/plugin/asyncomplete.lua b/.config/nvim/after/plugin/asyncomplete.lua
new file mode 100644
index 0000000..da28c37
--- /dev/null
+++ b/.config/nvim/after/plugin/asyncomplete.lua
@@ -0,0 +1,13 @@
+vim.cmd [[
+autocmd User asyncomplete_setup call asyncomplete#register_source(
+ \ asyncomplete#sources#clang#get_source_options({
+ \ 'config': {
+ \ 'clang_path': '/usr/bin/cc',
+ \ 'clang_args': {
+ \ 'default': ['-I/usr/include'],
+ \ 'c': ['-std=c89', '-I/usr/include'],
+ \ 'cpp': ['-std=c++98', '-I/usr/include']
+ \ }
+ \ }
+ \ }))
+]]
diff --git a/.config/nvim/after/plugin/floaterm.lua b/.config/nvim/after/plugin/floaterm.lua
new file mode 100644
index 0000000..7f80d65
--- /dev/null
+++ b/.config/nvim/after/plugin/floaterm.lua
@@ -0,0 +1,9 @@
+vim.g.floaterm_autoinsert = 1
+vim.g.floaterm_width = 0.6
+vim.g.floaterm_height = 0.45
+vim.g.floaterm_wintitle = 0
+vim.g.floaterm_autoclose = 1
+vim.g.floaterm_position = 'bottom'
+vim.g.floaterm_gitcommit = 'split'
+vim.g.floaterm_wintype = 'floating'
+vim.g.floaterm_rootmarkers = { '.project', '.git', '.hg', '.svn', '.root', '.gitignore', '.fslckout', '.fossil-settings' }
diff --git a/.config/nvim/after/plugin/lualine.lua b/.config/nvim/after/plugin/lualine.lua
new file mode 100644
index 0000000..f3d2fe7
--- /dev/null
+++ b/.config/nvim/after/plugin/lualine.lua
@@ -0,0 +1,349 @@
+-- Eviline config for lualine
+-- Author: shadmansaleh
+-- Credit: glepnir
+local lualine = require('lualine')
+
+-- Color table for highlights
+-- stylua: ignore
+local colors = {
+ bg = '#202328',
+ fg = '#bbc2cf',
+ yellow = '#ECBE7B',
+ cyan = '#008080',
+ darkblue = '#081633',
+ green = '#98be65',
+ orange = '#FF8800',
+ violet = '#a9a1e1',
+ magenta = '#c678dd',
+ blue = '#51afef',
+ red = '#ec5f67',
+}
+
+local conditions = {
+ buffer_not_empty = function()
+ return vim.fn.empty(vim.fn.expand('%:t')) ~= 1
+ end,
+ hide_in_width = function()
+ return vim.fn.winwidth(0) > 80
+ end,
+ check_git_workspace = function()
+ local filepath = vim.fn.expand('%:p:h')
+ local gitdir = vim.fn.finddir('.git', filepath .. ';')
+ return gitdir and #gitdir > 0 and #gitdir < #filepath
+ end,
+}
+
+-- Config
+local config = {
+ options = {
+ -- Disable sections and component separators
+ component_separators = '',
+ section_separators = '',
+ theme = {
+ -- We are going to use lualine_c an lualine_x as left and
+ -- right section. Both are highlighted by c theme . So we
+ -- are just setting default looks o statusline
+ normal = { c = { fg = colors.fg, bg = colors.bg } },
+ inactive = { c = { fg = colors.fg, bg = colors.bg } },
+ },
+ },
+ sections = {
+ -- these are to remove the defaults
+ lualine_a = {},
+ lualine_b = {},
+ lualine_y = {},
+ lualine_z = {},
+ -- These will be filled later
+ lualine_c = {},
+ lualine_x = {},
+ },
+ inactive_sections = {
+ -- these are to remove the defaults
+ lualine_a = {},
+ lualine_b = {},
+ lualine_y = {},
+ lualine_z = {},
+ lualine_c = {},
+ lualine_x = {},
+ },
+}
+
+-- Inserts a component in lualine_c at left section
+local function ins_left(component)
+ table.insert(config.sections.lualine_c, component)
+end
+
+-- Inserts a component in lualine_x at right section
+local function ins_right(component)
+ table.insert(config.sections.lualine_x, component)
+end
+
+ins_left {
+ function()
+ return '▊'
+ end,
+ -- color = { fg = colors.green }, -- Sets highlighting of component
+ color = function()
+ -- auto change color according to neovims mode
+ local mode_color = {
+ n = colors.green,
+ i = colors.blue,
+ v = colors.magenta,
+ [''] = colors.magenta,
+ V = colors.magenta,
+ c = colors.yellow,
+ no = colors.red,
+ s = colors.orange,
+ S = colors.orange,
+ [''] = colors.orange,
+ ic = colors.yellow,
+ R = colors.red,
+ Rv = colors.violet,
+ cv = colors.red,
+ ce = colors.red,
+ r = colors.cyan,
+ rm = colors.cyan,
+ ['r?'] = colors.cyan,
+ ['!'] = colors.red,
+ t = colors.red,
+ }
+ return { fg = mode_color[vim.fn.mode()] }
+ end,
+ padding = { left = 0, right = 1 }, -- We don't need space before this
+}
+
+ins_left {
+ -- mode component
+ function()
+ return ''
+ end,
+ color = function()
+ -- auto change color according to neovims mode
+ local mode_color = {
+ n = colors.green,
+ i = colors.blue,
+ v = colors.magenta,
+ [''] = colors.magenta,
+ V = colors.magenta,
+ c = colors.yellow,
+ no = colors.red,
+ s = colors.orange,
+ S = colors.orange,
+ [''] = colors.orange,
+ ic = colors.yellow,
+ R = colors.red,
+ Rv = colors.violet,
+ cv = colors.red,
+ ce = colors.red,
+ r = colors.cyan,
+ rm = colors.cyan,
+ ['r?'] = colors.cyan,
+ ['!'] = colors.red,
+ t = colors.red,
+ }
+ return { fg = mode_color[vim.fn.mode()] }
+ end,
+ padding = { right = 1 },
+}
+
+-- ins_left {
+-- 'filename',
+-- cond = conditions.buffer_not_empty,
+-- color = { fg = colors.magenta, gui = 'bold' },
+-- }
+
+ins_left {
+ 'buffers',
+ show_filename_only = false,
+ hide_filename_extension = false,
+ show_modified_status = true,
+ icons_enabled = true,
+ symbols = {
+ modified = ' ●', -- Text to show when the buffer is modified
+ alternate_file = '', -- Text to show to identify the alternate file
+ directory = '', -- Text to show when the buffer is a directory
+ },
+ buffers_color = {
+ -- Same values as the general color option can be used here.
+ active = function()
+ -- auto change color according to neovims mode
+ local mode_color = {
+ n = colors.green,
+ i = colors.blue,
+ v = colors.magenta,
+ [''] = colors.magenta,
+ V = colors.magenta,
+ c = colors.yellow,
+ no = colors.red,
+ s = colors.orange,
+ S = colors.orange,
+ [''] = colors.orange,
+ ic = colors.yellow,
+ R = colors.red,
+ Rv = colors.violet,
+ cv = colors.red,
+ ce = colors.red,
+ r = colors.cyan,
+ rm = colors.cyan,
+ ['r?'] = colors.cyan,
+ ['!'] = colors.red,
+ t = colors.red,
+ }
+ return { fg = mode_color[vim.fn.mode()], gui = 'bold' }
+ end,
+ },
+}
+
+ins_left {
+ 'diagnostics',
+ sources = { 'nvim_diagnostic' },
+ symbols = { error = ' ', warn = ' ', info = ' ' },
+ diagnostics_color = {
+ color_error = { fg = colors.red },
+ color_warn = { fg = colors.yellow },
+ color_info = { fg = colors.cyan },
+ },
+}
+
+-- Insert mid section. You can make any number of sections in neovim :)
+-- for lualine it's any number greater then 2
+-- ins_left {
+-- function()
+-- return '%='
+-- end,
+-- }
+
+ins_right {
+ 'filetype',
+ icons_enabled = true, -- I think icons are cool but Eviline doesn't have them. sigh
+ color = { fg = colors.blue },
+}
+
+ins_right {
+ -- Lsp server name .
+ function()
+ local msg = 'no lsp'
+ local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
+ local clients = vim.lsp.get_active_clients()
+ if next(clients) == nil then
+ -- icon = ''
+ return
+ end
+ for _, client in ipairs(clients) do
+ local filetypes = client.config.filetypes
+ if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
+ return client.name
+ end
+ end
+ return msg
+ end,
+ icon = ' ',
+ color = { fg = colors.cyan },
+}
+
+ins_right {
+ 'branch',
+ icon = '',
+ color = { fg = colors.violet, gui = 'bold' },
+}
+
+ins_right {
+ -- filesize component
+ 'filesize',
+ cond = conditions.buffer_not_empty,
+}
+
+ins_right {
+ 'diff',
+ -- Is it me or the symbol for modified us really weird
+ symbols = { added = ' ', modified = '󰝤 ', removed = ' ' },
+ diff_color = {
+ added = { fg = colors.green },
+ modified = { fg = colors.orange },
+ removed = { fg = colors.red },
+ },
+ cond = conditions.hide_in_width,
+}
+
+ins_right { 'location' }
+
+ins_right {
+ function()
+ return '▊'
+ end,
+ -- color = { fg = colors.green },
+ color = function()
+ -- auto change color according to neovims mode
+ local mode_color = {
+ n = colors.green,
+ i = colors.blue,
+ v = colors.magenta,
+ [''] = colors.magenta,
+ V = colors.magenta,
+ c = colors.yellow,
+ no = colors.red,
+ s = colors.orange,
+ S = colors.orange,
+ [''] = colors.orange,
+ ic = colors.yellow,
+ R = colors.red,
+ Rv = colors.violet,
+ cv = colors.red,
+ ce = colors.red,
+ r = colors.cyan,
+ rm = colors.cyan,
+ ['r?'] = colors.cyan,
+ ['!'] = colors.red,
+ t = colors.red,
+ }
+ return { fg = mode_color[vim.fn.mode()] }
+ end,
+ padding = { left = 1 },
+}
+
+-- Now don't forget to initialize lualine
+lualine.setup(config)
+
+
+
+
+-- require('lualine').setup {
+-- options = {
+-- icons_enabled = true,
+-- theme = 'gruvbox',
+-- section_separators = { left = '', right = '' },
+-- component_separators = { left = '', right = '' },
+-- disabled_filetypes = {
+-- statusline = {},
+-- winbar = {},
+-- },
+-- ignore_focus = {},
+-- always_divide_middle = true,
+-- globalstatus = false,
+-- refresh = {
+-- statusline = 1000,
+-- tabline = 1000,
+-- winbar = 1000,
+-- }
+-- },
+-- sections = {
+-- lualine_a = { 'mode' },
+-- lualine_b = { 'branch', 'diff', 'diagnostics' },
+-- lualine_c = { 'filename' },
+-- lualine_x = { 'buffers' },
+-- lualine_y = { 'filetype' },
+-- lualine_z = { 'location' }
+-- },
+-- inactive_sections = {
+-- lualine_a = {},
+-- lualine_b = {},
+-- lualine_c = { 'filename' },
+-- lualine_x = {},
+-- lualine_y = {},
+-- lualine_z = {}
+-- },
+-- tabline = {},
+-- winbar = {},
+-- inactive_winbar = {},
+-- extensions = {},
+-- }
diff --git a/.config/nvim/after/plugin/nerd-commenter.lua b/.config/nvim/after/plugin/nerd-commenter.lua
new file mode 100644
index 0000000..ddfadf2
--- /dev/null
+++ b/.config/nvim/after/plugin/nerd-commenter.lua
@@ -0,0 +1,14 @@
+-- NERD Commenter
+vim.g.NERDSpaceDelims = 1
+vim.g.NERDCompactSexyComs = 1
+vim.g.NERDDefaultAlign = 'left'
+vim.g.NERDAltDelims_java = 1
+vim.g.NERDCustomDelimiters = {
+ c = {
+ left = '/*',
+ right = '*/',
+ }
+}
+vim.g.NERDCommentEmptyLines = 1
+vim.g.NERDTrimTrailingWhitespace = 1
+vim.g.NERDToggleCheckAllLines = 1
diff --git a/.config/nvim/after/plugin/org.lua b/.config/nvim/after/plugin/org.lua
new file mode 100644
index 0000000..662ad08
--- /dev/null
+++ b/.config/nvim/after/plugin/org.lua
@@ -0,0 +1,4 @@
+-- Org-mode
+vim.g.org_todo_keywords = { 'TODO', '|', 'DONE', 'CANCELED' }
+vim.g.org_export_emacs = "/usr/bin/emacs"
+
diff --git a/.config/nvim/after/plugin/quickscope.lua b/.config/nvim/after/plugin/quickscope.lua
new file mode 100644
index 0000000..9fa10fe
--- /dev/null
+++ b/.config/nvim/after/plugin/quickscope.lua
@@ -0,0 +1,7 @@
+-- Quickscope
+vim.g.qs_highlight_on_keys = { 'f', 'F', 't', 'T' }
+vim.g.qs_max_chars=150
+vim.cmd [[
+highlight QuickScopePrimary guifg='#00C7DF' gui=underline ctermfg=155 cterm=underline
+highlight QuickScopeSecondary guifg='#afff5f' gui=underline ctermfg=81 cterm=underline
+]]
diff --git a/.config/nvim/after/plugin/rainbow.lua b/.config/nvim/after/plugin/rainbow.lua
new file mode 100644
index 0000000..e0951b8
--- /dev/null
+++ b/.config/nvim/after/plugin/rainbow.lua
@@ -0,0 +1,23 @@
+-- Rainbow
+-- This module contains a number of default definitions
+local rainbow_delimiters = require 'rainbow-delimiters'
+
+vim.g.rainbow_delimiters = {
+ strategy = {
+ [''] = rainbow_delimiters.strategy['global'],
+ vim = rainbow_delimiters.strategy['local'],
+ },
+ query = {
+ [''] = 'rainbow-delimiters',
+ lua = 'rainbow-blocks',
+ },
+ highlight = {
+ 'RainbowDelimiterOrange',
+ 'RainbowDelimiterRed',
+ 'RainbowDelimiterYellow',
+ 'RainbowDelimiterBlue',
+ 'RainbowDelimiterGreen',
+ 'RainbowDelimiterViolet',
+ 'RainbowDelimiterCyan',
+ },
+}
diff --git a/.config/nvim/after/plugin/signify.lua b/.config/nvim/after/plugin/signify.lua
new file mode 100644
index 0000000..a0a0a1d
--- /dev/null
+++ b/.config/nvim/after/plugin/signify.lua
@@ -0,0 +1 @@
+vim.g.signify_priority = 9
diff --git a/.config/nvim/after/plugin/startify.lua b/.config/nvim/after/plugin/startify.lua
new file mode 100644
index 0000000..a5d3efc
--- /dev/null
+++ b/.config/nvim/after/plugin/startify.lua
@@ -0,0 +1,29 @@
+-- Startify
+vim.cmd [[
+let g:startify_custom_header = startify#pad([
+\ '==========================',
+\ '====== ================',
+\ '======= =================',
+\ '======= =================',
+\ '======= ==== ==== ===',
+\ '======= === == = ==',
+\ '======= === = == ==',
+\ '== === === = == =====',
+\ '== === === = == = ==',
+\ '=== ===== ==== ===',
+\ '==========================',
+\ ])
+let g:startify_lists = [
+ \ { 'type': 'sessions', 'header': startify#pad(['Sessions']) },
+ \ { 'type': 'files', 'header': startify#pad(['Recent']) },
+ \ { 'type': 'bookmarks', 'header': startify#pad(['Bookmarks']) },
+ \ { 'type': 'commands', 'header': startify#pad(['Commands']) },
+ \ ]
+]]
+vim.g.startify_bookmarks = {
+ { env = '~/.config/env' },
+ { v = '~/.config/nvim/init.vim' },
+ { zc = '~/.config/zsh/.zshrc' },
+ { za = '~/.config/zsh/alias.zsh' },
+ { gj = '~/dev/go/gojosh' },
+}
diff --git a/.config/nvim/after/plugin/treesitter.lua b/.config/nvim/after/plugin/treesitter.lua
new file mode 100644
index 0000000..62b960b
--- /dev/null
+++ b/.config/nvim/after/plugin/treesitter.lua
@@ -0,0 +1,34 @@
+require'nvim-treesitter.configs'.setup {
+ -- A list of parser names, or "all" (the five listed parsers should always be installed)
+ ensure_installed = { "c", "cpp", "lua", "vim", "vimdoc", "query", "go" },
+
+ -- Install parsers synchronously (only applied to `ensure_installed`)
+ sync_install = false,
+
+ -- Automatically install missing parsers when entering buffer
+ -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
+ auto_install = true,
+
+ highlight = {
+ enable = true,
+
+ -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
+ -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
+ -- the name of the parser)
+ -- list of language that will be disabled
+ -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
+ disable = function(lang, buf)
+ local max_filesize = 100 * 1024 -- 100 KB
+ local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
+ if ok and stats and stats.size > max_filesize then
+ return true
+ end
+ end,
+
+ -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
+ -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
+ -- Using this option may slow down your editor, and you may see some duplicate highlights.
+ -- Instead of true it can also be a list of languages
+ additional_vim_regex_highlighting = false,
+ },
+}
diff --git a/.config/nvim/after/plugin/whichkey.lua b/.config/nvim/after/plugin/whichkey.lua
new file mode 100644
index 0000000..71274e1
--- /dev/null
+++ b/.config/nvim/after/plugin/whichkey.lua
@@ -0,0 +1,56 @@
+
+local ts = require('telescope.builtin')
+local wk = require('which-key')
+wk.register({
+ b = { ':Buffers<CR>', 'buffers', noremap = true, silent = true },
+ c = { name = '+nerd-commenter' },
+ d = { ':bd<CR>', 'close buffer', noremap = true, silent = false },
+ e = { ':Telescope find_files<CR>', 'find files', noremap = true, silent = true },
+ G = { ':FloatermNew lazygit<CR>', 'lazygit', noremap = true, silent = true },
+ h = { ':Startify<CR>', 'startify', noremap = true, silent = true },
+ k = { ':w<CR>:bp<CR>:bd #<CR>', 'write and close buffer', noremap = true, silent = false },
+ p = { ':<C-u>CocList -A --normal yank<CR>', 'CoC paste', noremap = true, silent = true },
+ u = { ':UndotreeShow<CR>', 'undotree', noremap = true, silent = true },
+ v = { ':FloatermNew vifm<CR>', 'vifm', noremap = true, silent = true },
+ w = { ':w<CR>', 'write buffer', noremap = true, silent = false },
+ x = { ':w<CR>:bp<CR>:bd #<CR>', 'write and close buffer', noremap = true, silent = false },
+ q = { name = '+coc-fix-current' },
+ r = { name = '+coc-rename' },
+ f = {
+ name = 'telescope',
+ -- f = { ':Telescope find_files<CR>', 'find files', noremap = true, silent = true },
+ f = { ts.find_files, 'find files', noremap = true, silent = true },
+ g = { ts.git_files, 'git files', noremap = true, silent = true },
+ s = { function()
+ ts.grep_string({ search = vim.fn.input("Grep > ") })
+ end, 'grep string', noremap = true, silent = true },
+ },
+ g = {
+ name = 'grep',
+ a = { ':Ag<CR>', 'the_silver_searcher', noremap = true, silent = true },
+ g = { ':Grep<CR>', 'grep', noremap = true, silent = true },
+ r = { ':Rg<CR>', 'ripgrep', noremap = true, silent = true },
+ },
+ v = {
+ name = 'nvim',
+ v = { vim.cmd.Ex, 'explorer', noremap = true, silent = true },
+ u = { ':PlugUpgrade<CR>:PlugUpdate<CR>', 'upgrade', noremap = true, silent = true },
+ },
+}, { prefix = '<leader>', })
+wk.setup({
+ plugins = {
+ presets = {
+ operators = false,
+ motions = false,
+ text_objects = false,
+ window = false,
+ nav = false,
+ z = false,
+ g = false
+ },
+ },
+ triggers = { "<leader>" },
+ triggers_nowait = { "d" },
+})
+
+vim.keymap.set('n', '<C-p>', ts.git_files)