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,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,
}
}
}