@ -0,0 +1,9 @@ | |||
-- General options and remaps | |||
require('config.general') | |||
-- Helper functions | |||
require('helper.toggle-tab-width') | |||
-- Plugins | |||
require('packer-plugins') |
@ -0,0 +1,5 @@ | |||
-- Set barbar's options | |||
require'bufferline'.setup { | |||
-- Enable/disable auto-hiding the tab bar when there is a single buffer | |||
auto_hide = true, | |||
} |
@ -0,0 +1,120 @@ | |||
local M = {} | |||
function M.setup() | |||
local has_words_before = function() | |||
local line, col = unpack(vim.api.nvim_win_get_cursor(0)) | |||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil | |||
end | |||
local luasnip = require("luasnip") | |||
local cmp = require("cmp") | |||
cmp.setup { | |||
completion = { completeopt = "menu,menuone,noinsert", keyword_length = 1 }, | |||
experimental = { native_menu = false, ghost_text = false }, | |||
snippet = { | |||
expand = function(args) | |||
require("luasnip").lsp_expand(args.body) | |||
end, | |||
}, | |||
formatting = { | |||
format = function(entry, vim_item) | |||
vim_item.menu = ({ | |||
nvim_lsp = "[LSP]", | |||
buffer = "[Buffer]", | |||
luasnip = "[Snip]", | |||
nvim_lua = "[Lua]", | |||
treesitter = "[Treesitter]", | |||
path = "[Path]", | |||
})[entry.source.name] | |||
return vim_item | |||
end, | |||
}, | |||
mapping = { | |||
["<C-k>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }), | |||
["<C-j>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }), | |||
["<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-e>"] = cmp.mapping { i = cmp.mapping.close(), c = cmp.mapping.close() }, | |||
["<CR>"] = cmp.mapping { | |||
i = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = false }, | |||
c = function(fallback) | |||
if cmp.visible() then | |||
cmp.confirm { behavior = cmp.ConfirmBehavior.Replace, select = false } | |||
else | |||
fallback() | |||
end | |||
end, | |||
}, | |||
["<Tab>"] = cmp.mapping( | |||
function(fallback) | |||
if cmp.visible() then | |||
cmp.select_next_item() | |||
elseif luasnip.expand_or_jumpable() then | |||
luasnip.expand_or_jump() | |||
elseif has_words_before() then | |||
cmp.complete() | |||
else | |||
fallback() | |||
end | |||
end, { | |||
"i", | |||
"s", | |||
"c", | |||
}), | |||
["<S-Tab>"] = cmp.mapping(function(fallback) | |||
if cmp.visible() then | |||
cmp.select_prev_item() | |||
elseif luasnip.jumpable(-1) then | |||
luasnip.jump(-1) | |||
else | |||
fallback() | |||
end | |||
end, { | |||
"i", | |||
"s", | |||
"c", | |||
}), | |||
}, | |||
sources = { | |||
{ name = "nvim_lsp" }, | |||
{ name = "treesitter" }, | |||
{ name = "buffer" }, | |||
{ name = "luasnip" }, | |||
{ name = "nvim_lua" }, | |||
{ name = "path" }, | |||
-- { name = "spell" }, | |||
-- { name = "emoji" }, | |||
-- { name = "calc" }, | |||
}, | |||
window = { | |||
documentation = { | |||
border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, | |||
winhighlight = "NormalFloat:NormalFloat,FloatBorder:TelescopeBorder", | |||
}, | |||
}, | |||
} | |||
-- Use buffer source for `/` | |||
cmp.setup.cmdline("/", { | |||
enabled = false | |||
-- mapping = cmp.mapping.preset.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' } | |||
}) | |||
}) | |||
end | |||
return M |
@ -0,0 +1,52 @@ | |||
local aucmd_dict = { | |||
FileType = { | |||
{ | |||
pattern = "dart,vue,js", | |||
callback = function() | |||
vim.opt_local.tabstop = 2 | |||
vim.opt_local.softtabstop = 2 | |||
vim.opt_local.shiftwidth = 2 | |||
end, | |||
}, | |||
}, | |||
BufWritePre = { | |||
{ | |||
command = [[%s/\s\+$//e]], | |||
}, | |||
{ | |||
pattern = '*.go', | |||
callback = function () require('go.format').gofmt() end, | |||
}, | |||
}, | |||
BufRead = { | |||
{ | |||
command = [[if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif]] | |||
}, | |||
{ | |||
pattern = { '*.docker' }, | |||
callback = function() | |||
vim.opt_local.syntax = 'dockerfile' | |||
end | |||
} | |||
}, | |||
BufNewFile = { | |||
{ | |||
pattern = { '*.docker' }, | |||
callback = function() | |||
vim.opt_local.syntax = 'dockerfile' | |||
end | |||
} | |||
}, | |||
VimLeave = { | |||
{ | |||
command = [[mksession! ~/.cache/nvim/session/shutdown_session.vim]] | |||
}, | |||
}, | |||
} | |||
for event, opt_tbls in pairs(aucmd_dict) do | |||
for _, opt_tbl in pairs(opt_tbls) do | |||
vim.api.nvim_create_autocmd(event, opt_tbl) | |||
end | |||
end |
@ -0,0 +1,3 @@ | |||
vim.cmd [[colorscheme moonfly]] | |||
@ -0,0 +1,6 @@ | |||
require('config.general.options') | |||
require('config.general.remaps') | |||
require('config.general.autocmd') | |||
require('config.general.colorscheme') |
@ -0,0 +1,28 @@ | |||
vim.g.mapleader = ',' | |||
vim.o.clipboard = 'unnamedplus' | |||
vim.o.nohlsearch = true | |||
vim.o.incsearch = true | |||
vim.o.ignorecase = true | |||
vim.o.mouse = 'a' | |||
vim.o.smartcase = true | |||
vim.o.linebreak = true | |||
vim.o.noswapfile = true | |||
vim.o.nobackup = true | |||
vim.o.undodir = vim.fn.expand('~/.cache/nvim/undodir') | |||
vim.o.undofile = true | |||
vim.o.encoding = 'utf-8' | |||
vim.o.number = true | |||
vim.o.relativenumber = true | |||
vim.o.tabstop = 4 | |||
vim.o.softtabstop = 4 | |||
vim.o.expandtab = true | |||
vim.o.shiftwidth = 4 | |||
vim.o.smarttab = true | |||
vim.o.formatoptions = 'tqj' |
@ -0,0 +1,41 @@ | |||
local options = { noremap = true } | |||
vim.api.nvim_set_keymap('n', 'c', '"_c', options) | |||
-- Easily open splits | |||
vim.api.nvim_set_keymap('n', '<leader>hs', '<cmd>split<cr>', options) | |||
vim.api.nvim_set_keymap('n', '<leader>vs', '<cmd>vsplit<cr>', options) | |||
-- Copy the entire file | |||
vim.api.nvim_set_keymap('n', '<leader>y', 'ggyG<C-o>', options) | |||
-- Manually store session | |||
vim.api.nvim_set_keymap('n', '<F5>', '<cmd>mksession! ~/.cache//nvim/session/manual_session.vim<cr>', options) | |||
-- Restore manually stored session | |||
vim.api.nvim_set_keymap('n', '<F6>', '<cmd>source ~/.cache/nvim/session/manual_session.vim<cr>', options) | |||
-- Restore auto saved session created on exit | |||
vim.api.nvim_set_keymap('n', '<F7>', '<cmd>source ~/.cache/nvim/session/shutdown_session.vim<CR>', options) | |||
-- Replace all is aliased to S. | |||
vim.api.nvim_set_keymap('n', '<C-s>', '<cmd>%s//g<Left><Left>', options) | |||
-- Navigating with guides | |||
vim.api.nvim_set_keymap('n', '<leader><leader>', '<Esc>/<++><Enter>"_c4l', options) | |||
vim.api.nvim_set_keymap('i', '<leader><leader>', '<Esc>/<++><Enter>"_c4l', options) | |||
vim.api.nvim_set_keymap('v', '<leader><leader>', '<Esc>/<++><Enter>"_c4l', options) | |||
-- Spell-check | |||
vim.api.nvim_set_keymap('n', '<leader>o', '<cmd>setlocal spell! spelllang=en_au<cr>', options) | |||
vim.api.nvim_set_keymap('n', '<A-<>', '<Cmd>BufferMovePrevious<CR>', options) | |||
vim.api.nvim_set_keymap('n', '<A->>', '<Cmd>BufferMoveNext<CR>', options) | |||
vim.api.nvim_set_keymap('n', '<A-1>', '<Cmd>BufferGoto 1<CR>', options) | |||
vim.api.nvim_set_keymap('n', '<A-2>', '<Cmd>BufferGoto 2<CR>', options) | |||
vim.api.nvim_set_keymap('n', '<A-3>', '<Cmd>BufferGoto 3<CR>', options) | |||
vim.api.nvim_set_keymap('n', '<A-4>', '<Cmd>BufferGoto 4<CR>', options) | |||
vim.api.nvim_set_keymap('n', '<A-5>', '<Cmd>BufferGoto 5<CR>', options) | |||
vim.api.nvim_set_keymap('n', '<A-6>', '<Cmd>BufferGoto 6<CR>', options) | |||
vim.api.nvim_set_keymap('n', '<A-7>', '<Cmd>BufferGoto 7<CR>', options) | |||
vim.api.nvim_set_keymap('n', '<A-8>', '<Cmd>BufferGoto 8<CR>', options) | |||
vim.api.nvim_set_keymap('n', '<A-9>', '<Cmd>BufferGoto 9<CR>', options) |
@ -0,0 +1,41 @@ | |||
require('gitsigns').setup { | |||
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 = true, -- Toggle with `:Gitsigns toggle_current_line_blame` | |||
current_line_blame_opts = { | |||
virt_text = true, | |||
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' | |||
delay = 1000, | |||
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, -- Disable if file is longer than this (in lines) | |||
preview_config = { | |||
-- Options passed to nvim_open_win | |||
border = 'single', | |||
style = 'minimal', | |||
relative = 'cursor', | |||
row = 0, | |||
col = 1 | |||
}, | |||
yadm = { | |||
enable = false | |||
}, | |||
} |
@ -0,0 +1 @@ | |||
require('go').setup() |
@ -0,0 +1,52 @@ | |||
local M = {} | |||
local servers = { | |||
gopls = {}, | |||
html = {}, | |||
jsonls = {}, | |||
pyright = {}, | |||
tsserver = {}, | |||
vimls = {}, | |||
dartls = {}, | |||
dockerls = {}, | |||
intelephense = {}, | |||
sqlls = {}, | |||
volar = {}, | |||
} | |||
local function on_attach(client, bufnr) | |||
-- Enable completion triggered by <C-X><C-O> | |||
-- See `:help omnifunc` and `:help ins-completion` for more information. | |||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") | |||
-- Use LSP as the handler for formatexpr. | |||
-- See `:help formatexpr` for more information. | |||
vim.api.nvim_buf_set_option(0, "formatexpr", "v:lua.vim.lsp.formatexpr()") | |||
-- Configure key mappings | |||
require("config.lsp.keymaps").setup(client, bufnr) | |||
end | |||
local lsp_signature = require "lsp_signature" | |||
lsp_signature.setup { | |||
bind = true, | |||
handler_opts = { | |||
border = "rounded", | |||
}, | |||
} | |||
local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) | |||
local opts = { | |||
on_attach = on_attach, | |||
capabilities = cababilities, | |||
flags = { | |||
debounce_text_changes = 150, | |||
}, | |||
} | |||
function M.setup() | |||
require("config.lsp.installer").setup(servers, opts) | |||
end | |||
return M |
@ -0,0 +1,26 @@ | |||
local lsp_installer_servers = require "nvim-lsp-installer.servers" | |||
local utils = require "utils" | |||
local M = {} | |||
function M.setup(servers, options) | |||
for server_name, _ in pairs(servers) do | |||
local server_available, server = lsp_installer_servers.get_server(server_name) | |||
if server_available then | |||
server:on_ready(function() | |||
local opts = vim.tbl_deep_extend("force", options, servers[server.name] or {}) | |||
server:setup(opts) | |||
end) | |||
if not server:is_installed() then | |||
utils.info("Installing " .. server.name) | |||
server:install() | |||
end | |||
else | |||
utils.error(server) | |||
end | |||
end | |||
end | |||
return M |
@ -0,0 +1,37 @@ | |||
local M = {} | |||
local keymap = vim.api.nvim_set_keymap | |||
local buf_keymap = vim.api.nvim_buf_set_keymap | |||
local function keymappings(client, bufnr) | |||
local opts = { noremap = true, silent = true } | |||
-- Key mappings | |||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) | |||
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) | |||
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts) | |||
vim.keymap.set("n", "[e", function () vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR}) end, opts) | |||
vim.keymap.set("n", "]e", function () vim.diagnostic.goto_next({severity = vim.diagnostic.severity.ERROR}) end, opts) | |||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts) | |||
vim.keymap.set("n", "K", vim.lsp.buf.code_action, opts) | |||
vim.keymap.set("n", "<leader>of", vim.diagnostic.open_float, opts) | |||
-- if client.resolved_capabilities.document_formatting then | |||
-- vim.keymap.set("n", "<leader>ff", vim.lsp.buf.formatting, opts) | |||
-- end | |||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) | |||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts) | |||
-- vim.keymap.set("n", "gr", function() vim.lsp.buf.references({ includeDeclaration = false }) end, opts) | |||
vim.keymap.set("n", "gh", vim.lsp.buf.signature_help, opts) | |||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts) | |||
vim.keymap.set("n", "gT", vim.lsp.buf.type_definition, opts) | |||
end | |||
function M.setup(client, bufnr) | |||
keymappings(client, bufnr) | |||
end | |||
return M |
@ -0,0 +1,40 @@ | |||
require('lualine').setup { | |||
options = { | |||
icons_enabled = true, | |||
theme = 'moonfly', | |||
component_separators = { left = '', right = ''}, | |||
section_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 = {'encoding', 'fileformat', 'filetype'}, | |||
lualine_y = {'progress'}, | |||
lualine_z = {'location'} | |||
}, | |||
inactive_sections = { | |||
lualine_a = {}, | |||
lualine_b = {}, | |||
lualine_c = {'filename'}, | |||
lualine_x = {'location'}, | |||
lualine_y = {}, | |||
lualine_z = {} | |||
}, | |||
tabline = {}, | |||
winbar = {}, | |||
inactive_winbar = {}, | |||
extensions = {} | |||
} |
@ -0,0 +1,14 @@ | |||
local M = {} | |||
function M.setup() | |||
local luasnip = require "luasnip" | |||
luasnip.config.set_config { | |||
history = false, | |||
updateevents = "TextChanged,TextChangedI", | |||
} | |||
require("luasnip/loaders/from_vscode").load() | |||
end | |||
return M |
@ -0,0 +1,205 @@ | |||
-- Unless you are still migrating, remove the deprecated commands from v1.x | |||
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) | |||
-- If you want icons for diagnostic errors, you'll need to define them somewhere: | |||
vim.fn.sign_define("DiagnosticSignError", | |||
{text = " ", texthl = "DiagnosticSignError"}) | |||
vim.fn.sign_define("DiagnosticSignWarn", | |||
{text = " ", texthl = "DiagnosticSignWarn"}) | |||
vim.fn.sign_define("DiagnosticSignInfo", | |||
{text = " ", texthl = "DiagnosticSignInfo"}) | |||
vim.fn.sign_define("DiagnosticSignHint", | |||
{text = "", texthl = "DiagnosticSignHint"}) | |||
-- NOTE: this is changed from v1.x, which used the old style of highlight groups | |||
-- in the form "LspDiagnosticsSignWarning" | |||
require("neo-tree").setup({ | |||
close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab | |||
popup_border_style = "rounded", | |||
enable_git_status = true, | |||
enable_diagnostics = true, | |||
sort_case_insensitive = false, -- used when sorting files and directories in the tree | |||
sort_function = nil , -- use a custom function for sorting files and directories in the tree | |||
-- sort_function = function (a,b) | |||
-- if a.type == b.type then | |||
-- return a.path > b.path | |||
-- else | |||
-- return a.type > b.type | |||
-- end | |||
-- end , -- this sorts files and directories descendantly | |||
default_component_configs = { | |||
container = { | |||
enable_character_fade = true | |||
}, | |||
indent = { | |||
indent_size = 2, | |||
padding = 1, -- extra padding on left hand side | |||
-- indent guides | |||
with_markers = true, | |||
indent_marker = "│", | |||
last_indent_marker = "└", | |||
highlight = "NeoTreeIndentMarker", | |||
-- expander config, needed for nesting files | |||
with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders | |||
expander_collapsed = "", | |||
expander_expanded = "", | |||
expander_highlight = "NeoTreeExpander", | |||
}, | |||
icon = { | |||
folder_closed = "", | |||
folder_open = "", | |||
folder_empty = "ﰊ", | |||
-- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there | |||
-- then these will never be used. | |||
default = "*", | |||
highlight = "NeoTreeFileIcon" | |||
}, | |||
modified = { | |||
symbol = "[+]", | |||
highlight = "NeoTreeModified", | |||
}, | |||
name = { | |||
trailing_slash = false, | |||
use_git_status_colors = true, | |||
highlight = "NeoTreeFileName", | |||
}, | |||
git_status = { | |||
symbols = { | |||
-- Change type | |||
added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name | |||
modified = "", -- or "", but this is redundant info if you use git_status_colors on the name | |||
deleted = "✖",-- this can only be used in the git_status source | |||
renamed = "",-- this can only be used in the git_status source | |||
-- Status type | |||
untracked = "", | |||
ignored = "", | |||
unstaged = "", | |||
staged = "", | |||
conflict = "", | |||
} | |||
}, | |||
}, | |||
window = { | |||
position = "left", | |||
width = 40, | |||
mapping_options = { | |||
noremap = true, | |||
nowait = true, | |||
}, | |||
mappings = { | |||
["<space>"] = { | |||
"toggle_node", | |||
nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use | |||
}, | |||
["<2-LeftMouse>"] = "open", | |||
["<cr>"] = "open", | |||
["S"] = "open_split", | |||
["s"] = "open_vsplit", | |||
-- ["S"] = "split_with_window_picker", | |||
-- ["s"] = "vsplit_with_window_picker", | |||
["t"] = "open_tabnew", | |||
["w"] = "open_with_window_picker", | |||
["C"] = "close_node", | |||
["z"] = "close_all_nodes", | |||
--["Z"] = "expand_all_nodes", | |||
["a"] = { | |||
"add", | |||
-- some commands may take optional config options, see `:h neo-tree-mappings` for details | |||
config = { | |||
show_path = "none" -- "none", "relative", "absolute" | |||
} | |||
}, | |||
["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". | |||
["d"] = "delete", | |||
["r"] = "rename", | |||
["y"] = "copy_to_clipboard", | |||
["x"] = "cut_to_clipboard", | |||
["p"] = "paste_from_clipboard", | |||
["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add": | |||
-- ["c"] = { | |||
-- "copy", | |||
-- config = { | |||
-- show_path = "none" -- "none", "relative", "absolute" | |||
-- } | |||
--} | |||
["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add". | |||
["q"] = "close_window", | |||
["R"] = "refresh", | |||
["?"] = "show_help", | |||
["<"] = "prev_source", | |||
[">"] = "next_source", | |||
} | |||
}, | |||
nesting_rules = {}, | |||
filesystem = { | |||
filtered_items = { | |||
visible = false, -- when true, they will just be displayed differently than normal items | |||
hide_dotfiles = true, | |||
hide_gitignored = true, | |||
hide_hidden = true, -- only works on Windows for hidden files/directories | |||
hide_by_name = { | |||
--"node_modules" | |||
}, | |||
hide_by_pattern = { -- uses glob style patterns | |||
--"*.meta" | |||
}, | |||
never_show = { -- remains hidden even if visible is toggled to true | |||
--".DS_Store", | |||
--"thumbs.db" | |||
}, | |||
}, | |||
follow_current_file = false, -- This will find and focus the file in the active buffer every | |||
-- time the current file is changed while the tree is open. | |||
group_empty_dirs = false, -- when true, empty folders will be grouped together | |||
hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree | |||
-- in whatever position is specified in window.position | |||
-- "open_current", -- netrw disabled, opening a directory opens within the | |||
-- window like netrw would, regardless of window.position | |||
-- "disabled", -- netrw left alone, neo-tree does not handle opening dirs | |||
use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes | |||
-- instead of relying on nvim autocmd events. | |||
window = { | |||
mappings = { | |||
["<bs>"] = "navigate_up", | |||
["."] = "set_root", | |||
["H"] = "toggle_hidden", | |||
["/"] = "fuzzy_finder", | |||
["D"] = "fuzzy_finder_directory", | |||
["f"] = "filter_on_submit", | |||
["<c-x>"] = "clear_filter", | |||
["[g"] = "prev_git_modified", | |||
["]g"] = "next_git_modified", | |||
} | |||
} | |||
}, | |||
buffers = { | |||
follow_current_file = true, -- This will find and focus the file in the active buffer every | |||
-- time the current file is changed while the tree is open. | |||
group_empty_dirs = true, -- when true, empty folders will be grouped together | |||
show_unloaded = true, | |||
window = { | |||
mappings = { | |||
["bd"] = "buffer_delete", | |||
["<bs>"] = "navigate_up", | |||
["."] = "set_root", | |||
} | |||
}, | |||
}, | |||
git_status = { | |||
window = { | |||
position = "float", | |||
mappings = { | |||
["A"] = "git_add_all", | |||
["gu"] = "git_unstage_file", | |||
["ga"] = "git_add_file", | |||
["gr"] = "git_revert_file", | |||
["gc"] = "git_commit", | |||
["gp"] = "git_push", | |||
["gg"] = "git_commit_and_push", | |||
} | |||
} | |||
} | |||
}) | |||
vim.api.nvim_set_keymap('n', '<C-q>', '<Cmd>Neotree toggle<CR>', { noremap = true }) |
@ -0,0 +1,7 @@ | |||
vim.keymap.set('n', '<C-d>', function () | |||
if vim.bo.filetype ~= 'php' then | |||
return | |||
end | |||
vim.api.nvim_call_function("PhpDocSingle", {}) | |||
end, options) |
@ -0,0 +1,71 @@ | |||
local pickers = require("telescope.pickers") | |||
local finders = require("telescope.finders") | |||
local previewers = require("telescope.previewers") | |||
local action_state = require("telescope.actions.state") | |||
local conf = require("telescope.config").values | |||
local actions = require("telescope.actions") | |||
require("telescope").setup({ | |||
defaults = { | |||
file_sorter = require("telescope.sorters").get_fzy_sorter, | |||
prompt_prefix = " >", | |||
color_devicons = true, | |||
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, | |||
mappings = { | |||
i = { | |||
["<C-x>"] = false, | |||
["<C-q>"] = actions.send_to_qflist, | |||
}, | |||
}, | |||
}, | |||
}) | |||
local M = {} | |||
function git_branches () | |||
require("telescope.builtin").git_branches({ | |||
attach_mappings = function(_, map) | |||
map("i", "<c-d>", actions.git_delete_branch) | |||
map("n", "<c-d>", actions.git_delete_branch) | |||
return true | |||
end, | |||
}) | |||
end | |||
local options = { noremap = true } | |||
-- vim.keymap.set('n', '<C-g>', function() | |||
-- local term = vim.fn.input("Grep For > ") | |||
-- if term == '' then | |||
-- return | |||
-- end | |||
-- require('telescope.builtin').grep_string({ search = term }) | |||
-- end, options) | |||
vim.keymap.set('n', '<C-g>', require('telescope.builtin').live_grep, options) | |||
vim.keymap.set('n', '<C-p>', function() | |||
local ran, errorMessage = pcall(function() | |||
require('telescope.builtin').git_files({ show_untracked = true }) | |||
end) | |||
if not ran then | |||
require('telescope.builtin').find_files() | |||
end | |||
end, options) | |||
-- vim.keymap.set('n', '<C-q>', function() | |||
-- end, options) | |||
vim.keymap.set('n', '<leader>fb', require('telescope.builtin').buffers, options) | |||
vim.keymap.set('n', '<leader>fo', require('telescope.builtin').oldfiles, options) | |||
vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, options) | |||
vim.keymap.set('n', '<leader>m', require('telescope.builtin').marks, options) | |||
vim.keymap.set('n', '<leader>ch', require('telescope.builtin').command_history, options) | |||
vim.keymap.set('n', '<leader>gb', git_branches, options) | |||
vim.keymap.set('n', '<leader>gs', require('telescope.builtin').git_status, options) |
@ -0,0 +1,17 @@ | |||
require("tmux").setup({ | |||
-- overwrite default configuration | |||
-- here, e.g. to enable default bindings | |||
copy_sync = { | |||
-- enables copy sync and overwrites all register actions to | |||
-- sync registers *, +, unnamed, and 0 till 9 from tmux in advance | |||
enable = true, | |||
}, | |||
navigation = { | |||
-- enables default keybindings (C-hjkl) for normal mode | |||
enable_default_keybindings = true, | |||
}, | |||
resize = { | |||
-- enables default keybindings (A-hjkl) for normal mode | |||
enable_default_keybindings = true, | |||
} | |||
}) |
@ -0,0 +1,25 @@ | |||
require('nvim-treesitter.configs').setup { | |||
-- A list of parser names, or "all" | |||
ensure_installed = { 'go', 'dart', 'php', 'javascript' }, | |||
-- Install parsers synchronously (only applied to `ensure_installed`) | |||
sync_install = false, | |||
-- Automatically install missing parsers when entering buffer | |||
auto_install = true, | |||
indent = { | |||
enable = true, | |||
}, | |||
highlight = { | |||
-- `false` will disable the whole extension | |||
enable = true, | |||
-- 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, | |||
}, | |||
} |
@ -0,0 +1,19 @@ | |||
local tabWidth = 4 | |||
function ToggleTabWidth() | |||
if tabWidth == 2 then | |||
vim.o.tabstop = 4 | |||
vim.o.softtabstop = 4 | |||
vim.o.shiftwidth = 4 | |||
tabWidth = 4 | |||
print('Set tab width to 4') | |||
return | |||
end | |||
vim.o.tabstop = 2 | |||
vim.o.softtabstop = 2 | |||
vim.o.shiftwidth = 2 | |||
tabWidth = 2 | |||
print('Set tab width to 2') | |||
end | |||
vim.keymap.set('n', '<leader>t', ToggleTabWidth, { noremap = true}) |
@ -0,0 +1,143 @@ | |||
return require('packer').startup(function() | |||
-- Packer can manage itself | |||
use 'wbthomason/packer.nvim' | |||
-- colorschemes | |||
use 'gruvbox-community/gruvbox' | |||
use 'bluz71/vim-moonfly-colors' | |||
use { 'neoclide/coc.nvim', run = 'yarn install', disable = true } | |||
use { "williamboman/nvim-lsp-installer" } | |||
use { 'SirVer/ultisnips' } | |||
use { | |||
"neovim/nvim-lspconfig", | |||
event = "BufReadPre", | |||
wants = { "cmp-nvim-lsp", "nvim-lsp-installer", "lsp_signature.nvim" }, | |||
config = function() | |||
require("config.lsp").setup() | |||
end, | |||
requires = { | |||
"williamboman/nvim-lsp-installer", | |||
"ray-x/lsp_signature.nvim", | |||
}, | |||
} | |||
use { | |||
"ray-x/lsp_signature.nvim", | |||
} | |||
use { | |||
"hrsh7th/nvim-cmp", | |||
event = "InsertEnter", | |||
requires = { | |||
{ "hrsh7th/cmp-nvim-lsp", after = "nvim-cmp" }, | |||
{ "f3fora/cmp-spell", after = "nvim-cmp" }, | |||
{ "hrsh7th/cmp-path", after = "nvim-cmp" }, | |||
{ "hrsh7th/cmp-buffer", after = "nvim-cmp" }, | |||
{ "hrsh7th/cmp-calc", after = "nvim-cmp" }, | |||
{ "quangnguyen30192/cmp-nvim-ultisnips", after = "nvim-cmp" }, | |||
{ | |||
"L3MON4D3/LuaSnip", | |||
-- after = 'nvim-cmp', | |||
wants = "friendly-snippets", | |||
requires = { | |||
{ "rafamadriz/friendly-snippets", after = 'nvim-cmp' }, | |||
}, | |||
config = function() | |||
require("config.luasnip").setup() | |||
end, | |||
}, | |||
}, | |||
config = function() | |||
require("config.cmp").setup() | |||
end, | |||
disable = false, | |||
} | |||
use 'nvim-lua/popup.nvim' | |||
use 'nvim-lua/plenary.nvim' | |||
use { | |||
'nvim-telescope/telescope.nvim', | |||
config = function() | |||
require('config.telescope') | |||
end | |||
} | |||
use 'nvim-telescope/telescope-fzy-native.nvim' | |||
use { | |||
'Rican7/php-doc-modded', | |||
config = function() | |||
require('config.php-doc') | |||
end | |||
} | |||
use 'dart-lang/dart-vim-plugin' | |||
use { 'nvim-treesitter/nvim-treesitter' } | |||
use { | |||
'romgrk/barbar.nvim', | |||
requires = {'kyazdani42/nvim-web-devicons'}, | |||
config = function() | |||
require('config.barbar') | |||
end | |||
} | |||
use { | |||
'lewis6991/gitsigns.nvim', | |||
config = function() | |||
require('config.gitsigns') | |||
end | |||
} | |||
use { | |||
'nvim-lualine/lualine.nvim', | |||
requires = { 'kyazdani42/nvim-web-devicons', opt = true }, | |||
config = function() | |||
require('config.lualine') | |||
end | |||
} | |||
use { | |||
'ray-x/go.nvim', | |||
config = function() | |||
require('config.go') | |||
end | |||
} | |||
use {'ray-x/guihua.lua', run = 'cd lua/fzy && make'} | |||
use { | |||
'aserowy/tmux.nvim', | |||
config = function () | |||
require('config.tmux') | |||
end | |||
} | |||
use { | |||
"nvim-neo-tree/neo-tree.nvim", | |||
branch = "v2.x", | |||
requires = { | |||
"nvim-lua/plenary.nvim", | |||
"kyazdani42/nvim-web-devicons", -- not strictly required, but recommended | |||
"MunifTanjim/nui.nvim", | |||
}, | |||
config = function () | |||
require('config.nvim-neo-tree') | |||
end | |||
} | |||
use { | |||
"startup-nvim/startup.nvim", | |||
requires = {"nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim"}, | |||
config = function() | |||
require"startup".setup() | |||
end | |||
} | |||
-- Local nvim plugin development | |||
-- use '~/Software/nvim-phpdoc/phpdoc.nvim' | |||
end) |
@ -0,0 +1,37 @@ | |||
_G.dump = function(...) | |||
print(vim.inspect(...)) | |||
end | |||
_G.prequire = function(...) | |||
local status, lib = pcall(require, ...) | |||
if status then | |||
return lib | |||
end | |||
return nil | |||
end | |||
local M = {} | |||
function M.t(str) | |||
return vim.api.nvim_replace_termcodes(str, true, true, true) | |||
end | |||
function M.log(msg, hl, name) | |||
name = name or "Neovim" | |||
hl = hl or "Todo" | |||
vim.api.nvim_echo({ { name .. ": ", hl }, { msg } }, true, {}) | |||
end | |||
function M.warn(msg, name) | |||
vim.notify(msg, vim.log.levels.WARN, { title = name }) | |||
end | |||
function M.error(msg, name) | |||
vim.notify(msg, vim.log.levels.ERROR, { title = name }) | |||
end | |||
function M.info(msg, name) | |||
vim.notify(msg, vim.log.levels.INFO, { title = name }) | |||
end | |||
return M |