Pro lua config vlastní afresář

This commit is contained in:
kankys 2024-10-19 17:17:59 +02:00
parent df373e3dd7
commit 9d67175db4
6 changed files with 70 additions and 133 deletions

168
init.vim
View File

@ -4,7 +4,7 @@ set cursorline " zvýraznění řádku s kurzorem
set noshowmode
set title " zobrazí název a cestu souboru
set clipboard=unnamedplus " povolí kopírování a vkládání mimo Neovim
set signcolumn=number
set signcolumn=yes " zajistí number a gitgutter vedle sebe
call plug#begin(has('nvim') ? stdpath('data') . '/plugged' : '~/.vim/plugged')
@ -19,6 +19,10 @@ imap <silent><expr> <TAB> coc#pum#visible() ? coc#pum#confirm() : "\<TAB>"
Plug 'othree/html5.vim'
Plug 'airblade/vim-gitgutter' " Git nápověda ke změně v kódu
Plug 'frazrepo/vim-rainbow' " Barevné závorky
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'shellRaining/hlchunk.nvim' " Propojovací lajny v kódu (lua)
@ -39,6 +43,8 @@ Plug 'wakatime/vim-wakatime' " Wakatime
Plug 'tpope/vim-fugitive' " Git - vim fugitive
Plug 'lewis6991/gitsigns.nvim' " Git Signs (lua)
Plug 'lilydjwg/colorizer' " Náhled barev css
Plug 'Pocco81/auto-save.nvim' " Autosave
@ -80,29 +86,36 @@ Plug 'jacoborus/tender.vim'
Plug 'nordtheme/vim'
" CMP setup
"LSP
Plug 'neovim/nvim-lspconfig'
"Autocompletion
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/vim-vsnip'
"LSP Signature
Plug 'ray-x/lsp_signature.nvim'
"Lightbulb
Plug 'kosayoda/nvim-lightbulb'
call plug#end()
" Autostart NERDTree
lua require('kankys') " Nastavení lua pluginů ve vlastních souborech
" Automatické instalování pluginů
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" vim-gitgutter
let g:gitgutter_sign_added = '+'
let g:gitgutter_sign_modified = '~'
let g:gitgutter_sign_removed = '-'
" Barevné závorky
let g:rainbow_active = 1
let g:rainbow_load_separately = [
\ [ '*' , [['(', ')'], ['\[', '\]'], ['{', '}']] ],
\ [ '*.tex' , [['(', ')'], ['\[', '\]']] ],
\ [ '*.cpp' , [['(', ')'], ['\[', '\]'], ['{', '}']] ],
\ [ '*.{html,htm}' , [['(', ')'], ['\[', '\]'], ['{', '}'], ['<\a[^>]*>', '</[^>]*>']] ],
\ ]
let g:rainbow_guifgs = ['RoyalBlue3', 'DarkOrange3', 'DarkOrchid3', 'FireBrick']
let g:rainbow_ctermfgs = ['lightblue', 'lightgreen', 'yellow', 'red', 'magenta']
" Autostart NERDTree
" autocmd VimEnter * call NERDTreeFocus() " Autostart NERDTreeFocus
" Komentáře NERD Commenter klávesové zkratky Ctrl + k + l
@ -122,114 +135,3 @@ let g:auto_save_events = ['InsertLeave', 'TextChanged']
" keys pretier
vmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
lua <<EOF
--AutocloseTag setup
require("autoclose").setup()
EOF
lua << EOF
-- LSP setup
local nvim_lsp = require('lspconfig')
-- Enable some language servers with the additional completion capabilities offered by nvim-cmp
local servers = { 'pyright', 'tsserver', 'clangd', 'sumneko_lua' }
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
}
end
EOF
lua << EOF
-- nvim-cmp setup
local cmp = require 'cmp'
cmp.setup {
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = {
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
{ name = 'buffer' },
{ name = 'path' },
},
}
-- Use buffer source for `/`
cmp.setup.cmdline('/', {
sources = {
{ name = 'buffer' }
}
})
-- Use cmdline & path source for ':'
cmp.setup.cmdline(':', {
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
EOF
lua << EOF
-- lsp_signature setup
require'lsp_signature'.setup({
bind = true, -- This is mandatory, otherwise border config won't get registered.
handler_opts = {
border = "rounded"
}
})
EOF
lua << EOF
-- nvim-lightbulb setup
require('nvim-lightbulb').setup({
autocmd = { enabled = true },
})
EOF
lua << EOF
require'nvim-treesitter.configs'.setup {
highlight = {
enable = true,
},
indent = {
enable = true,
},
}
EOF
lua << EOF
require('hlchunk').setup({
chunk = {
enable = true
-- ...
},
indent = {
enable = true
-- ...
}
})
EOF

View File

@ -0,0 +1 @@
require("autoclose").setup()

8
lua/kankys/gitsigns.lua Normal file
View File

@ -0,0 +1,8 @@
require('gitsigns').setup {
-- signs config
current_line_blame = true,
current_line_blame_opts = {
virt_text_pos = 'right_align'
}
}

11
lua/kankys/hlchunk.lua Normal file
View File

@ -0,0 +1,11 @@
require('hlchunk').setup({
chunk = {
enable = true
-- ...
},
indent = {
enable = true
-- ...
}
}
)

4
lua/kankys/init.lua Normal file
View File

@ -0,0 +1,4 @@
require('kankys/gitsigns')
require('kankys/hlchunk')
require('kankys/autoclosetag')
require('kankys/treesitter')

11
lua/kankys/treesitter.lua Normal file
View File

@ -0,0 +1,11 @@
local treesitter = require('nvim-treesitter.configs')
treesitter.setup {
highlight = {
enable = true
},
indent = {
enable = true,
},
}