From 081c3de2af751db0d0074160456b68d1ffb0a733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Sat, 10 Oct 2020 16:07:25 +0300 Subject: Switch to more based indentation method Also cleanup indentation in main configuration file, and consolidate several filetype specific settings in the main config file. --- dotfiles/.config/nvim/init.vim | 205 +++++++++++---------- .../.local/share/nvim/site/after/ftplugin/c.vim | 3 - .../.local/share/nvim/site/after/ftplugin/cpp.vim | 3 - .../.local/share/nvim/site/after/ftplugin/go.vim | 1 + .../.local/share/nvim/site/after/ftplugin/html.vim | 2 - .../share/nvim/site/after/ftplugin/javascript.vim | 3 - .../.local/share/nvim/site/after/ftplugin/json.vim | 2 - .../share/nvim/site/after/ftplugin/python.vim | 2 - .../.local/share/nvim/site/after/ftplugin/rust.vim | 7 +- .../.local/share/nvim/site/after/ftplugin/toml.vim | 3 - .../.local/share/nvim/site/after/ftplugin/yaml.vim | 2 - 11 files changed, 111 insertions(+), 122 deletions(-) delete mode 100644 dotfiles/.local/share/nvim/site/after/ftplugin/c.vim delete mode 100644 dotfiles/.local/share/nvim/site/after/ftplugin/cpp.vim create mode 100644 dotfiles/.local/share/nvim/site/after/ftplugin/go.vim delete mode 100644 dotfiles/.local/share/nvim/site/after/ftplugin/html.vim delete mode 100644 dotfiles/.local/share/nvim/site/after/ftplugin/javascript.vim delete mode 100644 dotfiles/.local/share/nvim/site/after/ftplugin/json.vim delete mode 100644 dotfiles/.local/share/nvim/site/after/ftplugin/python.vim delete mode 100644 dotfiles/.local/share/nvim/site/after/ftplugin/toml.vim delete mode 100644 dotfiles/.local/share/nvim/site/after/ftplugin/yaml.vim (limited to 'dotfiles') diff --git a/dotfiles/.config/nvim/init.vim b/dotfiles/.config/nvim/init.vim index ecb79d8..5b5d51f 100644 --- a/dotfiles/.config/nvim/init.vim +++ b/dotfiles/.config/nvim/init.vim @@ -3,96 +3,101 @@ let mapleader =" " " Check if vim-plug is installed, otherwise download and install if empty(glob('~/.local/share/nvim/site/autoload/plug.vim')) - silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs - \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - autocmd VimEnter * PlugInstall --sync | source $MYVIMRC + silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs + \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + autocmd VimEnter * PlugInstall --sync | source $MYVIMRC endif call plug#begin('~/.local/share/nvim/site/plugged') -Plug 'junegunn/goyo.vim' -Plug 'PotatoesMaster/i3-vim-syntax' -Plug 'jreybert/vimagit' -Plug 'tpope/vim-commentary' -Plug 'preservim/nerdtree' -Plug 'ervandew/supertab' -Plug 'neomake/neomake' -Plug 'jamessan/vim-gnupg' -Plug 'majutsushi/tagbar' -Plug 'rust-lang/rust.vim' -Plug 'cespare/vim-toml' -Plug 'xavierd/clang_complete' -Plug 'autozimu/LanguageClient-neovim', { - \ 'branch': 'next', - \ 'do': 'bash install.sh', - \ } + Plug 'junegunn/goyo.vim' + Plug 'PotatoesMaster/i3-vim-syntax' + Plug 'jreybert/vimagit' + Plug 'tpope/vim-commentary' + Plug 'preservim/nerdtree' + Plug 'vim-scripts/Smart-Tabs' + Plug 'ervandew/supertab' + Plug 'neomake/neomake' + Plug 'jamessan/vim-gnupg' + Plug 'majutsushi/tagbar' + Plug 'rust-lang/rust.vim' + Plug 'cespare/vim-toml' + Plug 'xavierd/clang_complete' + Plug 'autozimu/LanguageClient-neovim', { + \ 'branch': 'next', + \ 'do': 'bash install.sh', + \ } call plug#end() " Some basics: set nocompatible filetype plugin on syntax on - set omnifunc=syntaxcomplete#Complete - set background=dark - set termguicolors - set guicursor=n-v-c-sm:hor20,i-ci-ve:ver25,r-cr-o:block - set cursorline - let g:ultramar_italic=1 - colorscheme ultramar + set foldmethod=syntax + set omnifunc=syntaxcomplete#Complete + set background=dark + set termguicolors + set guicursor=n-v-c-sm:hor20,i-ci-ve:ver25,r-cr-o:block + set cursorline + let g:ultramar_italic=1 + colorscheme ultramar set number set relativenumber - set scrolloff=5 - set colorcolumn=+1 + set scrolloff=5 + set colorcolumn=+1 " Set screen title -let &titlestring = "vim - " . expand("%:t") -if &term == "screen" - set t_ts=^[k - set t_fs=^[\ -endif -set title -au BufEnter * let &titlestring = "vim - " . expand("%t") + let &titlestring = "vim - " . expand("%:t") + if &term == "screen" + set t_ts=^[k + set t_fs=^[\ + endif + set title + au BufEnter * let &titlestring = "vim - " . expand("%t") " Functions for git branch name on statusline - function! GitBranch() - return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'") - endfunction - function! StatuslineGit() - let l:branchname = GitBranch() - return strlen(l:branchname) > 0?'  '.l:branchname.' ':'' - endfunction + function! GitBranch() + return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'") + endfunction + function! StatuslineGit() + let l:branchname = GitBranch() + return strlen(l:branchname) > 0?'  '.l:branchname.' ':'' + endfunction " Statusline - let laststatus=2 - set statusline= - set statusline+=%#CursorLineNR# - set statusline+=%{StatuslineGit()} - set statusline+=%#StatusLine# - set statusline+=%< - set statusline+=\ %f%r%m - set statusline+=%= - set statusline+=\ %l:%v/%L - set statusline+=\ - set statusline+=%#StatusLineNC# - set statusline+=\ %Y - set statusline+=\ %{&fileencoding?&fileencoding:&encoding} - set statusline+=\[%{&fileformat}\] - set statusline+=\ - -" default indentation + let laststatus=2 + set statusline= + set statusline+=%#CursorLineNR# + set statusline+=%{StatuslineGit()} + set statusline+=%#StatusLine# + set statusline+=%< + set statusline+=\ %f%r%m + set statusline+=%= + set statusline+=\ %l:%v/%L + set statusline+=\ + set statusline+=%#StatusLineNC# + set statusline+=\ %Y + set statusline+=\ %{&fileencoding?&fileencoding:&encoding} + set statusline+=\[%{&fileformat}\] + set statusline+=\ + + " default indentation filetype plugin indent on + set noexpandtab + set copyindent + set preserveindent + set softtabstop=0 set tabstop=4 set shiftwidth=4 - set expandtab " Splits open at the bottom and right, which is non-retarded, unlike vim defaults. set splitbelow set splitright " To avoid switching between keyboards - set langmap=ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯХЪБЮ;ABCDEFGHIJKLMNOPQRSTUVWXYZ{}<>,фисвуапршолдьтщзйкыегмцчняхъэ;abcdefghijklmnopqrstuvwxyz[]' + set langmap=ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯХЪБЮ;ABCDEFGHIJKLMNOPQRSTUVWXYZ{}<>,фисвуапршолдьтщзйкыегмцчняхъэ;abcdefghijklmnopqrstuvwxyz[]' " Toggle relative line numbers - map r :set invrelativenumber + map r :set invrelativenumber " Shortcutting split navigation, saving a keypress: map h @@ -119,31 +124,31 @@ au BufEnter * let &titlestring = "vim - " . expand("%t") map :setlocal spell! spelllang=en_us,es,ru " Save changes - noremap s :update + noremap s :update " with russian layout - noremap ы :update + noremap ы :update " Copy to clipboard - vnoremap y "+y - nnoremap Y "+yg_ - nnoremap y "+y - nnoremap yy "+yy + vnoremap y "+y + nnoremap Y "+yg_ + nnoremap y "+y + nnoremap yy "+yy " with russian layout - vnoremap н "+y - nnoremap Н "+yg_ - nnoremap н "+y - nnoremap нн "+yy + vnoremap н "+y + nnoremap Н "+yg_ + nnoremap н "+y + nnoremap нн "+yy " Paste from clipboard - nnoremap p "+p - nnoremap P "+P - vnoremap p "+p - vnoremap P "+P + nnoremap p "+p + nnoremap P "+P + vnoremap p "+p + vnoremap P "+P " with russian layout - nnoremap з "+p - nnoremap З "+P - vnoremap з "+p - vnoremap З "+P + nnoremap з "+p + nnoremap З "+P + vnoremap з "+p + vnoremap З "+P " Enable autocompletion: set wildmode=list:longest,full @@ -159,16 +164,16 @@ au BufEnter * let &titlestring = "vim - " . expand("%t") autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o " Join line with alt - nnoremap J + nnoremap J " with russian layout - nnoremap J + nnoremap J " Easier tab navigation (similar to qutebrowser) - nnoremap J :tabn - nnoremap K :tabp + nnoremap J :tabn + nnoremap K :tabp " with russian layout - nnoremap О :tabn - nnoremap Л :tabp + nnoremap О :tabn + nnoremap Л :tabp " C-T for new tab nnoremap :tabe @@ -191,8 +196,8 @@ au BufEnter * let &titlestring = "vim - " . expand("%t") inoremap wj " SuperTab - let g:SuperTabDefaultCompletionType = "context" - let g:SuperTabContextDefaultCompletionType = "" + let g:SuperTabDefaultCompletionType = "context" + let g:SuperTabContextDefaultCompletionType = "" " NERDTree map f :NERDTreeToggle @@ -201,19 +206,19 @@ au BufEnter * let &titlestring = "vim - " . expand("%t") map :TagbarToggle " LSP - let g:LanguageClient_serverCommands = { - \ 'c': ['/usr/bin/clangd'], - \ 'go': ['/usr/bin/gopls'], - \ 'cpp': ['/usr/bin/clangd'], - \ 'python': ['/usr/bin/pyls'], - \ 'rust': ['/usr/bin/rustup', 'run', 'stable', 'rls'], - \ 'javascript': ['/usr/bin/javascript-typescript-stdio'], - \ } + let g:LanguageClient_serverCommands = { + \ 'c': ['/usr/bin/clangd'], + \ 'go': ['/usr/bin/gopls'], + \ 'cpp': ['/usr/bin/clangd'], + \ 'python': ['/usr/bin/pyls'], + \ 'rust': ['/usr/bin/rustup', 'run', 'stable', 'rls'], + \ 'javascript': ['/usr/bin/javascript-typescript-stdio'], + \ } " LanguageClient-neovim - nmap (lcn-menu) - nmap gd (lcn-definition) + nmap (lcn-menu) + nmap gd (lcn-definition) " Goyo - let g:goyo_width = 100 - map g :Goyo + let g:goyo_width = 100 + map g :Goyo diff --git a/dotfiles/.local/share/nvim/site/after/ftplugin/c.vim b/dotfiles/.local/share/nvim/site/after/ftplugin/c.vim deleted file mode 100644 index acc39c9..0000000 --- a/dotfiles/.local/share/nvim/site/after/ftplugin/c.vim +++ /dev/null @@ -1,3 +0,0 @@ -setlocal shiftwidth=4 -setlocal tabstop=4 -setlocal foldmethod=syntax diff --git a/dotfiles/.local/share/nvim/site/after/ftplugin/cpp.vim b/dotfiles/.local/share/nvim/site/after/ftplugin/cpp.vim deleted file mode 100644 index acc39c9..0000000 --- a/dotfiles/.local/share/nvim/site/after/ftplugin/cpp.vim +++ /dev/null @@ -1,3 +0,0 @@ -setlocal shiftwidth=4 -setlocal tabstop=4 -setlocal foldmethod=syntax diff --git a/dotfiles/.local/share/nvim/site/after/ftplugin/go.vim b/dotfiles/.local/share/nvim/site/after/ftplugin/go.vim new file mode 100644 index 0000000..deca82d --- /dev/null +++ b/dotfiles/.local/share/nvim/site/after/ftplugin/go.vim @@ -0,0 +1 @@ +setlocal tw=80 diff --git a/dotfiles/.local/share/nvim/site/after/ftplugin/html.vim b/dotfiles/.local/share/nvim/site/after/ftplugin/html.vim deleted file mode 100644 index 289b7cd..0000000 --- a/dotfiles/.local/share/nvim/site/after/ftplugin/html.vim +++ /dev/null @@ -1,2 +0,0 @@ -setlocal shiftwidth=4 -setlocal tabstop=4 diff --git a/dotfiles/.local/share/nvim/site/after/ftplugin/javascript.vim b/dotfiles/.local/share/nvim/site/after/ftplugin/javascript.vim deleted file mode 100644 index acc39c9..0000000 --- a/dotfiles/.local/share/nvim/site/after/ftplugin/javascript.vim +++ /dev/null @@ -1,3 +0,0 @@ -setlocal shiftwidth=4 -setlocal tabstop=4 -setlocal foldmethod=syntax diff --git a/dotfiles/.local/share/nvim/site/after/ftplugin/json.vim b/dotfiles/.local/share/nvim/site/after/ftplugin/json.vim deleted file mode 100644 index 810fd8f..0000000 --- a/dotfiles/.local/share/nvim/site/after/ftplugin/json.vim +++ /dev/null @@ -1,2 +0,0 @@ -setlocal shiftwidth=2 -setlocal tabstop=2 diff --git a/dotfiles/.local/share/nvim/site/after/ftplugin/python.vim b/dotfiles/.local/share/nvim/site/after/ftplugin/python.vim deleted file mode 100644 index 289b7cd..0000000 --- a/dotfiles/.local/share/nvim/site/after/ftplugin/python.vim +++ /dev/null @@ -1,2 +0,0 @@ -setlocal shiftwidth=4 -setlocal tabstop=4 diff --git a/dotfiles/.local/share/nvim/site/after/ftplugin/rust.vim b/dotfiles/.local/share/nvim/site/after/ftplugin/rust.vim index 01d4271..947bdca 100644 --- a/dotfiles/.local/share/nvim/site/after/ftplugin/rust.vim +++ b/dotfiles/.local/share/nvim/site/after/ftplugin/rust.vim @@ -1,4 +1,7 @@ -setlocal shiftwidth=4 +setlocal noexpandtab +setlocal copyindent +setlocal preserveindent +setlocal softtabstop=0 setlocal tabstop=4 -setlocal fdm=syntax +setlocal shiftwidth=4 setlocal tw=80 diff --git a/dotfiles/.local/share/nvim/site/after/ftplugin/toml.vim b/dotfiles/.local/share/nvim/site/after/ftplugin/toml.vim deleted file mode 100644 index 40a20ba..0000000 --- a/dotfiles/.local/share/nvim/site/after/ftplugin/toml.vim +++ /dev/null @@ -1,3 +0,0 @@ -setlocal shiftwidth=2 -setlocal tabstop=2 - diff --git a/dotfiles/.local/share/nvim/site/after/ftplugin/yaml.vim b/dotfiles/.local/share/nvim/site/after/ftplugin/yaml.vim deleted file mode 100644 index 810fd8f..0000000 --- a/dotfiles/.local/share/nvim/site/after/ftplugin/yaml.vim +++ /dev/null @@ -1,2 +0,0 @@ -setlocal shiftwidth=2 -setlocal tabstop=2 -- cgit v1.2.3