moved new files over
This commit is contained in:
@@ -1 +0,0 @@
|
||||
vim.api.nvim_del_keymap("n", "<leader>co")
|
||||
@@ -1,3 +0,0 @@
|
||||
vim.o.foldlevelstart = 10
|
||||
vim.o.foldmethod = "expr"
|
||||
vim.o.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
@@ -1,4 +0,0 @@
|
||||
---- automatically opens all marked files
|
||||
--_G.harpoon_open_marks()
|
||||
---- sets tab switch mode to harpoon marks
|
||||
--_G.harpoon_btoggle(true)
|
||||
@@ -1,15 +1,3 @@
|
||||
--require("ale")
|
||||
require("packer_check")
|
||||
require("base")
|
||||
require("plugins")
|
||||
require("config")
|
||||
require("keybinds")
|
||||
--require("save_buffer_position")
|
||||
require("lsp")
|
||||
|
||||
--local theme = vim.env.LIGHTMODE == "1" and "onehalflight" or "onedark"
|
||||
--vim.cmd("colorscheme " .. theme)
|
||||
|
||||
--vim.g.onedark_terminal_italics = true
|
||||
--vim.opt.background = "light"
|
||||
--vim.opt.background = "dark"
|
||||
vim.cmd("colorscheme onedark")
|
||||
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
local g = vim.g
|
||||
|
||||
-- neds to be before plugin startup
|
||||
g.ale_completion_enabled = false
|
||||
g.ale_linters_explicit = true
|
||||
|
||||
g.ale_fix_on_save = false
|
||||
g.ale_fixers = {
|
||||
--c = {"clang-format"},
|
||||
cpp = { "clang-format" },
|
||||
sh = { "shfmt" },
|
||||
python = { "isort", "black" },
|
||||
lua = { "luafmt" },
|
||||
json = { "prettier" },
|
||||
css = { "prettier" },
|
||||
scss = { "prettier" },
|
||||
html = { "prettier" },
|
||||
javascript = { "prettier" },
|
||||
typescript = { "prettier" },
|
||||
javascriptreact = { "prettier" },
|
||||
typescriptreact = { "prettier" },
|
||||
htmldjango = { "prettier" },
|
||||
}
|
||||
|
||||
g.ale_linters = {
|
||||
sh = { "bashate" },
|
||||
--python = {"flake8"},
|
||||
--cpp = {"g++"},
|
||||
--html = {"tidy"},
|
||||
--css = {"stylelint"}
|
||||
}
|
||||
|
||||
g.ale_lint_on_text_changed = "normal"
|
||||
--g.ale_lint_on_text_changed = "never"
|
||||
g.ale_lint_on_enter = true
|
||||
g.ale_lint_on_insert_leave = true
|
||||
g.ale_lint_on_filetype_changed = false
|
||||
g.ale_lint_on_save = false
|
||||
|
||||
--local flake8_ignore_args = "--ignore=E501,E265,E402,E262,E261,E241,E266"
|
||||
--g.ale_python_flake8_options = flake8_ignore_args
|
||||
--g.ale_python_autopep8_options = flake8_ignore_args
|
||||
--g.ale_lua_luafmt_options = ""
|
||||
--g.ale_javascript_prettier_options = "--print-width 120 --tab-width 4"
|
||||
g.ale_c_clangformat_options = '-style="{IndentWidth: 4,TabWidth: 4}"'
|
||||
g.ale_sh_bashate_options = "-i E006,E042,E003"
|
||||
--g.ale_sh_shfmt_options = "-kp -s"
|
||||
@@ -0,0 +1,98 @@
|
||||
-- SHOULD NOT CONTAIN ANY SETTINGS RELATED TO EXTERNAL PLUGINS
|
||||
-- OR CUSTOM CODE YOU YOURSELF WROTE.
|
||||
|
||||
local helpers = require("helpers")
|
||||
local map = helpers.map
|
||||
|
||||
local opt = vim.opt
|
||||
local g = vim.g
|
||||
|
||||
g.mapleader = ","
|
||||
|
||||
map("v", "<C-C>", '"+y')
|
||||
map("n", "<Tab>", ":bnext<CR>")
|
||||
map("n", "<S-Tab>", ":bprevious<CR>")
|
||||
map("n", "<Esc>", ":noh<CR><Esc>", { silent = true }) --After searching, pressing escape stops the highlight
|
||||
|
||||
map("n", "<Leader>w", [[:%s/\s\+$//e<CR>]])
|
||||
map("n", "<Leader>x", ":bp|bd #<CR>")
|
||||
map("n", "<Leader>t", ":tabnew<CR>")
|
||||
|
||||
-- Move split
|
||||
map("n", "<A-Right>", "<C-W><S-L>")
|
||||
map("n", "<A-Left>", "<C-W><S-H>")
|
||||
map("n", "<A-Up>", "<C-W><S-K>")
|
||||
map("n", "<A-Down>", "<C-W><S-J>")
|
||||
|
||||
-- Split navigations
|
||||
map("n", "<C-Right>", "<C-W><C-L>")
|
||||
map("n", "<C-Left>", "<C-W><C-H>")
|
||||
map("n", "<C-Up>", "<C-W><C-K>")
|
||||
map("n", "<C-Down>", "<C-W><C-J>")
|
||||
|
||||
-- Resize split
|
||||
map("n", "-", "<C-W>-")
|
||||
map("n", "+", "<C-W>+")
|
||||
map("n", "(", "<C-W><")
|
||||
map("n", ")", "<C-W>>")
|
||||
|
||||
-- Scroll viewport
|
||||
map("n", "<S-Up>", "<C-Y>")
|
||||
map("n", "<S-Down>", "<C-E>")
|
||||
map("v", "<S-Up>", "<C-Y>")
|
||||
map("v", "<S-Down>", "<C-E>")
|
||||
map("i", "<S-Up>", "<C-X><C-Y>")
|
||||
map("i", "<S-Down>", "<C-X><C-E>")
|
||||
|
||||
-- Make visual yanks place the cursor back where started
|
||||
map("v", "y", "ygv<Esc>")
|
||||
|
||||
-- Terminal binds
|
||||
local term_command = "split | set norelativenumber | set nonumber | term"
|
||||
map("t", "<C-Space>", [[<C-\><C-n>]])
|
||||
map("n", [[<Leader>\]], ":" .. term_command .. "<CR>")
|
||||
map("n", [[<Leader>|]], ":v" .. term_command .. "<CR>")
|
||||
|
||||
|
||||
opt.autoindent = true
|
||||
opt.autoread = true
|
||||
opt.cursorcolumn = true
|
||||
opt.cursorline = true
|
||||
opt.expandtab = true
|
||||
opt.hlsearch = true
|
||||
opt.ignorecase = true
|
||||
opt.incsearch = true -- Shows the match while typing
|
||||
opt.linebreak = true
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
opt.ruler = true
|
||||
opt.showcmd = true
|
||||
opt.smartcase = true
|
||||
opt.smartindent = true
|
||||
opt.splitbelow = true
|
||||
opt.splitright = true
|
||||
opt.termguicolors = false
|
||||
opt.title = true
|
||||
opt.undofile = true
|
||||
opt.wildmenu = true
|
||||
|
||||
opt.encoding = "utf-8"
|
||||
opt.fileformat = "unix"
|
||||
opt.inccommand = "split" -- Get a preview of replacements
|
||||
opt.titlestring = [[NVIM: [%{fnamemodify(getcwd(), ':t')}] %t]]
|
||||
|
||||
opt.scrolloff = 4 -- Lines of context
|
||||
opt.shiftwidth = 4
|
||||
opt.synmaxcol = 4000
|
||||
opt.tabstop = 4
|
||||
opt.textwidth = 0
|
||||
|
||||
opt.foldmethod = "indent"
|
||||
opt.foldlevelstart = 10
|
||||
|
||||
vim.cmd([[hi CursorLine cterm=NONE ctermbg=darkgray ctermfg=white]])
|
||||
vim.cmd([[au BufRead,BufNewFile .env.* set filetype=sh]])
|
||||
vim.cmd([[au BufRead,BufNewFile Dockerfile.* set filetype=dockerfile]])
|
||||
|
||||
-- redo folds on write
|
||||
vim.cmd([[au BufWrite * normal zx]])
|
||||
-291
@@ -1,291 +0,0 @@
|
||||
-- env file highlighting
|
||||
vim.cmd([[au BufRead,BufNewFile .env.* set filetype=sh]])
|
||||
-- Dockerfile file highlighting
|
||||
vim.cmd([[au BufRead,BufNewFile Dockerfile.* set filetype=dockerfile]])
|
||||
-- redo folds on write
|
||||
--vim.cmd([[au BufWrite * normal zx]])
|
||||
-- jinja highlighting
|
||||
vim.cmd([[au BufRead,BufNewFile *.jinja set filetype=html]])
|
||||
|
||||
local opt = vim.opt -- to set options
|
||||
local fn = vim.fn
|
||||
local g = vim.g
|
||||
|
||||
opt.autoindent = true
|
||||
opt.autoread = true
|
||||
--opt.autowrite = true
|
||||
opt.expandtab = true
|
||||
opt.hlsearch = true
|
||||
opt.ignorecase = true
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
opt.ruler = true
|
||||
opt.showcmd = true
|
||||
opt.smartcase = true
|
||||
opt.smartindent = true
|
||||
opt.splitbelow = true
|
||||
opt.splitright = true
|
||||
opt.title = true
|
||||
opt.wildmenu = true
|
||||
opt.termguicolors = true
|
||||
opt.linebreak = true
|
||||
|
||||
opt.inccommand = "split" -- Get a preview of replacements
|
||||
opt.incsearch = true -- Shows the match while typing
|
||||
|
||||
opt.undofile = true
|
||||
--opt.undodir = "~/.local/share/nvim/undodir"
|
||||
|
||||
opt.encoding = "utf-8"
|
||||
opt.fileformat = "unix"
|
||||
opt.scrolloff = 4 -- Lines of context
|
||||
opt.shiftwidth = 4
|
||||
opt.tabstop = 4
|
||||
opt.synmaxcol = 4000
|
||||
opt.textwidth = 0
|
||||
--opt.titlestring = "NVIM: %f"
|
||||
opt.titlestring = [[NVIM: [%{fnamemodify(getcwd(), ':t')}] %t]]
|
||||
|
||||
opt.cursorline = true
|
||||
opt.cursorcolumn = true
|
||||
|
||||
--opt.foldlevel = 1
|
||||
opt.foldlevelstart = 10
|
||||
--opt.foldenable = false
|
||||
--opt.foldmethod = "syntax"
|
||||
|
||||
local version = vim.version()
|
||||
if version.api_level == 9 then
|
||||
opt.foldmethod = "indent"
|
||||
else
|
||||
opt.foldmethod = "expr"
|
||||
opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
end
|
||||
|
||||
opt.termguicolors = false
|
||||
|
||||
vim.cmd([[hi CursorLine cterm=NONE ctermbg=darkgray ctermfg=white]])
|
||||
|
||||
-----------------------------------------------------
|
||||
-- DISABLE HIGHLIGHT OUTSIDE OF SEARCH AND REPLACE --
|
||||
-----------------------------------------------------
|
||||
--vim.cmd([[
|
||||
--" Enable highlighting all the matches in incsearch mode
|
||||
--" But don't enable hlsearch always
|
||||
--augroup vimrc-incsearch-highlight
|
||||
-- autocmd!
|
||||
-- autocmd CmdlineEnter [/\?:] :set hlsearch
|
||||
-- autocmd CmdlineLeave [/\?:] :set nohlsearch
|
||||
--augroup END
|
||||
--]])
|
||||
|
||||
---------------
|
||||
-- PROVIDERS --
|
||||
---------------
|
||||
--local pyenv_root = vim.env.PYENV_ROOT
|
||||
--if pyenv_root ~= nil then
|
||||
-- g.python3_host_prog = pyenv_root .. "/shims/python3"
|
||||
--else
|
||||
-- g.python3_host_prog = "/usr/bin/python3"
|
||||
--end
|
||||
|
||||
------------------
|
||||
-- ONEDARK.NVIM --
|
||||
------------------
|
||||
--g.onedark_style = "cool"
|
||||
--g.onedark_style = "darker"
|
||||
--g.onedark_toggle_style_keymap = "<nop>"
|
||||
--g.onedark_darker_diagnostics = false
|
||||
|
||||
-- Lua
|
||||
require("onedark").setup({
|
||||
style = "darker",
|
||||
toggle_style_key = "<nop>",
|
||||
})
|
||||
require("onedark").load()
|
||||
|
||||
----------------
|
||||
-- BCLOSE.VIM --
|
||||
----------------
|
||||
g.bclose_no_plugin_maps = true
|
||||
|
||||
----------------
|
||||
-- BRACEY.VIM --
|
||||
----------------
|
||||
-- https://github.com/turbio/bracey.vim
|
||||
g.bracey_refresh_on_save = true
|
||||
|
||||
-----------------------
|
||||
-- TREESITTER CONFIG --
|
||||
-----------------------
|
||||
local ts_visual_disable = { "typescript", "tsx", "html", "javascript" }
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = "all",
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = ts_visual_disable,
|
||||
},
|
||||
rainbow = {
|
||||
enable = true,
|
||||
disable = ts_visual_disable,
|
||||
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
|
||||
max_file_lines = nil, -- Do not enable for files with more than n lines, int
|
||||
-- colors = {}, -- table of hex strings
|
||||
--termcolors = {},
|
||||
},
|
||||
})
|
||||
|
||||
-----------------------
|
||||
-- GITHUB NVIM THEME --
|
||||
-----------------------
|
||||
--require("github-theme").setup(
|
||||
-- {
|
||||
-- theme_style = "dark_default",
|
||||
-- hide_inactive_statusline = false
|
||||
-- }
|
||||
--)
|
||||
g.github_hide_inactive_statusline = false
|
||||
|
||||
-------------
|
||||
-- LUALINE --
|
||||
-------------
|
||||
|
||||
require("lualine").setup({
|
||||
options = { theme = "onedark", icons_enabled = true },
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = {
|
||||
"FugitiveHead",
|
||||
},
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = {
|
||||
"encoding",
|
||||
"fileformat",
|
||||
"filetype",
|
||||
[[string.format("%d Lines", vim.fn.line('$'))]],
|
||||
{
|
||||
"diagnostics",
|
||||
sources = { "nvim_diagnostic", "ale" },
|
||||
},
|
||||
},
|
||||
lualine_y = {
|
||||
"progress",
|
||||
},
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = { "location" },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {
|
||||
lualine_a = {
|
||||
{
|
||||
"buffers",
|
||||
show_filename_only = false, -- shows shortened relative path when false
|
||||
show_modified_status = true, -- shows indicator then bufder is modified
|
||||
max_length = function()
|
||||
return vim.o.columns * 5 / 6
|
||||
end, -- maximum width of buffers component
|
||||
filetype_names = {
|
||||
TelescopePrompt = "Telescope",
|
||||
dashboard = "Dashboard",
|
||||
packer = "Packer",
|
||||
fzf = "FZF",
|
||||
alpha = "Alpha",
|
||||
["lsp-installer"] = "LSP Installer",
|
||||
}, -- shows specific buffer name for that filetype ( { `filetype` = `buffer_name`, ... } )
|
||||
buffers_color = {
|
||||
active = nil, -- color for active buffer
|
||||
inactive = nil, -- color for inactive buffer
|
||||
},
|
||||
},
|
||||
},
|
||||
lualine_b = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {
|
||||
{
|
||||
[[string.format("Tab %d/%d", vim.fn.tabpagenr(), vim.fn.tabpagenr('$'))]],
|
||||
cond = function()
|
||||
return fn.tabpagenr("$") > 1
|
||||
end,
|
||||
},
|
||||
{
|
||||
[[harpoon_status()]],
|
||||
cond = function()
|
||||
return require("harpoon.mark").get_length() > 0
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
extensions = {},
|
||||
})
|
||||
|
||||
-------------
|
||||
-- HARPOON --
|
||||
-------------
|
||||
|
||||
--Here is the set of global settings and their default values.
|
||||
|
||||
require("harpoon").setup({
|
||||
global_settings = {
|
||||
save_on_toggle = false,
|
||||
save_on_change = true,
|
||||
enter_on_sendcmd = false,
|
||||
tmux_autoclose_windows = false,
|
||||
excluded_filetypes = { "harpoon" },
|
||||
},
|
||||
})
|
||||
|
||||
--------------
|
||||
-- NVIM FZF --
|
||||
--------------
|
||||
require("fzf").default_options = {
|
||||
--fzf_cli_args = " --height 100% --preview='bat --color=always --style=header,grid --line-range :300 {}' ",
|
||||
fzf_cli_args = " --height 100% --preview='[[ -n \"$(command -v bat)\" ]] && bat --color=always --style=header,grid --line-range :300 {} || strings {+}' ",
|
||||
}
|
||||
|
||||
----------------------
|
||||
-- INDENT-BLANKLINE --
|
||||
----------------------
|
||||
--vim.opt.termguicolors = true
|
||||
--vim.cmd [[highlight IndentBlanklineIndent1 guibg=#1f1f1f gui=nocombine]]
|
||||
--vim.cmd [[highlight IndentBlanklineIndent2 guibg=#1a1a1a gui=nocombine]]
|
||||
--
|
||||
--require("indent_blankline").setup {
|
||||
-- char = "",
|
||||
-- char_highlight_list = {
|
||||
-- "IndentBlanklineIndent1",
|
||||
-- "IndentBlanklineIndent2"
|
||||
-- },
|
||||
-- space_char_highlight_list = {
|
||||
-- "IndentBlanklineIndent1",
|
||||
-- "IndentBlanklineIndent2"
|
||||
-- },
|
||||
-- show_trailing_blankline_indent = false
|
||||
--}
|
||||
|
||||
--vim.opt.list = true
|
||||
--vim.opt.listchars:append("eol:↴")
|
||||
--
|
||||
--require("indent_blankline").setup {
|
||||
-- show_end_of_line = true
|
||||
--}
|
||||
--vim.opt.listchars:append("eol:↴")
|
||||
--vim.opt.listchars:append("space:⋅")
|
||||
opt.list = true
|
||||
|
||||
require("indent_blankline").setup({
|
||||
space_char_blankline = " ",
|
||||
show_current_context = true,
|
||||
show_current_context_start = true,
|
||||
})
|
||||
|
||||
-- PETOBENS/POET-V --
|
||||
g.poetv_executables = { "poetry" }
|
||||
g.poetv_auto_activate = 1
|
||||
@@ -1,256 +0,0 @@
|
||||
local bug = [[
|
||||
|
||||
Weird bug:
|
||||
|
||||
When at home directory or in a dot directory, `Marked.get_current_index()` returns `nil` on files.
|
||||
Caused by differences in the outputs of `Marked.get_marked_file_name()`
|
||||
and `require("harpoon.utils").normalize_path()`.
|
||||
|
||||
Example:
|
||||
marked:
|
||||
./code/py/old/test.py
|
||||
|
||||
utils:
|
||||
code/py/old/test.py
|
||||
|
||||
]]
|
||||
|
||||
-- true: harpoon
|
||||
-- false: regular buffer
|
||||
vim.g.my_harpoon_tab_switch = false
|
||||
|
||||
-- Determines if harpoon_bnext and harpoon_bprevious
|
||||
-- should switch between buffers or harpoon marks
|
||||
-- `true` - harpoon
|
||||
-- `false` - buffers
|
||||
local function harpoon_tab_switch()
|
||||
--return require("harpoon.mark").get_length() > 0
|
||||
return vim.g.my_harpoon_tab_switch
|
||||
end
|
||||
|
||||
-- Checks if a table contains a value.
|
||||
local function has_value(tab, val)
|
||||
for _, value in ipairs(tab) do
|
||||
if value == val then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
local strip_dot_slash = function(str)
|
||||
local first_two = string.sub(str, 1, 2)
|
||||
if first_two == "./" then
|
||||
str = string.sub(str, 3)
|
||||
end
|
||||
return str
|
||||
end
|
||||
|
||||
local fzf_run_with_opts = function(args)
|
||||
local opts = require("fzf").default_options
|
||||
|
||||
opts.width = math.floor(vim.o.columns * 0.9)
|
||||
opts.height = math.floor(vim.o.lines * 0.6)
|
||||
|
||||
local old_cli_args = opts.fzf_cli_args
|
||||
if args.multi then
|
||||
opts.fzf_cli_args = opts.fzf_cli_args .. " --multi "
|
||||
end
|
||||
|
||||
local results = args.fn()
|
||||
|
||||
opts.fzf_cli_args = old_cli_args
|
||||
|
||||
return results
|
||||
end
|
||||
|
||||
-- Does a fzf function call with the default options set.
|
||||
-- idk if there's a better way to do this
|
||||
local fzf_call = function(args)
|
||||
local fn = function()
|
||||
local fzf = require("fzf").fzf
|
||||
if args.flags then
|
||||
return fzf(args.items, args.flags)
|
||||
elseif args.items then
|
||||
return fzf(args.items)
|
||||
else
|
||||
return fzf()
|
||||
end
|
||||
end
|
||||
|
||||
local results = fzf_run_with_opts({ fn = fn, multi = args.multi })
|
||||
local stripped_results = {}
|
||||
for _, filepath in ipairs(results) do
|
||||
stripped_results[#stripped_results + 1] = strip_dot_slash(filepath)
|
||||
end
|
||||
return stripped_results
|
||||
end
|
||||
--coroutine.wrap(fzf_call)()
|
||||
|
||||
-- Returns list of buffer file paths.
|
||||
-- Does not include buffers without a file path.
|
||||
local get_buffer_paths = function()
|
||||
local buffers = {}
|
||||
for b = 1, vim.fn.bufnr("$") do
|
||||
if vim.fn.buflisted(b) ~= 0 and vim.api.nvim_buf_get_option(b, "buftype") == "" then
|
||||
local buf_path = vim.fn.expand("#" .. b)
|
||||
if buf_path ~= "" then
|
||||
buffers[#buffers + 1] = strip_dot_slash(buf_path)
|
||||
--print(buf_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return buffers
|
||||
end
|
||||
|
||||
-- toggles tab mode
|
||||
function _G.harpoon_btoggle(on)
|
||||
if on == nil then
|
||||
vim.g.my_harpoon_tab_switch = require("harpoon.mark").get_length() > 0 and not vim.g.my_harpoon_tab_switch
|
||||
else
|
||||
vim.g.my_harpoon_tab_switch = on and require("harpoon.mark").get_length() > 0
|
||||
end
|
||||
print(vim.g.my_harpoon_tab_switch and "Tab: Harpoon" or "Tab: Buffer")
|
||||
end
|
||||
|
||||
-- Dynamically switches between bnext and harpoon.ui.nav_next
|
||||
function _G.harpoon_bnext()
|
||||
if harpoon_tab_switch() then
|
||||
require("harpoon.ui").nav_next()
|
||||
print("Harpoon nav_next")
|
||||
else
|
||||
vim.api.nvim_command("bnext")
|
||||
print("bnext")
|
||||
end
|
||||
end
|
||||
|
||||
-- Dynamically switches between bprevious and harpoon.ui.nav_prev
|
||||
function _G.harpoon_bprevious()
|
||||
if harpoon_tab_switch() then
|
||||
require("harpoon.ui").nav_prev()
|
||||
print("Harpoon nav_prev")
|
||||
else
|
||||
vim.api.nvim_command("bprevious")
|
||||
print("bprevious")
|
||||
end
|
||||
end
|
||||
|
||||
-- Runs harpoon.mark.toggle_file and refreshes lualine elements
|
||||
function _G.harpoon_toggle_file()
|
||||
require("harpoon.mark").add_file()
|
||||
vim.api.nvim_command("redrawtabline")
|
||||
vim.api.nvim_command("redrawstatus")
|
||||
end
|
||||
|
||||
function _G.harpoon_clear_all()
|
||||
require("harpoon.mark").clear_all()
|
||||
_G.harpoon_btoggle()
|
||||
vim.api.nvim_command("redrawtabline")
|
||||
vim.api.nvim_command("redrawstatus")
|
||||
end
|
||||
|
||||
-- I want my bclose bindings to also remove harpoon marks
|
||||
function _G.harpoon_rm_file()
|
||||
require("harpoon.mark").rm_file()
|
||||
vim.api.nvim_command("Bclose")
|
||||
end
|
||||
|
||||
-- Lualine status element for harpoon
|
||||
function _G.harpoon_status()
|
||||
local marked_files = require("harpoon.mark").get_length()
|
||||
local status_str = "Harpoon: %d file"
|
||||
if marked_files > 1 then
|
||||
status_str = status_str .. "s"
|
||||
end
|
||||
status_str = (harpoon_tab_switch() and "● " or "") .. status_str
|
||||
return string.format(status_str, marked_files)
|
||||
end
|
||||
|
||||
-- Marks buffers for harpoon
|
||||
local buffer_to_harpoon = function()
|
||||
local buf_paths = get_buffer_paths()
|
||||
local results = fzf_call({ items = buf_paths, multi = true })
|
||||
|
||||
if results then
|
||||
local sorted_results = {}
|
||||
-- original buf_paths table is correctly ordered, easier to take from there
|
||||
-- and just check if each item is in results.
|
||||
for _, filepath in ipairs(buf_paths) do
|
||||
if has_value(results, filepath) then
|
||||
sorted_results[#sorted_results + 1] = filepath
|
||||
end
|
||||
end
|
||||
local Marked = require("harpoon.mark")
|
||||
Marked.set_mark_list(sorted_results)
|
||||
_G.harpoon_btoggle(true)
|
||||
end
|
||||
end
|
||||
|
||||
function _G.fzf_buffer_add_to_harpoon()
|
||||
coroutine.wrap(buffer_to_harpoon)()
|
||||
end
|
||||
|
||||
-- Opens files from fzf, then marks them with harpoon.
|
||||
local files_to_harpoon = function()
|
||||
local results = fzf_call({ multi = true })
|
||||
|
||||
if results then
|
||||
-- opens all results into buffer
|
||||
local cmd = ":n "
|
||||
for _, filepath in ipairs(results) do
|
||||
cmd = cmd .. filepath .. " "
|
||||
end
|
||||
vim.cmd(cmd)
|
||||
|
||||
local buf_paths = get_buffer_paths()
|
||||
local sorted_results = {}
|
||||
for _, filepath in ipairs(buf_paths) do
|
||||
print(filepath)
|
||||
if has_value(results, filepath) then
|
||||
sorted_results[#sorted_results + 1] = filepath
|
||||
end
|
||||
end
|
||||
local Marked = require("harpoon.mark")
|
||||
Marked.set_mark_list(sorted_results)
|
||||
_G.harpoon_btoggle(true)
|
||||
end
|
||||
end
|
||||
|
||||
function _G.fzf_files_to_harpoon()
|
||||
coroutine.wrap(files_to_harpoon)()
|
||||
end
|
||||
|
||||
local get_marked_file_names = function()
|
||||
local Marked = require("harpoon.mark")
|
||||
local filepaths = {}
|
||||
for i = 1, Marked.get_length() do
|
||||
filepaths[#filepaths + 1] = Marked.get_marked_file_name(i)
|
||||
end
|
||||
return filepaths
|
||||
end
|
||||
|
||||
local select_harpoon_mark = function()
|
||||
local results = fzf_call({ items = get_marked_file_names() })
|
||||
|
||||
if results then
|
||||
vim.api.nvim_win_set_buf(0, vim.fn.bufnr(results[1]))
|
||||
end
|
||||
end
|
||||
|
||||
function _G.fzf_select_harpoon_mark()
|
||||
coroutine.wrap(select_harpoon_mark)()
|
||||
end
|
||||
|
||||
_G.harpoon_open_marks = function()
|
||||
local filepaths = get_marked_file_names()
|
||||
if #filepaths ~= 0 then
|
||||
local cmd = ":n "
|
||||
|
||||
for _, filepath in ipairs(filepaths) do
|
||||
cmd = cmd .. filepath .. " "
|
||||
end
|
||||
vim.cmd(cmd)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,74 @@
|
||||
local M = {}
|
||||
|
||||
function M.map(mode, lhs, rhs, opts)
|
||||
local default_opts = { noremap = true }
|
||||
if opts then
|
||||
default_opts = vim.tbl_extend("force", default_opts, opts)
|
||||
end
|
||||
vim.api.nvim_set_keymap(mode, lhs, rhs, default_opts)
|
||||
end
|
||||
|
||||
function M.lsp_config_defaults()
|
||||
return {
|
||||
root_dir = require("lspconfig.util").root_pattern(
|
||||
"manage.py",
|
||||
"pyproject.toml",
|
||||
"package.json",
|
||||
".null-ls-root",
|
||||
"Makefile",
|
||||
".git"
|
||||
),
|
||||
|
||||
on_attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||
end
|
||||
|
||||
local function buf_set_option(...)
|
||||
vim.api.nvim_buf_set_option(bufnr, ...)
|
||||
end
|
||||
|
||||
---- Disables document formatting by lsp
|
||||
--client.resolved_capabilities.document_formatting = false
|
||||
--client.resolved_capabilities.document_range_formatting = false
|
||||
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
|
||||
-- Mappings.
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
buf_set_keymap("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>e", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>q", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
|
||||
buf_set_keymap(
|
||||
"n",
|
||||
"<space>wl",
|
||||
"<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>",
|
||||
opts
|
||||
)
|
||||
buf_set_keymap("n", "<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
|
||||
buf_set_keymap("n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||
buf_set_keymap("n", "[d", "<cmd>lua vim.diagnostic.goto_prev({wrap = true})<CR>", opts)
|
||||
buf_set_keymap("n", "]d", "<cmd>lua vim.diagnostic.goto_next({wrap = true})<CR>", opts)
|
||||
buf_set_keymap("n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||
buf_set_keymap("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||
buf_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
||||
|
||||
local version = vim.version()
|
||||
if version.api_level == 9 then
|
||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||
else
|
||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.format({ async = true })<CR>", opts)
|
||||
end
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,119 +0,0 @@
|
||||
-- these are my custom functions
|
||||
require("functions")
|
||||
|
||||
--local fn = vim.fn -- to call Vim functions e.g. fn.bufnr()
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
local options = { noremap = true }
|
||||
if opts then
|
||||
options = vim.tbl_extend("force", options, opts)
|
||||
end
|
||||
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||
end
|
||||
|
||||
vim.g.mapleader = ","
|
||||
|
||||
map("v", "<C-C>", '"+y')
|
||||
map("n", "<Tab>", ":bnext<CR>")
|
||||
map("n", "<S-Tab>", ":bprevious<CR>")
|
||||
--map("n", "<Tab>", ":lua harpoon_bnext()<CR>")
|
||||
--map("n", "<S-Tab>", ":lua harpoon_bprevious()<CR>")
|
||||
map("n", "<Esc>", ":noh<CR><Esc>", { silent = true }) --After searching, pressing escape stops the highlight
|
||||
|
||||
map("n", "<Leader>w", [[:%s/\s\+$//e<CR>]])
|
||||
--map("n", "<Leader>x", ":Bclose <CR>")
|
||||
map("n", "<Leader>x", ":bp|bd #<CR>")
|
||||
map("n", "<Leader>t", ":tabnew<CR>")
|
||||
|
||||
-- Move split
|
||||
map("n", "<A-Right>", "<C-W><S-L>")
|
||||
map("n", "<A-Left>", "<C-W><S-H>")
|
||||
map("n", "<A-Up>", "<C-W><S-K>")
|
||||
map("n", "<A-Down>", "<C-W><S-J>")
|
||||
|
||||
-- Split navigations
|
||||
map("n", "<C-Right>", "<C-W><C-L>")
|
||||
map("n", "<C-Left>", "<C-W><C-H>")
|
||||
map("n", "<C-Up>", "<C-W><C-K>")
|
||||
map("n", "<C-Down>", "<C-W><C-J>")
|
||||
|
||||
-- Resize split
|
||||
map("n", "-", "<C-W>-")
|
||||
map("n", "+", "<C-W>+")
|
||||
map("n", "(", "<C-W><")
|
||||
map("n", ")", "<C-W>>")
|
||||
|
||||
-- Scroll viewport
|
||||
map("n", "<S-Up>", "<C-Y>")
|
||||
map("n", "<S-Down>", "<C-E>")
|
||||
map("v", "<S-Up>", "<C-Y>")
|
||||
map("v", "<S-Down>", "<C-E>")
|
||||
map("i", "<S-Up>", "<C-X><C-Y>")
|
||||
map("i", "<S-Down>", "<C-X><C-E>")
|
||||
|
||||
-- Make visual yanks place the cursor back where started
|
||||
map("v", "y", "ygv<Esc>")
|
||||
|
||||
-- Terminal binds
|
||||
local term_command = "split | set norelativenumber | set nonumber | term"
|
||||
map("t", "<C-Space>", [[<C-\><C-n>]])
|
||||
map("n", [[<Leader>\]], ":" .. term_command .. "<CR>")
|
||||
map("n", [[<Leader>|]], ":v" .. term_command .. "<CR>")
|
||||
|
||||
---------
|
||||
-- HOP --
|
||||
---------
|
||||
local hop_opts = "{ create_hl_autocmd = true }"
|
||||
local hopword = [[<cmd>lua require'hop'.hint_words(]] .. hop_opts .. [[)<cr>]]
|
||||
local hopline = [[<cmd>lua require'hop'.hint_lines_skip_whitespace(]] .. hop_opts .. [[)<cr>]]
|
||||
|
||||
map("n", "W", hopline, { silent = true })
|
||||
map("v", "W", hopline, { silent = true })
|
||||
map("n", "w", hopword, { silent = true })
|
||||
map("v", "w", hopword, { silent = true })
|
||||
|
||||
---------
|
||||
-- FZF --
|
||||
---------
|
||||
map("n", "<Leader>o", ":Files<CR>")
|
||||
map("n", "<Leader>O", ":Files ~/<CR>")
|
||||
map("n", "<Leader>p", ":Buffers<CR>")
|
||||
map("n", "<Leader>h", ":Helptags<CR>")
|
||||
map("n", "<Leader>;", ":History:<CR>")
|
||||
map("n", "<Leader>c", ":Commands<CR>")
|
||||
map("n", "<Leader>r", ":Rg <C-R><C-W><CR>")
|
||||
map("n", "<Leader>R", ":Rg<CR>")
|
||||
map("n", "<Leader>s", ":Lines<CR>")
|
||||
|
||||
map("n", "<Leader>gf", ":GFiles<CR>")
|
||||
map("n", "<Leader>gn", ":GFiles?<CR>")
|
||||
map("n", "<Leader>gc", ":Commits<CR>")
|
||||
|
||||
------------------
|
||||
-- FZF-CHECKOUT --
|
||||
------------------
|
||||
map("n", "<Leader>gb", ":GBranches<CR>")
|
||||
|
||||
-------------
|
||||
-- HARPOON --
|
||||
-------------
|
||||
|
||||
--map("n", "<Leader>m", [[:lua require("harpoon.mark").add_file() <CR>]])
|
||||
--map("n", "<Leader>x", ":lua harpoon_rm_file()<CR>")
|
||||
--map("n", "<Leader>ma", [[:lua harpoon_toggle_file()<CR>]])
|
||||
--map("n", "<Leader>mc", [[:lua harpoon_clear_all()<CR>]])
|
||||
--map("n", "<Leader>ml", [[:lua require("harpoon.ui").toggle_quick_menu()<CR>]])
|
||||
--map("n", "<Leader>mt", [[:lua harpoon_btoggle()<CR>]])
|
||||
|
||||
--map("n", "<Leader>n", [[:lua require("harpoon.ui").nav_next() <CR>]])
|
||||
--map("n", "<Leader>N", [[:lua require("harpoon.ui").nav_prev() <CR>]])
|
||||
|
||||
--------------
|
||||
-- NVIM FZF --
|
||||
--------------
|
||||
--map("n", "<Leader>mm", [[:lua fzf_buffer_add_to_harpoon()<CR>]])
|
||||
--map("n", "<Leader>mo", [[:lua fzf_files_to_harpoon()<CR>]])
|
||||
--map("n", "<Leader>ml", [[:lua fzf_select_harpoon_mark()<CR>]])
|
||||
|
||||
-- RNVIMR
|
||||
-- https://github.com/kevinhwang91/rnvimr
|
||||
map("n", "<Leader>f", [[:RnvimrToggle<CR>]])
|
||||
-302
@@ -1,302 +0,0 @@
|
||||
-- ooooo ooooo .o8
|
||||
-- `888' `888' "888
|
||||
-- 888 888 .ooooo. .oooo. .oooo888 .ooooo. oooo d8b
|
||||
-- 888ooooo888 d88' `88b `P )88b d88' `888 d88' `88b `888""8P
|
||||
-- 888 888 888ooo888 .oP"888 888 888 888ooo888 888
|
||||
-- 888 888 888 .o d8( 888 888 888 888 .o 888
|
||||
-- o888o o888o `Y8bod8P' `Y888""8o `Y8bod88P" `Y8bod8P' d888b
|
||||
|
||||
-- https://patorjk.com/software/taag/#p=display&f=Roman&t=WORD_TO_MAKE_HEADER
|
||||
|
||||
-- .oooooo. oooo .o8 oooo
|
||||
-- d8P' `Y8b `888 "888 `888
|
||||
-- 888 888 .ooooo. 888oooo. .oooo. 888
|
||||
-- 888 888 d88' `88b d88' `88b `P )88b 888
|
||||
-- 888 ooooo 888 888 888 888 888 .oP"888 888
|
||||
-- `88. .88' 888 888 888 888 888 d8( 888 888
|
||||
-- `Y8bood8P' o888o `Y8bod8P' `Y8bod8P' `Y888""8o o888o
|
||||
|
||||
local opt = vim.opt -- to set options
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
signs = true,
|
||||
update_in_insert = false,
|
||||
})
|
||||
|
||||
local config = {
|
||||
|
||||
root_dir = require("lspconfig.util").root_pattern(
|
||||
"manage.py",
|
||||
"pyproject.toml",
|
||||
"package.json",
|
||||
".null-ls-root",
|
||||
"Makefile",
|
||||
".git"
|
||||
),
|
||||
|
||||
on_attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||
end
|
||||
|
||||
local function buf_set_option(...)
|
||||
vim.api.nvim_buf_set_option(bufnr, ...)
|
||||
end
|
||||
|
||||
---- Disables document formatting by lsp
|
||||
--client.resolved_capabilities.document_formatting = false
|
||||
--client.resolved_capabilities.document_range_formatting = false
|
||||
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
|
||||
-- Mappings.
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
buf_set_keymap("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>e", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>q", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
|
||||
buf_set_keymap("n", "<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
|
||||
buf_set_keymap("n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||
buf_set_keymap("n", "[d", "<cmd>lua vim.diagnostic.goto_prev({wrap = true})<CR>", opts)
|
||||
buf_set_keymap("n", "]d", "<cmd>lua vim.diagnostic.goto_next({wrap = true})<CR>", opts)
|
||||
buf_set_keymap("n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||
buf_set_keymap("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||
buf_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
||||
|
||||
local version = vim.version()
|
||||
if version.api_level == 9 then
|
||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||
else
|
||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.format({ async = true })<CR>", opts)
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
-- .oooooo. ooo ooooo ooooooooo.
|
||||
-- d8P' `Y8b `88. .888' `888 `Y88.
|
||||
-- 888 888b d'888 888 .d88'
|
||||
-- 888 8 Y88. .P 888 888ooo88P'
|
||||
-- 888 8 `888' 888 888
|
||||
-- `88b ooo 8 Y 888 888
|
||||
-- `Y8bood8P' o8o o888o o888o
|
||||
|
||||
require("nvim-autopairs").setup({ check_ts = true })
|
||||
|
||||
-- Set completeopt to have a better completion experience
|
||||
opt.completeopt = "menuone,noselect"
|
||||
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
local cmp = require("cmp")
|
||||
|
||||
-- CMP NVIM ULTISNIP
|
||||
local cmp_ultisnips_mappings = require("cmp_nvim_ultisnips.mappings")
|
||||
local ultisnip = {
|
||||
expand = function(args)
|
||||
vim.fn["UltiSnips#Anon"](args.body)
|
||||
end,
|
||||
tab = cmp.mapping(function(fallback)
|
||||
cmp_ultisnips_mappings.compose({ "select_next_item" })(fallback)
|
||||
end, { "i", "s" }),
|
||||
shift_tab = cmp.mapping(function(fallback)
|
||||
cmp_ultisnips_mappings.compose({ "select_prev_item" })(fallback)
|
||||
end, { "i", "s" }),
|
||||
}
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = ultisnip.expand,
|
||||
},
|
||||
mapping = {
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
select = true,
|
||||
}),
|
||||
["<Tab>"] = ultisnip.tab,
|
||||
["<S-Tab>"] = ultisnip.shift_tab,
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "ultisnips" },
|
||||
},
|
||||
})
|
||||
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
|
||||
|
||||
-- ooooo ooo oooo oooo ooooo .oooooo..o
|
||||
-- `888b. `8' `888 `888 `888' d8P' `Y8
|
||||
-- 8 `88b. 8 oooo oooo 888 888 888 Y88bo.
|
||||
-- 8 `88b. 8 `888 `888 888 888 888 `"Y8888o.
|
||||
-- 8 `88b.8 888 888 888 888 888 `"Y88b
|
||||
-- 8 `888 888 888 888 888 888 o oo .d8P
|
||||
-- o8o `8 `V88V"V8P' o888o o888o o888ooooood8 8""88888P'
|
||||
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
-- ORDER IN TABLE DETERMINES EXECUTION ORDER
|
||||
local sources = {
|
||||
-- python
|
||||
null_ls.builtins.diagnostics.flake8,
|
||||
null_ls.builtins.diagnostics.mypy,
|
||||
null_ls.builtins.formatting.black,
|
||||
null_ls.builtins.formatting.isort,
|
||||
-- js
|
||||
null_ls.builtins.diagnostics.eslint,
|
||||
null_ls.builtins.code_actions.eslint,
|
||||
null_ls.builtins.formatting.prettier.with({
|
||||
extra_filetypes = { "svelte" },
|
||||
}),
|
||||
-- lua
|
||||
null_ls.builtins.formatting.stylua,
|
||||
-- bash
|
||||
null_ls.builtins.formatting.shfmt,
|
||||
null_ls.builtins.diagnostics.shellcheck,
|
||||
null_ls.builtins.code_actions.shellcheck,
|
||||
-- cpp
|
||||
null_ls.builtins.formatting.clang_format,
|
||||
-- latex
|
||||
--null_ls.builtins.formatting.latexindent,
|
||||
--null_ls.builtins.diagnostics.chktex,
|
||||
-- golang
|
||||
--null_ls.builtins.diagnostics.golangci_lint,
|
||||
-- sql
|
||||
--null_ls.builtins.diagnostics.sqlfluff.with({
|
||||
-- --filetypes = { "sql", "html" },
|
||||
-- args = { "lint", "--dialect", "ansi", "-f", "github-annotation", "-n", "--disable_progress_bar", "-" },
|
||||
--}),
|
||||
--null_ls.builtins.formatting.sqlfluff.with({
|
||||
-- --filetypes = { "sql", "html" },
|
||||
-- args = { "fix", "--dialect", "ansi", "--disable_progress_bar", "-f", "-n", "-" },
|
||||
--}),
|
||||
}
|
||||
null_ls.setup({
|
||||
sources = sources,
|
||||
on_attach = config.on_attach,
|
||||
root_dir = config.root_dir,
|
||||
})
|
||||
|
||||
-- ooooo .oooooo..o ooooooooo. ooooo . oooo oooo
|
||||
-- `888' d8P' `Y8 `888 `Y88. `888' .o8 `888 `888
|
||||
-- 888 Y88bo. 888 .d88' 888 ooo. .oo. .oooo.o .o888oo .oooo. 888 888 .ooooo. oooo d8b
|
||||
-- 888 `"Y8888o. 888ooo88P' 888 `888P"Y88b d88( "8 888 `P )88b 888 888 d88' `88b `888""8P
|
||||
-- 888 `"Y88b 888 888 888 888 `"Y88b. 888 .oP"888 888 888 888ooo888 888
|
||||
-- 888 o oo .d8P 888 888 888 888 o. )88b 888 . d8( 888 888 888 888 .o 888
|
||||
-- o888ooooood8 8""88888P' o888o o888o o888o o888o 8""888P' "888" `Y888""8o o888o o888o `Y8bod8P' d888b
|
||||
|
||||
local on_attach_tsserver = function(client, bufnr)
|
||||
local ts_utils = require("nvim-lsp-ts-utils")
|
||||
ts_utils.setup({
|
||||
eslint_bin = "eslint_d",
|
||||
eslint_enable_diagnostics = true,
|
||||
eslint_enable_code_actions = true,
|
||||
enable_import_on_completion = true,
|
||||
filter_out_diagnostics_by_severity = {
|
||||
"information",
|
||||
"hint",
|
||||
--"warning",
|
||||
--"error",
|
||||
},
|
||||
})
|
||||
ts_utils.setup_client(client)
|
||||
|
||||
-- no default maps, so you may want to define some here
|
||||
local o = { silent = true }
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gs", ":TSLspOrganize<CR>", o)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "rN", ":TSLspRenameFile<CR>", o)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gI", ":TSLspImportAll<CR>", o)
|
||||
end
|
||||
|
||||
require("nvim-lsp-installer").on_server_ready(function(server)
|
||||
--Enable (broadcasting) snippet capability for completion
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
local disable_diag = {
|
||||
["textDocument/publishDiagnostics"] = function() end,
|
||||
}
|
||||
|
||||
local on_attach_generic = function(client, bufnr)
|
||||
-- Disables document formatting by lsp
|
||||
client.server_capabilities.document_formatting = false
|
||||
client.server_capabilities.document_range_formatting = false
|
||||
|
||||
config.on_attach(client, bufnr)
|
||||
end
|
||||
|
||||
local opts = {
|
||||
on_attach = on_attach_generic,
|
||||
capabilities = capabilities,
|
||||
flags = {
|
||||
debounce_text_changes = 150,
|
||||
},
|
||||
settings = {
|
||||
format = { enable = true },
|
||||
},
|
||||
root_dir = config.root_dir,
|
||||
}
|
||||
|
||||
if server.name == "tsserver" then
|
||||
opts.on_attach = function(...)
|
||||
on_attach_tsserver(...)
|
||||
on_attach_generic(...)
|
||||
end
|
||||
elseif server.name == "sumneko_lua" then
|
||||
opts.settings.Lua = {
|
||||
diagnostics = {
|
||||
globals = {
|
||||
"vim",
|
||||
"awesome",
|
||||
"client",
|
||||
},
|
||||
},
|
||||
}
|
||||
elseif server.name == "html" then
|
||||
opts.filetypes = { "html", "htmldjango" }
|
||||
elseif server.name == "tailwindcss" then
|
||||
opts.init_options = {
|
||||
userLanguages = {
|
||||
htmldjango = "html",
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
server:setup(opts)
|
||||
vim.cmd([[do User LspAttachBuffers]])
|
||||
end)
|
||||
|
||||
local lsp_installer_servers = require("nvim-lsp-installer.servers")
|
||||
local auto_servers = {
|
||||
"sumneko_lua",
|
||||
"tsserver",
|
||||
"bashls",
|
||||
"vimls",
|
||||
"rust_analyzer",
|
||||
"html",
|
||||
"cssls",
|
||||
"jsonls",
|
||||
--"jedi_language_server",
|
||||
"pylsp",
|
||||
"svelte",
|
||||
"tailwindcss",
|
||||
"zls",
|
||||
}
|
||||
|
||||
for _, s in ipairs(auto_servers) do
|
||||
local ok, server = lsp_installer_servers.get_server(s)
|
||||
if ok and not server:is_installed() then
|
||||
server:install()
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,391 @@
|
||||
local helpers = require("helpers")
|
||||
local map = helpers.map
|
||||
local lsp_config_defaults = helpers.lsp_config_defaults
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.hop()
|
||||
require("hop").setup({ keys = "etovxqpdygfblzhckisuran" })
|
||||
|
||||
local hop_opts = "{ create_hl_autocmd = true }"
|
||||
local hopword = [[<cmd>lua require'hop'.hint_words(]] .. hop_opts .. [[)<cr>]]
|
||||
local hopline = [[<cmd>lua require'hop'.hint_lines_skip_whitespace(]] .. hop_opts .. [[)<cr>]]
|
||||
|
||||
map("n", "W", hopline, { silent = true })
|
||||
map("v", "W", hopline, { silent = true })
|
||||
map("n", "w", hopword, { silent = true })
|
||||
map("v", "w", hopword, { silent = true })
|
||||
end
|
||||
|
||||
function M.onedark()
|
||||
require("onedark").setup({
|
||||
style = "darker",
|
||||
toggle_style_key = "<nop>",
|
||||
})
|
||||
require("onedark").load()
|
||||
end
|
||||
|
||||
function M.fzf()
|
||||
map("n", "<Leader>o", ":Files<CR>")
|
||||
map("n", "<Leader>O", ":Files ~/<CR>")
|
||||
map("n", "<Leader>p", ":Buffers<CR>")
|
||||
map("n", "<Leader>h", ":Helptags<CR>")
|
||||
map("n", "<Leader>H", ":Helptags <C-R><C-W><CR>")
|
||||
map("n", "<Leader>;", ":History:<CR>")
|
||||
map("n", "<Leader>c", ":Commands<CR>")
|
||||
map("n", "<Leader>r", ":Rg <C-R><C-W><CR>")
|
||||
map("n", "<Leader>R", ":Rg<CR>")
|
||||
map("n", "<Leader>s", ":Lines<CR>")
|
||||
map("n", "<Leader>gf", ":GFiles<CR>")
|
||||
map("n", "<Leader>gn", ":GFiles?<CR>")
|
||||
map("n", "<Leader>gc", ":Commits<CR>")
|
||||
end
|
||||
|
||||
function M.rnvimr()
|
||||
map("n", "<Leader>f", [[:RnvimrToggle<CR>]])
|
||||
end
|
||||
|
||||
function M.nvim_fzf()
|
||||
require("fzf").default_options = {
|
||||
--fzf_cli_args = " --height 100% --preview='bat --color=always --style=header,grid --line-range :300 {}' ",
|
||||
fzf_cli_args = " --height 100% --preview='[[ -n \"$(command -v bat)\" ]] && bat --color=always --style=header,grid --line-range :300 {} || strings {+}' ",
|
||||
}
|
||||
end
|
||||
|
||||
function M.harpoon()
|
||||
require("harpoon").setup({
|
||||
global_settings = {
|
||||
save_on_toggle = false,
|
||||
save_on_change = true,
|
||||
enter_on_sendcmd = false,
|
||||
tmux_autoclose_windows = false,
|
||||
excluded_filetypes = { "harpoon" },
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
function M.auto_session()
|
||||
require("auto-session").setup({
|
||||
log_level = "info",
|
||||
auto_session_suppress_dirs = { "~/", "~/Projects" },
|
||||
auto_session_use_git_branch = true,
|
||||
})
|
||||
end
|
||||
|
||||
function M.fzf_checkout()
|
||||
map("n", "<Leader>gb", ":GBranches<CR>")
|
||||
end
|
||||
|
||||
function M.indent_blankline()
|
||||
vim.opt.list = true
|
||||
|
||||
require("indent_blankline").setup({
|
||||
space_char_blankline = " ",
|
||||
show_current_context = true,
|
||||
show_current_context_start = true,
|
||||
})
|
||||
end
|
||||
|
||||
function M.lualine()
|
||||
require("lualine").setup({
|
||||
options = { theme = "onedark", icons_enabled = true },
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = {
|
||||
"FugitiveHead",
|
||||
},
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = {
|
||||
"encoding",
|
||||
"fileformat",
|
||||
"filetype",
|
||||
[[string.format("%d Lines", vim.fn.line('$'))]],
|
||||
{
|
||||
"diagnostics",
|
||||
sources = { "nvim_diagnostic", "ale" },
|
||||
},
|
||||
},
|
||||
lualine_y = {
|
||||
"progress",
|
||||
},
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = { "location" },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {
|
||||
lualine_a = {
|
||||
{
|
||||
"buffers",
|
||||
show_filename_only = false, -- shows shortened relative path when false
|
||||
show_modified_status = true, -- shows indicator then bufder is modified
|
||||
max_length = function()
|
||||
return vim.o.columns * 5 / 6
|
||||
end, -- maximum width of buffers component
|
||||
filetype_names = {
|
||||
TelescopePrompt = "Telescope",
|
||||
dashboard = "Dashboard",
|
||||
packer = "Packer",
|
||||
fzf = "FZF",
|
||||
alpha = "Alpha",
|
||||
["lsp-installer"] = "LSP Installer",
|
||||
}, -- shows specific buffer name for that filetype ( { `filetype` = `buffer_name`, ... } )
|
||||
buffers_color = {
|
||||
active = nil, -- color for active buffer
|
||||
inactive = nil, -- color for inactive buffer
|
||||
},
|
||||
},
|
||||
},
|
||||
lualine_b = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {
|
||||
{
|
||||
[[string.format("Tab %d/%d", vim.fn.tabpagenr(), vim.fn.tabpagenr('$'))]],
|
||||
cond = function()
|
||||
return vim.fn.tabpagenr("$") > 1
|
||||
end,
|
||||
},
|
||||
{
|
||||
[[harpoon_status()]],
|
||||
cond = function()
|
||||
return require("harpoon.mark").get_length() > 0
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
extensions = {},
|
||||
})
|
||||
end
|
||||
|
||||
function M.nvim_treesitter()
|
||||
local ts_visual_disable = { "typescript", "tsx", "html", "javascript" }
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = "all",
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = ts_visual_disable,
|
||||
},
|
||||
rainbow = {
|
||||
enable = true,
|
||||
disable = ts_visual_disable,
|
||||
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
|
||||
max_file_lines = nil, -- Do not enable for files with more than n lines, int
|
||||
-- colors = {}, -- table of hex strings
|
||||
--termcolors = {},
|
||||
},
|
||||
})
|
||||
|
||||
local version = vim.version()
|
||||
if version.api_level ~= 9 then
|
||||
vim.opt.foldmethod = "expr"
|
||||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
end
|
||||
end
|
||||
|
||||
function M.nvim_lspconfig()
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
signs = true,
|
||||
update_in_insert = false,
|
||||
})
|
||||
end
|
||||
|
||||
function M.nvim_lsp_installer()
|
||||
local config = lsp_config_defaults()
|
||||
local on_attach_tsserver = function(client, bufnr)
|
||||
local ts_utils = require("nvim-lsp-ts-utils")
|
||||
ts_utils.setup({
|
||||
eslint_bin = "eslint_d",
|
||||
eslint_enable_diagnostics = true,
|
||||
eslint_enable_code_actions = true,
|
||||
enable_import_on_completion = true,
|
||||
filter_out_diagnostics_by_severity = {
|
||||
"information",
|
||||
"hint",
|
||||
--"warning",
|
||||
--"error",
|
||||
},
|
||||
})
|
||||
ts_utils.setup_client(client)
|
||||
|
||||
-- no default maps, so you may want to define some here
|
||||
local o = { silent = true }
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gs", ":TSLspOrganize<CR>", o)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "rN", ":TSLspRenameFile<CR>", o)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gI", ":TSLspImportAll<CR>", o)
|
||||
end
|
||||
|
||||
require("nvim-lsp-installer").on_server_ready(function(server)
|
||||
--Enable (broadcasting) snippet capability for completion
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
local disable_diag = {
|
||||
["textDocument/publishDiagnostics"] = function() end,
|
||||
}
|
||||
|
||||
local on_attach_generic = function(client, bufnr)
|
||||
-- Disables document formatting by lsp
|
||||
client.server_capabilities.document_formatting = false
|
||||
client.server_capabilities.document_range_formatting = false
|
||||
|
||||
config.on_attach(client, bufnr)
|
||||
end
|
||||
|
||||
local opts = {
|
||||
on_attach = on_attach_generic,
|
||||
capabilities = capabilities,
|
||||
flags = {
|
||||
debounce_text_changes = 150,
|
||||
},
|
||||
settings = {
|
||||
format = { enable = true },
|
||||
},
|
||||
root_dir = config.root_dir,
|
||||
}
|
||||
|
||||
if server.name == "tsserver" then
|
||||
opts.on_attach = function(...)
|
||||
on_attach_tsserver(...)
|
||||
on_attach_generic(...)
|
||||
end
|
||||
elseif server.name == "sumneko_lua" then
|
||||
opts.settings.Lua = {
|
||||
diagnostics = {
|
||||
globals = {
|
||||
"vim",
|
||||
"awesome",
|
||||
"client",
|
||||
},
|
||||
},
|
||||
}
|
||||
elseif server.name == "html" then
|
||||
opts.filetypes = { "html", "htmldjango" }
|
||||
elseif server.name == "tailwindcss" then
|
||||
opts.init_options = {
|
||||
userLanguages = {
|
||||
htmldjango = "html",
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
server:setup(opts)
|
||||
vim.cmd([[do User LspAttachBuffers]])
|
||||
end)
|
||||
|
||||
local lsp_installer_servers = require("nvim-lsp-installer.servers")
|
||||
local auto_servers = {
|
||||
"sumneko_lua",
|
||||
"tsserver",
|
||||
"bashls",
|
||||
"vimls",
|
||||
"rust_analyzer",
|
||||
"html",
|
||||
"cssls",
|
||||
"jsonls",
|
||||
--"jedi_language_server",
|
||||
"pylsp",
|
||||
"svelte",
|
||||
"tailwindcss",
|
||||
"zls",
|
||||
}
|
||||
|
||||
for _, s in ipairs(auto_servers) do
|
||||
local ok, server = lsp_installer_servers.get_server(s)
|
||||
if ok and not server:is_installed() then
|
||||
server:install()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.null_ls()
|
||||
local null_ls = require("null-ls")
|
||||
local config = lsp_config_defaults()
|
||||
|
||||
-- ORDER IN TABLE DETERMINES EXECUTION ORDER
|
||||
local sources = {
|
||||
-- python
|
||||
null_ls.builtins.diagnostics.flake8,
|
||||
null_ls.builtins.diagnostics.mypy,
|
||||
null_ls.builtins.formatting.black,
|
||||
null_ls.builtins.formatting.isort,
|
||||
-- js
|
||||
null_ls.builtins.diagnostics.eslint,
|
||||
null_ls.builtins.code_actions.eslint,
|
||||
null_ls.builtins.formatting.prettier.with({
|
||||
extra_filetypes = { "svelte" },
|
||||
}),
|
||||
-- lua
|
||||
null_ls.builtins.formatting.stylua,
|
||||
-- bash
|
||||
null_ls.builtins.formatting.shfmt,
|
||||
null_ls.builtins.diagnostics.shellcheck,
|
||||
null_ls.builtins.code_actions.shellcheck,
|
||||
-- cpp
|
||||
null_ls.builtins.formatting.clang_format,
|
||||
}
|
||||
null_ls.setup({
|
||||
sources = sources,
|
||||
on_attach = config.on_attach,
|
||||
root_dir = config.root_dir,
|
||||
})
|
||||
end
|
||||
|
||||
function M.nvim_autopairs()
|
||||
require("nvim-autopairs").setup({ check_ts = true })
|
||||
end
|
||||
|
||||
function M.nvim_cmp()
|
||||
vim.opt.completeopt = "menuone,noselect"
|
||||
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
local cmp = require("cmp")
|
||||
|
||||
-- CMP NVIM ULTISNIP
|
||||
local cmp_ultisnips_mappings = require("cmp_nvim_ultisnips.mappings")
|
||||
local ultisnip = {
|
||||
expand = function(args)
|
||||
vim.fn["UltiSnips#Anon"](args.body)
|
||||
end,
|
||||
tab = cmp.mapping(function(fallback)
|
||||
cmp_ultisnips_mappings.compose({ "select_next_item" })(fallback)
|
||||
end, { "i", "s" }),
|
||||
shift_tab = cmp.mapping(function(fallback)
|
||||
cmp_ultisnips_mappings.compose({ "select_prev_item" })(fallback)
|
||||
end, { "i", "s" }),
|
||||
}
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = ultisnip.expand,
|
||||
},
|
||||
mapping = {
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
select = true,
|
||||
}),
|
||||
["<Tab>"] = ultisnip.tab,
|
||||
["<S-Tab>"] = ultisnip.shift_tab,
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "ultisnips" },
|
||||
},
|
||||
})
|
||||
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,20 @@
|
||||
require("plugins.startup")
|
||||
|
||||
local config = require("plugins.config")
|
||||
|
||||
config.auto_session()
|
||||
config.fzf()
|
||||
config.fzf_checkout()
|
||||
config.harpoon()
|
||||
config.hop()
|
||||
config.indent_blankline()
|
||||
config.lualine()
|
||||
config.null_ls()
|
||||
config.nvim_autopairs()
|
||||
config.nvim_cmp()
|
||||
config.nvim_fzf()
|
||||
config.nvim_lsp_installer()
|
||||
config.nvim_lspconfig()
|
||||
config.nvim_treesitter()
|
||||
config.onedark()
|
||||
config.rnvimr()
|
||||
@@ -1,30 +1,11 @@
|
||||
require("packer").startup(function()
|
||||
local use = require("packer").use
|
||||
|
||||
require("packer").startup(function(use)
|
||||
use("wbthomason/packer.nvim")
|
||||
|
||||
-- OPENAI CODEX
|
||||
--use "tom-doerr/vim_codex"
|
||||
|
||||
-- NAVIGATION
|
||||
use({
|
||||
"phaazon/hop.nvim",
|
||||
--branch = "v1.2", -- optional but strongly recommended
|
||||
config = function()
|
||||
-- you can configure Hop the way you like here; see :h hop-config
|
||||
require("hop").setup({ keys = "etovxqpdygfblzhckisuran" })
|
||||
end,
|
||||
})
|
||||
|
||||
-- TABLE
|
||||
--use "dhruvasagar/vim-table-mode"
|
||||
use("phaazon/hop.nvim")
|
||||
|
||||
-- VIM THEMING
|
||||
--use "rafi/awesome-vim-colorschemes" -- vim themes
|
||||
use("navarasu/onedark.nvim")
|
||||
--use("projekt0n/github-nvim-theme")
|
||||
--use("wojciechkepka/vim-github-dark")
|
||||
--use("folke/tokyonight.nvim")
|
||||
|
||||
-- FILE MANAGEMENT
|
||||
use("junegunn/fzf")
|
||||
@@ -32,46 +13,45 @@ require("packer").startup(function()
|
||||
use("kevinhwang91/rnvimr")
|
||||
use("vijaymarupudi/nvim-fzf")
|
||||
use("vijaymarupudi/nvim-fzf-commands")
|
||||
--use({ "tpope/vim-obsession" })
|
||||
|
||||
-- SESSION
|
||||
use("ThePrimeagen/harpoon")
|
||||
use("rmagatti/auto-session")
|
||||
|
||||
-- GIT
|
||||
use("tpope/vim-fugitive")
|
||||
use("stsewd/fzf-checkout.vim")
|
||||
|
||||
-- AIRLINE
|
||||
-- EDITOR
|
||||
use("lukas-reineke/indent-blankline.nvim")
|
||||
use({
|
||||
"nvim-lualine/lualine.nvim",
|
||||
requires = { "kyazdani42/nvim-web-devicons", opt = true },
|
||||
})
|
||||
|
||||
-- EDITOR
|
||||
use("windwp/nvim-autopairs")
|
||||
use("lukas-reineke/indent-blankline.nvim")
|
||||
--use "sheerun/vim-polyglot"
|
||||
|
||||
-- SNIPPETS
|
||||
use("SirVer/ultisnips")
|
||||
use("honza/vim-snippets")
|
||||
use("L3MON4D3/LuaSnip") -- Snippets plugin
|
||||
|
||||
-- LSP
|
||||
use("hrsh7th/nvim-cmp") -- Autocompletion plugin
|
||||
use("p00f/nvim-ts-rainbow")
|
||||
use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" })
|
||||
use("nvim-treesitter/nvim-treesitter-context")
|
||||
use("neovim/nvim-lspconfig") -- Collection of configurations for built-in LSP client
|
||||
use("williamboman/nvim-lsp-installer")
|
||||
use({
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
requires = "quangnguyen30192/cmp-nvim-ultisnips",
|
||||
}) -- LSP source for nvim-cmp
|
||||
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
run = ":TSUpdate",
|
||||
})
|
||||
use("nvim-treesitter/nvim-treesitter-context")
|
||||
use("neovim/nvim-lspconfig")
|
||||
use("williamboman/nvim-lsp-installer")
|
||||
use("nvim-lua/plenary.nvim")
|
||||
use("jose-elias-alvarez/nvim-lsp-ts-utils")
|
||||
use("jose-elias-alvarez/null-ls.nvim")
|
||||
|
||||
use("ThePrimeagen/harpoon")
|
||||
|
||||
use("L3MON4D3/LuaSnip") -- Snippets plugin
|
||||
use("windwp/nvim-autopairs")
|
||||
use({
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
requires = "quangnguyen30192/cmp-nvim-ultisnips",
|
||||
})
|
||||
use("hrsh7th/nvim-cmp")
|
||||
|
||||
-- JS
|
||||
use("HerringtonDarkholme/yats.vim")
|
||||
@@ -79,22 +59,8 @@ require("packer").startup(function()
|
||||
use("yuezk/vim-js") -- js
|
||||
use("maxmellon/vim-jsx-pretty") -- react/tsx syntax highlight & indent
|
||||
|
||||
-- PYTHON
|
||||
--use {"numirias/semshi", run = ":UpdateRemotePlugins"} -- python
|
||||
--use("Vimjas/vim-python-pep8-indent")
|
||||
|
||||
-- HTML/CSS
|
||||
use("mattn/emmet-vim")
|
||||
use({
|
||||
"rmagatti/auto-session",
|
||||
config = function()
|
||||
require("auto-session").setup({
|
||||
log_level = "info",
|
||||
auto_session_suppress_dirs = { "~/", "~/Projects" },
|
||||
auto_session_use_git_branch = true,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- ZIG
|
||||
use("ziglang/zig.vim")
|
||||
@@ -1,30 +0,0 @@
|
||||
vim.cmd([[
|
||||
|
||||
" https://vim.fandom.com/wiki/Avoid_scrolling_when_switch_buffers
|
||||
" Save current view settings on a per-window, per-buffer basis.
|
||||
|
||||
function! AutoSaveWinView()
|
||||
if !exists("w:SavedBufView")
|
||||
let w:SavedBufView = {}
|
||||
endif
|
||||
let w:SavedBufView[bufnr("%")] = winsaveview()
|
||||
endfunction
|
||||
|
||||
" Restore current view settings.
|
||||
|
||||
function! AutoRestoreWinView()
|
||||
let buf = bufnr("%")
|
||||
if exists("w:SavedBufView") && has_key(w:SavedBufView, buf)
|
||||
let v = winsaveview()
|
||||
let atStartOfFile = v.lnum == 1 && v.col == 0
|
||||
if atStartOfFile && !&diff
|
||||
call winrestview(w:SavedBufView[buf])
|
||||
endif
|
||||
unlet w:SavedBufView[buf]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
autocmd BufLeave * call AutoSaveWinView()
|
||||
autocmd BufEnter * call AutoRestoreWinView()
|
||||
|
||||
]])
|
||||
Reference in New Issue
Block a user