diff --git a/aliases b/aliases index dd9d7a3..54c75fd 100644 --- a/aliases +++ b/aliases @@ -1,4 +1,8 @@ export PATH="$HOME/.local/bin:$PATH" +export EDITOR="/usr/bin/nvim" + +#vim +alias vim="nvim" #ls alias ls="ls --color=auto" @@ -7,7 +11,6 @@ alias ..="cd .." alias ...="cd ../.." alias ....="cd ../../.." alias .....="cd ../../../.." -export EDITOR="/usr/bin/vim" # improved reset and clear alias reset="tput reset" diff --git a/config/dunst/dunstrc b/config/dunst/dunstrc index 4c54317..4eee4ac 100644 --- a/config/dunst/dunstrc +++ b/config/dunst/dunstrc @@ -287,7 +287,7 @@ # On the US keyboard layout "grave" is normally above TAB and left # of "1". Make sure this key actually exists on your keyboard layout, # e.g. check output of 'xmodmap -pke' - history = ctrl+p + history = ctrl+bracketleft # Context menu. context = ctrl+shift+period diff --git a/config/nvim/init.vim b/config/nvim/init.vim new file mode 100644 index 0000000..2513bdb --- /dev/null +++ b/config/nvim/init.vim @@ -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 :set list! + +noremap - ddp +nnoremap _ ddkP + +let mapleader = " " +let maplocalleader = "," + +nnoremap ev :vsplit $MYVIMRC +nnoremap sv :source $MYVIMRC +nnoremap :%s//gc +nnoremap t :tabnew + +vnoremap " a"``> +nnoremap H 0 +nnoremap L $ + +augroup html + autocmd! + autocmd FileType html inoremap > >F<"tyef>"tpa>TT> + autocmd FileType html inoremap = ="" + autocmd FileType html inoremap \= = + autocmd FileType html inoremap \> > + autocmd FileType html iabbrev df> + autocmd FileType html nnoremap f Vatzf + autocmd FileType html vnoremap H "tdh?>"tpvT> + autocmd FileType html vnoremap L "td/<"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', '', 'compe#confirm("")', { 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 + 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 diff --git a/home/vimrc b/home/vimrc deleted file mode 100644 index 2e3c92c..0000000 --- a/home/vimrc +++ /dev/null @@ -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 ev :vsplit $MYVIMRC -nnoremap sv :source $MYVIMRC -nnoremap :%s//gc -nnoremap t :tabnew - -vnoremap " a"``> -nnoremap H 0 -nnoremap L $ - -augroup comments - autocmd! - autocmd FileType javascript nnoremap c 0i// - autocmd FileType c nnoremap c 0i// - autocmd FileType python nnoremap c 0i# - autocmd FileType html nnoremap c 0i -augroup END - -augroup html - autocmd! - autocmd FileType html inoremap > >F<"tyef>"tpa>TT> - autocmd FileType html inoremap = ="" - autocmd FileType html inoremap \= = - autocmd FileType html inoremap \> > - autocmd FileType html iabbrev df> - autocmd FileType html nnoremap f Vatzf - autocmd FileType html vnoremap H "tdh?>"tpvT> - autocmd FileType html vnoremap L "td/<"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 :NERDTree - -let g:airline_theme = "powerlineish" -let g:airline#extensions#tabline#enabled = 1 - -:let g:ycm_autoclose_preview_window_after_completion = 1 -nnoremap :!compiledb make diff --git a/old-nvimrc b/old-nvimrc new file mode 100644 index 0000000..e39aa86 --- /dev/null +++ b/old-nvimrc @@ -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 h +map j +map k +map l + +" Easier tab +nnoremap t :tabnew + +" Easier find and replace +nnoremap :%s//gc + +" Disable annoying keybindings +"Command/Search History +nnoremap q: +nnoremap q/ +nnoremap q? +cnoremap +"Manual (wtf??) +nnoremap +"Select mode +vnoremap + +" 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