This commit is contained in:
Tim Schubert 2020-08-01 15:46:33 +02:00
parent b7b348c163
commit 3d86adb45f
Signed by: dadada
GPG key ID: EEB8D1CE62C4DFEA
41 changed files with 124 additions and 81 deletions

42
modules/vim/default.nix Normal file
View file

@ -0,0 +1,42 @@
{ config, pkgs, lib, fetchFromGitHub, ... }:
let
myFtplugins = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "myFtplugins";
version = "2010-11-06";
src = vim/plugins/myFtplugins;
};
spacemacsTheme = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "spacemacs-theme";
version = "2.0.1";
src = pkgs.fetchFromGitHub {
owner = "colepeters";
repo = "spacemacs-theme.vim";
rev = "056bba9bd05a2c97c63c28216a1c232cfb91529e";
sha256 = "0iy3i6waigk759p2z59mrxkjc0p412y7d8zf3cjak4a9sh1sh6qz";
};
};
in
{
programs.vim = {
enable = true;
extraConfig = builtins.readFile ./vimrc;
plugins = [
pkgs.vimPlugins.vim-nix
#pkgs.vimPlugins.kotlin-vim
pkgs.vimPlugins.ale
pkgs.vimPlugins.fzf-vim
pkgs.vimPlugins.rust-vim
pkgs.vimPlugins.base16-vim
pkgs.vimPlugins.typescript-vim
pkgs.vimPlugins.vim-airline
pkgs.vimPlugins.vim-airline-themes
pkgs.vimPlugins.vim-fish
spacemacsTheme
#pkgs.vimPlugins.vim-gnupg
#pkgs.vimPlugins.vim-l9
pkgs.vimPlugins.vim-ledger
#pkgs.vimPlugins.clang_complete
];
};
}

View file

