292 lines
7.8 KiB
VimL
292 lines
7.8 KiB
VimL
|
||
nnoremap <Left> :echoe "Use h"<CR>
|
||
nnoremap <Right> :echoe "Use l"<CR>
|
||
nnoremap <Up> :echoe "Use k"<CR>
|
||
nnoremap <Down> :echoe "Use j"<CR>
|
||
|
||
set number "номер строки
|
||
set ruler
|
||
set laststatus=2
|
||
|
||
" xclip requiered
|
||
set clipboard=unnamedplus
|
||
|
||
|
||
set shell=zsh
|
||
|
||
|
||
nnoremap <Leader>c :set cursorline!<CR>
|
||
|
||
|
||
let g:airline_powerline_fonts = 1 "Включить поддержку Powerline шрифтов
|
||
let g:airline#extensions#keymap#enabled = 0 "Не показывать текущий маппинг
|
||
let g:airline_section_z = "\ue0a1:%l/%L Col:%c" "Кастомная графа положения курсора
|
||
let g:Powerline_symbols='unicode' "Поддержка unicode
|
||
let g:airline#extensions#xkblayout#enabled = 0
|
||
let g:airline#extensions#branch#enabled=1
|
||
|
||
set ttimeoutlen=10 "Понижаем задержку ввода escape последовательностей
|
||
let &t_SI.="\e[5 q" "SI = режим вставки
|
||
let &t_SR.="\e[3 q" "SR = режим замены
|
||
let &t_EI.="\e[1 q" "EI = нормальный режим
|
||
|
||
set encoding=utf-8 "Ставит кодировку UTF-8
|
||
set nocompatible "Отключает обратную совместимость с Vi
|
||
syntax on "Включает подсветку синтаксиса
|
||
|
||
set expandtab
|
||
set smarttab
|
||
set tabstop=4
|
||
set softtabstop=4
|
||
set shiftwidth=4
|
||
set autoindent
|
||
set smartindent
|
||
set nowrap
|
||
|
||
set noerrorbells
|
||
set novisualbell
|
||
set showcmd
|
||
set showtabline=2
|
||
|
||
set ignorecase
|
||
set smartcase
|
||
set hlsearch
|
||
set incsearch
|
||
|
||
set mousehide
|
||
set mouse=a
|
||
|
||
set colorcolumn=120
|
||
set scrolloff=7
|
||
|
||
set virtualedit=onemore " allow for cursor beyond last character
|
||
|
||
" f4 toggle hlsearch
|
||
nnoremap <F4> :set invhlsearch<CR>
|
||
|
||
" navigation on russian
|
||
nmap о j
|
||
nmap л k
|
||
nmap р h
|
||
nmap д l
|
||
nmap ш i
|
||
nmap ф a
|
||
nmap в d
|
||
|
||
|
||
set ffs=unix,mac
|
||
set encoding=utf8
|
||
|
||
" tabs
|
||
nnoremap <C-Left> :tabprevious<CR>
|
||
nnoremap <C-Right> :tabnext<CR>
|
||
nnoremap <A-h> :tabprevious<CR>
|
||
nnoremap <A-l> :tabnext<CR>
|
||
|
||
|
||
|
||
|
||
" Plugins
|
||
set rtp+=~/.vim/bundle/Vundle.vim
|
||
|
||
call vundle#begin()
|
||
|
||
Plugin 'VundleVim/Vundle.vim'
|
||
Plugin 'vim-airline/vim-airline'
|
||
Plugin 'morhetz/gruvbox'
|
||
Plugin 'tpope/vim-surround'
|
||
Plugin 'tpope/vim-commentary'
|
||
Plugin 'ap/vim-css-color'
|
||
Plugin 'terryma/vim-multiple-cursors'
|
||
Plugin 'preservim/tagbar'
|
||
Plugin 'preservim/vimux'
|
||
Plugin 'francoiscabrol/ranger.vim'
|
||
Plugin 'rbgrouleff/bclose.vim'
|
||
" requiered patch your font
|
||
Plugin 'ryanoasis/vim-devicons'
|
||
Plugin 'jiangmiao/auto-pairs'
|
||
|
||
" pyright
|
||
Plugin 'neovim/nvim-lspconfig'
|
||
Plugin 'hrsh7th/nvim-cmp'
|
||
Plugin 'hrsh7th/cmp-nvim-lsp'
|
||
Plugin 'saadparwaiz1/cmp_luasnip'
|
||
Plugin 'L3MON4D3/LuaSnip'
|
||
|
||
call vundle#end()
|
||
|
||
filetype plugin indent on
|
||
|
||
" Python
|
||
let python_highlight_all = 1
|
||
set t_Co=256
|
||
nnoremap <silent> <special> <F10> :!python3 % <CR>
|
||
|
||
|
||
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class,match,case
|
||
|
||
" nerdtree
|
||
" Ctrl + w l|h - change window
|
||
|
||
|
||
|
||
nnoremap <silent> <special> <F3> :Ranger <CR>
|
||
|
||
let g:ranger_replace_netrw = 1 " open ranger when vim open a directory
|
||
let g:ranger_map_keys = 0
|
||
|
||
" ctags required
|
||
nnoremap <silent> <special> <F8> :TagbarToggle <CR>
|
||
|
||
|
||
|
||
set laststatus=2
|
||
let g:lightline = {
|
||
\ 'colorscheme': 'iceberg',
|
||
\ 'active': {
|
||
\ 'left': [ [ 'mode', 'paste' ],
|
||
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
|
||
\ },
|
||
\ 'component_function': {
|
||
\ 'gitbranch': 'fugitive#head'
|
||
\ },
|
||
\ }
|
||
|
||
|
||
" Colorscheme
|
||
colorscheme gruvbox
|
||
set bg=dark
|
||
|
||
|
||
let g:multi_cursor_use_default_mapping=0
|
||
|
||
" Default mapping
|
||
let g:multi_cursor_start_word_key = '<C-n>'
|
||
let g:multi_cursor_select_all_word_key = '<A-n>'
|
||
let g:multi_cursor_start_key = 'g<C-n>'
|
||
let g:multi_cursor_select_all_key = 'g<A-n>'
|
||
let g:multi_cursor_next_key = '<C-n>'
|
||
let g:multi_cursor_prev_key = '<C-p>'
|
||
let g:multi_cursor_skip_key = '<C-x>'
|
||
let g:multi_cursor_quit_key = '<Esc>'
|
||
|
||
|
||
|
||
|
||
" BEGIN pyright
|
||
|
||
|
||
|
||
|
||
lua << EOF
|
||
-- Set completeopt to have a better completion experience
|
||
vim.o.completeopt = 'menuone,noselect'
|
||
|
||
-- luasnip setup
|
||
local luasnip = require 'luasnip'
|
||
|
||
-- nvim-cmp setup
|
||
local cmp = require 'cmp'
|
||
cmp.setup {
|
||
completion = {
|
||
autocomplete = false
|
||
},
|
||
snippet = {
|
||
expand = function(args)
|
||
require('luasnip').lsp_expand(args.body)
|
||
end,
|
||
},
|
||
mapping = {
|
||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||
['<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,
|
||
},
|
||
['<Tab>'] = function(fallback)
|
||
if vim.fn.pumvisible() == 1 then
|
||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-n>', true, true, true), 'n')
|
||
elseif luasnip.expand_or_jumpable() then
|
||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-expand-or-jump', true, true, true), '')
|
||
else
|
||
fallback()
|
||
end
|
||
end,
|
||
['<S-Tab>'] = function(fallback)
|
||
if vim.fn.pumvisible() == 1 then
|
||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-p>', true, true, true), 'n')
|
||
elseif luasnip.jumpable(-1) then
|
||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-jump-prev', true, true, true), '')
|
||
else
|
||
fallback()
|
||
end
|
||
end,
|
||
},
|
||
sources = {
|
||
{ name = 'nvim_lsp' },
|
||
{ name = 'luasnip' },
|
||
},
|
||
}
|
||
EOF
|
||
|
||
|
||
|
||
|
||
lua << EOF
|
||
local nvim_lsp = require('lspconfig')
|
||
|
||
-- Use an on_attach function to only map the following keys
|
||
-- after the language server attaches to the current buffer
|
||
local on_attach = function(client, bufnr)
|
||
|
||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||
|
||
-- Enable completion triggered by <c-x><c-o>
|
||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||
|
||
-- Mappings.
|
||
local opts = { noremap=true, silent=true }
|
||
|
||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
|
||
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
||
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
||
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||
buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||
|
||
end
|
||
|
||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||
-- map buffer local keybindings when the language server attaches
|
||
local servers = { 'pyright' }
|
||
for _, lsp in ipairs(servers) do
|
||
nvim_lsp[lsp].setup {
|
||
on_attach = on_attach,
|
||
flags = {
|
||
debounce_text_changes = 150,
|
||
}
|
||
}
|
||
end
|
||
EOF
|
||
|
||
|
||
" END pyright
|
||
|