cleanup by splitting the plugin configs
This commit is contained in:
parent
9a896746d1
commit
92bd1c83a1
10 changed files with 298 additions and 207 deletions
40
.gitignore
vendored
Normal file
40
.gitignore
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
# Compiled Lua sources
|
||||
luac.out
|
||||
|
||||
# luarocks build files
|
||||
*.src.rock
|
||||
*.zip
|
||||
*.tar.gz
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.os
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
*.def
|
||||
*.exp
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
7
README.md
Normal file
7
README.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
# nvim-config
|
||||
|
||||
[Salar Rahmanian](https://www.softinio.com) [neovim](https://neovim.io/)
|
||||
|
||||
### Credit
|
||||
|
||||
Based on [kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim) by the awesome [TJ DeVries](https://twitter.com/teej_dv) thank you!
|
12
after/plugin/gitsigns.lua
Normal file
12
after/plugin/gitsigns.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
local installed, gitsigns = pcall(require, 'gitsigns')
|
||||
if installed then
|
||||
gitsigns.setup {
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
}
|
||||
end
|
13
after/plugin/lualine.lua
Normal file
13
after/plugin/lualine.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local installed, lualine = pcall(require, 'lualine')
|
||||
if installed then
|
||||
-- Set lualine as statusline
|
||||
-- See `:help lualine.txt`
|
||||
lualine.setup {
|
||||
options = {
|
||||
icons_enabled = false,
|
||||
theme = 'tokyonight',
|
||||
component_separators = '|',
|
||||
section_separators = '',
|
||||
},
|
||||
}
|
||||
end
|
10
after/plugin/neogit.lua
Normal file
10
after/plugin/neogit.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
local installed, neogit = pcall(require, 'neogit')
|
||||
if installed then
|
||||
neogit.setup {
|
||||
integrations = {
|
||||
diffview = true,
|
||||
},
|
||||
}
|
||||
|
||||
vim.api.nvim_set_keymap('n', '<leader>ng', [[<cmd>lua require('neogit').open({ kind = "split" })<cr>]], { noremap = true, silent = true })
|
||||
end
|
26
after/plugin/nvim-tree.lua
Normal file
26
after/plugin/nvim-tree.lua
Normal file
|
@ -0,0 +1,26 @@
|
|||
local installed, nvim_tree = pcall(require, 'nvim-tree')
|
||||
if installed then
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
nvim_tree.setup({
|
||||
sort_by = "case_sensitive",
|
||||
disable_netrw = true,
|
||||
view = {
|
||||
adaptive_size = true,
|
||||
mappings = {
|
||||
list = {
|
||||
{ key = "u", action = "dir_up" },
|
||||
},
|
||||
},
|
||||
},
|
||||
renderer = {
|
||||
highlight_git = true,
|
||||
group_empty = true,
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
},
|
||||
})
|
||||
|
||||
vim.api.nvim_set_keymap('n', '<leader>m', [[<cmd>lua require('nvim-tree').toggle()<cr>]], { noremap = true, silent = true })
|
||||
end
|
37
after/plugin/telescope.lua
Normal file
37
after/plugin/telescope.lua
Normal file
|
@ -0,0 +1,37 @@
|
|||
local installed, telescope = pcall(require, 'telescope')
|
||||
if installed then
|
||||
-- [[ Configure Telescope ]]
|
||||
-- See `:help telescope` and `:help telescope.setup()`
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
['<C-u>'] = false,
|
||||
['<C-d>'] = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(require('telescope').load_extension, 'fzf')
|
||||
pcall(require('telescope').load_extension, 'scaladex')
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
||||
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
})
|
||||
end, { desc = '[/] Fuzzily search in current buffer]' })
|
||||
|
||||
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
||||
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
||||
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
||||
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
||||
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||
|
||||
end
|
36
after/plugin/texlabconfig.lua
Normal file
36
after/plugin/texlabconfig.lua
Normal file
|
@ -0,0 +1,36 @@
|
|||
local installed, texlabconfig = pcall(require, 'texlabconfig')
|
||||
if installed then
|
||||
-- vimtex
|
||||
vim.g.vimtex_view_method = 'skim'
|
||||
vim.g.vimtex_compiler_method = 'tectonic'
|
||||
|
||||
-- nvim-texlabconfig
|
||||
local tex_preview_executable = '/Applications/Skim.app/Contents/SharedSupport/displayline'
|
||||
local tex_preview_args = {"%l", "%p", "%f"}
|
||||
local texlab_build_executable = 'tectonic'
|
||||
local texlab_build_args = {
|
||||
'-X',
|
||||
'compile',
|
||||
'%f',
|
||||
'--synctex',
|
||||
'--keep-logs',
|
||||
'--keep-intermediates'
|
||||
}
|
||||
texlabconfig.setup {
|
||||
cache_activate = true,
|
||||
cache_filetypes = { 'tex', 'bib' },
|
||||
reverse_search_edit_cmd = vim.cmd.edit,
|
||||
settings = {
|
||||
texlab = {
|
||||
build = {
|
||||
executable = texlab_build_executable,
|
||||
args = texlab_build_args
|
||||
},
|
||||
forwardSearch = {
|
||||
executable = tex_preview_executable,
|
||||
args = tex_preview_args
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
117
after/plugin/treesitter.lua
Normal file
117
after/plugin/treesitter.lua
Normal file
|
@ -0,0 +1,117 @@
|
|||
local installed, treesitter = pcall(require, 'nvim-treesitter.configs')
|
||||
if installed then
|
||||
-- [[ Configure Treesitter ]]
|
||||
-- See `:help nvim-treesitter`
|
||||
treesitter.setup {
|
||||
-- Add languages to be installed here that you want installed for treesitter
|
||||
ensure_installed = {
|
||||
'c',
|
||||
'cpp',
|
||||
'go',
|
||||
'lua',
|
||||
'python',
|
||||
'rust',
|
||||
'typescript',
|
||||
'help',
|
||||
'vim',
|
||||
'scala',
|
||||
'bash',
|
||||
'dockerfile',
|
||||
'fish',
|
||||
'git_rebase',
|
||||
'gitattributes',
|
||||
'gitcommit',
|
||||
'gitignore',
|
||||
'haskell',
|
||||
'hocon',
|
||||
'html',
|
||||
'http',
|
||||
'java',
|
||||
'javascript',
|
||||
'json',
|
||||
'json5',
|
||||
'latex',
|
||||
'make',
|
||||
'markdown_inline',
|
||||
'nix',
|
||||
'sql',
|
||||
'terraform',
|
||||
'yaml'
|
||||
},
|
||||
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true, disable = { 'python' } },
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = '<c-space>',
|
||||
node_incremental = '<c-space>',
|
||||
scope_incremental = '<c-s>',
|
||||
node_decremental = '<c-backspace>',
|
||||
},
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
||||
keymaps = {
|
||||
-- You can use the capture groups defined in textobjects.scm
|
||||
['aa'] = '@parameter.outer',
|
||||
['ia'] = '@parameter.inner',
|
||||
['af'] = '@function.outer',
|
||||
['if'] = '@function.inner',
|
||||
['ac'] = '@class.outer',
|
||||
['ic'] = '@class.inner',
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true, -- whether to set jumps in the jumplist
|
||||
goto_next_start = {
|
||||
[']m'] = '@function.outer',
|
||||
[']]'] = '@class.outer',
|
||||
},
|
||||
goto_next_end = {
|
||||
[']M'] = '@function.outer',
|
||||
[']['] = '@class.outer',
|
||||
},
|
||||
goto_previous_start = {
|
||||
['[m'] = '@function.outer',
|
||||
['[['] = '@class.outer',
|
||||
},
|
||||
goto_previous_end = {
|
||||
['[M'] = '@function.outer',
|
||||
['[]'] = '@class.outer',
|
||||
},
|
||||
},
|
||||
swap = {
|
||||
enable = true,
|
||||
swap_next = {
|
||||
['<leader>a'] = '@parameter.inner',
|
||||
},
|
||||
swap_previous = {
|
||||
['<leader>A'] = '@parameter.inner',
|
||||
},
|
||||
playground = {
|
||||
enable = true,
|
||||
disable = {},
|
||||
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
|
||||
persist_queries = false, -- Whether the query persists across vim sessions
|
||||
keybindings = {
|
||||
toggle_query_editor = 'o',
|
||||
toggle_hl_groups = 'i',
|
||||
toggle_injected_languages = 't',
|
||||
toggle_anonymous_nodes = 'a',
|
||||
toggle_language_display = 'I',
|
||||
focus_language = 'f',
|
||||
unfocus_language = 'F',
|
||||
update = 'R',
|
||||
goto_node = '<cr>',
|
||||
show_help = '?',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
207
init.lua
207
init.lua
|
@ -166,17 +166,6 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
|||
pattern = '*',
|
||||
})
|
||||
|
||||
-- Set lualine as statusline
|
||||
-- See `:help lualine.txt`
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = false,
|
||||
theme = 'onedark',
|
||||
component_separators = '|',
|
||||
section_separators = '',
|
||||
},
|
||||
}
|
||||
|
||||
-- Enable Comment.nvim
|
||||
require('Comment').setup()
|
||||
|
||||
|
@ -187,203 +176,11 @@ require('indent_blankline').setup {
|
|||
show_trailing_blankline_indent = false,
|
||||
}
|
||||
|
||||
-- Gitsigns
|
||||
-- See `:help gitsigns.txt`
|
||||
require('gitsigns').setup {
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
}
|
||||
|
||||
-- neogit
|
||||
require('neogit').setup {
|
||||
integrations = {
|
||||
diffview = true,
|
||||
},
|
||||
}
|
||||
|
||||
-- [[ Configure Telescope ]]
|
||||
-- See `:help telescope` and `:help telescope.setup()`
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
['<C-u>'] = false,
|
||||
['<C-d>'] = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
require('trouble').setup()
|
||||
|
||||
-- nvim-autopairs
|
||||
require('nvim-autopairs').setup()
|
||||
|
||||
-- vimtex
|
||||
vim.g.vimtex_view_method = 'skim'
|
||||
vim.g.vimtex_compiler_method = 'tectonic'
|
||||
|
||||
-- nvim-texlabconfig
|
||||
local tex_preview_executable = '/Applications/Skim.app/Contents/SharedSupport/displayline'
|
||||
local tex_preview_args = {"%l", "%p", "%f"}
|
||||
local texlab_build_executable = 'tectonic'
|
||||
local texlab_build_args = {
|
||||
'-X',
|
||||
'compile',
|
||||
'%f',
|
||||
'--synctex',
|
||||
'--keep-logs',
|
||||
'--keep-intermediates'
|
||||
}
|
||||
require('texlabconfig').setup {
|
||||
cache_activate = true,
|
||||
cache_filetypes = { 'tex', 'bib' },
|
||||
reverse_search_edit_cmd = vim.cmd.edit,
|
||||
settings = {
|
||||
texlab = {
|
||||
build = {
|
||||
executable = texlab_build_executable,
|
||||
args = texlab_build_args
|
||||
},
|
||||
forwardSearch = {
|
||||
executable = tex_preview_executable,
|
||||
args = tex_preview_args
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- nvim-tree
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
require("nvim-tree").setup({
|
||||
sort_by = "case_sensitive",
|
||||
disable_netrw = true,
|
||||
view = {
|
||||
adaptive_size = true,
|
||||
mappings = {
|
||||
list = {
|
||||
{ key = "u", action = "dir_up" },
|
||||
},
|
||||
},
|
||||
},
|
||||
renderer = {
|
||||
highlight_git = true,
|
||||
group_empty = true,
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
},
|
||||
})
|
||||
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(require('telescope').load_extension, 'fzf')
|
||||
pcall(require('telescope').load_extension, 'scaladex')
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
||||
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
})
|
||||
end, { desc = '[/] Fuzzily search in current buffer]' })
|
||||
|
||||
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
||||
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
||||
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
||||
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
||||
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||
|
||||
-- [[ Configure Treesitter ]]
|
||||
-- See `:help nvim-treesitter`
|
||||
require('nvim-treesitter.configs').setup {
|
||||
-- Add languages to be installed here that you want installed for treesitter
|
||||
-- ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript', 'help', 'vim' },
|
||||
ensure_installed = "all",
|
||||
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true, disable = { 'python' } },
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = '<c-space>',
|
||||
node_incremental = '<c-space>',
|
||||
scope_incremental = '<c-s>',
|
||||
node_decremental = '<c-backspace>',
|
||||
},
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
||||
keymaps = {
|
||||
-- You can use the capture groups defined in textobjects.scm
|
||||
['aa'] = '@parameter.outer',
|
||||
['ia'] = '@parameter.inner',
|
||||
['af'] = '@function.outer',
|
||||
['if'] = '@function.inner',
|
||||
['ac'] = '@class.outer',
|
||||
['ic'] = '@class.inner',
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true, -- whether to set jumps in the jumplist
|
||||
goto_next_start = {
|
||||
[']m'] = '@function.outer',
|
||||
[']]'] = '@class.outer',
|
||||
},
|
||||
goto_next_end = {
|
||||
[']M'] = '@function.outer',
|
||||
[']['] = '@class.outer',
|
||||
},
|
||||
goto_previous_start = {
|
||||
['[m'] = '@function.outer',
|
||||
['[['] = '@class.outer',
|
||||
},
|
||||
goto_previous_end = {
|
||||
['[M'] = '@function.outer',
|
||||
['[]'] = '@class.outer',
|
||||
},
|
||||
},
|
||||
swap = {
|
||||
enable = true,
|
||||
swap_next = {
|
||||
['<leader>a'] = '@parameter.inner',
|
||||
},
|
||||
swap_previous = {
|
||||
['<leader>A'] = '@parameter.inner',
|
||||
},
|
||||
playground = {
|
||||
enable = true,
|
||||
disable = {},
|
||||
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
|
||||
persist_queries = false, -- Whether the query persists across vim sessions
|
||||
keybindings = {
|
||||
toggle_query_editor = 'o',
|
||||
toggle_hl_groups = 'i',
|
||||
toggle_injected_languages = 't',
|
||||
toggle_anonymous_nodes = 'a',
|
||||
toggle_language_display = 'I',
|
||||
focus_language = 'f',
|
||||
unfocus_language = 'F',
|
||||
update = 'R',
|
||||
goto_node = '<cr>',
|
||||
show_help = '?',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||
|
@ -538,9 +335,5 @@ cmp.event:on(
|
|||
cmp_autopairs.on_confirm_done()
|
||||
)
|
||||
|
||||
vim.api.nvim_set_keymap('n', '<leader>m', [[<cmd>lua require('nvim-tree').toggle()<cr>]], { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<leader>ng', [[<cmd>lua require('neogit').open({ kind = "split" })<cr>]], { noremap = true, silent = true })
|
||||
|
||||
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
|
|
Loading…
Reference in a new issue