move stuff to common and half figured out the install script

This commit is contained in:
Benjamin Kyd
2023-02-02 00:34:50 +00:00
parent 3e508fb613
commit 27a774acfe
78 changed files with 80 additions and 938 deletions

View File

@@ -0,0 +1,100 @@
-- ================= Holy leader key ================= --
vim.g.mapleader = ','
-- ================= File management ================= --
-- swapfile has global & local config, eventhough help says otherwise
vim.o.swapfile = false -- can open already open files
vim.bo.swapfile = false
vim.o.backup = false
vim.o.writebackup = false
vim.o.autoread = true -- auto file change detection
-- autocmds are currently not supported by nvim (0.5 nighlty)
vim.api.nvim_command([[
" Triger `autoread` when files changes on disk
autocmd FocusGained,BufEnter,CursorHold,CursorHoldI * if mode() != 'c' | checktime | endif
" Notification after file change
autocmd FileChangedShellPost *
\ echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None
]])
-- ================= Scrolling ================= --
vim.o.scrolloff = 8 -- start scrolling when 8 lines away from margins
-- ================= Indentation ================= --
-- pay attention to 'vim.bo' (buffer local options) and 'vim.o' (global options)
-- see :help options.txt
-- for some reason these values need to be set in both o and bo objects
-- eventhough these options are supposed to be local to buffer
vim.o.tabstop = 4 -- maximum width of tab character (measured in spaces)
vim.bo.tabstop = 4
vim.o.shiftwidth = 4 -- size of indent (measured in spaces), should equal tabstop
vim.bo.shiftwidth = 4
vim.o.softtabstop = 4 -- should be the same as the other two above
vim.bo.softtabstop = 4
vim.o.expandtab = true -- expand tabs to spaces
vim.bo.expandtab = true -- expand tabs to spaces
vim.o.smartindent = true -- smart indenting on new line for C-like programs
vim.bo.smartindent = true
vim.o.autoindent = true -- copy the indentation from previous line
vim.bo.autoindent = true
vim.o.smarttab = true -- tab infront of a line inserts blanks based on shiftwidth
-- ================= Number column ================= --
vim.wo.number = true
vim.cmd [[
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu && mode() != "i" | set rnu | endif
autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif
augroup END
]] -- h/t https://jeffkreeftmeijer.com/vim-number/
-- ================= Search ================= --
vim.o.ignorecase = true -- Ignorecase when searching
vim.o.incsearch = true -- start searching on each keystroke
vim.o.smartcase = true -- ignore case when lowercase, match case when capital case is used
vim.o.hlsearch = true -- highlight the search results
-- ================= Performance ================= --
vim.o.lazyredraw = false -- useful for when executing macros.
vim.o.ttimeoutlen = 30 -- ms to wait for a key code seq to complete
-- ================= Misc ================= --
vim.wo.wrap = true -- wrap long text into multiple lines
vim.o.history = 10000 -- numbers of entries in history for ':' commands and search patterns (10000 = max)
vim.o.updatetime = 300 -- used for CursorHold event (for document highlighting detection)
vim.o.mouse = 'nv' -- allow mose in normal & visual mode
-- we want splits to be to the bottom and to the right
vim.o.splitright = true
vim.o.splitbelow = true
-- better autocomplete behaviour
-- menuone - show popup menu also when there is only one match available
-- preview - show extra information about currently selected completion
-- noinsert - do not insert any text for match until the user selects it from the menu
vim.o.completeopt='menuone,preview,noinsert'
-- allows hidden buffers
-- this means that a modified buffer doesn't need to be saved when changing
-- tabs/windows.
vim.o.hidden=true
-- Copy paste between vim and everything else
vim.o.clipboard = "unnamedplus"

View File

@@ -0,0 +1,2 @@
DATA_PATH = vim.fn.stdpath('data')
CACHE_PATH = vim.fn.stdpath('cache')

View File

