Rebuilding config
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2024 Ian Cini
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# Neovim config
|
||||||
|
|
||||||
|
## Lsp
|
||||||
|
|
||||||
|
### Angular
|
||||||
|
|
||||||
|
```shell
|
||||||
|
npm install -g @angular/language-server
|
||||||
|
```
|
||||||
|
Change the `npm_path` variable into `lsp.lua`, with the path where the lsp is downloaded.
|
||||||
|
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
lua require('config.settings')
|
||||||
|
" vim.fn.stdpath("data")
|
||||||
|
"lua require('plugins')
|
||||||
|
"lua require('plugin_settings')
|
||||||
|
"lua require('color_scheme')
|
||||||
|
"lua require('settings')
|
||||||
|
"lua require('keybinds')
|
||||||
|
"lua require('lsp/lsp_init')
|
||||||
|
"lua require('status_line')
|
||||||
|
"lua require('neotree')
|
||||||
|
"lua require('my_funcs')
|
||||||
|
"lua require('git/git_init')
|
||||||
|
"lua require('goVoyeur')
|
||||||
|
"lua require('jdtls_conf')
|
||||||
|
"lua require('java')
|
||||||
|
|
||||||
|
syntax on
|
||||||
|
|
||||||
|
" Show quotes in JSON files
|
||||||
|
let g:vim_json_conceal=0
|
||||||
|
" set conceallevel=0
|
||||||
|
autocmd BufEnter *.* set conceallevel=0
|
||||||
|
|
||||||
|
" Highlight 81 char in line
|
||||||
|
highlight ColorColumn ctermbg=DarkBlue guibg=DarkBlue
|
||||||
|
call matchadd('ColorColumn', '\%81v', 100)
|
||||||
|
|
||||||
|
" Find files and tab autocomplete
|
||||||
|
set path+=**
|
||||||
|
set wildmenu
|
||||||
|
nnoremap <leader>fi :find<Space>
|
||||||
|
|
||||||
|
autocmd TermOpen * setlocal nonumber
|
||||||
|
|
||||||
|
augroup extra_white_spaces
|
||||||
|
au!
|
||||||
|
highlight ExtraWhitespace ctermbg=red guibg=red
|
||||||
|
match ExtraWhitespace /\s\+\%#\@<!$/
|
||||||
|
au InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
|
||||||
|
au InsertLeave * match ExtraWhitespace /\s\+$/
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
|
||||||
|
let g:python3_host_prog = "/usr/bin/python"
|
||||||
|
|
||||||
|
" Python buffer settings
|
||||||
|
augroup fileType_python
|
||||||
|
autocmd!
|
||||||
|
autocmd BufNewFile,BufRead *.py set autoindent
|
||||||
|
autocmd Syntax python :syn keyword Keyword self
|
||||||
|
au FileType python nnoremap <buffer> <leader>c 0i#<esc>
|
||||||
|
augroup END
|
||||||
|
|
||||||
@@ -0,0 +1,179 @@
|
|||||||
|
-----------------------------------------------------------------------
|
||||||
|
-- Line numbers
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Show absolute line numbers.
|
||||||
|
vim.wo.number = true
|
||||||
|
|
||||||
|
-- Show relative line numbers for all lines except the current one.
|
||||||
|
-- Useful for relative motions (5j, 3k, etc.).
|
||||||
|
vim.wo.relativenumber = true
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
-- Search and editing behavior
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Ignore case when searching.
|
||||||
|
vim.opt.ignorecase = true
|
||||||
|
|
||||||
|
-- Override ignorecase if the search pattern contains uppercase letters.
|
||||||
|
-- Example:
|
||||||
|
-- /foo -> finds foo, Foo, FOO
|
||||||
|
-- /Foo -> finds only Foo variants with capital F
|
||||||
|
vim.opt.smartcase = true
|
||||||
|
|
||||||
|
-- Enable automatic indentation based on the previous line.
|
||||||
|
vim.opt.smartindent = true
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
-- Indentation
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Number of spaces used to display a tab character.
|
||||||
|
vim.opt.tabstop = 4
|
||||||
|
|
||||||
|
-- Number of spaces used for indentation commands (>>, <<).
|
||||||
|
vim.opt.shiftwidth = 4
|
||||||
|
|
||||||
|
-- Insert spaces instead of tab characters.
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
|
||||||
|
-- Number of spaces inserted/deleted when pressing Tab or Backspace.
|
||||||
|
vim.opt.softtabstop = 4
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
-- File format and encoding
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Use Unix-style line endings (LF instead of CRLF).
|
||||||
|
vim.opt.fileformat = "unix"
|
||||||
|
|
||||||
|
-- Use UTF-8 encoding.
|
||||||
|
vim.opt.encoding = "utf-8"
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
-- Line wrapping
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Wrap long lines instead of scrolling horizontally.
|
||||||
|
vim.opt.wrap = true
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
-- Disable terminal bells
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Disable audible and visual bells.
|
||||||
|
vim.opt.belloff = "all"
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
-- Split windows
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Open horizontal splits below the current window.
|
||||||
|
vim.opt.splitbelow = true
|
||||||
|
|
||||||
|
-- Open vertical splits to the right of the current window.
|
||||||
|
vim.opt.splitright = true
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
-- Completion popup menu
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Maximum number of entries displayed in completion popup.
|
||||||
|
vim.opt.pumheight = 15
|
||||||
|
|
||||||
|
-- Transparency level of popup menus.
|
||||||
|
-- 0 = opaque, 100 = fully transparent.
|
||||||
|
vim.opt.pumblend = 20
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
-- Temporary files
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Store backup files in /tmp.
|
||||||
|
-- The // suffix preserves the original directory tree.
|
||||||
|
vim.opt.backupdir = "/tmp//"
|
||||||
|
|
||||||
|
vim.opt.swapfile = false
|
||||||
|
|
||||||
|
-- Store swap files in /tmp.
|
||||||
|
vim.opt.directory = "/tmp//"
|
||||||
|
|
||||||
|
-- Store persistent undo files in /tmp.
|
||||||
|
vim.opt.undodir = "/tmp//"
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
-- Command line
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Height of the command line area.
|
||||||
|
vim.opt.cmdheight = 0
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
-- System clipboard
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Use the system clipboard (+ register) for yank/paste operations.
|
||||||
|
vim.opt.clipboard = "unnamedplus"
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
-- netrw file explorer
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Use tree-style listing.
|
||||||
|
vim.g.netrw_liststyle = 3
|
||||||
|
|
||||||
|
-- netrw buffer options:
|
||||||
|
-- noma -> not modifiable
|
||||||
|
-- nomod -> not marked as modified
|
||||||
|
-- nu -> show line numbers
|
||||||
|
-- nobl -> do not add to buffer list
|
||||||
|
-- nowrap -> disable line wrapping
|
||||||
|
-- ro -> read-only
|
||||||
|
vim.g.netrw_bufsettings = "noma nomod nu nobl nowrap ro"
|
||||||
|
|
||||||
|
|
||||||
|
-- Customize netrw buffers.
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = "netrw",
|
||||||
|
callback = function()
|
||||||
|
-- Hide absolute line numbers in netrw.
|
||||||
|
vim.opt_local.number = false
|
||||||
|
|
||||||
|
-- Hide relative line numbers in netrw.
|
||||||
|
vim.opt_local.relativenumber = false
|
||||||
|
|
||||||
|
-- Disable folding in netrw.
|
||||||
|
vim.opt_local.foldenable = false
|
||||||
|
|
||||||
|
-- Keep netrw read-only.
|
||||||
|
vim.opt_local.modifiable = false
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
-- Lua indentation
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Use 2 spaces instead of 4 for Lua files.
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = "lua",
|
||||||
|
callback = function()
|
||||||
|
vim.opt_local.tabstop = 2
|
||||||
|
vim.opt_local.shiftwidth = 2
|
||||||
|
vim.opt_local.softtabstop = 2
|
||||||
|
vim.opt_local.expandtab = true
|
||||||
|
end,
|
||||||
|
})
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
local function count_buffers()
|
||||||
|
local buff_list = vim.api.nvim_exec('ls', true)
|
||||||
|
local t = {}
|
||||||
|
local count = 0
|
||||||
|
for v in buff_list.gmatch(buff_list, "[^\n]+") do
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
|
return count
|
||||||
|
end
|
||||||
|
|
||||||
|
local function count_windows_and_position()
|
||||||
|
local win_n = vim.api.nvim_list_wins()
|
||||||
|
local current_win = vim.api.nvim_get_current_win()
|
||||||
|
local total_win = 0
|
||||||
|
local pos = 0
|
||||||
|
|
||||||
|
for k, v in pairs(win_n) do
|
||||||
|
total_win = total_win + 1
|
||||||
|
if v == current_win then
|
||||||
|
pos = k
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return total_win, pos
|
||||||
|
end
|
||||||
|
|
||||||
|
local function close_open_buff()
|
||||||
|
local count = count_buffers()
|
||||||
|
local total_win, pos = count_windows_and_position()
|
||||||
|
|
||||||
|
vim.api.nvim_command("bd")
|
||||||
|
|
||||||
|
if total_win ~= 1 and count > 2 then
|
||||||
|
vim.api.nvim_command("vs")
|
||||||
|
vim.api.nvim_command("bn")
|
||||||
|
|
||||||
|
if pos == 1 then
|
||||||
|
vim.api.nvim_exec("wincmd r", false)
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif count == 2 then
|
||||||
|
print(" > Last buffer")
|
||||||
|
|
||||||
|
elseif count == 1 then
|
||||||
|
print(" > No more buffer to close!")
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
close_open_buff = close_open_buff
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
-- Monokai scheme
|
||||||
|
-- --vim.opt.t_Co = 256
|
||||||
|
-- vim.opt.background = "dark"
|
||||||
|
--
|
||||||
|
-- vim.g['sonokai_disable_terminal_colors'] = 1
|
||||||
|
-- vim.g['sonokai_better_performance'] = 1
|
||||||
|
-- vim.g['sonokai_style'] = "atlantis"
|
||||||
|
-- vim.cmd.colorscheme('sonokai')
|
||||||
|
|
||||||
|
-- Catpuccin
|
||||||
|
vim.cmd.colorscheme('catppuccin-frappe')
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
-- require('git/gitsigns')
|
||||||
|
-- require('git/neogit')
|
||||||
|
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
-- require('gitsigns').setup {
|
||||||
|
-- signs = {
|
||||||
|
-- add = { text = '+' },
|
||||||
|
-- change = { text = '┃' },
|
||||||
|
-- delete = { text = '_' },
|
||||||
|
-- topdelete = { text = '‾' },
|
||||||
|
-- changedelete = { text = '~' },
|
||||||
|
-- untracked = { text = '┆' },
|
||||||
|
-- },
|
||||||
|
-- signs_staged = {
|
||||||
|
-- add = { text = '┃' },
|
||||||
|
-- change = { text = '┃' },
|
||||||
|
-- delete = { text = '_' },
|
||||||
|
-- topdelete = { text = '‾' },
|
||||||
|
-- changedelete = { text = '~' },
|
||||||
|
-- untracked = { text = '┆' },
|
||||||
|
-- },
|
||||||
|
-- signs_staged_enable = true,
|
||||||
|
-- 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 = {
|
||||||
|
-- follow_files = true
|
||||||
|
-- },
|
||||||
|
-- auto_attach = false,
|
||||||
|
-- attach_to_untracked = false,
|
||||||
|
-- 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 = 1000,
|
||||||
|
-- ignore_whitespace = false,
|
||||||
|
-- virt_text_priority = 100,
|
||||||
|
-- },
|
||||||
|
-- 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
|
||||||
|
-- },
|
||||||
|
-- }
|
||||||
|
--
|
||||||
@@ -0,0 +1,296 @@
|
|||||||
|
-- require("neogit").setup {
|
||||||
|
-- -- Hides the hints at the top of the status buffer
|
||||||
|
-- disable_hint = false,
|
||||||
|
-- -- Disables changing the buffer highlights based on where the cursor is.
|
||||||
|
-- disable_context_highlighting = false,
|
||||||
|
-- -- Disables signs for sections/items/hunks
|
||||||
|
-- disable_signs = false,
|
||||||
|
-- -- Changes what mode the Commit Editor starts in. `true` will leave nvim in normal mode, `false` will change nvim to
|
||||||
|
-- -- insert mode, and `"auto"` will change nvim to insert mode IF the commit message is empty, otherwise leaving it in
|
||||||
|
-- -- normal mode.
|
||||||
|
-- disable_insert_on_commit = "auto",
|
||||||
|
-- -- When enabled, will watch the `.git/` directory for changes and refresh the status buffer in response to filesystem
|
||||||
|
-- -- events.
|
||||||
|
-- filewatcher = {
|
||||||
|
-- interval = 1000,
|
||||||
|
-- enabled = true,
|
||||||
|
-- },
|
||||||
|
-- -- "ascii" is the graph the git CLI generates
|
||||||
|
-- -- "unicode" is the graph like https://github.com/rbong/vim-flog
|
||||||
|
-- graph_style = "ascii",
|
||||||
|
-- -- Used to generate URL's for branch popup action "pull request".
|
||||||
|
-- git_services = {
|
||||||
|
-- ["github.com"] = "https://github.com/${owner}/${repository}/compare/${branch_name}?expand=1",
|
||||||
|
-- ["bitbucket.org"] = "https://bitbucket.org/${owner}/${repository}/pull-requests/new?source=${branch_name}&t=1",
|
||||||
|
-- ["gitlab.com"] = "https://gitlab.com/${owner}/${repository}/merge_requests/new?merge_request[source_branch]=${branch_name}",
|
||||||
|
-- },
|
||||||
|
-- -- Allows a different telescope sorter. Defaults to 'fuzzy_with_index_bias'. The example below will use the native fzf
|
||||||
|
-- -- sorter instead. By default, this function returns `nil`.
|
||||||
|
-- telescope_sorter = function()
|
||||||
|
-- return require("telescope").extensions.fzf.native_fzf_sorter()
|
||||||
|
-- end,
|
||||||
|
-- -- Persist the values of switches/options within and across sessions
|
||||||
|
-- remember_settings = true,
|
||||||
|
-- -- Scope persisted settings on a per-project basis
|
||||||
|
-- use_per_project_settings = true,
|
||||||
|
-- -- Table of settings to never persist. Uses format "Filetype--cli-value"
|
||||||
|
-- ignored_settings = {
|
||||||
|
-- "NeogitPushPopup--force-with-lease",
|
||||||
|
-- "NeogitPushPopup--force",
|
||||||
|
-- "NeogitPullPopup--rebase",
|
||||||
|
-- "NeogitCommitPopup--allow-empty",
|
||||||
|
-- "NeogitRevertPopup--no-edit",
|
||||||
|
-- },
|
||||||
|
-- -- Configure highlight group features
|
||||||
|
-- highlight = {
|
||||||
|
-- italic = true,
|
||||||
|
-- bold = true,
|
||||||
|
-- underline = true
|
||||||
|
-- },
|
||||||
|
-- -- Set to false if you want to be responsible for creating _ALL_ keymappings
|
||||||
|
-- use_default_keymaps = true,
|
||||||
|
-- -- Neogit refreshes its internal state after specific events, which can be expensive depending on the repository size.
|
||||||
|
-- -- Disabling `auto_refresh` will make it so you have to manually refresh the status after you open it.
|
||||||
|
-- auto_refresh = true,
|
||||||
|
-- -- Value used for `--sort` option for `git branch` command
|
||||||
|
-- -- By default, branches will be sorted by commit date descending
|
||||||
|
-- -- Flag description: https://git-scm.com/docs/git-branch#Documentation/git-branch.txt---sortltkeygt
|
||||||
|
-- -- Sorting keys: https://git-scm.com/docs/git-for-each-ref#_options
|
||||||
|
-- sort_branches = "-committerdate",
|
||||||
|
-- -- Change the default way of opening neogit
|
||||||
|
-- kind = "tab",
|
||||||
|
-- -- Disable line numbers and relative line numbers
|
||||||
|
-- disable_line_numbers = true,
|
||||||
|
-- -- The time after which an output console is shown for slow running commands
|
||||||
|
-- console_timeout = 2000,
|
||||||
|
-- -- Automatically show console if a command takes more than console_timeout milliseconds
|
||||||
|
-- auto_show_console = true,
|
||||||
|
-- status = {
|
||||||
|
-- show_head_commit_hash = true,
|
||||||
|
-- recent_commit_count = 10,
|
||||||
|
-- HEAD_padding = 10,
|
||||||
|
-- HEAD_folded = false,
|
||||||
|
-- mode_padding = 3,
|
||||||
|
-- mode_text = {
|
||||||
|
-- M = "modified",
|
||||||
|
-- N = "new file",
|
||||||
|
-- A = "added",
|
||||||
|
-- D = "deleted",
|
||||||
|
-- C = "copied",
|
||||||
|
-- U = "updated",
|
||||||
|
-- R = "renamed",
|
||||||
|
-- DD = "unmerged",
|
||||||
|
-- AU = "unmerged",
|
||||||
|
-- UD = "unmerged",
|
||||||
|
-- UA = "unmerged",
|
||||||
|
-- DU = "unmerged",
|
||||||
|
-- AA = "unmerged",
|
||||||
|
-- UU = "unmerged",
|
||||||
|
-- ["?"] = "",
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- commit_editor = {
|
||||||
|
-- kind = "auto",
|
||||||
|
-- show_staged_diff = true,
|
||||||
|
-- -- Accepted values:
|
||||||
|
-- -- "split" to show the staged diff below the commit editor
|
||||||
|
-- -- "vsplit" to show it to the right
|
||||||
|
-- -- "split_above" Like :top split
|
||||||
|
-- -- "vsplit_left" like :vsplit, but open to the left
|
||||||
|
-- -- "auto" "vsplit" if window would have 80 cols, otherwise "split"
|
||||||
|
-- staged_diff_split_kind = "split"
|
||||||
|
-- },
|
||||||
|
-- commit_select_view = {
|
||||||
|
-- kind = "tab",
|
||||||
|
-- },
|
||||||
|
-- -- This breaks status line -> need to investigate
|
||||||
|
-- -- commit_view = {
|
||||||
|
-- -- kind = "vsplit",
|
||||||
|
-- -- verify_commit = os.execute("which gpg") == 0, -- Can be set to true or false, otherwise we try to find the binary
|
||||||
|
-- -- },
|
||||||
|
-- log_view = {
|
||||||
|
-- kind = "tab",
|
||||||
|
-- },
|
||||||
|
-- rebase_editor = {
|
||||||
|
-- kind = "auto",
|
||||||
|
-- },
|
||||||
|
-- reflog_view = {
|
||||||
|
-- kind = "tab",
|
||||||
|
-- },
|
||||||
|
-- merge_editor = {
|
||||||
|
-- kind = "auto",
|
||||||
|
-- },
|
||||||
|
-- tag_editor = {
|
||||||
|
-- kind = "auto",
|
||||||
|
-- },
|
||||||
|
-- preview_buffer = {
|
||||||
|
-- kind = "split",
|
||||||
|
-- },
|
||||||
|
-- popup = {
|
||||||
|
-- kind = "split",
|
||||||
|
-- },
|
||||||
|
-- signs = {
|
||||||
|
-- -- { CLOSED, OPENED }
|
||||||
|
-- hunk = { "", "" },
|
||||||
|
-- item = { ">", "v" },
|
||||||
|
-- section = { ">", "v" },
|
||||||
|
-- },
|
||||||
|
-- -- Each Integration is auto-detected through plugin presence, however, it can be disabled by setting to `false`
|
||||||
|
-- integrations = {
|
||||||
|
-- -- If enabled, use telescope for menu selection rather than vim.ui.select.
|
||||||
|
-- -- Allows multi-select and some things that vim.ui.select doesn't.
|
||||||
|
-- telescope = true,
|
||||||
|
-- -- Neogit only provides inline diffs. If you want a more traditional way to look at diffs, you can use `diffview`.
|
||||||
|
-- -- The diffview integration enables the diff popup.
|
||||||
|
-- --
|
||||||
|
-- -- Requires you to have `sindrets/diffview.nvim` installed.
|
||||||
|
-- diffview = true,
|
||||||
|
--
|
||||||
|
-- -- If enabled, uses fzf-lua for menu selection. If the telescope integration
|
||||||
|
-- -- is also selected then telescope is used instead
|
||||||
|
-- -- Requires you to have `ibhagwan/fzf-lua` installed.
|
||||||
|
-- fzf_lua = true,
|
||||||
|
-- },
|
||||||
|
-- sections = {
|
||||||
|
-- -- Reverting/Cherry Picking
|
||||||
|
-- sequencer = {
|
||||||
|
-- folded = false,
|
||||||
|
-- hidden = false,
|
||||||
|
-- },
|
||||||
|
-- untracked = {
|
||||||
|
-- folded = false,
|
||||||
|
-- hidden = false,
|
||||||
|
-- },
|
||||||
|
-- unstaged = {
|
||||||
|
-- folded = false,
|
||||||
|
-- hidden = false,
|
||||||
|
-- },
|
||||||
|
-- staged = {
|
||||||
|
-- folded = false,
|
||||||
|
-- hidden = false,
|
||||||
|
-- },
|
||||||
|
-- stashes = {
|
||||||
|
-- folded = true,
|
||||||
|
-- hidden = false,
|
||||||
|
-- },
|
||||||
|
-- unpulled_upstream = {
|
||||||
|
-- folded = true,
|
||||||
|
-- hidden = false,
|
||||||
|
-- },
|
||||||
|
-- unmerged_upstream = {
|
||||||
|
-- folded = false,
|
||||||
|
-- hidden = false,
|
||||||
|
-- },
|
||||||
|
-- unpulled_pushRemote = {
|
||||||
|
-- folded = true,
|
||||||
|
-- hidden = false,
|
||||||
|
-- },
|
||||||
|
-- unmerged_pushRemote = {
|
||||||
|
-- folded = false,
|
||||||
|
-- hidden = false,
|
||||||
|
-- },
|
||||||
|
-- recent = {
|
||||||
|
-- folded = true,
|
||||||
|
-- hidden = false,
|
||||||
|
-- },
|
||||||
|
-- rebase = {
|
||||||
|
-- folded = true,
|
||||||
|
-- hidden = false,
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- mappings = {
|
||||||
|
-- commit_editor = {
|
||||||
|
-- ["q"] = "Close",
|
||||||
|
-- ["<c-c><c-c>"] = "Submit",
|
||||||
|
-- ["<c-c><c-k>"] = "Abort",
|
||||||
|
-- },
|
||||||
|
-- commit_editor_I = {
|
||||||
|
-- ["<c-c><c-c>"] = "Submit",
|
||||||
|
-- ["<c-c><c-k>"] = "Abort",
|
||||||
|
-- },
|
||||||
|
-- rebase_editor = {
|
||||||
|
-- ["p"] = "Pick",
|
||||||
|
-- ["r"] = "Reword",
|
||||||
|
-- ["e"] = "Edit",
|
||||||
|
-- ["s"] = "Squash",
|
||||||
|
-- ["f"] = "Fixup",
|
||||||
|
-- ["x"] = "Execute",
|
||||||
|
-- ["d"] = "Drop",
|
||||||
|
-- ["b"] = "Break",
|
||||||
|
-- ["q"] = "Close",
|
||||||
|
-- ["<cr>"] = "OpenCommit",
|
||||||
|
-- ["gk"] = "MoveUp",
|
||||||
|
-- ["gj"] = "MoveDown",
|
||||||
|
-- ["<c-c><c-c>"] = "Submit",
|
||||||
|
-- ["<c-c><c-k>"] = "Abort",
|
||||||
|
-- ["[c"] = "OpenOrScrollUp",
|
||||||
|
-- ["]c"] = "OpenOrScrollDown",
|
||||||
|
-- },
|
||||||
|
-- rebase_editor_I = {
|
||||||
|
-- ["<c-c><c-c>"] = "Submit",
|
||||||
|
-- ["<c-c><c-k>"] = "Abort",
|
||||||
|
-- },
|
||||||
|
-- finder = {
|
||||||
|
-- ["<cr>"] = "Select",
|
||||||
|
-- ["<c-c>"] = "Close",
|
||||||
|
-- ["<esc>"] = "Close",
|
||||||
|
-- ["<c-n>"] = "Next",
|
||||||
|
-- ["<c-p>"] = "Previous",
|
||||||
|
-- ["<down>"] = "Next",
|
||||||
|
-- ["<up>"] = "Previous",
|
||||||
|
-- ["<tab>"] = "MultiselectToggleNext",
|
||||||
|
-- ["<s-tab>"] = "MultiselectTogglePrevious",
|
||||||
|
-- ["<c-j>"] = "NOP",
|
||||||
|
-- },
|
||||||
|
-- -- Setting any of these to `false` will disable the mapping.
|
||||||
|
-- popup = {
|
||||||
|
-- ["?"] = "HelpPopup",
|
||||||
|
-- ["A"] = "CherryPickPopup",
|
||||||
|
-- ["D"] = "DiffPopup",
|
||||||
|
-- ["M"] = "RemotePopup",
|
||||||
|
-- ["P"] = "PushPopup",
|
||||||
|
-- ["X"] = "ResetPopup",
|
||||||
|
-- ["Z"] = "StashPopup",
|
||||||
|
-- ["b"] = "BranchPopup",
|
||||||
|
-- ["B"] = "BisectPopup",
|
||||||
|
-- ["c"] = "CommitPopup",
|
||||||
|
-- ["f"] = "FetchPopup",
|
||||||
|
-- ["l"] = "LogPopup",
|
||||||
|
-- ["m"] = "MergePopup",
|
||||||
|
-- ["p"] = "PullPopup",
|
||||||
|
-- ["r"] = "RebasePopup",
|
||||||
|
-- ["v"] = "RevertPopup",
|
||||||
|
-- ["w"] = "WorktreePopup",
|
||||||
|
-- },
|
||||||
|
-- status = {
|
||||||
|
-- ["k"] = "MoveUp",
|
||||||
|
-- ["j"] = "MoveDown",
|
||||||
|
-- ["q"] = "Close",
|
||||||
|
-- ["o"] = "OpenTree",
|
||||||
|
-- ["I"] = "InitRepo",
|
||||||
|
-- ["1"] = "Depth1",
|
||||||
|
-- ["2"] = "Depth2",
|
||||||
|
-- ["3"] = "Depth3",
|
||||||
|
-- ["4"] = "Depth4",
|
||||||
|
-- ["<tab>"] = "Toggle",
|
||||||
|
-- ["x"] = "Discard",
|
||||||
|
-- ["s"] = "Stage",
|
||||||
|
-- ["S"] = "StageUnstaged",
|
||||||
|
-- ["<c-s>"] = "StageAll",
|
||||||
|
-- ["K"] = "Untrack",
|
||||||
|
-- ["u"] = "Unstage",
|
||||||
|
-- ["U"] = "UnstageStaged",
|
||||||
|
-- ["$"] = "CommandHistory",
|
||||||
|
-- ["Y"] = "YankSelected",
|
||||||
|
-- ["<c-r>"] = "RefreshBuffer",
|
||||||
|
-- ["<enter>"] = "GoToFile",
|
||||||
|
-- ["<c-v>"] = "VSplitOpen",
|
||||||
|
-- ["<c-x>"] = "SplitOpen",
|
||||||
|
-- ["<c-t>"] = "TabOpen",
|
||||||
|
-- ["{"] = "GoToPreviousHunkHeader",
|
||||||
|
-- ["}"] = "GoToNextHunkHeader",
|
||||||
|
-- ["[c"] = "OpenOrScrollUp",
|
||||||
|
-- ["]c"] = "OpenOrScrollDown",
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- }
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.set_port = function(port)
|
||||||
|
default_port = '7070'
|
||||||
|
if port ~= nil then
|
||||||
|
default_port = port
|
||||||
|
end
|
||||||
|
|
||||||
|
return default_port
|
||||||
|
end
|
||||||
|
|
||||||
|
M.start = function(port)
|
||||||
|
default_port = M.set_port(port)
|
||||||
|
-- Create autocmd for execute cmd when autosave
|
||||||
|
end
|
||||||
|
|
||||||
|
M.file_saved = function()
|
||||||
|
local ouput = vim.fn.system('ls -l')
|
||||||
|
print(output)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
-- File types that signify a Java project's root directory. This will be
|
||||||
|
-- used by eclipse to determine what constitutes a workspace
|
||||||
|
--local root_markers = {'gradlew', 'mvnw', 'pom.xml'}
|
||||||
|
--local root_dir = require('jdtls.setup').find_root(root_markers)
|
||||||
|
--print(root_dir)
|
||||||
|
--
|
||||||
|
--local workspace_folder = "/home/ian/.local/share/eclipse/" .. vim.fn.fnamemodify(root_dir, ":p:h:t")
|
||||||
|
--
|
||||||
|
--local config = {
|
||||||
|
-- cmd = {
|
||||||
|
-- 'java',
|
||||||
|
-- '-Declipse.application=org.eclipse.jdt.ls.core.id1',
|
||||||
|
-- '-Dosgi.bundles.defaultStartLevel=4',
|
||||||
|
-- '-Declipse.product=org.eclipse.jdt.ls.core.product',
|
||||||
|
-- '-Dlog.protocol=true',
|
||||||
|
-- '-Dlog.level=ALL',
|
||||||
|
-- '-Xmx1g',
|
||||||
|
-- '--add-modules=ALL-SYSTEM',
|
||||||
|
-- '--add-opens', 'java.base/java.util=ALL-UNNAMED',
|
||||||
|
-- '--add-opens', 'java.base/java.lang=ALL-UNNAMED',
|
||||||
|
-- -- '-jar', '/home/ian/jdtls/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.2.900.v20240129-1338.jar',
|
||||||
|
-- '-jar', '/home/ian/jdtls/plugins/org.eclipse.equinox.launcher_1.6.700.v20231214-2017.jar',
|
||||||
|
-- '-configuration', '/home/ian/jdtls/config_linux',
|
||||||
|
-- '-data', workspace_folder,
|
||||||
|
-- },
|
||||||
|
--
|
||||||
|
-- -- 💀
|
||||||
|
-- -- This is the default if not provided, you can remove it. Or adjust as needed.
|
||||||
|
-- -- One dedicated LSP server & client will be started per unique root_dir
|
||||||
|
-- root_dir = root_dir,
|
||||||
|
--
|
||||||
|
-- -- Here you can configure eclipse.jdt.ls specific settings
|
||||||
|
-- -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request
|
||||||
|
-- -- for a list of options
|
||||||
|
-- settings = {
|
||||||
|
-- java = {
|
||||||
|
-- format = {
|
||||||
|
-- url = '/home/ian/.local/share/eclipse/eclipse-java-google-style.xml',
|
||||||
|
-- profile = 'GoogleStyle',
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
--
|
||||||
|
-- -- Language server `initializationOptions`
|
||||||
|
-- -- You need to extend the `bundles` with paths to jar files
|
||||||
|
-- -- if you want to use additional eclipse.jdt.ls plugins.
|
||||||
|
-- --
|
||||||
|
-- -- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation
|
||||||
|
-- --
|
||||||
|
-- -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this
|
||||||
|
-- init_options = {
|
||||||
|
-- bundles = {}
|
||||||
|
-- },
|
||||||
|
--
|
||||||
|
-- signatureHelp = { enabled = true },
|
||||||
|
-- contentProvider = { preferred = 'fernflower' }, -- Use fernflower to decompile library code
|
||||||
|
-- -- Specify any completion options
|
||||||
|
-- completion = {
|
||||||
|
-- favoriteStaticMembers = {
|
||||||
|
-- "org.hamcrest.MatcherAssert.assertThat",
|
||||||
|
-- "org.hamcrest.Matchers.*",
|
||||||
|
-- "org.hamcrest.CoreMatchers.*",
|
||||||
|
-- "org.junit.jupiter.api.Assertions.*",
|
||||||
|
-- "java.util.Objects.requireNonNull",
|
||||||
|
-- "java.util.Objects.requireNonNullElse",
|
||||||
|
-- "org.mockito.Mockito.*"
|
||||||
|
-- },
|
||||||
|
-- filteredTypes = {
|
||||||
|
-- "com.sun.*",
|
||||||
|
-- "io.micrometer.shaded.*",
|
||||||
|
-- "java.awt.*",
|
||||||
|
-- "jdk.*", "sun.*",
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- -- Specify any options for organizing imports
|
||||||
|
-- sources = {
|
||||||
|
-- organizeImports = {
|
||||||
|
-- starThreshold = 9999;
|
||||||
|
-- staticStarThreshold = 9999;
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- -- How code generation should act
|
||||||
|
-- codeGeneration = {
|
||||||
|
-- toString = {
|
||||||
|
-- template = "${object.className}{${member.name()}=${member.value}, ${otherMembers}}"
|
||||||
|
-- },
|
||||||
|
-- hashCodeEquals = {
|
||||||
|
-- useJava7Objects = true,
|
||||||
|
-- },
|
||||||
|
-- useBlocks = true,
|
||||||
|
-- },
|
||||||
|
--}
|
||||||
|
---- This starts a new client & server,
|
||||||
|
---- or attaches to an existing client & server depending on the `root_dir`.
|
||||||
|
--require('jdtls').start_or_attach(config)
|
||||||
|
|
||||||
|
local config = {
|
||||||
|
cmd = {'/home/ian/jdtls/bin/jdtls'},
|
||||||
|
root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, { upward = true })[1]),
|
||||||
|
}
|
||||||
|
require('jdtls').start_or_attach(config)
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
local bind = vim.keymap.set
|
||||||
|
|
||||||
|
vim.g.mapleader = ","
|
||||||
|
|
||||||
|
bind('n', '<leader>v', '<cmd>vsp<cr><C-w>l', { desc = 'Vertical split' })
|
||||||
|
--bind('n', '<leader>e', '<cmd>e .<cr><cmd>set relativenumber<cr>', { desc = 'Netrw file manager' })
|
||||||
|
bind('n', '<leader>e', '<cmd>Neotree toggle<cr>', { desc = 'Neotree' })
|
||||||
|
bind('n', '<M-1>', '<cmd>Neotree reveal<cr>')
|
||||||
|
|
||||||
|
-- Buffer navigation
|
||||||
|
bind('n', '<M-l>', '<cmd>bp<cr>', { desc = 'Buffer previous' })
|
||||||
|
bind('n', '<M-h>', '<cmd>bn<cr>', { desc = 'Buffer next' })
|
||||||
|
bind('n', '<M-Down>', '<cmd>CloseOpenBuff<cr>', { desc = 'Buffer close' })
|
||||||
|
|
||||||
|
-- Buffer resize
|
||||||
|
bind('n', '<leader>+', '<cmd>vertical resize +5<cr>', { desc = 'Buffer increase size' })
|
||||||
|
bind('n', '<leader>-', '<cmd>vertical resize -5<cr>', { desc = 'Buffer decrease size' })
|
||||||
|
|
||||||
|
-- Tab movements
|
||||||
|
bind('n', '<C-M-n>', '<cmd>tabnew<cr>', { desc = 'New tab' })
|
||||||
|
bind('n', '<C-M-Down>', '<cmd>tabclose<cr>', { desc = 'Close tab' })
|
||||||
|
bind('n', '<C-M-l>', '<cmd>tabnext<cr>', { desc = 'Next tab' })
|
||||||
|
bind('n', '<C-M-h>', '<cmd>tabprevious<cr>', { desc = 'Previous tab' })
|
||||||
|
|
||||||
|
-- Movements into buffer
|
||||||
|
bind('n', "<C-d>", "<C-d>zz", { desc = 'Center cursor after page down' })
|
||||||
|
bind('n', "<C-u>", "<C-u>zz", { desc = 'Center cursor after page up' })
|
||||||
|
|
||||||
|
-- Move lines in visual mode
|
||||||
|
bind('v', 'K', ":m '<-2<cr>gv=gv", { desc = 'Move highlighted lines up' })
|
||||||
|
bind('v', 'J', ":m '>+1<cr>gv=gv", { desc = 'Move highlighted lines down' })
|
||||||
|
|
||||||
|
-- Text cleaning
|
||||||
|
bind('n', '<leader>w', '<cmd>%s/\\s\\+$/<cr><cmd>nohlsearch<cr>', { desc = 'Delete white spaces at end of each line' })
|
||||||
|
|
||||||
|
-- Quick fix list
|
||||||
|
bind('n', '<leader>cc', '<cmd>cclose<cr>')
|
||||||
|
bind('n', '<leader>co', '<cmd>copen<cr>')
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command('W', "update", { nargs='?'})
|
||||||
|
|
||||||
|
-- Telescope
|
||||||
|
bind('n', '<leader>ff', '<cmd>Telescope find_files<cr>')
|
||||||
|
-- bind('n', '<leader>fg', '<cmd>Telescope live_grep<cr>')
|
||||||
|
bind('n', '<leader>fg', require("telescope").extensions.live_grep_args.live_grep_args, { noremap = true })
|
||||||
|
bind('n', '<leader>fb', '<cmd>Telescope buffers<cr>')
|
||||||
|
bind('n', '<leader>fh', '<cmd>Telescope help_tags<cr>')
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command('MyFuncs', require('my_funcs').reopen, { nargs='?'})
|
||||||
|
bind('n', '<leader>r', '<cmd>MyFuncs<cr>')
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command('MyFuncsPP', require('my_funcs').print_path, { nargs='?'})
|
||||||
|
bind('n', '<leader>pp', '<cmd>MyFuncsPP<cr>')
|
||||||
|
-- bind({'n', 'i'}, '<C-w>', '<cmd>w<cr>', { desc = 'Save with CTRL+s' })
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command('GoVoyeur', require('goVoyeur').file_saved, { nargs='?'})
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
vim.opt.completeopt = {'menu', 'menuone', 'noselect'}
|
||||||
|
local cmp = require('cmp')
|
||||||
|
|
||||||
|
if cmp ~= nil then
|
||||||
|
|
||||||
|
local select_opts = {behavior = cmp.SelectBehavior.Select}
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
sources = {
|
||||||
|
-- l'ordine indica la priorità o aggiungere `priority = k`
|
||||||
|
{ name = 'luasnip' },
|
||||||
|
{ name = 'nvim_lsp', keyword_length = 3,
|
||||||
|
-- Disable LSP snippets
|
||||||
|
entry_filter = function(entry)
|
||||||
|
return require("cmp").lsp.CompletionItemKind.Snippet ~= entry:get_kind()
|
||||||
|
end },
|
||||||
|
{ name = 'buffer', keyword_length = 3 },
|
||||||
|
{ name = 'path' },
|
||||||
|
{ name = 'nvim_lua' },
|
||||||
|
},
|
||||||
|
|
||||||
|
window = {
|
||||||
|
completion = {
|
||||||
|
scrolloff = 2
|
||||||
|
},
|
||||||
|
documentation = {
|
||||||
|
max_width = 80
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
formatting = {
|
||||||
|
fields = { 'abbr', 'kind', 'menu' },
|
||||||
|
format = function(entry, item)
|
||||||
|
local menu_icon = {
|
||||||
|
nvim_lsp = '[LSP]',
|
||||||
|
luasnip = '[Snip]',
|
||||||
|
buffer = '[Buf]',
|
||||||
|
path = '[Path]',
|
||||||
|
latex_symbols = '[LaTeX]',
|
||||||
|
nvim_lua = '[Lua]'
|
||||||
|
}
|
||||||
|
|
||||||
|
item.menu = menu_icon[entry.source.name]
|
||||||
|
|
||||||
|
if (string.len(item.abbr) > 50) then
|
||||||
|
item.abbr = string.sub(item.abbr, 1, 50) .. ".."
|
||||||
|
end
|
||||||
|
|
||||||
|
return item
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
mapping = {
|
||||||
|
['<C-p>'] = cmp.mapping.select_prev_item(select_opts),
|
||||||
|
['<C-n>'] = cmp.mapping.select_next_item(select_opts),
|
||||||
|
|
||||||
|
['<C-u>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
|
||||||
|
--['<C-e>'] = cmp.mapping.abort(), -- cmp.mapping.close()
|
||||||
|
|
||||||
|
['<CR>'] = cmp.mapping.confirm({select = true}),
|
||||||
|
['<C-y>'] = cmp.mapping.confirm({select = true}),
|
||||||
|
|
||||||
|
--['<C-Space>'] = cmp.mapping.complete(),
|
||||||
|
['<C-Space>'] = function()
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.abort()
|
||||||
|
else
|
||||||
|
cmp.complete()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--['<Tab>'] = cmp.mapping(function(fallback)
|
||||||
|
|
||||||
|
-- local col = vim.fn.col('.') - 1
|
||||||
|
|
||||||
|
-- if cmp.visible() then
|
||||||
|
-- cmp.select_next_item(select_opts)
|
||||||
|
-- elseif col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
|
||||||
|
-- fallback()
|
||||||
|
-- else
|
||||||
|
-- cmp.complete()
|
||||||
|
-- end
|
||||||
|
--end, {'i', 's'}),
|
||||||
|
|
||||||
|
--['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||||
|
-- if cmp.visible() then
|
||||||
|
-- cmp.select_prev_item(select_opts)
|
||||||
|
-- else
|
||||||
|
-- fallback()
|
||||||
|
-- end
|
||||||
|
--end, {'i', 's'}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
end
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
-- Global configuration
|
||||||
|
local lsp_defaults = {
|
||||||
|
flags = {
|
||||||
|
debounce_text_changes = 150,
|
||||||
|
},
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(
|
||||||
|
vim.lsp.protocol.make_client_capabilities()
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
local lspconfig = require('lspconfig')
|
||||||
|
|
||||||
|
lspconfig.util.default_config = vim.tbl_deep_extend(
|
||||||
|
'force',
|
||||||
|
lspconfig.util.default_config,
|
||||||
|
lsp_defaults
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Disable lsp messages over text
|
||||||
|
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||||
|
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
|
signs = false,
|
||||||
|
virtual_text = false,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Show diagnostic window when cursor is over error
|
||||||
|
vim.o.updatetime = 250
|
||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
command = [[autocmd! CursorHold * lua vim.diagnostic.open_float(nil, {focus=false, scope="cursor"})]],
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
desc = 'LSP Keybinds',
|
||||||
|
|
||||||
|
callback = function(ev)
|
||||||
|
local bufmap = function(mode, keys, func)
|
||||||
|
local opts = {buffer = 0}
|
||||||
|
vim.keymap.set(mode, keys, func, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
bufmap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>')
|
||||||
|
bufmap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>')
|
||||||
|
bufmap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>')
|
||||||
|
bufmap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>')
|
||||||
|
bufmap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>')
|
||||||
|
bufmap('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<cr>')
|
||||||
|
bufmap({'n', 'v'}, '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<cr>')
|
||||||
|
|
||||||
|
bufmap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<cr>')
|
||||||
|
bufmap('n', '<C-h>', '<cmd>lua vim.diagnostic.setloclist()<cr>')
|
||||||
|
bufmap('n', '<C-p>', '<cmd>lua vim.diagnostic.goto_prev()<cr>')
|
||||||
|
bufmap('n', '<C-n>', '<cmd>lua vim.diagnostic.goto_next()<cr>')
|
||||||
|
-- Jumps to the definition of the type symbol
|
||||||
|
--bufmap('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>')
|
||||||
|
--print(string.format('event fired: %s', vim.inspect(ev)))
|
||||||
|
|
||||||
|
bufmap('n', '<leader>sa', '<cmd>vim.lsp.buf.add_workspace_folder<cr>')
|
||||||
|
bufmap('n', '<leader>sr', '<cmd>vim.lsp.buf.remove_workspace_folder<cr>')
|
||||||
|
bufmap('n', '<leader>sl', function()
|
||||||
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
end)
|
||||||
|
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Lsp autoformat file
|
||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
command = [[lua vim.api.nvim_buf_create_user_command(0, 'Format',
|
||||||
|
function()
|
||||||
|
vim.lsp.buf.format()
|
||||||
|
end, { desc = 'Format current buffer with LSP' })
|
||||||
|
]]
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Lsp server init
|
||||||
|
|
||||||
|
-- https://pypi.org/project/pyright/
|
||||||
|
require'lspconfig'.pyright.setup{}
|
||||||
|
|
||||||
|
-- require'lspconfig'.dockerls.setup{ }
|
||||||
|
|
||||||
|
-- https://github.com/MaskRay/ccls/wiki
|
||||||
|
--require'lspconfig'.ccls.setup {
|
||||||
|
-- init_options = {
|
||||||
|
-- compilationDatabaseDirectory = "build";
|
||||||
|
-- index = {
|
||||||
|
-- threads = 0;
|
||||||
|
-- };
|
||||||
|
-- clang = {
|
||||||
|
-- excludeArgs = { "-frounding-math"} ;
|
||||||
|
-- };
|
||||||
|
-- }
|
||||||
|
--}
|
||||||
|
|
||||||
|
-- require('lspconfig').yamlls.setup {
|
||||||
|
-- settings = {
|
||||||
|
-- yaml = {
|
||||||
|
-- schemas = {
|
||||||
|
-- ["https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.yaml"] = "/*.openapi.yaml"
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- }
|
||||||
|
-- }
|
||||||
|
|
||||||
|
-- https://github.com/golang/tools/tree/master/gopls
|
||||||
|
require'lspconfig'.gopls.setup{
|
||||||
|
cmd = {'gopls', '--remote=auto'}
|
||||||
|
}
|
||||||
|
|
||||||
|
-- https://clangd.llvm.org/installation.html
|
||||||
|
require'lspconfig'.clangd.setup{}
|
||||||
|
|
||||||
|
-- https://quick-lint-js.com/
|
||||||
|
require'lspconfig'.quick_lint_js.setup{}
|
||||||
|
|
||||||
|
-- require'lspconfig'.vuels.setup{}
|
||||||
|
|
||||||
|
-- npm install -g @angular/language-server
|
||||||
|
-- https://github.com/neovim/nvim-lspconfig/issues/1155#issuecomment-1205680003
|
||||||
|
local npm_path = "/usr/lib/node_modules"
|
||||||
|
local cmd = {"ngserver", "--stdio", "--tsProbeLocations", npm_path , "--ngProbeLocations", npm_path}
|
||||||
|
|
||||||
|
require'lspconfig'.angularls.setup{
|
||||||
|
cmd = cmd,
|
||||||
|
on_new_config = function(new_config,new_root_dir)
|
||||||
|
new_config.cmd = cmd
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- npm install -g typescript typescript-language-server
|
||||||
|
require'lspconfig'.tsserver.setup{}
|
||||||
|
|
||||||
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
|
|
||||||
|
-- npm i -g vscode-langservers-extracted
|
||||||
|
require'lspconfig'.html.setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
filetypes = { "css", "html", "php" }
|
||||||
|
}
|
||||||
|
|
||||||
|
-- npm i -g vscode-langservers-extracted
|
||||||
|
require'lspconfig'.cssls.setup{
|
||||||
|
capabilities = capabilities,
|
||||||
|
filetypes = { "css", "html", "php" }
|
||||||
|
}
|
||||||
|
|
||||||
|
require'lspconfig'.cssmodules_ls.setup{
|
||||||
|
filetypes = { "css", "html", "php" }
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
require('lsp/lsp')
|
||||||
|
require('lsp/cmp_conf')
|
||||||
|
require('lsp/snippets')
|
||||||
|
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
local bind = vim.keymap.set
|
||||||
|
local ls = require("luasnip")
|
||||||
|
|
||||||
|
local snip = ls.snippet
|
||||||
|
local node = ls.snippet_node
|
||||||
|
local text = ls.text_node
|
||||||
|
local insert = ls.insert_node
|
||||||
|
local func = ls.function_node
|
||||||
|
local choice = ls.choice_node
|
||||||
|
local dynamicn = ls.dynamic_node
|
||||||
|
|
||||||
|
local fmt = require('luasnip.extras.fmt').fmt
|
||||||
|
|
||||||
|
ls.config.set_config({
|
||||||
|
history = true,
|
||||||
|
updateevents = "TextChanged, TextChangedI",
|
||||||
|
enable_autosnippets = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Lua snips
|
||||||
|
bind({"i", "s"}, "<C-l>", function()
|
||||||
|
if ls.expand_or_jumpable() then
|
||||||
|
ls.expand_or_jump()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
bind({"i", "s"}, "<C-h>", function()
|
||||||
|
if ls.jumpable(-1) then
|
||||||
|
ls.jump(-1)
|
||||||
|
end
|
||||||
|
end, {silent = true})
|
||||||
|
|
||||||
|
bind({"i", "s"}, "<C-k>", function()
|
||||||
|
if ls.choice_active() then
|
||||||
|
ls.change_choice(1)
|
||||||
|
end
|
||||||
|
end, {silent = true})
|
||||||
|
|
||||||
|
ls.add_snippets(nil, {
|
||||||
|
all = {
|
||||||
|
snip({
|
||||||
|
trig = "ternary",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
-- equivalent to "${1:cond} ? ${2:then} : ${3:else}"
|
||||||
|
insert(1, "cond"), text(" ? "), insert(2, "then"), text(" : "), insert(3, "else")
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
sh = {
|
||||||
|
snip({
|
||||||
|
trig = "shebang-bash",
|
||||||
|
namr = "Shebang bash",
|
||||||
|
dscr = "Shebang for bash",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text { "#!/bin/bash", ""},
|
||||||
|
insert(0),
|
||||||
|
}),
|
||||||
|
|
||||||
|
snip({
|
||||||
|
trig = "shebang-shell",
|
||||||
|
namr = "Shebang shell",
|
||||||
|
dscr = "Shebang for shell"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text { "#!/bin/sh", ""},
|
||||||
|
insert(0),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
|
||||||
|
typescript = ({
|
||||||
|
snip({
|
||||||
|
trig = "cfunction",
|
||||||
|
namr = "Class typed function",
|
||||||
|
},
|
||||||
|
fmt([[{} {}({}): {}{{{}}}]],
|
||||||
|
{
|
||||||
|
choice(1,
|
||||||
|
{
|
||||||
|
text(""),
|
||||||
|
text("private"),
|
||||||
|
text("public")
|
||||||
|
}),
|
||||||
|
insert(2, "func"),
|
||||||
|
insert(3, "params"),
|
||||||
|
insert(4, "return_type"),
|
||||||
|
insert(5),
|
||||||
|
})
|
||||||
|
),
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.hello = function()
|
||||||
|
print('Hello da my funcs')
|
||||||
|
end
|
||||||
|
|
||||||
|
M.reopen = function()
|
||||||
|
local path = vim.api.nvim_buf_get_name(0)
|
||||||
|
vim.api.nvim_command("bd")
|
||||||
|
vim.api.nvim_command("e " ..path)
|
||||||
|
end
|
||||||
|
|
||||||
|
M.print_path = function()
|
||||||
|
local path = vim.api.nvim_buf_get_name(0)
|
||||||
|
print(path)
|
||||||
|
local cmd = "echo \"" ..path .."\" | clip"
|
||||||
|
vim.fn.system(cmd)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,329 @@
|
|||||||
|
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,
|
||||||
|
open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes
|
||||||
|
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 = 1,
|
||||||
|
padding = 0, -- 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 = "",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
-- If you don't want to use these columns, you can set `enabled = false` for each of them individually
|
||||||
|
file_size = {
|
||||||
|
enabled = true,
|
||||||
|
required_width = 64, -- min width of window required to show this column
|
||||||
|
},
|
||||||
|
type = {
|
||||||
|
enabled = true,
|
||||||
|
required_width = 122, -- min width of window required to show this column
|
||||||
|
},
|
||||||
|
last_modified = {
|
||||||
|
enabled = true,
|
||||||
|
required_width = 88, -- min width of window required to show this column
|
||||||
|
},
|
||||||
|
created = {
|
||||||
|
enabled = true,
|
||||||
|
required_width = 110, -- min width of window required to show this column
|
||||||
|
},
|
||||||
|
symlink_target = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- A list of functions, each representing a global custom command
|
||||||
|
-- that will be available in all sources (if not overridden in `opts[source_name].commands`)
|
||||||
|
-- see `:h neo-tree-custom-commands-global`
|
||||||
|
commands = {
|
||||||
|
yank_path = function(state)
|
||||||
|
-- NeoTree is based on [NuiTree](https://github.com/MunifTanjim/nui.nvim/tree/main/lua/nui/tree)
|
||||||
|
-- The node is based on [NuiNode](https://github.com/MunifTanjim/nui.nvim/tree/main/lua/nui/tree#nuitreenode)
|
||||||
|
local node = state.tree:get_node()
|
||||||
|
local filepath = node:get_id()
|
||||||
|
local filename = node.name
|
||||||
|
local modify = vim.fn.fnamemodify
|
||||||
|
|
||||||
|
local results = {
|
||||||
|
filepath,
|
||||||
|
modify(filepath, ':.'),
|
||||||
|
modify(filepath, ':~'),
|
||||||
|
filename,
|
||||||
|
modify(filename, ':r'),
|
||||||
|
modify(filename, ':e'),
|
||||||
|
}
|
||||||
|
|
||||||
|
-- absolute path to clipboard
|
||||||
|
local i = vim.fn.inputlist({
|
||||||
|
'Choose to copy to clipboard:',
|
||||||
|
'1. Absolute path: ' .. results[1],
|
||||||
|
'2. Path relative to CWD: ' .. results[2],
|
||||||
|
'3. Path relative to HOME: ' .. results[3],
|
||||||
|
'4. Filename: ' .. results[4],
|
||||||
|
'5. Filename without extension: ' .. results[5],
|
||||||
|
'6. Extension of the filename: ' .. results[6],
|
||||||
|
})
|
||||||
|
|
||||||
|
if i > 0 then
|
||||||
|
local result = results[i]
|
||||||
|
if not result then return print('Invalid choice: ' .. i) end
|
||||||
|
vim.fn.setreg('"', result)
|
||||||
|
vim.notify('Copied: ' .. result)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
position = "left",
|
||||||
|
width = 40,
|
||||||
|
mapping_options = {
|
||||||
|
noremap = true,
|
||||||
|
nowait = true,
|
||||||
|
},
|
||||||
|
mappings = {
|
||||||
|
["Y"] = "yank_path";
|
||||||
|
["<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",
|
||||||
|
["<esc>"] = "cancel", -- close preview or floating neo-tree window
|
||||||
|
["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = true, popup = { -- settings that apply to float position only
|
||||||
|
size = { height = "17", width = "45" },
|
||||||
|
position = "50%", -- 50% means center it
|
||||||
|
}, } },
|
||||||
|
-- Read `# Preview Mode` for more information
|
||||||
|
["l"] = "focus_preview",
|
||||||
|
["S"] = "open_split",
|
||||||
|
["s"] = "open_vsplit",
|
||||||
|
-- ["S"] = "split_with_window_picker",
|
||||||
|
-- ["s"] = "vsplit_with_window_picker",
|
||||||
|
["t"] = "open_tabnew",
|
||||||
|
-- ["<cr>"] = "open_drop",
|
||||||
|
-- ["t"] = "open_tab_drop",
|
||||||
|
["w"] = "open_with_window_picker",
|
||||||
|
--["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing
|
||||||
|
["C"] = "close_node",
|
||||||
|
-- ['C'] = 'close_all_subnodes',
|
||||||
|
["z"] = "close_all_nodes",
|
||||||
|
--["Z"] = "expand_all_nodes",
|
||||||
|
["a"] = {
|
||||||
|
"add",
|
||||||
|
-- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details
|
||||||
|
-- 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". this also supports BASH style brace expansion.
|
||||||
|
["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",
|
||||||
|
["i"] = "show_file_details",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
nesting_rules = {},
|
||||||
|
filesystem = {
|
||||||
|
filtered_items = {
|
||||||
|
visible = true, -- when true, they will just be displayed differently than normal items
|
||||||
|
hide_dotfiles = false,
|
||||||
|
hide_gitignored = false,
|
||||||
|
hide_hidden = false, -- only works on Windows for hidden files/directories
|
||||||
|
hide_by_name = {
|
||||||
|
--"node_modules"
|
||||||
|
},
|
||||||
|
hide_by_pattern = { -- uses glob style patterns
|
||||||
|
--"*.meta",
|
||||||
|
--"*/src/*/tsconfig.json",
|
||||||
|
},
|
||||||
|
always_show = { -- remains visible even if other settings would normally hide it
|
||||||
|
--".gitignored",
|
||||||
|
},
|
||||||
|
never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show
|
||||||
|
--".DS_Store",
|
||||||
|
--"thumbs.db"
|
||||||
|
},
|
||||||
|
never_show_by_pattern = { -- uses glob style patterns
|
||||||
|
--".null-ls_*",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
follow_current_file = {
|
||||||
|
enabled = false, -- This will find and focus the file in the active buffer every time
|
||||||
|
-- -- the current file is changed while the tree is open.
|
||||||
|
leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal`
|
||||||
|
},
|
||||||
|
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",
|
||||||
|
["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm
|
||||||
|
-- ["D"] = "fuzzy_sorter_directory",
|
||||||
|
["f"] = "filter_on_submit",
|
||||||
|
["<c-x>"] = "clear_filter",
|
||||||
|
["[g"] = "prev_git_modified",
|
||||||
|
["]g"] = "next_git_modified",
|
||||||
|
["o"] = { "show_help", nowait=false, config = { title = "Order by", prefix_key = "o" }},
|
||||||
|
["oc"] = { "order_by_created", nowait = false },
|
||||||
|
["od"] = { "order_by_diagnostics", nowait = false },
|
||||||
|
["og"] = { "order_by_git_status", nowait = false },
|
||||||
|
["om"] = { "order_by_modified", nowait = false },
|
||||||
|
["on"] = { "order_by_name", nowait = false },
|
||||||
|
["os"] = { "order_by_size", nowait = false },
|
||||||
|
["ot"] = { "order_by_type", nowait = false },
|
||||||
|
},
|
||||||
|
fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode
|
||||||
|
["<down>"] = "move_cursor_down",
|
||||||
|
["<C-n>"] = "move_cursor_down",
|
||||||
|
["<up>"] = "move_cursor_up",
|
||||||
|
["<C-p>"] = "move_cursor_up",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
commands = {} -- Add a custom command or override a global one using the same function name
|
||||||
|
},
|
||||||
|
buffers = {
|
||||||
|
follow_current_file = {
|
||||||
|
enabled = true, -- This will find and focus the file in the active buffer every time
|
||||||
|
-- -- the current file is changed while the tree is open.
|
||||||
|
leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal`
|
||||||
|
},
|
||||||
|
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",
|
||||||
|
["o"] = { "show_help", nowait=false, config = { title = "Order by", prefix_key = "o" }},
|
||||||
|
["oc"] = { "order_by_created", nowait = false },
|
||||||
|
["od"] = { "order_by_diagnostics", nowait = false },
|
||||||
|
["om"] = { "order_by_modified", nowait = false },
|
||||||
|
["on"] = { "order_by_name", nowait = false },
|
||||||
|
["os"] = { "order_by_size", nowait = false },
|
||||||
|
["ot"] = { "order_by_type", nowait = false },
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
event_handlers = {
|
||||||
|
{
|
||||||
|
event = "file_opened",
|
||||||
|
handler = function(arg)
|
||||||
|
vim.cmd([[Neotree close]])
|
||||||
|
end,
|
||||||
|
id = "Close Neotree when opening file"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
event = "neo_tree_buffer_enter",
|
||||||
|
handler = function(arg)
|
||||||
|
vim.opt.relativenumber = true
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
event = "neo_tree_popup_input_ready",
|
||||||
|
---@param args { bufnr: integer, winid: integer }
|
||||||
|
handler = function(args)
|
||||||
|
vim.cmd("stopinsert")
|
||||||
|
vim.keymap.set("i", "<esc>", vim.cmd.stopinsert, { noremap = true, buffer = args.bufnr })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
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",
|
||||||
|
["o"] = { "show_help", nowait=false, config = { title = "Order by", prefix_key = "o" }},
|
||||||
|
["oc"] = { "order_by_created", nowait = false },
|
||||||
|
["od"] = { "order_by_diagnostics", nowait = false },
|
||||||
|
["om"] = { "order_by_modified", nowait = false },
|
||||||
|
["on"] = { "order_by_name", nowait = false },
|
||||||
|
["os"] = { "order_by_size", nowait = false },
|
||||||
|
["ot"] = { "order_by_type", nowait = false },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
local function count_buffers()
|
||||||
|
local buff_list = vim.api.nvim_exec('ls', true)
|
||||||
|
local t = {}
|
||||||
|
local count = 0
|
||||||
|
for v in buff_list.gmatch(buff_list, "[^\n]+") do
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
|
return count
|
||||||
|
end
|
||||||
|
|
||||||
|
local function count_windows_and_position()
|
||||||
|
local win_n = vim.api.nvim_list_wins()
|
||||||
|
local current_win = vim.api.nvim_get_current_win()
|
||||||
|
local total_win = 0
|
||||||
|
local pos = 0
|
||||||
|
|
||||||
|
for k, v in pairs(win_n) do
|
||||||
|
total_win = total_win + 1
|
||||||
|
if v == current_win then
|
||||||
|
pos = k
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return total_win, pos
|
||||||
|
end
|
||||||
|
|
||||||
|
local function close_open_buff()
|
||||||
|
local count = count_buffers()
|
||||||
|
local total_win, pos = count_windows_and_position()
|
||||||
|
|
||||||
|
vim.api.nvim_command("bd")
|
||||||
|
|
||||||
|
if total_win ~= 1 and count > 2 then
|
||||||
|
vim.api.nvim_command("vs")
|
||||||
|
vim.api.nvim_command("bn")
|
||||||
|
|
||||||
|
if pos == 1 then
|
||||||
|
vim.api.nvim_exec("wincmd r", false)
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif count == 2 then
|
||||||
|
print(" > Last buffer")
|
||||||
|
|
||||||
|
elseif count == 1 then
|
||||||
|
print(" > No more buffer to close!")
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
-- Vimtex
|
||||||
|
vim.g['vimtex_syntax_conceal_disable'] = 1
|
||||||
|
|
||||||
|
-- Treesitter
|
||||||
|
require('treesitter')
|
||||||
|
|
||||||
|
require("nvim-autopairs").setup {}
|
||||||
|
|
||||||
|
require('ibl').setup({
|
||||||
|
indent = { char= '¦' },
|
||||||
|
scope = { enabled = false},
|
||||||
|
--show_trailing_blankline_indent = false,
|
||||||
|
--show_first_indent_level = false,
|
||||||
|
--use_treesitter = true,
|
||||||
|
})
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
-- https://github.com/junegunn/vim-plug
|
||||||
|
-- :PlugInstall :PlugClean
|
||||||
|
|
||||||
|
local Plug = vim.fn['plug#']
|
||||||
|
|
||||||
|
vim.call('plug#begin', '~/.local/share/nvim/plugged')
|
||||||
|
|
||||||
|
Plug 'lukas-reineke/indent-blankline.nvim'
|
||||||
|
Plug 'lervag/vimtex'
|
||||||
|
|
||||||
|
-- Colorscheme
|
||||||
|
Plug 'sainnhe/sonokai'
|
||||||
|
Plug 'catppuccin/nvim'
|
||||||
|
|
||||||
|
Plug 'tpope/vim-surround'
|
||||||
|
|
||||||
|
-- Git
|
||||||
|
-- Plug 'NeogitOrg/neogit'
|
||||||
|
-- Plug 'sindrets/diffview.nvim'
|
||||||
|
-- Plug 'lewis6991/gitsigns.nvim'
|
||||||
|
|
||||||
|
Plug 'ibhagwan/fzf-lua'
|
||||||
|
|
||||||
|
Plug 'nvim-neo-tree/neo-tree.nvim'
|
||||||
|
Plug 'MunifTanjim/nui.nvim'
|
||||||
|
|
||||||
|
-- Fs tree + deps
|
||||||
|
Plug 'nvim-lua/plenary.nvim'
|
||||||
|
Plug 'nvim-telescope/telescope.nvim'
|
||||||
|
Plug 'nvim-tree/nvim-web-devicons'
|
||||||
|
|
||||||
|
-- LSP configurations
|
||||||
|
Plug 'neovim/nvim-lspconfig'
|
||||||
|
|
||||||
|
-- LSP autocomplete
|
||||||
|
Plug 'hrsh7th/nvim-cmp'
|
||||||
|
Plug 'hrsh7th/cmp-nvim-lsp'
|
||||||
|
Plug 'hrsh7th/cmp-buffer'
|
||||||
|
Plug 'hrsh7th/cmp-path'
|
||||||
|
Plug 'hrsh7th/cmp-nvim-lua'
|
||||||
|
|
||||||
|
-- Lps for java
|
||||||
|
Plug "mfussenegger/nvim-jdtls"
|
||||||
|
|
||||||
|
-- Snippets
|
||||||
|
Plug 'L3MON4D3/LuaSnip'
|
||||||
|
Plug 'saadparwaiz1/cmp_luasnip'
|
||||||
|
Plug 'rafamadriz/friendly-snippets'
|
||||||
|
|
||||||
|
-- Treesitter
|
||||||
|
Plug('nvim-treesitter/nvim-treesitter', {['do'] = ':TSUpdate'})
|
||||||
|
Plug('nvim-telescope/telescope-live-grep-args.nvim')
|
||||||
|
|
||||||
|
Plug 'windwp/nvim-autopairs'
|
||||||
|
|
||||||
|
Plug 'windwp/nvim-ts-autotag'
|
||||||
|
-- EditorConfig
|
||||||
|
Plug 'editorconfig/editorconfig-vim'
|
||||||
|
|
||||||
|
|
||||||
|
vim.call('plug#end')
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
-- Line numbers
|
||||||
|
vim.wo.number = true
|
||||||
|
vim.wo.relativenumber = true
|
||||||
|
|
||||||
|
--vim.opt.conceallevel = 0
|
||||||
|
|
||||||
|
vim.opt.ignorecase = true
|
||||||
|
vim.opt.smartindent = true
|
||||||
|
|
||||||
|
-- Indentation
|
||||||
|
vim.opt.tabstop = 4
|
||||||
|
vim.opt.shiftwidth = 4
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
vim.opt.softtabstop = 4
|
||||||
|
|
||||||
|
-- File format
|
||||||
|
vim.opt.fileformat = "unix"
|
||||||
|
vim.opt.encoding = "utf-8"
|
||||||
|
|
||||||
|
-- Long lines wrapping
|
||||||
|
vim.opt.wrap = true
|
||||||
|
|
||||||
|
-- Mute error sound
|
||||||
|
vim.opt.belloff = "all"
|
||||||
|
|
||||||
|
-- Windows split positions
|
||||||
|
vim.opt.splitbelow = true
|
||||||
|
vim.opt.splitright = true
|
||||||
|
|
||||||
|
-- Popup max lines
|
||||||
|
vim.opt.pumheight = 15
|
||||||
|
|
||||||
|
-- Popup transparency
|
||||||
|
vim.opt.pumblend = 20
|
||||||
|
|
||||||
|
-- Write temp file in tmp folder
|
||||||
|
vim.opt.backupdir = "/tmp//"
|
||||||
|
vim.opt.directory = "/tmp//"
|
||||||
|
vim.opt.undodir = "/tmp//"
|
||||||
|
|
||||||
|
-- Cl size
|
||||||
|
vim.opt.cmdheight = 1
|
||||||
|
|
||||||
|
-- Connection with s.o. clipboard
|
||||||
|
vim.opt.clipboard = "unnamedplus"
|
||||||
|
|
||||||
|
-- Netwr settings
|
||||||
|
vim.g.netrw_liststyle = 3
|
||||||
|
vim.g.netrw_bufsettings = "noma nomod nu nobl nowrap ro"
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = "netwr",
|
||||||
|
command = [[lua vim.opt_local = delete]],
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Lua indentation
|
||||||
|
vim.cmd([[
|
||||||
|
autocmd FileType lua setlocal
|
||||||
|
\ tabstop=2
|
||||||
|
\ shiftwidth=2
|
||||||
|
\ softtabstop=2
|
||||||
|
\ expandtab
|
||||||
|
]])
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
local function git_branch()
|
||||||
|
local branch = vim.fn.system("git rev-parse --abbrev-ref HEAD")
|
||||||
|
local i = string.find(branch, "fatal")
|
||||||
|
|
||||||
|
if i == nil then
|
||||||
|
return branch:sub(1, -2)
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function statusline()
|
||||||
|
local set_color_1 = "%#PmenuSel#" -- Git color
|
||||||
|
local set_color_2 = "%#Pmenu#" -- Bar color
|
||||||
|
local file_name = "%<%f"
|
||||||
|
local branch = git_branch()
|
||||||
|
local modified = "%m"
|
||||||
|
local align_right = "%="
|
||||||
|
local fileencoding = " %{&fileencoding?&fileencoding:&encoding}"
|
||||||
|
local fileformat = "[%{&fileformat}]"
|
||||||
|
local percentage = " %p%%"
|
||||||
|
local linecol = " %l/%L:%c"
|
||||||
|
|
||||||
|
if branch then
|
||||||
|
return string.format(
|
||||||
|
"%s %s %s %s%s%s%s%s%s%s",
|
||||||
|
set_color_1,
|
||||||
|
branch,
|
||||||
|
set_color_2,
|
||||||
|
file_name,
|
||||||
|
modified,
|
||||||
|
align_right,
|
||||||
|
fileencoding,
|
||||||
|
filetype,
|
||||||
|
fileformat,
|
||||||
|
linecol,
|
||||||
|
percentage
|
||||||
|
)
|
||||||
|
else
|
||||||
|
return string.format(
|
||||||
|
"%s%s%s%s%s%s%s%s",
|
||||||
|
set_color_2,
|
||||||
|
file_name,
|
||||||
|
modified,
|
||||||
|
align_right,
|
||||||
|
fileencoding,
|
||||||
|
filetype,
|
||||||
|
fileformat,
|
||||||
|
linecol,
|
||||||
|
percentage
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.opt.statusline = statusline()
|
||||||
|
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
require'nvim-treesitter'.setup {
|
||||||
|
-- A list of parser names, or "all"
|
||||||
|
ensure_installed = { "python" },
|
||||||
|
|
||||||
|
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||||
|
sync_install = false,
|
||||||
|
|
||||||
|
-- Automatically install missing parsers when entering buffer
|
||||||
|
auto_install = true,
|
||||||
|
|
||||||
|
-- List of parsers to ignore installing (for "all")
|
||||||
|
ignore_install = { },
|
||||||
|
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
disable = { "" },
|
||||||
|
additional_vim_regex_highlighting = false,
|
||||||
|
},
|
||||||
|
incremental_selection = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
init_selection = '<c-space>',
|
||||||
|
node_incremental = '<c-space>',
|
||||||
|
scope_incremental = '<c-s>',
|
||||||
|
node_decremental = '<M-space>',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- https://github.com/windwp/nvim-ts-autotag
|
||||||
|
autotag = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
if exists('g:close_open_buff')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:save_cpo = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
hi def link WhidHeader Number
|
||||||
|
hi def link WhidSubHeader Identifier
|
||||||
|
|
||||||
|
command! CloseOpenBuff lua require'buffer_closer'.close_open_buff()
|
||||||
|
|
||||||
|
let &cpo = s:save_cpo
|
||||||
|
unlet s:save_cpo
|
||||||
|
|
||||||
|
let g:close_open_buff = 1
|
||||||
Reference in New Issue
Block a user