Browse Source

telescope, fzf and gitsigns

master
Ivan Polyakov 2 years ago
parent
commit
1cbee3dc99
  1. 1
      .config/nvim/init.lua
  2. 84
      .config/nvim/lua/init/gitsigns.lua
  3. 36
      .config/nvim/lua/init/plugins.lua
  4. 25
      .config/nvim/lua/init/treesitter.lua
  5. 7
      .config/nvim/lua/plugins.lua

1
.config/nvim/init.lua

@ -2,4 +2,5 @@ vim.cmd('source ~/.vim/init/general.vim')
require 'init.plugins' require 'init.plugins'
require 'init.gitsigns' require 'init.gitsigns'
require 'init.treesitter'
require 'init.lsp_and_cmp' require 'init.lsp_and_cmp'

84
.config/nvim/lua/init/gitsigns.lua

@ -1,48 +1,48 @@
local status_ok, gitsigns = pcall(require, "gitsigns") local status_ok, gitsigns = pcall(require, "gitsigns")
if not status_ok then if not status_ok then
return return
end end
gitsigns.setup { gitsigns.setup {
signs = { signs = {
add = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, add = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
change = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, change = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
delete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, delete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
topdelete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, topdelete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
changedelete = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, changedelete = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
}, },
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl` numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl` linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = { watch_gitdir = {
interval = 1000, interval = 1000,
follow_files = true, follow_files = true,
}, },
attach_to_untracked = true, attach_to_untracked = true,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = { current_line_blame_opts = {
virt_text = true, virt_text = true,
virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align'
delay = 1000, delay = 1000,
ignore_whitespace = false, ignore_whitespace = false,
}, },
current_line_blame_formatter_opts = { current_line_blame_formatter_opts = {
relative_time = false, relative_time = false,
}, },
sign_priority = 6, sign_priority = 6,
update_debounce = 100, update_debounce = 100,
status_formatter = nil, -- Use default status_formatter = nil, -- Use default
max_file_length = 40000, max_file_length = 40000,
preview_config = { preview_config = {
-- Options passed to nvim_open_win -- Options passed to nvim_open_win
border = "single", border = "single",
style = "minimal", style = "minimal",
relative = "cursor", relative = "cursor",
row = 0, row = 0,
col = 1, col = 1,
}, },
yadm = { yadm = {
enable = false, enable = false,
}, },
} }

36
.config/nvim/lua/init/plugins.lua

@ -1,8 +1,14 @@
vim.cmd('colorscheme nord')
vim.cmd('source ~/.vim/init/vimtex.vim') vim.cmd('source ~/.vim/init/vimtex.vim')
require 'plugins' vim.g.nord_borders = true
require 'lualine'.setup{}
require('plugins')
require('nord').set()
require('lualine').setup {
options = {
theme = 'nord',
}
}
vim.cmd [[ vim.cmd [[
"" Snippets "" Snippets
@ -12,3 +18,27 @@ vim.cmd [[
smap <expr> <S-Tab> snippy#can_jump(-1) ? '<Plug>(snippy-previous)' : '<S-Tab>' smap <expr> <S-Tab> snippy#can_jump(-1) ? '<Plug>(snippy-previous)' : '<S-Tab>'
xmap <Tab> <Plug>(snippy-cut-text) xmap <Tab> <Plug>(snippy-cut-text)
]] ]]
-- You dont need to set any of these options. These are the default ones. Only
-- the loading is important
require('telescope').setup {
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
-- the default case_mode is "smart_case"
}
}
}
-- To get fzf loaded and working with telescope, you need to call
-- load_extension, somewhere after setup function:
require('telescope').load_extension('fzf')
vim.cmd [[
nnoremap <leader>ff <cmd>lua require('telescope.builtin').find_files()<cr>
nnoremap <leader>fg <cmd>lua require('telescope.builtin').live_grep()<cr>
nnoremap <leader>fb <cmd>lua require('telescope.builtin').buffers()<cr>
nnoremap <leader>fh <cmd>lua require('telescope.builtin').help_tags()<cr>
]]

25
.config/nvim/lua/init/treesitter.lua

@ -0,0 +1,25 @@
local ok, configs = pcall(require, "nvim-treesitter.configs")
if not ok then
return
end
configs.setup {
ensure_installed = {
"c", "cpp", "lua", "scheme", "vue", "javascript", "pug"
},
sync_install = false,
ignore_install = { "" },
autopairs = {
enable = true,
},
highlight = {
enable = true,
disable = { "" },
additional_vim_regex_highlighting = true,
},
indent = { enable = true, disable = { "yaml" } },
context_commentstring = {
enable = true,
enable_autocmd = false,
},
}

7
.config/nvim/lua/plugins.lua

@ -41,4 +41,11 @@ return require('packer').startup(function()
-- Another tools -- -- Another tools --
use 'MunifTanjim/nui.nvim' -- UI framework use 'MunifTanjim/nui.nvim' -- UI framework
use {
'nvim-telescope/telescope.nvim', tag = '0.1.0',
requires = { {'nvim-lua/plenary.nvim'} }
}
use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }
end) end)

Loading…
Cancel
Save