vscode 에서 nodejs 코딩을 하다보면 코드를 정렬해 주는 툴 중에 prettier라는 것이 있다. 이 기능을 vim에서도 사용할 수 있는 방법이 있다.

https://vimawesome.com/plugin/vim-prettier-who-speaks 에서 설치하는 방법을 따라서 할 수 있다.

Vundle 을 설치했다고 가정하고.

~/.vimrc 파일에 아래 옵션을 추가 한다

Plugin 'prettier/vim-prettier', { 'do': 'yarn install' }
  1. :w를 통해 저장
  2. :source %명령을 통해 소스를 적용 시킨다.
  3. :PluginInstall 을 통해서 설치한다.

이제 yarn 을 통해서 설치해야 한다.

node 가 설치되어 있고, npm 이 설치 되어 있는 상태에서 진행을 해야 한다.
prettier를 사용하기 위해서는 npm이 필요하다.
$ npm -g install yarn를 통해서 global로 yarn을 설치하자.

vim-prettier가 설치되어 있는 폴더로 이동

$ cd ~/.vim/bundle/vim-prettier/

yarn을 통해서 vim-pretter에 필요한 모듈을 설치

$ yarn

참고
: yarn = yarn install 과 같은 동작을 한다

이제 파일들을 수정하고 난 뒤에

:Prettier명령을 통해서 자동으로 정렬되는 것을 확인 할 수 있다.

Imgur

저장할 때 자동으로 Prettier 적용하기

~/.vimrc파일 에 아래 항목을 추가 한다.

vim 8+ 버전에서

let g:prettier#autoformat = 0
autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync

기타 옵션에 대해서

VimAwesome페이지에서 더 많은 옵션을 찾을 수 있다.

반응형

OmniFocus 에서 Webdav 를 이용해서 어디서든 동기화 해서 사용할 수 있는 시스템이 있다. 이렇게 한다면 아이폰이든 맥에서 자동으로 동기화가 되서 같은 DB 를 이용해서 사용할 수 있다.

Omnifocus 설정

동기화 설정에서 아래와 같이 설정하자

example.com:[https 포트]/[시놀로지 계정]

Imgur

지금 동기화 버튼을 누르면, 계정명암호를 입력하는 창이 나온다.
입력하면, webdav폴더에 파일이 생성되어 있는 것을 확인 할 수 있을 것이다

반응형

맥에서 다양한 키보드를 사용하다 보니 필요에 따라서 설정을 변경해야 할때가 많다.
기본적인 function키들은 설정이 가능한데, 추가 설정해야 할 경우에 karabiner를 사용하면 정말 편하다.

처음에는 단순히 한영 전환을 위해서만 사용했는데, 이 기능은 빙산으 일각에 불과하다.

기본적인 OS 에서 단축키 전환

Imgur
윈도우 키보드를 사용할 때 불편한 사항 중 하나가, 키 배열이 다르다는 점이다. 지 엉도 기능만으로 만족한다면 아래 응용프로그램을 사용 할 필요가 없다.

karabiner에서는 키보드별로 단축키를 설정할 수 있고, 모든 키보드에도 단축키를 전환 할 수 있다.

Karabiner를 설치하면 기본 맥에서 설정할 수 단축키는 작동하지 않는다.

Imgur
현재 왼쪽 OPTION, COMMAND, CAPSLOCK, CTRL키를 전환해서 사용하고 있다. 일반 키보드를 사용하면서도 맥의 키 타입을 사용할 수 있어서 좋다.

키보드자체에서 스위치(DLP SWITCH)로 키를 변경할 수 있는 키보드를 사용할 수도 있는데, 운영체제를 바꿔서 사용할때 번거롭다.
예 ) 레오폴드 660 시리즈, 해피해킹 등등

반응형

vscode를 잘 사용하고 있지만, 왠지 terminal 모드를 잘 사용하고 싶어서 다시 한번 vim에 도전을 해보려고 한다.
예전과 다르게 더 간단히 설치할 수 있게 되었다.

준비

python3 용 vim 설치

