Change vim for neovim

This commit is contained in:
Augusto Gunsch 2021-08-22 16:23:16 -03:00
parent f37de2a180
commit 013d6c4266
No known key found for this signature in database
GPG Key ID: F7EEFE29825C72DC
5 changed files with 274 additions and 71 deletions

View File

@ -1,4 +1,8 @@
export PATH="$HOME/.local/bin:$PATH" export PATH="$HOME/.local/bin:$PATH"
export EDITOR="/usr/bin/nvim"
#vim
alias vim="nvim"
#ls #ls
alias ls="ls --color=auto" alias ls="ls --color=auto"
@ -7,7 +11,6 @@ alias ..="cd .."
alias ...="cd ../.." alias ...="cd ../.."
alias ....="cd ../../.." alias ....="cd ../../.."
alias .....="cd ../../../.." alias .....="cd ../../../.."
export EDITOR="/usr/bin/vim"
# improved reset and clear # improved reset and clear
alias reset="tput reset" alias reset="tput reset"

View File

@ -287,7 +287,7 @@
# On the US keyboard layout "grave" is normally above TAB and left # On the US keyboard layout "grave" is normally above TAB and left
# of "1". Make sure this key actually exists on your keyboard layout, # of "1". Make sure this key actually exists on your keyboard layout,
# e.g. check output of 'xmodmap -pke' # e.g. check output of 'xmodmap -pke'
history = ctrl+p history = ctrl+bracketleft
# Context menu. # Context menu.
context = ctrl+shift+period context = ctrl+shift+period

119
config/nvim/init.vim Normal file
View File

@ -0,0 +1,119 @@
syntax on
filetype on
filetype plugin on
set encoding=utf-8
set clipboard=unnamedplus
set nu rnu
set smartindent
set nocp
set bo=all
colorscheme torte
set ts=8
set list
set listchars=tab:*·,lead,trail:~,extends:>,precedes:<
hi Whitespace ctermfg=233
hi SignColumn ctermbg=233
nnoremap <F5> :set list!<cr>
noremap - ddp
nnoremap _ ddkP
let mapleader = " "
let maplocalleader = ","
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
nnoremap <C-s> :%s//gc<left><left><left>
nnoremap <C-w>t :tabnew<cr>
vnoremap <leader>" <esc>a"<esc>`<i"<esc>`>
nnoremap H 0
nnoremap L $
augroup html
autocmd!
autocmd FileType html inoremap <buffer> > ><esc>F<"tyef>"tpa><esc>T<i/<c-o>T>
autocmd FileType html inoremap <buffer> = =""<left>
autocmd FileType html inoremap <buffer> \= =
autocmd FileType html inoremap <buffer> \> >
autocmd FileType html iabbrev <buffer> <! <!DOCTYPE html><c-o>df>
autocmd FileType html nnoremap <buffer> <localleader>f Vatzf
autocmd FileType html vnoremap <buffer> H "tdh?><CR>"tpvT>
autocmd FileType html vnoremap <buffer> L "td/<<CR>"tPg;vt<
augroup END
call plug#begin('~/.config/nvim/plugged')
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'scrooloose/nerdtree'
Plug 'scrooloose/nerdcommenter'
" LSP config
Plug 'neovim/nvim-lspconfig'
" *auto* completion
Plug 'hrsh7th/nvim-compe'
Plug 'tpope/vim-fugitive'
call plug#end()
let g:airline_theme = "powerlineish"
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
lua << EOF
--- nvim-compe
require'compe'.setup {
enabled = true;
autocomplete = true;
debug = false;
min_length = 1;
preselect = 'enable';
throttle_time = 80;
source_timeout = 200;
incomplete_delay = 400;
max_abbr_width = 100;
max_kind_width = 100;
max_menu_width = 100;
documentation = true;
source = {
path = true;
nvim_lsp = true;
};
}
--- IMPORTANT
vim.api.nvim_set_keymap('i', '<cr>', 'compe#confirm("<cr>")', { expr = true })
--- LSP
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_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')
end
-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
local servers = { 'pyright', 'clangd' }
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
on_attach = on_attach,
flags = {
debounce_text_changes = 150,
}
}
end
EOF
" auto close scratch buffer (preview window)
autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif

View File