@@ -0,0 +1,83 @@
-- defaults
local opts = { noremap = true, silent = true }
-- copy
vim.api.nvim_set_keymap('', '<C-c>', '"+y', opts)
-- paste
vim.api.nvim_set_keymap('', '<C-v>', '"+p', opts)
-- cut
vim.api.nvim_set_keymap('', '<C-x>', '"+d', opts)
-- paste in insert mode
vim.api.nvim_set_keymap('i', '<C-v>', '<Esc>"+pa', opts)
-- better tree
vim.api.nvim_set_keymap('n', '<C-b>', ":Lexplore<CR> :vertical resize 30<CR>", { noremap = true })
-- make the cursor stay on the same character when leaving insert mode
vim.api.nvim_set_keymap('i', 'ć', '<Esc>l', opts)
vim.api.nvim_set_keymap('i', 'Ć', '<Esc>l', opts)
-- make ctrl-shift arrows movement
vim.api.nvim_set_keymap('n', '<C-A-Up>', 'ddkP', opts)
vim.api.nvim_set_keymap('v', '<C-A-Up>', ':m \'<-2<CR>gv=gv', opts)
vim.api.nvim_set_keymap('n', '<C-A-Down>', 'ddp', opts)
vim.api.nvim_set_keymap('v', '<C-A-Down>', ':m \'>+1<CR>gv=gv', opts)
-- fast scrolling
--vim.api.nvim_set_keymap('n', '<C-Down>', '9j', opts)
--vim.api.nvim_set_keymap('n', '<C-Up>', '9k', opts)
--vim.api.nvim_set_keymap('v', '<C-Down>', '9j', opts)
--vim.api.nvim_set_keymap('v', '<C-Up>', '9k', opts)
-- stay in normal mode after inserting a new line
vim.api.nvim_set_keymap('', 'o', 'o <Bs><Esc>', opts)
vim.api.nvim_set_keymap('', 'O', 'O <Bs><Esc>', opts)
-- mapping that opens .vimrc in a new tab for quick editing
vim.api.nvim_set_keymap('n', '<Leader>ev', '<Cmd>tabe $MYVIMRC<CR>', opts)
-- mapping that sources the vimrc in the current filea doesn't work, should change all require calls to dofile
-- or clear all require cache and reimport
-- vim.api.nvim_set_keymap('n', '<Leader>sv', '<Cmd>lua dofile(vim.fn.stdpath(\'config\')..\'/init.lua\')<CR>', { noremap = true, silent = false })
-- Mapping U to Redo.
vim.api.nvim_set_keymap('', 'U', '<C-r>', opts)
vim.api.nvim_set_keymap('', '<C-r>', '<NOP>', opts)
-- indent via Tab
vim.api.nvim_set_keymap('n', '<Tab>', '>>_', opts)
vim.api.nvim_set_keymap('n', '<S-Tab>', '<<_', opts)
vim.api.nvim_set_keymap('v', '<Tab>', '>>_', opts)
vim.api.nvim_set_keymap('v', '<S-Tab>', '<<_', opts)
vim.api.nvim_set_keymap('i', '<Tab>', '\t', opts)
vim.api.nvim_set_keymap('i', '<S-Tab>', '\b', opts)
-- window movement
--vim.api.nvim_set_keymap('', '<C-w>j', '<C-w>h', opts)
--vim.api.nvim_set_keymap('', '<C-w>k', '<C-w>j', opts)
--vim.api.nvim_set_keymap('', '<C-w>l', '<C-w>k', opts)
--vim.api.nvim_set_keymap('', '<C-w>č', '<C-w>l', opts)
-- opening terminal with shortcut
vim.api.nvim_set_keymap('', '<Leader><CR>', '<Cmd>silent !$TERM &<CR>', opts)
-- jumping back and forth
vim.api.nvim_set_keymap('', '<C-K>', '<C-O>', opts)
vim.api.nvim_set_keymap('', '<C-L>', '<C-I>', opts)
-- LSP
vim.api.nvim_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
vim.api.nvim_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
vim.api.nvim_set_keymap('n', 'gt', '<Cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
vim.api.nvim_set_keymap('n', 'gi', '<Cmd>lua vim.lsp.buf.implementation()<CR>', opts)
vim.api.nvim_set_keymap('n', 'gf', '<Cmd>lua vim.lsp.buf.references()<CR>', opts)
-- usages replaced by LspSaga plugin
-- vim.api.nvim_set_keymap('n', 'ga', '<Cmd>lua vim.lsp.buf.code_action()<CR>', opts) -- eg. autoimport
-- vim.api.nvim_set_keymap('n', 'gn', '<Cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
-- vim.api.nvim_set_keymap('n', 'gN', '<Cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
-- vim.api.nvim_set_keymap('n', 'h', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
-- vim.api.nvim_set_keymap('n', 'gr', '<Cmd>lua vim.lsp.buf.rename()<CR>', opts)
-- autocomplete
-- if autocomplete popup menu opens pressing enter will complete the first match
--vim.api.nvim_set_keymap('i', '<Tab>', 'v:lua.smart_tab()', {expr = true, noremap = true})
vim.api.nvim_set_keymap('i', '<CR>', 'pumvisible() ? "<C-n><Esc>a" : "<CR>"', {expr = true, noremap = true, silent = true})

View File

@@ -0,0 +1,74 @@
local lsp_installer = require'nvim-lsp-installer'
local lsp_installer_servers = require'nvim-lsp-installer.servers'
-- install LSP servers
local function installServer(name)
local ok, server = lsp_installer_servers.get_server(name)
if ok then
if not server:is_installed() then
server:install()
end
end
end
local function installServers(names)
for _,name in pairs(names) do
installServer(name)
end
end
-- find a list of available ones here: https://github.com/williamboman/nvim-lsp-installer
installServers({'angularls', 'bashls', 'dockerls', 'sumneko_lua', 'pyright', 'jsonls', 'cssls', 'tsserver'})
-- setup installed servers
lsp_installer.on_server_ready(function(server)
local opts = {}
-- (optional) Customize the options passed to the server
-- if server.name == "tsserver" then
-- opts.root_dir = function() ... end
-- end
if server.name == 'sumneko_lua' then
opts = require'lsp-server-config.lua'
end
-- This setup() function is exactly the same as lspconfig's setup function.
-- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/ADVANCED_README.md
server:setup(opts)
end)
-- diagnostic symbols
local signs = { Error = "", Warn = "", Hint = "", Info = ""}
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
-- completion symbols
vim.lsp.protocol.CompletionItemKind = {
"  (Text) ",
"  (Method)",
"  (Function)",
"  (Constructor)",
" ﴲ (Field)",
"[] (Variable)",
"  (Class)",
" ﰮ (Interface)",
"  (Module)",
" 襁 (Property)",
"  (Unit)",
"  (Value)",
" 練 (Enum)",
"  (Keyword)",
"  (Snippet)",
"  (Color)",
"  (File)",
"  (Reference)",
"  (Folder)",
"  (EnumMember)",
" ﲀ (Constant)",
" ﳤ (Struct)",
"  (Event)",
"  (Operator)",
"  (TypeParameter)"
}

View File

@@ -0,0 +1,18 @@
local opts = {
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
workspace = {
library = {
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
},
maxPreload = 100000,
preloadFileSize = 10000,
},
},
},
}
return opts

View File

@@ -0,0 +1,159 @@
require('dressing').setup({
input = {
-- Set to false to disable the vim.ui.input implementation
enabled = true,
-- Default prompt string
default_prompt = "Input:",
-- Can be 'left', 'right', or 'center'
prompt_align = "center",
-- When true, <Esc> will close the modal
insert_only = true,
-- When true, input will start in insert mode.
start_in_insert = true,
-- These are passed to nvim_open_win
anchor = "SW",
border = "rounded",
-- 'editor' and 'win' will default to being centered
relative = "cursor",
-- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
prefer_width = 40,
width = nil,
-- min_width and max_width can be a list of mixed types.
-- min_width = {20, 0.2} means "the greater of 20 columns or 20% of total"
max_width = { 140, 0.9 },
min_width = { 20, 0.2 },
buf_options = {},
win_options = {
-- Window transparency (0-100)
winblend = 10,
-- Disable line wrapping
wrap = false,
},
-- Set to `false` to disable
mappings = {
n = {
["<Esc>"] = "Close",
["<CR>"] = "Confirm",
},
i = {
["<C-c>"] = "Close",
["<CR>"] = "Confirm",
["<Up>"] = "HistoryPrev",
["<Down>"] = "HistoryNext",
},
},
override = function(conf)
-- This is the config that will be passed to nvim_open_win.
-- Change values here to customize the layout
return conf
end,
-- see :help dressing_get_config
get_config = nil,
},
select = {
-- Set to false to disable the vim.ui.select implementation
enabled = true,
-- Priority list of preferred vim.select implementations
backend = { "telescope", "fzf_lua", "fzf", "builtin", "nui" },
-- Trim trailing `:` from prompt
trim_prompt = true,
-- Options for telescope selector
-- These are passed into the telescope picker directly. Can be used like:
-- telescope = require('telescope.themes').get_ivy({...})
telescope = nil,
-- Options for fzf selector
fzf = {
window = {
width = 0.5,
height = 0.4,
},
},
-- Options for fzf_lua selector
fzf_lua = {
winopts = {
width = 0.5,
height = 0.4,
},
},
-- Options for nui Menu
nui = {
position = "50%",
size = nil,
relative = "editor",
border = {
style = "rounded",
},
buf_options = {
swapfile = false,
filetype = "DressingSelect",
},
win_options = {
winblend = 10,
},
max_width = 80,
max_height = 40,
min_width = 40,
min_height = 10,
},
-- Options for built-in selector
builtin = {
-- These are passed to nvim_open_win
anchor = "NW",
border = "rounded",
-- 'editor' and 'win' will default to being centered
relative = "editor",
buf_options = {},
win_options = {
-- Window transparency (0-100)
winblend = 10,
},
-- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
-- the min_ and max_ options can be a list of mixed types.
-- max_width = {140, 0.8} means "the lesser of 140 columns or 80% of total"
width = nil,
max_width = { 140, 0.8 },
min_width = { 40, 0.2 },
height = nil,
max_height = 0.9,
min_height = { 10, 0.2 },
-- Set to `false` to disable
mappings = {
["<Esc>"] = "Close",
["<C-c>"] = "Close",
["<CR>"] = "Confirm",
},
override = function(conf)
-- This is the config that will be passed to nvim_open_win.
-- Change values here to customize the layout
return conf
end,
},
-- Used to override format_item. See :help dressing-format
format_item_override = {},
-- see :help dressing_get_config
get_config = nil,
},
})

View File

@@ -0,0 +1,284 @@
local gl = require('galaxyline')
local section = gl.section
local condition = require('galaxyline.condition')
-- TODO: move to util - credit to kraftwerk28/dotfiles
local function u(code)
if type(code) == 'string' then code = tonumber('0x' .. code) end
local c = string.char
if code <= 0x7f then return c(code) end
local t = {}
if code <= 0x07ff then
t[1] = c(bit.bor(0xc0, bit.rshift(code, 6)))
t[2] = c(bit.bor(0x80, bit.band(code, 0x3f)))
elseif code <= 0xffff then
t[1] = c(bit.bor(0xe0, bit.rshift(code, 12)))
t[2] = c(bit.bor(0x80, bit.band(bit.rshift(code, 6), 0x3f)))
t[3] = c(bit.bor(0x80, bit.band(code, 0x3f)))
else
t[1] = c(bit.bor(0xf0, bit.rshift(code, 18)))
t[2] = c(bit.bor(0x80, bit.band(bit.rshift(code, 12), 0x3f)))
t[3] = c(bit.bor(0x80, bit.band(bit.rshift(code, 6), 0x3f)))
t[4] = c(bit.bor(0x80, bit.band(code, 0x3f)))
end
return table.concat(t)
end
-- li - line icon
local li = {
-- block
b = '',
-- bottom left
bl = u'e0b8', -- '',
-- bottom right
br = u'e0ba', -- '',
-- top left
tl = u'e0bc', -- '',
-- top right
tr = u'e0be' -- '',
}
-- taken from LunarVim
local colors = {
bg = '#292D38',
yellow = '#FFEB68',
dark_yellow = '#D7BA7D',
cyan = '#4EC9B0',
green = '#608B4E',
light_green = '#B5CEA8',
string_orange = '#CE9178',
orange = '#FF8800',
purple = '#C586C0',
magenta = '#D16D9E',
grey = '#858585',
blue = '#569CD6',
vivid_blue = '#4FC1FF',
light_blue = '#9CDCFE',
red = '#D16969',
error_red = '#F44747',
info_yellow = '#FFCC66',
white = '#FFFFFF'
}
-- list of windows for which short line will be used
-- short line is just a shorter status line. it's normally used in
-- places where it's not really needed/desired
gl.short_line_list = {'NvimTree', 'vista', 'dbui', 'packer'}
-- first section to the left will be a colored block shape that will
-- tell in which mode we're in
section.left[1] = {
ViMode = {
provider = function()
-- define color for each mode
local mode_color = {
n = colors.blue, -- normal
i = colors.grey, -- insert
v = colors.purple, -- visual
[''] = colors.purple, -- visual block
V = colors.purple, -- visual line
c = colors.dark_yellow, -- command
no = colors.blue, -- normal ??
s = colors.orange, -- select ??
S = colors.orange, -- select line ??
[''] = colors.orange, -- select block??
ic = colors.yellow,
R = colors.red, -- Replace
Rv = colors.red, -- replace visual?
cv = colors.blue, -- command ??
ce = colors.blue, -- command ??
r = colors.cyan, -- ??
rm = colors.cyan, -- ??
['r?'] = colors.cyan,
['!'] = colors.blue,
t = colors.blue
}
-- set color with nvim command
vim.api.nvim_command('hi GalaxyViMode guifg=' .. mode_color[vim.fn.mode()])
-- returns the text that will be displayed in this section
return li.b..li.tl..' '
end,
highlight = {colors.red, colors.bg}
}
}
-- git branch icon
section.left[2] = {
GitIcon = {
-- main text
provider = function()
return ''
end,
-- enable only if vim is open in git workspace
condition = condition.check_git_workspace,
-- separator is the stuff after the main text
separator = ' ',
-- separator foreground & background color
separator_highlight = {'NONE', colors.bg},
-- main text foreground & background color
highlight = {colors.orange, colors.bg}
}
}
-- git branch name
section.left[3] = {
GitBranch = {
provider = 'GitBranch',
-- enable only if vim is open in git workspace
condition = condition.check_git_workspace,
separator = ' ',
separator_highlight = {'NONE', colors.bg},
highlight = {colors.grey, colors.bg}
}
}
-- git added files
section.left[4] = {
DiffAdd = {
provider = 'DiffAdd',
condition = condition.hide_in_width,
icon = '',
highlight = {colors.green, colors.bg}
}
}
-- git modified files
section.left[5] = {
DiffModified = {
provider = 'DiffModified',
condition = condition.hide_in_width,
icon = '',
highlight = {colors.blue, colors.bg}
}
}
-- git removed files
section.left[6] = {
DiffRemove = {
provider = 'DiffRemove',
condition = condition.hide_in_width,
icon = '',
highlight = {colors.red, colors.bg}
}
}
-- diagnostics
section.right[1] = {
DiagnosticError = {
provider = 'DiagnosticError',
icon = '',
highlight = {colors.error_red, colors.bg}
}
}
section.right[2] = {
DiagnosticWarn = {
provider = 'DiagnosticWarn',
icon = '',
highlight = {colors.orange, colors.bg}
}
}
section.right[3] = {
DiagnosticHint = {
provider = 'DiagnosticHint',
icon = '',
highlight = {colors.vivid_blue, colors.bg}
}
}
section.right[4] = {
DiagnosticInfo = {
provider = 'DiagnosticInfo',
icon = '',
highlight = {
colors.info_yellow,
colors.bg
}
}
}
-- cosmetics
section.right[5] = {
Space2 = {
provider = function()
return li.br..li.b
end,
separator = ' ',
separator_highlight = {'NONE', colors.bg},
highlight = {colors.white, colors.bg}
}
}
-- lsp info
section.right[7] = {
ShowLspClient = {
provider = 'GetLspClient',
condition = function()
local tbl = {['dashboard'] = true, [' '] = true}
if tbl[vim.bo.filetype] then return false end
return true
end,
separator = ' ',
separator_highlight = {colors.grey, colors.white},
icon = '',
highlight = {colors.grey, colors.white}
}
}
-- file type
section.right[8] = {
BufferType = {
provider = 'FileTypeName',
separator = li.b..li.tl..' ',
separator_highlight = {colors.white, colors.bg},
highlight = {colors.grey, colors.bg}
}
}
section.right[9] = {
FileEncode = {
provider = 'FileEncode',
condition = condition.hide_in_width,
separator = ' ',
separator_highlight = {'NONE', colors.bg},
highlight = {colors.grey, colors.bg}
}
}
-- cosmetics: right dash
section.right[10] = {
LastDash = {
provider = function()
return li.tr..li.b
end,
separator = ' ',
separator_highlight = {'NONE', colors.bg},
highlight = {colors.white, colors.bg}
}
}
-- short line settings
section.short_line_left[1] = {
BufferType = {
provider = 'FileTypeName',
separator = ' ',
separator_highlight = {'NONE', colors.bg},
highlight = {colors.grey, colors.bg}
}
}
section.short_line_left[2] = {
SFileName = {
provider = 'SFileName',
condition = condition.buffer_not_empty,
highlight = {
colors.grey,
colors.bg
}
}
}
section.short_line_right[1] = {
BufferIcon = {
provider = 'BufferIcon',
highlight = {
colors.grey,
colors.bg
}
}
}

View File

@@ -0,0 +1,56 @@
require('gitsigns').setup {
keymaps = {
-- Default keymap options
noremap = tue,
buffer = true,
['n <leader>hn'] = { expr = true, "&diff ? '<leader>hn' : '<cmd>lua require\"gitsigns\".next_hunk()<CR>'"},
['n <leader>hN'] = { expr = true, "&diff ? '<leader>hN' : '<cmd>lua require\"gitsigns\".prev_hunk()<CR>'"},
['n <leader>hs'] = '<cmd>lua require"gitsigns".stage_hunk()<CR>',
['n <leader>hu'] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>',
['n <leader>hr'] = '<cmd>lua require"gitsigns".reset_hunk()<CR>',
['n <leader>hR'] = '<cmd>lua require"gitsigns".reset_buffer()<CR>',
['n <leader>hp'] = '<cmd>lua require"gitsigns".preview_hunk()<CR>',
['n <leader>hb'] = '<cmd>lua require"gitsigns".blame_line()<CR>',
},
signs = {
add = {hl = 'GitSignsAdd' , text = '', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'},
change = {hl = 'GitSignsChange', text = '', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
topdelete = {hl = 'GitSignsDelete', text = '', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
},
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = {
interval = 1000,
follow_files = true
},
attach_to_untracked = true,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
delay = 100,
ignore_whitespace = false,
},
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
max_file_length = 40000,
preview_config = {
-- Options passed to nvim_open_win
border = 'single',
style = 'minimal',
relative = 'cursor',
row = 0,
col = 1
},
yadm = {
enable = false
},
}

View File

@@ -0,0 +1,8 @@
-- settings for both plugins:
-- 'lukas-reineke/indent-blankline.nvim'
-- 'Yggdroot/indentLine'
vim.api.nvim_command("let g:indentLine_char = '⎸'")
vim.api.nvim_command("let g:indentLine_fileTypeExclude = ['text', 'markdown', 'help']")
vim.api.nvim_command("let g:indentLine_bufNameExclude = ['STARTIFY', 'NVIMTREE']")
vim.api.nvim_command("let g:indent_blankline_extra_indent_level = -1")

View File

@@ -0,0 +1,7 @@
-- Lua
require('lsp-colors').setup({
Error = '#F44747',
Warning = '#FF8800',
Hint = '#4FC1FF',
Information = '#FFCC66'
})

View File

@@ -0,0 +1,40 @@
local opts = {silent = true, noremap = true}
vim.api.nvim_set_keymap("n", "<leader>xx", "<cmd>TroubleToggle<cr>", opts)
require('trouble').setup{
position = "bottom", -- position of the list can be: bottom, top, left, right
icons = true, -- use devicons for filenames
mode = "document_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
fold_open = "", -- icon used for open folds
fold_closed = "", -- icon used for closed folds
group = true, -- group results by file
padding = true, -- add an extra new line on top of the list
action_keys = { -- key mappings for actions in the trouble list
close = "q", -- close the list
cancel = {"ć", "Ć"}, -- cancel the preview and get back to your last window / buffer / cursor
refresh = "r", -- manually refresh
jump = {"<cr>", "<tab>"}, -- jump to the diagnostic or open / close folds
toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
toggle_preview = "P", -- toggle auto_preview
hover = "H", -- opens a small popup with the full multiline message
preview = "p", -- preview the diagnostic location
close_folds = {"zM", "zm"}, -- close all folds
open_folds = {"zR", "zr"}, -- open all folds
toggle_fold = {"zA", "za"}, -- toggle fold of current file
previous = "l", -- preview item
next = "k" -- next item
},
indent_lines = true, -- add an indent guide below the fold icons
auto_open = false, -- automatically open the list when you have diagnostics
auto_close = false, -- automatically close the list when you have no diagnostics
auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
auto_fold = false, -- automatically fold a file trouble list at creation
signs = {
-- icons / text used for a diagnostic
error = "",
warning = "",
hint = "",
information = "",
other = ""
},
use_diagnostic_signs = true -- enabling this will use the signs defined in your lsp client
}

View File

@@ -0,0 +1,64 @@
local keymap = vim.keymap.set
-- LSP finder - Find the symbol's definition
-- If there is no definition, it will instead be hidden
-- When you use an action in finder like "open vsplit",
-- you can use <C-t> to jump back
keymap("n", "gh", "<cmd>Lspsaga lsp_finder<CR>")
-- Code action
keymap({"n","v"}, "<leader>ca", "<cmd>Lspsaga code_action<CR>")
-- Rename all occurrences of the hovered word for the entire file
keymap("n", "gr", "<cmd>Lspsaga rename<CR>")
-- Rename all occurrences of the hovered word for the selected files
keymap("n", "gr", "<cmd>Lspsaga rename ++project<CR>")
-- Peek definition
-- You can edit the file containing the definition in the floating window
-- It also supports open/vsplit/etc operations, do refer to "definition_action_keys"
-- It also supports tagstack
-- Use <C-t> to jump back
keymap("n", "gp", "<cmd>Lspsaga peek_definition<CR>")
-- Go to definition
keymap("n", "gd", "<cmd>Lspsaga goto_definition<CR>")
-- Diagnostic jump
-- You can use <C-o> to jump back to your previous location
keymap("n", "[e", "<cmd>Lspsaga diagnostic_jump_prev<CR>")
keymap("n", "]e", "<cmd>Lspsaga diagnostic_jump_next<CR>")
-- Diagnostic jump with filters such as only jumping to an error
keymap("n", "[E", function()
require("lspsaga.diagnostic"):goto_prev({ severity = vim.diagnostic.severity.ERROR })
end)
keymap("n", "]E", function()
require("lspsaga.diagnostic"):goto_next({ severity = vim.diagnostic.severity.ERROR })
end)
-- Toggle outline
keymap("n","<leader>o", "<cmd>Lspsaga outline<CR>")
-- Hover Doc
-- If there is no hover doc,
-- there will be a notification stating that
-- there is no information available.
-- To disable it just use ":Lspsaga hover_doc ++quiet"
-- Pressing the key twice will enter the hover window
keymap("n", "K", "<cmd>Lspsaga hover_doc<CR>")
-- If you want to keep the hover window in the top right hand corner,
-- you can pass the ++keep argument
-- Note that if you use hover with ++keep, pressing this key again will
-- close the hover window. If you want to jump to the hover window
-- you should use the wincmd command "<C-w>w"
keymap("n", "K", "<cmd>Lspsaga hover_doc ++keep<CR>")
-- Call hierarchy
keymap("n", "<Leader>ci", "<cmd>Lspsaga incoming_calls<CR>")
keymap("n", "<Leader>co", "<cmd>Lspsaga outgoing_calls<CR>")
-- Floating terminal
keymap({"n", "t"}, "<A-d>", "<cmd>Lspsaga term_toggle<CR>")

View File

@@ -0,0 +1,38 @@
local status, starter = pcall(require, "mini.starter")
if not status then
return
end
starter.setup({
content_hooks = {
starter.gen_hook.adding_bullet(""),
starter.gen_hook.aligning("center", "center"),
},
evaluate_single = true,
footer = os.date(),
header = table.concat({
[[██████╗ ███████╗███╗ ██╗██╗ ██╗██╗███╗ ███╗]],
[[██╔══██╗██╔════╝████╗ ██║██║ ██║██║████╗ ████║]],
[[██████╔╝█████╗ ██╔██╗ ██║██║ ██║██║██╔████╔██║]],
[[██╔══██╗██╔══╝ ██║╚██╗██║╚██╗ ██╔╝██║██║╚██╔╝██║]],
[[██████╔╝███████╗██║ ╚████║ ╚████╔╝ ██║██║ ╚═╝ ██║]],
[[╚═════╝ ╚══════╝╚═╝ ╚═══╝ ╚═══╝ ╚═╝╚═╝ ╚═╝]],
[[─────────────────────────────────────────────────]],
}, "\n"),
query_updaters = [[abcdefghilmoqrstuvwxyz0123456789_-,.ABCDEFGHIJKLMOQRSTUVWXYZ]],
items = {
{ action = "PackerSync", name = "U: Update Plugins", section = "Plugins" },
{ action = "enew", name = "E: New Buffer", section = "Builtin actions" },
{ action = "qall!", name = "Q: Quit Neovim", section = "Builtin actions" },
},
})
vim.cmd([[
augroup MiniStarterJK
au!
au User MiniStarterOpened nmap <buffer> j <Cmd>lua MiniStarter.update_current_item('next')<CR>
au User MiniStarterOpened nmap <buffer> k <Cmd>lua MiniStarter.update_current_item('prev')<CR>
au User MiniStarterOpened nmap <buffer> <C-p> <Cmd>Telescope find_files<CR>
au User MiniStarterOpened nmap <buffer> <C-n> <Cmd>Telescope file_browser<CR>
augroup END
]])

View File

@@ -0,0 +1,18 @@
require("noice").setup({
lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
},
-- you can enable a preset for easier configuration
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
})

View File

@@ -0,0 +1,58 @@
-- TODO( fix
local cmp = require'cmp'
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
end,
},
mapping = {
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
['<C-e>'] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' }, -- For vsnip users.
}, {
{ name = 'buffer' },
})
})
-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
}, {
{ name = 'buffer' },
})
})
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline('/', {
sources = {
{ name = 'buffer' }
}
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
-- Setup lspconfig.
-- local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
-- require('lspconfig')['<YOUR_LSP_SERVER>'].setup {
--capabilities = capabilities
-- }

View File

@@ -0,0 +1,67 @@
-- local opts = {silent = true, noremap = true}
-- vim.api.nvim_set_keymap('n', '<C-n>', '<Cmd>NvimTreeToggle<CR>', opts)
-- vim.api.nvim_set_keymap('n', '<leader>r', '<Cmd>NvimTreeRefresh<CR>', opts)
-- -- find the currently open file in tree
-- vim.api.nvim_set_keymap('n', '<leader>n', '<Cmd>NvimTreeFindFile<CR>', opts)
-- local tree_cb = require'nvim-tree.config'.nvim_tree_callback
-- local list = {
-- { key = "<C-t>", cb = tree_cb("tabnew") },
-- { key = "<CR>", cb = tree_cb("edit") },
-- { key = "o", cb = tree_cb("edit") },
-- { key = "<2-LeftMouse>", cb = tree_cb("edit") },
-- { key = "<2-RightMouse>", cb = tree_cb("cd") },
-- { key = "<Tab>", cb = tree_cb("preview") },
-- { key = "R", cb = tree_cb("refresh") },
-- { key = "a", cb = tree_cb("create") },
-- { key = "d", cb = tree_cb("remove") },
-- { key = "r", cb = tree_cb("rename") },
-- { key = "x", cb = tree_cb("cut") },
-- { key = "y", cb = tree_cb("copy") },
-- { key = "p", cb = tree_cb("paste") },
-- { key = "<", cb = tree_cb("dir_up") },
-- { key = "q", cb = tree_cb("close") }
-- }
-- require'nvim-tree'.setup {
-- disable_netrw = true,
-- hijack_netrw = true,
-- open_on_setup = false,
-- ignore_ft_on_setup = {},
-- open_on_tab = false,
-- hijack_cursor = false,
-- update_cwd = false,
-- diagnostics = {
-- enable = false,
-- icons = {
-- hint = "",
-- info = "",
-- warning = "",
-- error = "",
-- }
-- },
-- update_focused_file = {
-- enable = false,
-- update_cwd = false,
-- ignore_list = {}
-- },
-- system_open = {
-- cmd = nil,
-- args = {}
-- },
-- filters = {
-- dotfiles = false,
-- custom = {}
-- },
-- view = {
-- width = 30,
-- height = 30,
-- hide_root_folder = false,
-- side = 'left',
-- mappings = {
-- custom_only = false,
-- list = list,
-- }
-- }
-- }

View File

@@ -0,0 +1,8 @@
require'nvim-treesitter.configs'.setup {
-- will install treesitter for all available languages
ensure_installed = 'all',
ignore_install = {'haskell'}, -- broken
highlight = {
enable = true
}
}

View File

@@ -0,0 +1,62 @@
require('smart-splits').setup({
-- Ignored filetypes (only while resizing)
ignored_filetypes = {
'nofile',
'quickfix',
'prompt',
},
-- Ignored buffer types (only while resizing)
ignored_buftypes = { 'NvimTree' },
-- the default number of lines/columns to resize by at a time
default_amount = 3,
-- whether to wrap to opposite side when cursor is at an edge
-- e.g. by default, moving left at the left edge will jump
-- to the rightmost window, and vice versa, same for up/down.
wrap_at_edge = true,
-- when moving cursor between splits left or right,
-- place the cursor on the same row of the *screen*
-- regardless of line numbers. False by default.
-- Can be overridden via function parameter, see Usage.
move_cursor_same_row = false,
-- resize mode options
resize_mode = {
-- key to exit persistent resize mode
quit_key = '<ESC>',
-- keys to use for moving in resize mode
-- in order of left, down, up' right
resize_keys = { 'Left', 'Down', 'Up', 'Right' },
-- set to true to silence the notifications
-- when entering/exiting persistent resize mode
silent = false,
-- must be functions, they will be executed when
-- entering or exiting the resize mode
hooks = {
on_enter = nil,
on_leave = nil,
},
},
-- ignore these autocmd events (via :h eventignore) while processing
-- smart-splits.nvim computations, which involve visiting different
-- buffers and windows. These events will be ignored during processing,
-- and un-ignored on completed. This only applies to resize events,
-- not cursor movement events.
ignored_events = {
'BufEnter',
'WinEnter',
},
-- enable or disable the tmux integration
tmux_integration = true,
-- disable tmux navigation if current tmux pane is zoomed
disable_tmux_nav_when_zoomed = true,
})
vim.keymap.set('n', '<A-Left>', require('smart-splits').resize_left)
vim.keymap.set('n', '<A-Down>', require('smart-splits').resize_down)
vim.keymap.set('n', '<A-Up>', require('smart-splits').resize_up)
vim.keymap.set('n', '<A-Right>', require('smart-splits').resize_right)
-- moving between splits
vim.keymap.set('n', '<C-Left>', require('smart-splits').move_cursor_left)
vim.keymap.set('n', '<C-Down>', require('smart-splits').move_cursor_down)
vim.keymap.set('n', '<C-Up>', require('smart-splits').move_cursor_up)
vim.keymap.set('n', '<C-Right>', require('smart-splits').move_cursor_right)

View File

@@ -0,0 +1,64 @@
-- Find files using lua fuctions
local opts = { silent = true, noremap = true }
vim.api.nvim_set_keymap('n', '<Leader>ff', "<Cmd>lua require'telescope.builtin'.find_files()<CR>", {silent=false, noremap=true})
vim.api.nvim_set_keymap('n', '<Leader>fg', "<Cmd>lua require'telescope.builtin'.live_grep()<CR>", opts)
vim.api.nvim_set_keymap('n', '<Leader>fb', "<Cmd>lua require'telescope.builtin'.buffers()<CR>", opts)
vim.api.nvim_set_keymap('n', '<Leader>fh', "<Cmd>lua require'telescope.builtin'.help_tags()<CR>", opts)
local actions = require('telescope.actions')
require('telescope').setup {
defaults = {
-- program to use for searching with its arguments
find_command = {'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case'},
-- prompt_position = 'top', -- have prompt at the top (has no effect on vertical configuration)
prompt_prefix = '', -- symbol on prompt window
selection_caret = '', -- symbol on selected row in results window
entry_prefix = ' ', -- symbol on non-selected rows in results window
initial_mode = 'insert', -- start in insert mode
selection_strategy = 'reset', -- what happens to selection when list changes
sorting_strategy = 'ascending', -- start with most important search on top
layout_strategy = 'vertical', -- vertical layout
layout_config = {
vertical = {
mirror = true, -- windows should be in this order from top to bottom: search, results, preview
preview_height = 0.5 -- preview window takes 0.5 of the total window height
}
},
file_sorter = require'telescope.sorters'.get_fuzzy_file,
file_ignore_patterns = {'node_modules/.*'}, -- never search in node_modules/ dir
generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter,
display_path = true,
winblend = 0, -- window should not be transparent
border = {}, -- no border?
borderchars = {'', '', '', '', '', '', '', ''}, -- border chars
color_devicons = true, -- colorize used icons
use_less = true, -- less is bash program for preview file contents
set_env = {['COLORTERM'] = 'truecolor'}, -- use all the colors
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,
buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker,
-- preview_cutoff = 120,
mappings = {
i = {
['<C-k>'] = actions.move_selection_next,
['<C-l>'] = actions.move_selection_previous,
['<C-q>'] = actions.smart_send_to_qflist + actions.open_qflist,
['<C-d>'] = 'delete_buffer',
['<CR>'] = actions.select_default + actions.center,
},
n = {
['<C-k>'] = actions.move_selection_next,
['<C-l>'] = actions.move_selection_previous,
['<C-q>'] = actions.smart_send_to_qflist + actions.open_qflist,
['<C-d>'] = 'delete_buffer',
}
}
},
extensions = {
fzy_native = {
override_generic_sorter = false,
override_file_sorter = true,
}
}
}

View File

@@ -0,0 +1,165 @@
local fn = vim.fn
local installPath = DATA_PATH..'/site/pack/packer/start/packer.nvim'
-- install packer if it's not installed already
local packerBootstrap = nil
if fn.empty(fn.glob(installPath)) > 0 then
packerBootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', installPath})
vim.cmd [[packadd packer.nvim]]
end
local packer = require('packer').startup(function(use)
-- Packer should manage itself
use 'wbthomason/packer.nvim'
-- QUALITY OF LIFE INTEGRATIONS
-- git integration
use {
'lewis6991/gitsigns.nvim',
requires = {
'nvim-lua/plenary.nvim'
}
}
-- speedy searching
use 'ggandor/leap.nvim'
-- telescope - searching / navigation
use {
'nvim-telescope/telescope.nvim',
requires = { {'nvim-lua/plenary.nvim'} }
}
-- better hotfix window (for showing and searching through results in telescope's find usages)
use {"kevinhwang91/nvim-bqf"}
-- better highlighting
use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'}
-- better split navigation
use 'mrjones2014/smart-splits.nvim'
-- gorbit's codewindow
use {
'gorbit99/codewindow.nvim',
config = function()
local codewindow = require('codewindow')
codewindow.setup()
codewindow.apply_default_keybinds()
end,
}
-- surround vim
use 'tpope/vim-surround'
-- nerd commenter
use 'scrooloose/nerdcommenter'
-- nice diagnostic pane on the bottom
use 'folke/lsp-trouble.nvim'
-- support the missing lsp diagnostic colors
use 'folke/lsp-colors.nvim'
-- better LSP UI (for code actions, rename etc.)
use({
"glepnir/lspsaga.nvim",
branch = "main",
config = function()
require("lspsaga").setup({})
end,
requires = { {"nvim-tree/nvim-web-devicons"} }
})
-- better find and replace
use 'nvim-lua/plenary.nvim'
use 'windwp/nvim-spectre'
-- VISUAL CHANGES
-- start page
use 'echasnovski/mini.starter'
-- status line
use 'glepnir/galaxyline.nvim'
-- colorscheme
use { 'catppuccin/nvim', as = 'catppuccin' }
-- nicer looking tab display
use 'lukas-reineke/indent-blankline.nvim'
use 'echasnovski/mini.indentscope'
-- show startup time
use 'dstein64/vim-startuptime'
-- UX improvements
use({
"folke/noice.nvim",
requires = {
"MunifTanjim/nui.nvim",
"rcarriga/nvim-notify",
}
})
use 'stevearc/dressing.nvim'
use 'rcarriga/nvim-notify'
-- FUNCTIONAL CODING STUFF
-- lsp config
use {
'neovim/nvim-lspconfig',
'williamboman/nvim-lsp-installer',
}
-- for LSP autocompletion
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-path'
use 'hrsh7th/cmp-cmdline'
use 'hrsh7th/nvim-cmp'
-- For vsnip users.
use 'hrsh7th/cmp-vsnip'
use 'hrsh7th/vim-vsnip'
-- highlight variables under cursor
use 'RRethy/vim-illuminate'
-- this will automatically install listed dependencies
-- only the first time NeoVim is opened, because that's when Packer gets installed
if packerBootstrap then
require('packer').sync()
end
end)
require('leap').add_default_mappings()-- small plugin pre-init goes here
require("indent_blankline").setup {
char = "",
filetype_exclude = { "help", "alpha", "dashboard", "neo-tree", "Trouble", "lazy" },
--show_current_context = true,
--show_current_context_start = true,
}
require('mini.indentscope').setup({
symbol = "",
options = { try_as_border = true },
})
-- plugin specific configs go here
require('plugin-config/nvim-cmp')
require('plugin-config/telescope')
require('plugin-config/nvim-treesitter')
require('plugin-config/lsp-trouble')
require('plugin-config/lspsaga')
require('plugin-config/galaxyline')
require('plugin-config/gitsigns')
require('plugin-config/indent-guide-lines')
require('plugin-config/dressing')
require('plugin-config/noice')
require('plugin-config/ministarter')
require('plugin-config/smart-splits')
return packer

View File

@@ -0,0 +1,8 @@
-- ################# Basic settings dependent on plugins ################ --
-- ================= Visualization ================= --
vim.o.termguicolors = true
vim.o.background = 'dark'
vim.cmd('colorscheme catppuccin-macchiato')