mac에 기본적으로 설치되어 있는 것은 python2 버전이다.
vim을 다시 설치 해 준다

$ brew install vim

python3 로 빌드 된 버전이 설치 된다.

Note: brew install vim --with-python3 명령어는 이제 지원하지 않는다.
Note2 : 터미널을 종료하고, 다시 실행시키자. vim이 brew 버전으로 변경된다.

VIM - Vi IMproved 8.1 (2018 May 18, compiled Apr 23 2019 20:00:52)
macOS version
Included patches: 1-1200
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               +extra_search      +mouse_netterm     -tag_old_static
+arabic            -farsi             +mouse_sgr         -tag_any_white
+autocmd           +file_in_path      -mouse_sysmouse    -tcl
+autochdir         +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           +netbeans_intg     +textprop
+byte_offset       -hangul_input      +num64             +timers
+channel           +iconv             +packages          +title
+cindent           +insert_expand     +path_extra        -toolbar
-clientserver      +job               +perl              +user_commands
+clipboard         +jumplist          +persistent_undo   +vartabs
+cmdline_compl     +keymap            +postscript        +vertsplit
+cmdline_hist      +lambda            +printer           +virtualedit
+cmdline_info      +langmap           +profile           +visual
+comments          +libcall           -python            +visualextra
+conceal           +linebreak         +python3           +viminfo
+cryptv            +lispindent        +quickfix          +vreplace
+cscope            +listcmds          +reltime           +wildignore
+cursorbind        +localmap          +rightleft         +wildmenu
+cursorshape       +lua               +ruby              +windows
+dialog_con        +menu              +scrollbind        +writebackup
+diff              +mksession         +signs             -X11
+digraphs          +modify_fname      +smartindent       -xfontset
-dnd               +mouse             +startuptime       -xim
-ebcdic            -mouseshape        +statusline        -xpm
+emacs_tags        +mouse_dec         -sun_workshop      -xsmp
+eval              -mouse_gpm         +syntax            -xterm_clipboard
+ex_extra          -mouse_jsbterm     +tag_binary        -xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: clang   -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -lintl -framework AppKit  -L/usr/local/opt/lua/lib -llua5.3 -mmacosx-version-min=10.14 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.28.1/lib/perl5/5.28.1/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc  -L/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m -framework CoreFoundation  -lruby.2.6     

빌드 설치

$ brew install cmake

YouCompleteMe 설치

vim 플러그인 Vundle설치