@ -1,69 +0,0 @@
syntax on
filetype on
colorscheme torte
set clipboard=unnamedplus
set nu rnu
set smartindent
noremap - ddp
nnoremap _ ddkP
let mapleader = " "
let maplocalleader = ","
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
nnoremap <C-s> :%s//gc<left><left><left>
nnoremap <C-w>t :tabnew<cr>
vnoremap <leader>" <esc>a"<esc>`<i"<esc>`>
nnoremap H 0
nnoremap L $
augroup comments
autocmd!
autocmd FileType javascript nnoremap <buffer> <localleader>c 0i//<esc>
autocmd FileType c nnoremap <buffer> <localleader>c 0i//<esc>
autocmd FileType python nnoremap <buffer> <localleader>c 0i#<esc>
autocmd FileType html nnoremap <buffer> <localleader>c 0i<!--<esc>A--><esc>
augroup END
augroup html
autocmd!
autocmd FileType html inoremap <buffer> > ><esc>F<"tyef>"tpa><esc>T<i/<c-o>T>
autocmd FileType html inoremap <buffer> = =""<left>
autocmd FileType html inoremap <buffer> \= =
autocmd FileType html inoremap <buffer> \> >
autocmd FileType html iabbrev <buffer> <! <!DOCTYPE html><c-o>df>
autocmd FileType html nnoremap <buffer> <localleader>f Vatzf
autocmd FileType html vnoremap <buffer> H "tdh?><CR>"tpvT>
autocmd FileType html vnoremap <buffer> L "td/<<CR>"tPg;vt<
augroup END
augroup python
autocmd!
" autocmd FileType python set et
autocmd FileType python set ts=4
augroup END
call plug#begin()
Plug 'valloric/youcompleteme', { 'do': './install.py --clangd-completer'}
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'scrooloose/nerdtree'
Plug 'scrooloose/nerdcommenter'
Plug 'tpope/vim-fugitive'
call plug#end()
nnoremap <C-n> :NERDTree<cr>
let g:airline_theme = "powerlineish"
let g:airline#extensions#tabline#enabled = 1
:let g:ycm_autoclose_preview_window_after_completion = 1
nnoremap <C-F12> :!compiledb make<cr>

150
old-nvimrc Normal file
View File

@ -0,0 +1,150 @@
" no highlighting search
set nohlsearch
" encoding:
set encoding=utf-8
" line numbers:
set number relativenumber
" color highlighting:
syntax on
" Use 256 colours
set t_Co=256
" copying/paste from system register (requires xclip)
set clipboard+=unnamedplus
" Always show statusline:
set laststatus=2
" Easier panel navigation
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" Easier tab
nnoremap <silent> <C-w>t :tabnew<CR>
" Easier find and replace
nnoremap <C-s> :%s//gc<Left><Left><Left>
" Disable annoying keybindings
"Command/Search History
nnoremap q: <Nop>
nnoremap q/ <Nop>
nnoremap q? <Nop>
cnoremap <C-f> <Nop>
"Manual (wtf??)
nnoremap <S-k> <Nop>
"Select mode
vnoremap <C-g> <Nop>
" base
hi User1 ctermfg=231 ctermbg=234
" base light
hi User4 ctermfg=231 ctermbg=237
" blue bg
hi User2 ctermfg=231 ctermbg=27
" default
hi User3 ctermfg=white ctermbg=27
function! GetMode()
if mode() == 'n'
hi User3 ctermfg=white ctermbg=27
return '  NORMAL '
elseif mode() == 'i'
hi User3 ctermfg=black ctermbg=green
return ' 﫦INSERT '
elseif mode() == 'v' || mode() == 'V' || mode() == ''
hi User3 ctermfg=black ctermbg=190
if mode() == 'V'
return '  VISUAL LINE '
elseif mode() == ''
return '  VISUAL BLOCK '
else
return '  VISUAL '
endif
elseif mode() == 'c'
hi User3 ctermfg=white ctermbg=27
return '  COMMAND '
elseif mode() == 'R'
hi User3 ctermfg=white ctermbg=196
return ' 易REPLACE '
else
hi User3 ctermfg=white ctermbg=27
return '  UNKNOWN '
endif
endfunction
function! DrawStatusLine()
set statusline=%1* "bare
set statusline+=\ \ \ "Vim logo
set statusline+=%3* "mode color
set statusline+=%{GetMode()} "mode
set statusline+=%1*\ "space
set statusline+=%4* "base light
set statusline+=\ \ \ %f\ "file name
set statusline+=%1* "bare
set statusline+=%= "switch side
set statusline+=%2* "blue
set statusline+=\ \ %l:%c/%L\ "line and collon
endfunction
call DrawStatusLine()
" TabLine colors
hi clear TabLine
hi clear TabLineFill
hi clear TabLineSel
hi TabLineFill ctermfg=231 ctermbg=234
hi TabLine ctermfg=231 ctermbg=237
hi TabLineSel ctermfg=231 ctermbg=27
" Disable -- INSERT --, etc
set noshowmode
set noshowcmd
" VUNDLE START
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.config/nvim/bundle/Vundle.vim
"call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
call vundle#begin('~/.config/nvim/bundle')
"let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
"Plugin 'ycm-core/YouCompleteMe'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" VUNDLE END
" YCM
"set completeopt-=preview
"let g:ycm_clangd_args=['--header-insertion=never']
"hi clear SignColumn
"hi link YcmWarningLine WarningMsg
"hi link YcmWarningSign WarningMsg
"hi link YcmWarningSection Error
"hi link YcmErrorLine Question
"hi link YcmErrorSign Question
"hi link YcmErrorSection Todo