formatted code
parent
da382b5d61
commit
4316ac84df
@ -1,6 +1,6 @@
|
||||
return {
|
||||
"rmehri01/onenord.nvim",
|
||||
config = function ()
|
||||
vim.cmd.colorscheme 'onenord'
|
||||
end
|
||||
"rmehri01/onenord.nvim",
|
||||
config = function()
|
||||
vim.cmd.colorscheme 'onenord'
|
||||
end
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
return {
|
||||
"glepnir/lspsaga.nvim",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
vim.keymap.set('n', '<leader>k', ':Lspsaga hover_doc<CR>')
|
||||
vim.keymap.set('n', '<leader>gs', ':Lspsaga signature_help<CR>')
|
||||
vim.keymap.set('n', '<leader>rn', ':Lspsaga rename<CR>')
|
||||
vim.keymap.set('n', '<leader>ca', ':Lspsaga code_action<CR>')
|
||||
vim.keymap.set('n', '<leader>gl', ':Lspsaga show_line_diagnostics<CR>')
|
||||
vim.keymap.set('n', '<leader>gn', ':Lspsaga diagnostic_jump_next<CR>')
|
||||
vim.keymap.set('n', '<leader>gp', ':Lspsaga diagnostic_jump_prev<CR>')
|
||||
require("lspsaga").setup({})
|
||||
end,
|
||||
dependencies = {
|
||||
{"nvim-tree/nvim-web-devicons"},
|
||||
--Please make sure you install markdown and markdown_inline parser
|
||||
{"nvim-treesitter/nvim-treesitter"}
|
||||
}
|
||||
"glepnir/lspsaga.nvim",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
vim.keymap.set('n', '<leader>k', ':Lspsaga hover_doc<CR>')
|
||||
vim.keymap.set('n', '<leader>gs', ':Lspsaga signature_help<CR>')
|
||||
vim.keymap.set('n', '<leader>rn', ':Lspsaga rename<CR>')
|
||||
vim.keymap.set('n', '<leader>ca', ':Lspsaga code_action<CR>')
|
||||
vim.keymap.set('n', '<leader>gl', ':Lspsaga show_line_diagnostics<CR>')
|
||||
vim.keymap.set('n', '<leader>gn', ':Lspsaga diagnostic_jump_next<CR>')
|
||||
vim.keymap.set('n', '<leader>gp', ':Lspsaga diagnostic_jump_prev<CR>')
|
||||
require("lspsaga").setup({})
|
||||
end,
|
||||
dependencies = {
|
||||
{"nvim-tree/nvim-web-devicons"},
|
||||
-- Please make sure you install markdown and markdown_inline parser
|
||||
{"nvim-treesitter/nvim-treesitter"}
|
||||
}
|
||||
}
|
||||
|
@ -1,41 +1,41 @@
|
||||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
opts = {
|
||||
options = {
|
||||
theme = 'onenord',
|
||||
icons_enabled = true,
|
||||
component_separators = {left = '', right = ''},
|
||||
section_separators = {left = '', right = ''},
|
||||
disabled_filetypes = {},
|
||||
always_divide_middle = true
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||
-- lualine_c = {'filename'},
|
||||
lualine_c = {
|
||||
{
|
||||
'filename',
|
||||
file_status = true, -- Displays file status (readonly status, modified status)
|
||||
path = 1, -- 0: Just the filename
|
||||
-- 1: Relative path
|
||||
-- 2: Absolute path
|
||||
|
||||
shorting_target = 40 -- Shortens path to leave 40 spaces in the window
|
||||
-- for other components. (terrible name, any suggestions?)
|
||||
}
|
||||
'nvim-lualine/lualine.nvim',
|
||||
opts = {
|
||||
options = {
|
||||
theme = 'onenord',
|
||||
icons_enabled = true,
|
||||
component_separators = {left = '', right = ''},
|
||||
section_separators = {left = '', right = ''},
|
||||
disabled_filetypes = {},
|
||||
always_divide_middle = true
|
||||
},
|
||||
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'}
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'location'},
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||
-- lualine_c = {'filename'},
|
||||
lualine_c = {
|
||||
{
|
||||
'filename',
|
||||
file_status = true, -- Displays file status (readonly status, modified status)
|
||||
path = 1, -- 0: Just the filename
|
||||
-- 1: Relative path
|
||||
-- 2: Absolute path
|
||||
|
||||
shorting_target = 40 -- Shortens path to leave 40 spaces in the window
|
||||
-- for other components. (terrible name, any suggestions?)
|
||||
}
|
||||
},
|
||||
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'}
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'location'},
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,54 +1,56 @@
|
||||
return {
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
dependencies = {"nvim-lua/plenary.nvim"},
|
||||
config = function ()
|
||||
local null_ls = require("null-ls")
|
||||
dependencies = {"nvim-lua/plenary.nvim"},
|
||||
config = function()
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
local formatting = null_ls.builtins.formatting
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
local codeActions = null_ls.builtins.code_actions
|
||||
local formatting = null_ls.builtins.formatting
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
local codeActions = null_ls.builtins.code_actions
|
||||
|
||||
local sources = {
|
||||
formatting.eslint_d, formatting.prettierd.with({
|
||||
env = {
|
||||
PRETTIERD_DEFAULT_CONFIG = vim.fn.expand "~/.config/nvim/utils/linter-config/.prettierrc.js"
|
||||
}
|
||||
}), -- formatting.prettier
|
||||
-- .with({extra_args = {'--single-quote', '--tab-width 2', '--arrow-parens avoid'}}),
|
||||
formatting.lua_format.with({
|
||||
extra_args = {
|
||||
'--no-keep-simple-function-one-line', '--no-break-after-operator', '--column-limit=100',
|
||||
'--break-after-table-lb', '--indent-width=2'
|
||||
}
|
||||
}), diagnostics.eslint_d.with({diagnostics_format = "[#{c}] #{m} (#{s})"}), codeActions.eslint_d
|
||||
}
|
||||
local sources = {
|
||||
formatting.eslint_d, formatting.prettierd.with({
|
||||
env = {
|
||||
PRETTIERD_DEFAULT_CONFIG = vim.fn
|
||||
.expand "~/.config/nvim/utils/linter-config/.prettierrc.js"
|
||||
}
|
||||
}), -- formatting.prettier
|
||||
-- .with({extra_args = {'--single-quote', '--tab-width 2', '--arrow-parens avoid'}}),
|
||||
formatting.lua_format.with({
|
||||
extra_args = {
|
||||
'--no-keep-simple-function-one-line', '--no-break-after-operator', '--column-limit=100',
|
||||
'--break-after-table-lb', '--indent-width=2'
|
||||
}
|
||||
}), diagnostics.eslint_d.with({diagnostics_format = "[#{c}] #{m} (#{s})"}),
|
||||
codeActions.eslint_d
|
||||
}
|
||||
|
||||
local lsp_formatting = function(bufnr)
|
||||
vim.lsp.buf.format({
|
||||
filter = function(client)
|
||||
-- apply whatever logic you want (in this example, we'll only use null-ls)
|
||||
return client.name == "null-ls"
|
||||
end,
|
||||
bufnr = bufnr
|
||||
})
|
||||
end
|
||||
local lsp_formatting = function(bufnr)
|
||||
vim.lsp.buf.format({
|
||||
filter = function(client)
|
||||
-- apply whatever logic you want (in this example, we'll only use null-ls)
|
||||
return client.name == "null-ls"
|
||||
end,
|
||||
bufnr = bufnr
|
||||
})
|
||||
end
|
||||
|
||||
-- if you want to set up formatting on save, you can use this as a callback
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
-- if you want to set up formatting on save, you can use this as a callback
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({group = augroup, buffer = bufnr})
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
lsp_formatting(bufnr)
|
||||
end
|
||||
})
|
||||
end
|
||||
end
|
||||
local on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({group = augroup, buffer = bufnr})
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
lsp_formatting(bufnr)
|
||||
end
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
null_ls.setup({sources = sources, debug = true, on_attach = on_attach})
|
||||
null_ls.setup({sources = sources, debug = true, on_attach = on_attach})
|
||||
end
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
return {
|
||||
"rafamadriz/friendly-snippets",
|
||||
config = function ()
|
||||
require("luasnip/loaders/from_vscode").lazy_load()
|
||||
config = function()
|
||||
require("luasnip/loaders/from_vscode").lazy_load()
|
||||
end
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
return {
|
||||
'norcalli/nvim-colorizer.lua',
|
||||
config = function ()
|
||||
require'colorizer'.setup {
|
||||
'*', -- Highlight all files, but customize some others.
|
||||
css = {css = true} -- Enable parsing rgb(...) functions in css.
|
||||
}
|
||||
config = function()
|
||||
require'colorizer'.setup {
|
||||
'*', -- Highlight all files, but customize some others.
|
||||
css = {css = true} -- Enable parsing rgb(...) functions in css.
|
||||
}
|
||||
end
|
||||
}
|
||||
|
@ -1,16 +1,16 @@
|
||||
return {
|
||||
'petertriho/nvim-scrollbar',
|
||||
config = function ()
|
||||
require("scrollbar").setup({
|
||||
handle = {text = " "},
|
||||
marks = {
|
||||
Search = {text = {"-- ", "== "}},
|
||||
Error = {text = {" ", " "}},
|
||||
Warn = {text = {" ", " "}},
|
||||
Info = {text = {" ", " "}},
|
||||
Hint = {text = {" ", " "}},
|
||||
Misc = {text = {"-- ", "== "}}
|
||||
}
|
||||
})
|
||||
config = function()
|
||||
require("scrollbar").setup({
|
||||
handle = {text = " "},
|
||||
marks = {
|
||||
Search = {text = {"-- ", "== "}},
|
||||
Error = {text = {" ", " "}},
|
||||
Warn = {text = {" ", " "}},
|
||||
Info = {text = {" ", " "}},
|
||||
Hint = {text = {" ", " "}},
|
||||
Misc = {text = {"-- ", "== "}}
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
return {
|
||||
"kylechui/nvim-surround",
|
||||
config = function()
|
||||
require("nvim-surround").setup({})
|
||||
end
|
||||
"kylechui/nvim-surround",
|
||||
config = function()
|
||||
require("nvim-surround").setup({})
|
||||
end
|
||||
}
|
||||
|
@ -1,3 +1 @@
|
||||
return {
|
||||
'mhinz/vim-startify'
|
||||
}
|
||||
return {'mhinz/vim-startify'}
|
||||
|
@ -1,73 +1,78 @@
|
||||
return {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
'nvim-telescope/telescope.nvim',
|
||||
version = '*',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
config = function ()
|
||||
-- Find files using lua fuctions
|
||||
local opts = { silent = true, noremap = true }
|
||||
vim.api.nvim_set_keymap('n', '<Leader>ff', "<Cmd>lua require'telescope.builtin'.find_files()<CR>", {silent=false, noremap=true})
|
||||
vim.api.nvim_set_keymap('n', '<Leader>fg', "<Cmd>lua require'telescope.builtin'.live_grep()<CR>", opts)
|
||||
vim.api.nvim_set_keymap('n', '<Leader>fs', "<Cmd>lua require'telescope.builtin'.grep_string()<CR>", opts)
|
||||
vim.api.nvim_set_keymap('n', '<Leader>ft', "<Cmd>lua require'telescope.builtin'.file_browser()<CR>", opts)
|
||||
vim.api.nvim_set_keymap('n', '<Leader>fo', "<Cmd>lua require'telescope.builtin'.oldfiles()<CR>", opts)
|
||||
vim.api.nvim_set_keymap('n', '<Leader>gc', "<Cmd>lua require'telescope.builtin'.git_commits()<CR>", opts)
|
||||
vim.api.nvim_set_keymap('n', '<Leader>gb', "<Cmd>lua require'telescope.builtin'.git_branches()<CR>", opts)
|
||||
vim.api.nvim_set_keymap('n', '<Leader>fb', "<Cmd>lua require'telescope.builtin'.buffers()<CR>", opts)
|
||||
vim.api.nvim_set_keymap('n', '<Leader>fh', "<Cmd>lua require'telescope.builtin'.help_tags()<CR>", opts)
|
||||
dependencies = {'nvim-lua/plenary.nvim'},
|
||||
config = function()
|
||||
-- Find files using lua fuctions
|
||||
local opts = {silent = true, noremap = true}
|
||||
vim.api.nvim_set_keymap('n', '<Leader>ff',
|
||||
"<Cmd>lua require'telescope.builtin'.find_files()<CR>",
|
||||
{silent = false, noremap = true})
|
||||
vim.api.nvim_set_keymap('n', '<Leader>fg',
|
||||
"<Cmd>lua require'telescope.builtin'.live_grep()<CR>", opts)
|
||||
vim.api.nvim_set_keymap('n', '<Leader>fs',
|
||||
"<Cmd>lua require'telescope.builtin'.grep_string()<CR>", opts)
|
||||
vim.api.nvim_set_keymap('n', '<Leader>ft',
|
||||
"<Cmd>lua require'telescope.builtin'.file_browser()<CR>", opts)
|
||||
vim.api.nvim_set_keymap('n', '<Leader>fo', "<Cmd>lua require'telescope.builtin'.oldfiles()<CR>",
|
||||
opts)
|
||||
vim.api.nvim_set_keymap('n', '<Leader>gc',
|
||||
"<Cmd>lua require'telescope.builtin'.git_commits()<CR>", opts)
|
||||
vim.api.nvim_set_keymap('n', '<Leader>gb',
|
||||
"<Cmd>lua require'telescope.builtin'.git_branches()<CR>", opts)
|
||||
vim.api.nvim_set_keymap('n', '<Leader>fb', "<Cmd>lua require'telescope.builtin'.buffers()<CR>",
|
||||
opts)
|
||||
vim.api.nvim_set_keymap('n', '<Leader>fh',
|
||||
"<Cmd>lua require'telescope.builtin'.help_tags()<CR>", opts)
|
||||
|
||||
local actions = require('telescope.actions')
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
-- program to use for searching with its arguments
|
||||
find_command = {'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case'},
|
||||
-- prompt_position = 'top', -- have prompt at the top (has no effect on vertical configuration)
|
||||
prompt_prefix = ' ', -- symbol on prompt window
|
||||
selection_caret = ' ', -- symbol on selected row in results window
|
||||
entry_prefix = ' ', -- symbol on non-selected rows in results window
|
||||
initial_mode = 'insert', -- start in insert mode
|
||||
selection_strategy = 'reset', -- what happens to selection when list changes
|
||||
sorting_strategy = 'ascending', -- start with most important search on top
|
||||
layout_strategy = 'horizontal', -- vertical layout
|
||||
layout_config = {
|
||||
prompt_position = 'top'
|
||||
},
|
||||
file_sorter = require'telescope.sorters'.get_fuzzy_file,
|
||||
file_ignore_patterns = {'node_modules/.*'}, -- never search in node_modules/ dir
|
||||
generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter,
|
||||
display_path = true,
|
||||
winblend = 0, -- window should not be transparent
|
||||
border = {}, -- no border?
|
||||
borderchars = {'─', '│', '─', '│', '╭', '╮', '╯', '╰'}, -- border chars
|
||||
color_devicons = true, -- colorize used icons
|
||||
use_less = true, -- less is bash program for preview file contents
|
||||
set_env = {['COLORTERM'] = 'truecolor'}, -- use all the colors
|
||||
file_previewer = require'telescope.previewers'.vim_buffer_cat.new,
|
||||
grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new,
|
||||
qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new,
|
||||
buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker,
|
||||
-- preview_cutoff = 120,
|
||||
mappings = {
|
||||
i = {
|
||||
['<C-j>'] = actions.move_selection_next,
|
||||
['<C-k>'] = actions.move_selection_previous,
|
||||
['<C-q>'] = actions.smart_send_to_qflist + actions.open_qflist,
|
||||
-- ['ć'] = actions.close,
|
||||
['<CR>'] = actions.select_default + actions.center,
|
||||
},
|
||||
n = {
|
||||
['<C-j>'] = actions.move_selection_next,
|
||||
['<C-k>'] = actions.move_selection_previous,
|
||||
['<C-q>'] = actions.smart_send_to_qflist + actions.open_qflist,
|
||||
['ć'] = actions.close,
|
||||
}
|
||||
}
|
||||
},
|
||||
extensions = {
|
||||
fzy_native = {
|
||||
override_generic_sorter = false,
|
||||
override_file_sorter = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
local actions = require('telescope.actions')
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
-- program to use for searching with its arguments
|
||||
find_command = {
|
||||
'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case'
|
||||
},
|
||||
-- prompt_position = 'top', -- have prompt at the top (has no effect on vertical configuration)
|
||||
prompt_prefix = ' ', -- symbol on prompt window
|
||||
selection_caret = ' ', -- symbol on selected row in results window
|
||||
entry_prefix = ' ', -- symbol on non-selected rows in results window
|
||||
initial_mode = 'insert', -- start in insert mode
|
||||
selection_strategy = 'reset', -- what happens to selection when list changes
|
||||
sorting_strategy = 'ascending', -- start with most important search on top
|
||||
layout_strategy = 'horizontal', -- vertical layout
|
||||
layout_config = {prompt_position = 'top'},
|
||||
file_sorter = require'telescope.sorters'.get_fuzzy_file,
|
||||
file_ignore_patterns = {'node_modules/.*'}, -- never search in node_modules/ dir
|
||||
generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter,
|
||||
display_path = true,
|
||||
winblend = 0, -- window should not be transparent
|
||||
border = {}, -- no border?
|
||||
borderchars = {'─', '│', '─', '│', '╭', '╮', '╯', '╰'}, -- border chars
|
||||
color_devicons = true, -- colorize used icons
|
||||
use_less = true, -- less is bash program for preview file contents
|
||||
set_env = {['COLORTERM'] = 'truecolor'}, -- use all the colors
|
||||
file_previewer = require'telescope.previewers'.vim_buffer_cat.new,
|
||||
grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new,
|
||||
qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new,
|
||||
buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker,
|
||||
-- preview_cutoff = 120,
|
||||
mappings = {
|
||||
i = {
|
||||
['<C-j>'] = actions.move_selection_next,
|
||||
['<C-k>'] = actions.move_selection_previous,
|
||||
['<C-q>'] = actions.smart_send_to_qflist + actions.open_qflist,
|
||||
-- ['ć'] = actions.close,
|
||||
['<CR>'] = actions.select_default + actions.center
|
||||
},
|
||||
n = {
|
||||
['<C-j>'] = actions.move_selection_next,
|
||||
['<C-k>'] = actions.move_selection_previous,
|
||||
['<C-q>'] = actions.smart_send_to_qflist + actions.open_qflist,
|
||||
['ć'] = actions.close
|
||||
}
|
||||
}
|
||||
},
|
||||
extensions = {fzy_native = {override_generic_sorter = false, override_file_sorter = true}}
|
||||
}
|
||||
end
|
||||
}
|
||||
|
Loading…
Reference in New Issue