$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim`

참조:https://github.com/VundleVim/Vundle.vim

YoutCompleteMe 설치

Vundle에 플러그인 설치

$ vi ~/.vimrc

아래와 같은 내용을 추가

Plugin 'Valloric/YouCompleteMe' "항목추가

:w 명령어를 통해 저장하고, :PluginInstall 명령어를 통해서 설치한다.

Note: 용량이 크기때문에 시간이 조금 더 걸릴 수 있다.
~/.vim/bundle/YouCompleteMe/폴더를 확인할 수 있다.

YCM 빌드

YouCompleteMe 폴더로 이동

$ cd ~/.vim/bundle/YouCompleteMe

자동완성 기능을 추가하기에 앞서서 어떤 언어를 지원하는지 확인 할수 있다.

$ python3 install.py --help
optional arguments:
  --clang-completer     Enable C-family semantic completion engine through
                        libclang.
  --clangd-completer    Enable C-family semantic completion engine through
                        clangd lsp server.(EXPERIMENTAL)
  --cs-completer        Enable C# semantic completion engine.
  --go-completer        Enable Go semantic completion engine.
  --rust-completer      Enable Rust semantic completion engine.
  --java-completer      Enable Java semantic completion engine.
  --ts-completer        Enable JavaScript and TypeScript semantic completion
                        engine.

여러가지 옵션들이 있지만, 위의 내용만을 참조해서 사용하자.
go와 javascript 언어를 사용하기에 아래와 같은 옵션을 사용했다

$ python3 install.py --go-completer --ts-completer
Searching Python 3.7 libraries...
Found Python library: /usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin/libpython3.7.dylib
Found Python headers folder: /usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/include/python3.7m
-- The C compiler identification is AppleClang 10.0.1.10010046
-- The CXX compiler identification is AppleClang 10.0.1.10010046
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonLibs: /usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin/libpython3.7.dylib (found suitable version "3.7.3", minimum required is "3.5")
-- NOT using libclang, no semantic completion for C/C++/ObjC will be available
-- NOT using clang-tidy for static analysis.
-- Configuring done
-- Generating done
-- Build files have been written to: /private/var/folders/76/tll39g2x4cz8fyxqk6zxh3_00000gn/T/ycm_build__txi1732
Scanning dependencies of target BoostParts
[  2%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/codecvt_error_category.cpp.o
[  7%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/path_traits.cpp.o
[  7%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/path.cpp.o
[  9%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/utf8_codecvt_facet.cpp.o
[ 14%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/portability.cpp.o
[ 14%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/operations.cpp.o
[ 19%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/unique_path.cpp.o
[ 19%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/windows_file_codecvt.cpp.o
[ 21%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/c_regex_traits.cpp.o
[ 26%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/fileiter.cpp.o
[ 28%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/cpp_regex_traits.cpp.o
[ 28%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/cregex.cpp.o
[ 30%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/icu.cpp.o
[ 33%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/instances.cpp.o
[ 35%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/posix_api.cpp.o
[ 38%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/regex.cpp.o
[ 40%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/regex_debug.cpp.o
[ 42%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/regex_raw_buffer.cpp.o
[ 45%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/regex_traits_defaults.cpp.o
[ 47%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/static_mutex.cpp.o
[ 50%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/usinstances.cpp.o
[ 52%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/w32_regex_traits.cpp.o
[ 54%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/wc_regex_traits.cpp.o
[ 57%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/wide_posix_api.cpp.o
[ 59%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/winstances.cpp.o
[ 61%] Linking CXX static library libBoostParts.a
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libBoostParts.a(windows_file_codecvt.cpp.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libBoostParts.a(icu.cpp.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libBoostParts.a(instances.cpp.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libBoostParts.a(regex_debug.cpp.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libBoostParts.a(usinstances.cpp.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libBoostParts.a(w32_regex_traits.cpp.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libBoostParts.a(winstances.cpp.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libBoostParts.a(windows_file_codecvt.cpp.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libBoostParts.a(icu.cpp.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libBoostParts.a(instances.cpp.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libBoostParts.a(regex_debug.cpp.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libBoostParts.a(usinstances.cpp.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libBoostParts.a(w32_regex_traits.cpp.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libBoostParts.a(winstances.cpp.o) has no symbols
[ 61%] Built target BoostParts
Scanning dependencies of target ycm_core
[ 64%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Candidate.cpp.o
[ 66%] Building CXX object ycm/CMakeFiles/ycm_core.dir/CharacterRepository.cpp.o
[ 69%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Character.cpp.o
[ 71%] Building CXX object ycm/CMakeFiles/ycm_core.dir/CandidateRepository.cpp.o
[ 73%] Building CXX object ycm/CMakeFiles/ycm_core.dir/CodePointRepository.cpp.o
[ 78%] Building CXX object ycm/CMakeFiles/ycm_core.dir/IdentifierDatabase.cpp.o
[ 78%] Building CXX object ycm/CMakeFiles/ycm_core.dir/CodePoint.cpp.o
[ 80%] Building CXX object ycm/CMakeFiles/ycm_core.dir/IdentifierCompleter.cpp.o
[ 83%] Building CXX object ycm/CMakeFiles/ycm_core.dir/IdentifierUtils.cpp.o
[ 88%] Building CXX object ycm/CMakeFiles/ycm_core.dir/PythonSupport.cpp.o
[ 88%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Result.cpp.o
[ 90%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Utils.cpp.o
[ 92%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Word.cpp.o
[ 95%] Building CXX object ycm/CMakeFiles/ycm_core.dir/versioning.cpp.o
[ 97%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ycm_core.cpp.o
[100%] Linking CXX shared library /Users/forteleaf/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_core.so
[100%] Built target ycm_core
-- The C compiler identification is AppleClang 10.0.1.10010046
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PythonLibs: /usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin/libpython3.7.dylib (found version "3.7.3")
-- Configuring done
-- Generating done
-- Build files have been written to: /private/var/folders/76/tll39g2x4cz8fyxqk6zxh3_00000gn/T/regex_build_5gvorctk
Scanning dependencies of target _regex
[ 66%] Building C object CMakeFiles/_regex.dir/regex_3/_regex_unicode.c.o
[ 66%] Building C object CMakeFiles/_regex.dir/regex_3/_regex.c.o
[100%] Linking C shared library /Users/forteleaf/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/cregex/regex_3/_regex.so
[100%] Built target _regex
/Users/forteleaf/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/tsserver/bin/tsc -> /Users/forteleaf/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/tsserver/lib/node_modules/typescript/bin/tsc
/Users/forteleaf/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/tsserver/bin/tsserver -> /Users/forteleaf/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/tsserver/lib/node_modules/typescript/bin/tsserver
+ typescript@3.3.3333
updated 1 package in 0.641s
반응형

 

 

맥을 처음 사용하면 어떤 프로그램들을 설치해야 할까 모르는 사람들이 많다. 본인도 처음에는 어떤 프로그램을 사용해야 할지 고민을 많이 했고 검색도 많이 했다.

현재는 필수적인 몇개의 파일을 제외하고는 사용하고 있지 않다.

이유는 :

  1. 용량이 늘어남.
  2. 노트북을 바꿀 때마다 불편함.
  3. 단순한게 좋다.

결국에는 상황에 따라서 추가로 설치하겠지만, 다음 항목은 꼭 설치 했으면 한다.

윈도우 처럼 한영키를 변환하기

Imgur

윈도우에서는 스페이스바 오른쪽에 있는 키로 한/영 전환을 하지만 맥에서는 caps lock으로 전환을 한다. 나중에는 익숙해 지겠지만, 윈도우도 겸해서 사용하게 되면 오타 빈도가 늘어난다. 이를 방지 하기 위해서 아래와 같은 프로그램을 사용하자.

karabiner

키보드 매핑하는 프로그램인데, 기본 프로그램에서는 오른쪽 COMMAND 키를 설정할 수가 없다. 이를 해결하고 오른쪽 키를 한/영 키로 전환 할 수 있는 옵션을 제공한다.

압축프로그램 제어

Imgur

윈도우에서 최고로 치는 압축 프로그램은 알집반디집이다. 맥에서도 사용할 수는 있지만 유료로 사용할 수 있기 때문에 이를 대체할 수 있는 프로그램인 The Unarchiver를 사용하자.

장점

  1. 압축을 풀었을 때, 한글이 깨지는 현상을 방지할 수 있다.
  2. 무료
  3. 가볍다

The Unarchiver

APP STORE에서 무료로 다운 받을 수 있다.

윈도우창을 제어하자

Imgur

윈도우에서는 창을 드레그해서 오른쪽이나 왼쪽 끝에 옮겨놓으면 자동으로 화면이 불할되는 기능을 갖고 있다. 하지만 맥에서는 이 기능을 지원하고 있지 않아서 이 앱을 설치해야 한다

유료 버전이며 5000원 정도 하는 걸로 기억한다.
나중을 위해서 편히 결제하는 것을 추천한다.

MAGNET

반드시 설치하시길 …

앱 삭제를 위한 앱

Imgur

앱이 설치되어 있는데 이를 제대로 삭제 해 주지 않는다면… 윈도우에서 레지스트리 쓰레기에서 오는 속도저하가 맥에서도 일어날 수 있다.
이를 방지하기 위해서 지우려는 앱의 연동되어 있는 저장내용도 삭제를 해야 한다.

현재 앱스토어에서 무료로 풀리고 있는 삭제앱을 추천하다.

App Cleaner
자신은 맥을 보다 깨끗하고 효율성 있게 관리하자.

반응형

+ Recent posts