@ -0,0 +1,11 @@
let b:ale_fixers = ['clang-format', 'remove_trailing_lines', 'trim_whitespace']
let b:ale_linters = ['clangd']
"setlocal tabstop=8 expandtab shiftwidth=2 smarttab
" GNU Coding Standards
setlocal cindent
setlocal cinoptions=>4,n-2,{2,^-2,:2,=2,g0,h2,p5,t0,+2,(0,u0,w1,m1
setlocal shiftwidth=2
setlocal softtabstop=2
setlocal textwidth=79
setlocal fo-=ro fo+=cql

View file

@ -0,0 +1,3 @@
setlocal expandtab
setlocal shiftwidth=2
setlocal softtabstop=2

View file

@ -0,0 +1,2 @@
" Set up :make to use fish for syntax checking.
compiler fish

View file

@ -0,0 +1,3 @@
class Foo {
fun
}

View file

@ -0,0 +1,3 @@
setlocal expandtab
setlocal shiftwidth=2
setlocal softtabstop=2

View file

@ -0,0 +1,5 @@
let b:ale_fixers = ['prettier', 'eslint']
setlocal expandtab
setlocal shiftwidth=2
setlocal softtabstop=2

View file

@ -0,0 +1,5 @@
setlocal expandtab
setlocal shiftwidth=4
setlocal softtabstop=4
let g:ale_kotlin_languageserver_executable = "/home/tim/src/kotlin-language-server/server/build/install/server/bin/kotlin-language-server"

View file

@ -0,0 +1,3 @@
setlocal expandtab
setlocal shiftwidth=4
setlocal softtabstop=4

View file

@ -0,0 +1,3 @@
setlocal expandtab
setlocal shiftwidth=2
setlocal softtabstop=2

View file

@ -0,0 +1,4 @@
" Check Python files with flake8 and pylint.
let b:ale_linters = ['flake8', 'pylint']
" Fix Python files with autopep8 and yapf.
let b:ale_fixers = ['autopep8', 'yapf', 'add_blank_lines_for_python_control_statements', 'autopep8', 'remove_trailing_lines', 'reorder-python-imports', 'trim_whitespace']

View file

@ -0,0 +1,2 @@
let b:ale_linters = {'rust': ['rustc', 'rls', 'rust-analyzer']}
let b:ale_fixers = {'rust': ['rustfmt']}

View file

@ -0,0 +1,3 @@
setlocal expandtab
setlocal shiftwidth=2
setlocal softtabstop=2

View file

@ -0,0 +1,5 @@
let b:ale_fixers = ['prettier', 'eslint', 'tsserver']
setlocal expandtab
setlocal shiftwidth=2
setlocal softtabstop=2

View file

@ -0,0 +1,4 @@
setlocal expandtab
setlocal shiftwidth=2
setlocal softtabstop=2

143
modules/vim/vimrc Normal file
View file

@ -0,0 +1,143 @@
filetype plugin on
filetype indent on
set autoread
" :W sudo saves the file
" (useful for handling the permission-denied error)
command W w !sudo tee % > /dev/null
" no command execution from modeline
set nomodeline
" Turn on the Wild menu
set wildmenu
" Enable hidden buffers
set hidden
" Clipboard copy & paste
"set clipboard=unnamedplus
" Always show current position
set ruler
" When searching try to be smart about cases
set smartcase
" Highlight search results
set hlsearch
" Inenteremental search
set incsearch
" Don't redraw while executing macros (good performance config)
set lazyredraw
" Do not show matching brackets when text indicator is over them
" set noshowmatch
" let loaded_matchparen = 1
" No annoying sound on errors
set noerrorbells
set novisualbell
set wrap
set linebreak
set nolist " list disables linebreak
" Enable syntax highlighting
syntax enable
if (has("termguicolors"))
set termguicolors
endif
set t_Co=256
set background=dark
colorscheme spacemacs-theme
" Use tabs for indent
set smarttab
set smartindent
set autoindent
set copyindent
set preserveindent
set wildmode=longest,list,full
set wildmenu
set cursorline
set number
set relativenumber
" Transparency
"hi Normal guibg=NONE ctermbg=NONE
"set list!
"set listchars=trail:⛤,extends:⟩,precedes:⟨,nbsp:␣,conceal:…
" Map leader to do extra key combinations
let mapleader = " "
" Toggle paste mode on and off
map <leader>pp :setlocal paste!<Enter>
" Fast saving
nmap <leader>w :w!<Enter>
" Buffer switching
nmap <leader>bb :Buffers<Enter>
nmap <leader>bl :Buffers<Enter>
nmap <leader>bn :bnext<Enter>
nmap <leader>bp :bprevious<Enter>
nmap <leader>ll :Lines<Enter>
nmap <leader>mm :Marks<Enter>
nmap <leader>ww :Windows<Enter>
nmap <leader>hh :History/<Enter>
nmap <leader>rr :reg<Enter>
" finding files
nmap <leader>ff :Files<Enter>
nmap <leader>pp :FufDir<Enter>
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
"let g:syntastic_always_populate_loc_list = 1
"let g:syntastic_auto_loc_list = 1
"let g:syntastic_check_on_open = 1
"let g:syntastic_check_on_wq = 0
nmap <leader>sp :ALEFindReferences<Enter>
nmap <leader>ss :ALESymbolSearch<Enter>
nmap <leader>gd :ALEGoToDefinition<Enter>
nmap <leader>?? :ALEHover<Enter>
" Enable completion where available.
" This setting must be set before ALE is loaded.
let g:ale_completion_enabled = 1
let g:ale_fix_on_save = 1
let g:ale_warn_about_trailing_whitespace = 1
let g:ale_warn_about_trailing_lines = 1
let g:ale_completion_tsserver_autoimport = 1
"let g:ale_lint_on_text_changed = 'never'
" You can disable this option too
" if you don't want linters to run on opening a file
"let g:ale_lint_on_enter = 0
" Set airline theme
let g:airline_theme='base16_spacemacs'
" Load all plugins now.
" Plugins need to be added to runtimepath before helptags can be generated.
packloadall
" Load all of the helptags now, after plugins have been loaded.
" All messages and errors will be ignored.
silent! helptags ALL
set omnifunc=ale#completion#OmniFunc